UNPKG

@triply/yasqe

Version:

Yet Another SPARQL Query Editor

1 lines 506 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Yasqe",[],t):"object"==typeof exports?exports.Yasqe=t():e.Yasqe=t()}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=82)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"c",(function(){return c})),r.d(t,"f",(function(){return p})),r.d(t,"b",(function(){return d})),r.d(t,"g",(function(){return h})),r.d(t,"e",(function(){return f}));var i=r(4),n=r.n(i),o=r(5),s=r.n(o),a=r(106),l=function(){function e(t){n()(this,e),this.namespace=t}return s()(e,[{key:"set",value:function(e,t,r,i){if(a.enabled&&(this.removeExpiredKeys(),e&&void 0!==t)){t.documentElement&&(t=(new XMLSerializer).serializeToString(t.documentElement));try{a.set(e,{namespace:this.namespace,val:t,exp:r,time:(new Date).getTime()/1e3})}catch(e){if(e instanceof Error){var n=e;if(n.quotaExceeded=function(e){var t=!1;if(e)if(e.code)switch(e.code){case 22:t=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===e.name&&(t=!0)}else-2147024882===e.number&&(t=!0);return t}(e),!n.quotaExceeded||!i)throw n;i(e)}throw e}}}},{key:"remove",value:function(e){a.enabled&&e&&a.remove(e)}},{key:"removeExpiredKeys",value:function(){var e=this;a.enabled&&a.each((function(t,r){t&&t.exp&&(new Date).getTime()/1e3-t.time>t.exp&&e.remove(r)}))}},{key:"removeAll",value:function(){a.enabled}},{key:"removeNamespace",value:function(){var e=this;a.each((function(t,r){t.namespace&&t.namespace===e.namespace&&e.remove(r)}))}},{key:"get",value:function(e){if(a.enabled&&e&&(this.removeExpiredKeys(),e)){var t=a.get(e);if(!t)return;return t.val}}}]),e}();function u(e){if(e&&0==e.trim().indexOf("<svg")){var t=(new DOMParser).parseFromString(e,"text/xml").documentElement;t.setAttribute("aria-hidden","true");var r=document.createElement("div");return r.className="svgImg",r.appendChild(t),r}throw new Error("No svg string given. Cannot draw")}function c(e){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.concat(e.width," ").concat(e.height,'" aria-hidden="true"><path fill="currentColor" d="').concat(e.svgPathData,'"></path></svg>')}function p(e,t){if(e)return e.classList?e.classList.contains(t):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function d(e){if(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=0,o=r;n<o.length;n++){var s=o[n];e.classList?e.classList.add(s):p(e,s)||(e.className+=" "+s)}}}function h(e,t){if(e)if(e.classList)e.classList.remove(t);else if(p(e,t)){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(r," ")}}function f(e,t){return"function"==typeof e?e(t):e}},function(e,t,r){"use strict";var i=Array.isArray;t.a=i},function(e,t,r){"use strict";t.a=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,r){"use strict";var i=r(63),n="object"==typeof self&&self&&self.Object===Object&&self,o=i.a||n||Function("return this")();t.a=o},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}},function(e,t,r){"use strict";t.a=function(e){return null!=e&&"object"==typeof e}},function(e,t,r){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),s=i||n||o,a=s&&(i?document.documentMode||6:+(o||n)[1]),l=!o&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),p=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),f=/PhantomJS/.test(e),E=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),g=/Android/.test(e),m=E||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),v=E||/Mac/.test(t),x=/\bCrOS\b/.test(e),y=/win/i.test(t),N=p&&e.match(/Version\/(\d*\.\d*)/);N&&(N=Number(N[1])),N&&N>=15&&(p=!1,l=!0);var L=v&&(u||p&&(null==N||N<12.11)),T=r||s&&a>=9;function I(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,A=function(e,t){var r=e.className,i=I(t).exec(r);if(i){var n=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(n?i[1]+n:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function b(e,t){return C(e).appendChild(t)}function O(e,t,r,i){var n=document.createElement(e);if(r&&(n.className=r),i&&(n.style.cssText=i),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function R(e,t,r,i){var n=O(e,t,r,i);return n.setAttribute("role","presentation"),n}function P(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function _(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function D(e,t){var r=e.className;I(t).test(r)||(e.className+=(r?" ":"")+t)}function w(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!I(r[i]).test(t)&&(t+=" "+r[i]);return t}S=document.createRange?function(e,t,r,i){var n=document.createRange();return n.setEnd(i||e,r),n.setStart(e,t),n}:function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(e){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i};var M=function(e){e.select()};function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function G(e,t,r){for(var i in t||(t={}),e)!e.hasOwnProperty(i)||!1===r&&t.hasOwnProperty(i)||(t[i]=e[i]);return t}function k(e,t,r,i,n){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=i||0,s=n||0;;){var a=e.indexOf("\t",o);if(a<0||a>=t)return s+(t-o);s+=a-o,s+=r-s%r,o=a+1}}E?M=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:s&&(M=function(e){try{e.select()}catch(e){}});var U=function(){this.id=null,this.f=null,this.time=0,this.handler=F(this.onTimeout,this)};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}U.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},U.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var j={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},H={origin:"*mouse"},q={origin:"+move"};function W(e,t,r){for(var i=0,n=0;;){var o=e.indexOf("\t",i);-1==o&&(o=e.length);var s=o-i;if(o==e.length||n+s>=t)return i+Math.min(s,t-n);if(n+=o-i,i=o+1,(n+=r-n%r)>=t)return i}}var z=[""];function K(e){for(;z.length<=e;)z.push(X(z)+" ");return z[e]}function X(e){return e[e.length-1]}function Y(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function $(){}function Q(e,t){var r;return Object.create?r=Object.create(e):($.prototype=e,r=new $),t&&G(t,r),r}var Z=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function ne(e,t,r){for(;(r<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function oe(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var n=(t+r)/2,o=i<0?Math.ceil(n):Math.floor(n);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+i}}var se=null;function ae(e,t,r){var i;se=null;for(var n=0;n<e.length;++n){var o=e[n];if(o.from<t&&o.to>t)return n;o.to==t&&(o.from!=o.to&&"before"==r?i=n:se=n),o.from==t&&(o.from!=o.to&&"before"!=r?i=n:se=n)}return null!=i?i:se}var le=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,i=/[Lb1n]/,n=/[1n]/;function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(s,a){var l="ltr"==a?"L":"R";if(0==s.length||"ltr"==a&&!e.test(s))return!1;for(var u,c=s.length,p=[],d=0;d<c;++d)p.push((u=s.charCodeAt(d))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":8204==u?"b":"L");for(var h=0,f=l;h<c;++h){var E=p[h];"m"==E?p[h]=f:f=E}for(var g=0,m=l;g<c;++g){var v=p[g];"1"==v&&"r"==m?p[g]="n":r.test(v)&&(m=v,"r"==v&&(p[g]="R"))}for(var x=1,y=p[0];x<c-1;++x){var N=p[x];"+"==N&&"1"==y&&"1"==p[x+1]?p[x]="1":","!=N||y!=p[x+1]||"1"!=y&&"n"!=y||(p[x]=y),y=N}for(var L=0;L<c;++L){var T=p[L];if(","==T)p[L]="N";else if("%"==T){var I=void 0;for(I=L+1;I<c&&"%"==p[I];++I);for(var S=L&&"!"==p[L-1]||I<c&&"1"==p[I]?"1":"N",A=L;A<I;++A)p[A]=S;L=I-1}}for(var C=0,b=l;C<c;++C){var O=p[C];"L"==b&&"1"==O?p[C]="L":r.test(O)&&(b=O)}for(var R=0;R<c;++R)if(t.test(p[R])){var P=void 0;for(P=R+1;P<c&&t.test(p[P]);++P);for(var _="L"==(R?p[R-1]:l),D=_==("L"==(P<c?p[P]:l))?_?"L":"R":l,w=R;w<P;++w)p[w]=D;R=P-1}for(var M,F=[],G=0;G<c;)if(i.test(p[G])){var k=G;for(++G;G<c&&i.test(p[G]);++G);F.push(new o(0,k,G))}else{var U=G,B=F.length,j="rtl"==a?1:0;for(++G;G<c&&"L"!=p[G];++G);for(var V=U;V<G;)if(n.test(p[V])){U<V&&(F.splice(B,0,new o(1,U,V)),B+=j);var H=V;for(++V;V<G&&n.test(p[V]);++V);F.splice(B,0,new o(2,H,V)),B+=j,U=V}else++V;U<G&&F.splice(B,0,new o(1,U,G))}return"ltr"==a&&(1==F[0].level&&(M=s.match(/^\s+/))&&(F[0].from=M[0].length,F.unshift(new o(0,0,M[0].length))),1==X(F).level&&(M=s.match(/\s+$/))&&(X(F).to-=M[0].length,F.push(new o(0,c-M[0].length,c)))),"rtl"==a?F.reverse():F}}();function ue(e,t){var r=e.order;return null==r&&(r=e.order=le(e.text,t)),r}var ce=[],pe=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||ce).concat(r)}};function de(e,t){return e._handlers&&e._handlers[t]||ce}function he(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,n=i&&i[t];if(n){var o=B(n,r);o>-1&&(i[t]=n.slice(0,o).concat(n.slice(o+1)))}}}function fe(e,t){var r=de(e,t);if(r.length)for(var i=Array.prototype.slice.call(arguments,2),n=0;n<r.length;++n)r[n].apply(null,i)}function Ee(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),fe(e,r||t.type,e,t),Ne(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)-1==B(r,t[i])&&r.push(t[i])}function me(e,t){return de(e,t).length>0}function ve(e){e.prototype.on=function(e,t){pe(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function xe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ye(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Le(e){xe(e),ye(e)}function Te(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),v&&e.ctrlKey&&1==t&&(t=3),t}var Se,Ae,Ce=function(){if(s&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function be(e){if(null==Se){var t=O("span","​");b(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Se=t.offsetWidth<=1&&t.offsetHeight>2&&!(s&&a<8))}var r=Se?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Oe(e){if(null!=Ae)return Ae;var t=b(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),i=S(t,1,2).getBoundingClientRect();return C(e),!(!r||r.left==r.right)&&(Ae=i.right-r.right<3)}var Re,Pe=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],i=e.length;t<=i;){var n=e.indexOf("\n",t);-1==n&&(n=e.length);var o=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),s=o.indexOf("\r");-1!=s?(r.push(o.slice(0,s)),t+=s+1):(r.push(o),t=n+1)}return r}:function(e){return e.split(/\r\n?|\n/)},_e=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},De="oncopy"in(Re=O("div"))||(Re.setAttribute("oncopy","return;"),"function"==typeof Re.oncopy),we=null,Me={},Fe={};function Ge(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Me[e]=t}function ke(e){if("string"==typeof e&&Fe.hasOwnProperty(e))e=Fe[e];else if(e&&"string"==typeof e.name&&Fe.hasOwnProperty(e.name)){var t=Fe[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ke("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ke("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ue(e,t){t=ke(t);var r=Me[t.name];if(!r)return Ue(e,"text/plain");var i=r(e,t);if(Be.hasOwnProperty(t.name)){var n=Be[t.name];for(var o in n)n.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=n[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)i[s]=t.modeProps[s];return i}var Be={};function je(e,t){G(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function Ve(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var n=t[i];n instanceof Array&&(n=n.concat([])),r[i]=n}return r}function He(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function qe(e,t,r){return!e.startState||e.startState(t,r)}var We=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function ze(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var n=r.children[i],o=n.chunkSize();if(t<o){r=n;break}t-=o}return r.lines[t]}function Ke(e,t,r){var i=[],n=t.line;return e.iter(t.line,r.line+1,(function(e){var o=e.text;n==r.line&&(o=o.slice(0,r.ch)),n==t.line&&(o=o.slice(t.ch)),i.push(o),++n})),i}function Xe(e,t,r){var i=[];return e.iter(t,r,(function(e){i.push(e.text)})),i}function Ye(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function $e(e){if(null==e.parent)return null;for(var t=e.parent,r=B(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var n=0;i.children[n]!=t;++n)r+=i.children[n].chunkSize();return r+t.first}function Qe(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var n=e.children[i],o=n.height;if(t<o){e=n;continue e}t-=o,r+=n.chunkSize()}return r}while(!e.lines);for(var s=0;s<e.lines.length;++s){var a=e.lines[s].height;if(t<a)break;t-=a}return r+s}function Ze(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r);this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function it(e){return et(e.line,e.ch)}function nt(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function st(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function at(e,t){if(t.line<e.first)return et(e.first,0);var r=e.first+e.size-1;return t.line>r?et(r,ze(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,ze(e,t.line).text.length)}function lt(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=at(e,t[i]);return r}We.prototype.eol=function(){return this.pos>=this.string.length},We.prototype.sol=function(){return this.pos==this.lineStart},We.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},We.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},We.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},We.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},We.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},We.prototype.skipToEnd=function(){this.pos=this.string.length},We.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},We.prototype.backUp=function(e){this.pos-=e},We.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=k(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?k(this.string,this.lineStart,this.tabSize):0)},We.prototype.indentation=function(){return k(this.string,null,this.tabSize)-(this.lineStart?k(this.string,this.lineStart,this.tabSize):0)},We.prototype.match=function(e,t,r){if("string"!=typeof e){var i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var n=function(e){return r?e.toLowerCase():e};if(n(this.string.substr(this.pos,e.length))==n(e))return!1!==t&&(this.pos+=e.length),!0},We.prototype.current=function(){return this.string.slice(this.start,this.pos)},We.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},We.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},We.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function pt(e,t,r,i){var n=[e.state.modeGen],o={};yt(e,t.text,e.doc.mode,r,(function(e,t){return n.push(e,t)}),o,i);for(var s=r.state,a=function(i){r.baseTokens=n;var a=e.state.overlays[i],l=1,u=0;r.state=!0,yt(e,t.text,a.mode,r,(function(e,t){for(var r=l;u<e;){var i=n[l];i>e&&n.splice(l,1,e,n[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(a.opaque)n.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var o=n[r+1];n[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=s,r.baseTokens=null,r.baseTokenPos=1},l=0;l<e.state.overlays.length;++l)a(l);return{styles:n,classes:o.bgClass||o.textClass?o:null}}function dt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=ht(e,$e(t)),n=t.text.length>e.options.maxHighlightLength&&Ve(e.doc.mode,i.state),o=pt(e,t,i);n&&(i.state=n),t.stateAfter=i.save(!n),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return new ct(i,!0,t);var o=function(e,t,r){for(var i,n,o=e.doc,s=r?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>s;--a){if(a<=o.first)return o.first;var l=ze(o,a-1),u=l.stateAfter;if(u&&(!r||a+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return a;var c=k(l.text,null,e.options.tabSize);(null==n||i>c)&&(n=a-1,i=c)}return n}(e,t,r),s=o>i.first&&ze(i,o-1).stateAfter,a=s?ct.fromSaved(i,s,o):new ct(i,qe(i.mode),o);return i.iter(o,t,(function(r){ft(e,r.text,a);var i=a.line;r.stateAfter=i==t-1||i%5==0||i>=n.viewFrom&&i<n.viewTo?a.save():null,a.nextLine()})),r&&(i.modeFrontier=a.line),a}function ft(e,t,r,i){var n=e.doc.mode,o=new We(t,e.options.tabSize,r);for(o.start=o.pos=i||0,""==t&&Et(n,r.state);!o.eol();)gt(n,o,r.state),o.start=o.pos}function Et(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=He(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function gt(e,t,r,i){for(var n=0;n<10;n++){i&&(i[0]=He(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.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}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ve(e.mode,t.state),r,t.lookAhead):new ct(e,Ve(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ve(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var mt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function vt(e,t,r,i){var n,o,s=e.doc,a=s.mode,l=ze(s,(t=at(s,t)).line),u=ht(e,t.line,r),c=new We(l.text,e.options.tabSize,u);for(i&&(o=[]);(i||c.pos<t.ch)&&!c.eol();)c.start=c.pos,n=gt(a,c,u.state),i&&o.push(new mt(c,n,Ve(s.mode,u.state)));return i?o:new mt(c,n,u.state)}function xt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";null==t[i]?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function yt(e,t,r,i,n,o,s){var a=r.flattenSpans;null==a&&(a=e.options.flattenSpans);var l,u=0,c=null,p=new We(t,e.options.tabSize,i),d=e.options.addModeClass&&[null];for(""==t&&xt(Et(r,i.state),o);!p.eol();){if(p.pos>e.options.maxHighlightLength?(a=!1,s&&ft(e,t,i,p.pos),p.pos=t.length,l=null):l=xt(gt(r,p,i.state,d),o),d){var h=d[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!a||c!=l){for(;u<p.start;)n(u=Math.min(p.start,u+5e3),c);c=l}p.start=p.pos}for(;u<p.pos;){var f=Math.min(p.pos,u+5e3);n(f,c),u=f}}var Nt=!1,Lt=!1;function Tt(e,t,r){this.marker=e,this.from=t,this.to=r}function It(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function St(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function At(e,t){if(t.full)return null;var r=Ze(e,t.from.line)&&ze(e,t.from.line).markedSpans,i=Ze(e,t.to.line)&&ze(e,t.to.line).markedSpans;if(!r&&!i)return null;var n=t.from.ch,o=t.to.ch,s=0==tt(t.from,t.to),a=function(e,t,r){var i;if(e)for(var n=0;n<e.length;++n){var o=e[n],s=o.marker;if(null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==s.type&&(!r||!o.marker.insertLeft)){var a=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new Tt(s,o.from,a?null:o.to))}}return i}(r,n,s),l=function(e,t,r){var i;if(e)for(var n=0;n<e.length;++n){var o=e[n],s=o.marker;if(null==o.to||(s.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==s.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new Tt(s,a?null:o.from-t,null==o.to?null:o.to-t))}}return i}(i,o,s),u=1==t.text.length,c=X(t.text).length+(u?n:0);if(a)for(var p=0;p<a.length;++p){var d=a[p];if(null==d.to){var h=It(l,d.marker);h?u&&(d.to=null==h.to?null:h.to+c):d.to=n}}if(l)for(var f=0;f<l.length;++f){var E=l[f];null!=E.to&&(E.to+=c),null==E.from?It(a,E.marker)||(E.from=c,u&&(a||(a=[])).push(E)):(E.from+=c,u&&(a||(a=[])).push(E))}a&&(a=Ct(a)),l&&l!=a&&(l=Ct(l));var g=[a];if(!u){var m,v=t.text.length-2;if(v>0&&a)for(var x=0;x<a.length;++x)null==a[x].to&&(m||(m=[])).push(new Tt(a[x].marker,null,null));for(var y=0;y<v;++y)g.push(m);g.push(l)}return g}function Ct(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function bt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Ot(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Rt(e){return e.inclusiveLeft?-1:0}function Pt(e){return e.inclusiveRight?1:0}function _t(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var i=e.find(),n=t.find(),o=tt(i.from,n.from)||Rt(e)-Rt(t);if(o)return-o;var s=tt(i.to,n.to)||Pt(e)-Pt(t);return s||t.id-e.id}function Dt(e,t){var r,i=Lt&&e.markedSpans;if(i)for(var n=void 0,o=0;o<i.length;++o)(n=i[o]).marker.collapsed&&null==(t?n.from:n.to)&&(!r||_t(r,n.marker)<0)&&(r=n.marker);return r}function wt(e){return Dt(e,!0)}function Mt(e){return Dt(e,!1)}function Ft(e,t){var r,i=Lt&&e.markedSpans;if(i)for(var n=0;n<i.length;++n){var o=i[n];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||_t(r,o.marker)<0)&&(r=o.marker)}return r}function Gt(e,t,r,i,n){var o=ze(e,t),s=Lt&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var u=l.marker.find(0),c=tt(u.from,r)||Rt(l.marker)-Rt(n),p=tt(u.to,i)||Pt(l.marker)-Pt(n);if(!(c>=0&&p<=0||c<=0&&p>=0)&&(c<=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(u.from,i)<=0:tt(u.from,i)<0)))return!0}}}function kt(e){for(var t;t=wt(e);)e=t.find(-1,!0).line;return e}function Ut(e,t){var r=ze(e,t),i=kt(r);return r==i?t:$e(i)}function Bt(e,t){if(t>e.lastLine())return t;var r,i=ze(e,t);if(!jt(e,i))return t;for(;r=Mt(i);)i=r.find(1,!0).line;return $e(i)+1}function jt(e,t){var r=Lt&&t.markedSpans;if(r)for(var i=void 0,n=0;n<r.length;++n)if((i=r[n]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&Vt(e,t,i))return!0}}function Vt(e,t,r){if(null==r.to){var i=r.marker.find(1,!0);return Vt(e,i.line,It(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var n=void 0,o=0;o<t.markedSpans.length;++o)if((n=t.markedSpans[o]).marker.collapsed&&!n.marker.widgetNode&&n.from==r.to&&(null==n.to||n.to!=r.from)&&(n.marker.inclusiveLeft||r.marker.inclusiveRight)&&Vt(e,t,n))return!0}function Ht(e){for(var t=0,r=(e=kt(e)).parent,i=0;i<r.lines.length;++i){var n=r.lines[i];if(n==e)break;t+=n.height}for(var o=r.parent;o;o=(r=o).parent)for(var s=0;s<o.children.length;++s){var a=o.children[s];if(a==r)break;t+=a.height}return t}function qt(e){if(0==e.height)return 0;for(var t,r=e.text.length,i=e;t=wt(i);){var n=t.find(0,!0);i=n.from.line,r+=n.from.ch-n.to.ch}for(i=e;t=Mt(i);){var o=t.find(0,!0);r-=i.text.length-o.from.ch,r+=(i=o.to.line).text.length-o.to.ch}return r}function Wt(e){var t=e.display,r=e.doc;t.maxLine=ze(r,r.first),t.maxLineLength=qt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=qt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var zt=function(e,t,r){this.text=e,Ot(this,t),this.height=r?r(this):1};function Kt(e){e.parent=null,bt(e)}zt.prototype.lineNo=function(){return $e(this)},ve(zt);var Xt={},Yt={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:Xt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Qt(e,t){var r=R("span",null,null,l?"padding-right: .1px":null),i={pre:R("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var o=n?t.rest[n-1]:t.line,s=void 0;i.pos=0,i.addToken=Jt,Oe(e.display.measure)&&(s=ue(o,e.doc.direction))&&(i.addToken=er(i.addToken,s)),i.map=[],rr(o,i,dt(e,o,t!=e.display.externalMeasured&&$e(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=w(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=w(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(be(e.display.measure))),0==n?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=w(i.pre.className,i.textClass||"")),i}function Zt(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,i,n,o,l){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",n=0;n<e.length;n++){var o=e.charAt(n);" "!=o||!r||n!=e.length-1&&32!=e.charCodeAt(n+1)||(o=" "),i+=o,r=" "==o}return i}(t,e.trailingSpace):t,p=e.cm.state.specialChars,d=!1;if(p.test(t)){u=document.createDocumentFragment();for(var h=0;;){p.lastIndex=h;var f=p.exec(t),E=f?f.index-h:t.length-h;if(E){var g=document.createTextNode(c.slice(h,h+E));s&&a<9?u.appendChild(O("span",[g])):u.appendChild(g),e.map.push(e.pos,e.pos+E,g),e.col+=E,e.pos+=E}if(!f)break;h+=E+1;var m=void 0;if("\t"==f[0]){var v=e.cm.options.tabSize,x=v-e.col%v;(m=u.appendChild(O("span",K(x),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=x}else"\r"==f[0]||"\n"==f[0]?((m=u.appendChild(O("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]),e.col+=1):((m=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),s&&a<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),s&&a<9&&(d=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||i||n||d||o){var y=r||"";i&&(y+=i),n&&(y+=n);var N=O("span",[u],y,o);if(l)for(var L in l)l.hasOwnProperty(L)&&"style"!=L&&"class"!=L&&N.setAttribute(L,l[L]);return e.content.appendChild(N)}e.content.appendChild(u)}}function er(e,t){return function(r,i,n,o,s,a,l){n=n?n+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+i.length;;){for(var p=void 0,d=0;d<t.length&&!((p=t[d]).to>u&&p.from<=u);d++);if(p.to>=c)return e(r,i,n,o,s,a,l);e(r,i.slice(0,p.to-u),n,o,null,a,l),o=null,i=i.slice(p.to-u),u=p.to}}}function tr(e,t,r,i){var n=!i&&r.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!i&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",r.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var i=e.markedSpans,n=e.text,o=0;if(i)for(var s,a,l,u,c,p,d,h=n.length,f=0,E=1,g="",m=0;;){if(m==f){l=u=c=a="",d=null,p=null,m=1/0;for(var v=[],x=void 0,y=0;y<i.length;++y){var N=i[y],L=N.marker;if("bookmark"==L.type&&N.from==f&&L.widgetNode)v.push(L);else if(N.from<=f&&(null==N.to||N.to>f||L.collapsed&&N.to==f&&N.from==f)){if(null!=N.to&&N.to!=f&&m>N.to&&(m=N.to,u=""),L.className&&(l+=" "+L.className),L.css&&(a=(a?a+";":"")+L.css),L.startStyle&&N.from==f&&(c+=" "+L.startStyle),L.endStyle&&N.to==m&&(x||(x=[])).push(L.endStyle,N.to),L.title&&((d||(d={})).title=L.title),L.attributes)for(var T in L.attributes)(d||(d={}))[T]=L.attributes[T];L.collapsed&&(!p||_t(p.marker,L)<0)&&(p=N)}else N.from>f&&m>N.from&&(m=N.from)}if(x)for(var I=0;I<x.length;I+=2)x[I+1]==m&&(u+=" "+x[I]);if(!p||p.from==f)for(var S=0;S<v.length;++S)tr(t,0,v[S]);if(p&&(p.from||0)==f){if(tr(t,(null==p.to?h+1:p.to)-f,p.marker,null==p.from),null==p.to)return;p.to==f&&(p=!1)}}if(f>=h)break;for(var A=Math.min(h,m);;){if(g){var C=f+g.length;if(!p){var b=C>A?g.slice(0,A-f):g;t.addToken(t,b,s?s+l:l,c,f+b.length==m?u:"",a,d)}if(C>=A){g=g.slice(A-f),f=A;break}f=C,c=""}g=n.slice(o,o=r[E++]),s=$t(r[E++],t.cm.options)}}else for(var O=1;O<r.length;O+=2)t.addToken(t,n.slice(o,o=r[O]),$t(r[O+1],t.cm.options))}function ir(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Mt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?$e(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=jt(e,t)}function nr(e,t,r){for(var i,n=[],o=t;o<r;o=i){var s=new ir(e.doc,ze(e.doc,o),o);i=o+s.size,n.push(s)}return n}var or=null,sr=null;function ar(e,t){var r=de(e,t);if(r.length){var i,n=Array.prototype.slice.call(arguments,2);or?i=or.delayedCallbacks:sr?i=sr:(i=sr=[],setTimeout(lr,0));for(var o=function(e){i.push((function(){return r[e].apply(null,n)}))},s=0;s<r.length;++s)o(s)}}function lr(){var e=sr;sr=null;for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,i){for(var n=0;n<t.changes.length;n++){var o=t.changes[n];"text"==o?dr(e,t):"gutter"==o?fr(e,t,r,i):"class"==o?hr(e,t):"widget"==o&&Er(e,t,i)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),s&&a<8&&(e.node.style.zIndex=2)),e.node}function pr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Qt(e,t)}function dr(e,t){var r=t.text.className,i=pr(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=cr(t);t.background=i.insertBefore(O("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function fr(e,t,r,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=cr(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var s=cr(t),a=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),s.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(O("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,c=o.hasOwnProperty(u)&&o[u];c&&a.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+i.gutterLeft[u]+"px; width: "+i.gutterWidth[u]+"px"))}}}function Er(e,t,r){t.alignable&&(t.alignable=null);for(var i=I("CodeMirror-linewidget"),n=t.node.firstChild,o=void 0;n;n=o)o=n.nextSibling,i.test(n.className)&&t.node.removeChild(n);mr(e,t,r)}function gr(e,t,r,i){var n=pr(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),hr(e,t),fr(e,t,r,i),mr(e,t,i),t.node}function mr(e,t,r){if(vr(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)vr(e,t.rest[i],t,r,!1)}function vr(e,t,r,i,n){if(t.widgets)for(var o=cr(r),s=0,a=t.widgets;s<a.length;++s){var l=a[s],u=O("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),xr(l,u,r,i),e.display.input.setUneditable(u),n&&l.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),ar(l,"redraw")}}function xr(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var n=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(n-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function yr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!P(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),b(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var r=Te(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Lr(e){return e.lineSpace.offsetTop}function Tr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ir(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=b(e.measure,O("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(e.cachedPaddingH=i),i}function Sr(e){return 50-e.display.nativeBarWidth}function Ar(e){return e.display.scroller.clientWidth-Sr(e)-e.display.barWidth}function Cr(e){return e.display.scroller.clientHeight-Sr(e)-e.display.barHeight}function br(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var n=0;n<e.rest.length;n++)if($e(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Or(e,t,r,i){return _r(e,Pr(e,t),r,i)}function Rr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ui(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Pr(e,t){var r=$e(t),i=Rr(e,r);i&&!i.text?i=null:i&&i.changes&&(ur(e,i,r,ni(e)),e.curOp.forceUpdate=!0),i||(i=function(e,t){var r=$e(t=kt(t)),i=e.display.externalMeasured=new ir(e.doc,t,r);i.lineN=r;var n=i.built=Qt(e,i);return i.text=n.pre,b(e.display.lineMeasure,n.pre),i}(e,t));var n=br(i,t,r);return{line:t,view:i,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function _r(e,t,r,i,n){t.before&&(r=-1);var o,l=r+(i||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var i=e.options.lineWrapping,n=i&&Ar(e);if(!t.measure.heights||i&&t.measure.width!=n){var o=t.measure.heights=[];if(i){t.measure.width=n;for(var s=t.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],u=s[a+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,i){var n,o=Mr(t.map,r,i),l=o.node,u=o.start,c=o.end,p=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c));)++c;if((n=s&&a<9&&0==u&&c==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Fr(S(l,u,c).getClientRects(),i)).left||n.right||0==u)break;c=u,u-=1,p="right"}s&&a<11&&(n=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=we)return we;var t=b(e,O("span","x")),r=t.getBoundingClientRect(),i=S(t,0,1).getBoundingClientRect();return we=Math.abs(r.left-i.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}(e.display.measure,n))}else{var h;u>0&&(p=i="right"),n=e.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==i?h.length-1:0]:l.getBoundingClientRect()}if(s&&a<9&&!u&&(!n||!n.left&&!n.right)){var f=l.parentNode.getClientRects()[0];n=f?{left:f.left,right:f.left+ii(e.display),top:f.top,bottom:f.bottom}:wr}for(var E=n.top-t.rect.top,g=n.bottom-t.rect.top,m=(E+g)/2,v=t.view.measure.heights,x=0;x<v.length-1&&!(m<v[x]);x++);var y=x?v[x-1]:0,N=v[x],L={left:("right"==p?n.right:n.left)-t.rect.left,right:("left"==p?n.left:n.right)-t.rect.left,top:y,bottom:N};return n.left||n.right||(L.bogus=!0),e.options.singleCursorHeightPerLine||(L.rtop=E,L.rbottom=g),L}(e,t,r,i)).bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:n?o.rtop:o.top,bottom:n?o.rbottom:o.bottom}}var Dr,wr={left:0,right:0,top:0,bottom:0};function Mr(e,t,r){for(var i,n,o,s,a,l,u=0;u<e.length;u+=3)if(a=e[u],l=e[u+1],t<a?(n=0,o=1,s="left"):t<l?o=1+(n=t-a):(u==e.length-3||t==l&&e[u+3]>t)&&(n=(o=l-a)-1,t>=l&&(s="right")),null!=n){if(i=e[u+2],a==l&&r==(i.insertLeft?"left":"right")&&(s=r),"left"==r&&0==n)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[2+(u-=3)],s="left";if("right"==r&&n==l-a)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)i=e[(u+=3)+2],s="right";break}return{node:i,start:n,end:o,collapse:s,coverStart:a,coverEnd:l}}function Fr(e,t){var r=wr;if("left"==t)for(var i=0;i<e.length&&(r=e[i]).left==r.right;i++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function Gr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function kr(e){e.display.externalMeasure=null,C(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Gr(e.display.view[t])}function Ur(e){kr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Br(){return c&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jr(){return c&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Vr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=yr(e.widgets[r]));return t}function Hr(e,t,r,i,n){if(!n){var o=Vr(t);r.top+=o,r.bottom+=o}if("line"==i)return r;i||(i="local");var s=Ht(t);if("local"==i?s+=Lr(e.display):s-=e.display.viewOffset,"page"==i||"window"==i){var a=e.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==i?0:jr());var l=a.left+("window"==i?0:Br());r.left+=l,r.right+=l}return r.top+=s,r.bottom+=s,r}function qr(e,t,r){if("div"==r)return t;var i=t.left,n=t.top;if("page"==r)i-=Br(),n-=jr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();i+=o.left,n+=o.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:i-s.left,top:n-s.top}}function Wr(e,t,r,i,n){return i||(i=ze(e.doc,t.line)),Hr(e,i,Or(e,i,t.ch,n),r)}function zr(e,t,r,i,n,o){function s(t,s){var a=_r(e,n,t,s?"right":"left",o);return s?a.left=a.right:a.right=a.left,Hr(e,i,a,r)}i=i||ze(e.doc,t.line),n||(n=Pr(e,i));var a=ue(i,e.doc.direction),l=t.ch,u=t.sticky;if(l>=i.text.length?(l=i.text.length,u="before"):l<=0&&(l=0,u="after"),!a)return s("before"==u?l-1:l,"before"==u);function c(e,t,r){return s(r?e-1:e,1==a[t].level!=r)}var p=ae(a,l,u),d=se,h=c(l,p,"before"==u);return null!=d&&(h.other=c(l,d,"before"!=u)),h}function Kr(e,t){var r=0;t=at(e.doc,t),e.options.lineWrapping||(r=ii(e.display)*t.ch);var i=ze(e.doc,t.line),n=Ht(i)+Lr(e.display);return{left:r,right:r,top:n,bottom:n+i.height}}function Xr(e,t,r,i,n){var o=et(e,t,r);return o.xRel=n,i&&(o.outside=i),o}function Yr(e,t,r){var i=e.doc;if((r+=e.display.viewOffset)<0)return Xr(i.first,0,null,-1,-1);var n=Qe(i,r),o=i.first+i.size-1;if(n>o)return Xr(i.first+i.size-1,ze(i,o).text.length,null,1,1);t<0&&(t=0);for(var s=ze(i,n);;){var a=Jr(e,s,n,t,r),l=Ft(s,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var u=l.find(1);if(u.line==n)return u;s=ze(i,n=u.line)}}function $r(e,t,r,i){i-=Vr(t);var n=t.text.length,o=oe((function(t){return _r(e,r,t-1).bottom<=i}),n,0);return{begin:o,end:n=oe((function(t){return _r(e,r,t).top>i}),o,n)}}function Qr(e,t,r,i){return r||(r=Pr(e,t)),$r(e,t,r,Hr(e,t,_r(e,r,i),"line").top)}function Zr(e,t,r,i){return!(e.bottom<=r)&&(e.top>r||(i?e.left:e.right)>t)}function Jr(e,t,r,i,n){n-=Ht(t);var o=Pr(e,t),s=Vr(t),a=0,l=t.text.length,u=!0,c=ue(t,e.doc.direction);if(c){var p=(e.options.lineWrapping?ti:ei)(e,t,r,o,c,i,n);a=(u=1!=p.level)?p.from:p.to-1,l=u?p.to:p.from-1}var d,h,f=null,E=null,g=oe((function(t){var r=_r(e,o,t);return r.top+=s,r.bottom+=s,!!Zr(r,i,n,!1)&&(r.top<=n&&r.left<=i&&(f=t,E=r),!0)}),a,l),m=!1;if(E){var v=i-E.left<E.right-i,x=v==u;g=f+(x?0:1),h=x?"after":"before",d=v?E.left:E.right}else{u||g!=l&&g!=a||g++,h=0==g?"after":g==t.text.length?"before":_r(e,o,g-(u?1:0)).bottom+s<=n==u?"after":"before";var y=zr(e,et(r,g,h),"line",t,o);d=y.left,m=n<y.top?-1:n>=y.bottom?1:0}return Xr(r,g=ne(t.text,g,1),h,m,i-d)}function ei(e,t,r,i,n,o,s){var a=oe((function(a){var l=n[a],u=1!=l.level;return Zr(zr(e,et(r,u?l.to:l.from,u?"before":"after"),"line",t,i),o,s,!0)}),0,n.length-1),l=n[a];if(a>0){var u=1!=l.level,c=zr(e,et(r,u?l.from:l.to,u?"after":"before"),"line",t,i);Zr(c,o,s,!0)&&c.top>s&&(l=n[a-1])}return l}function ti(e,t,r,i,n,o,s){var a=$r(e,t,i,s),l=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,p=null,d=0;d<n.length;d++){var h=n[d];if(!(h.from>=u||h.to<=l)){var f=_r(e,i,1!=h.level?Math.min(u,h.to)-1:Math.max(l,h.from)).right,E=f<o?o-f+1e9:f-o;(!c||p>E)&&(c=h,p=E)}}return c||(c=n[n.length-1]),c.from<l&&(c={from:l,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function ri(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Dr){Dr=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Dr.appendChild(document.createTextNode("x")),Dr.appendChild(O("br"));Dr.appendChild(document.createTextNode("x"))}b(e.measure,Dr);var r=Dr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),C(e.measure),r||1}function ii(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t],"CodeMirror-line-like");b(e.measure,r);var i=t.getBoundingClientRect(),n=(i.right-i.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ni(e){for(var t=e.display,r={},i={},n=t.gutters.clientLeft,o=t.gutters.firstChild,s=0;o;o=o.nextSibling,++s){var a=e.display.gutterSpecs[s].className;r[a]=o.offsetLeft+o.clientLeft+n,i[a]=o.clientWidth}return{fixedPos:oi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function oi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function si(e){var t=ri(e.display),r=e.