@zazuko/yasqe
Version:
Yet Another SPARQL Query Editor
2 lines • 515 kB
JavaScript
/*! For license information please see yasqe.min.js.LICENSE.txt */
!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()}(self,()=>(()=>{var __webpack_modules__={160:e=>{"use strict";var t=new RegExp("(%[a-f0-9]{2})|([^%]+?)","gi"),r=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],i(r),i(n))}function n(e){try{return decodeURIComponent(e)}catch(o){for(var r=e.match(t)||[],n=1;n<r.length;n++)r=(e=i(r,n).join("")).match(t)||[];return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},i=r.exec(e);i;){try{t[i[0]]=decodeURIComponent(i[0])}catch(e){var o=n(i[0]);o!==i[0]&&(t[i[0]]=o)}i=r.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var l=s[a];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},232:(e,t,r)=>{var i=r(8541)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},365:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var i=r(4360);function n(e,t){if(t&&("object"==(0,i.A)(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}},404:(e,t,r)=>{!function(e){"use strict";var t,r,i=e.Pos;function n(e,t){for(var r=function(e){var t=e.flags;return null!=t?t:(e.ignoreCase?"i":"")+(e.global?"g":"")+(e.multiline?"m":"")}(e),i=r,n=0;n<t.length;n++)-1==i.indexOf(t.charAt(n))&&(i+=t.charAt(n));return r==i?e:new RegExp(e.source,i)}function o(e){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source)}function s(e,t,r){t=n(t,"g");for(var o=r.line,s=r.ch,a=e.lastLine();o<=a;o++,s=0){t.lastIndex=s;var l=e.getLine(o),u=t.exec(l);if(u)return{from:i(o,u.index),to:i(o,u.index+u[0].length),match:u}}}function a(e,t,r){if(!o(t))return s(e,t,r);t=n(t,"gm");for(var a,l=1,u=r.line,c=e.lastLine();u<=c;){for(var p=0;p<l&&!(u>c);p++){var d=e.getLine(u++);a=null==a?d:a+"\n"+d}l*=2,t.lastIndex=r.ch;var h=t.exec(a);if(h){var f=a.slice(0,h.index).split("\n"),E=h[0].split("\n"),m=r.line+f.length-1,g=f[f.length-1].length;return{from:i(m,g),to:i(m+E.length-1,1==E.length?g+E[0].length:E[E.length-1].length),match:h}}}}function l(e,t,r){for(var i,n=0;n<=e.length;){t.lastIndex=n;var o=t.exec(e);if(!o)break;var s=o.index+o[0].length;if(s>e.length-r)break;(!i||s>i.index+i[0].length)&&(i=o),n=o.index+1}return i}function u(e,t,r){t=n(t,"g");for(var o=r.line,s=r.ch,a=e.firstLine();o>=a;o--,s=-1){var u=e.getLine(o),c=l(u,t,s<0?0:u.length-s);if(c)return{from:i(o,c.index),to:i(o,c.index+c[0].length),match:c}}}function c(e,t,r){if(!o(t))return u(e,t,r);t=n(t,"gm");for(var s,a=1,c=e.getLine(r.line).length-r.ch,p=r.line,d=e.firstLine();p>=d;){for(var h=0;h<a&&p>=d;h++){var f=e.getLine(p--);s=null==s?f:f+"\n"+s}a*=2;var E=l(s,t,c);if(E){var m=s.slice(0,E.index).split("\n"),g=E[0].split("\n"),v=p+m.length,x=m[m.length-1].length;return{from:i(v,x),to:i(v+g.length-1,1==g.length?x+g[0].length:g[g.length-1].length),match:E}}}}function p(e,t,r,i){if(e.length==t.length)return r;for(var n=0,o=r+Math.max(0,e.length-t.length);;){if(n==o)return n;var s=n+o>>1,a=i(e.slice(0,s)).length;if(a==r)return s;a>r?o=s:n=s+1}}function d(e,n,o,s){if(!n.length)return null;var a=s?t:r,l=a(n).split(/\r|\n\r?/);e:for(var u=o.line,c=o.ch,d=e.lastLine()+1-l.length;u<=d;u++,c=0){var h=e.getLine(u).slice(c),f=a(h);if(1==l.length){var E=f.indexOf(l[0]);if(-1==E)continue e;return o=p(h,f,E,a)+c,{from:i(u,p(h,f,E,a)+c),to:i(u,p(h,f,E+l[0].length,a)+c)}}var m=f.length-l[0].length;if(f.slice(m)==l[0]){for(var g=1;g<l.length-1;g++)if(a(e.getLine(u+g))!=l[g])continue e;var v=e.getLine(u+l.length-1),x=a(v),N=l[l.length-1];if(x.slice(0,N.length)==N)return{from:i(u,p(h,f,m,a)+c),to:i(u+l.length-1,p(v,x,N.length,a))}}}}function h(e,n,o,s){if(!n.length)return null;var a=s?t:r,l=a(n).split(/\r|\n\r?/);e:for(var u=o.line,c=o.ch,d=e.firstLine()-1+l.length;u>=d;u--,c=-1){var h=e.getLine(u);c>-1&&(h=h.slice(0,c));var f=a(h);if(1==l.length){var E=f.lastIndexOf(l[0]);if(-1==E)continue e;return{from:i(u,p(h,f,E,a)),to:i(u,p(h,f,E+l[0].length,a))}}var m=l[l.length-1];if(f.slice(0,m.length)==m){var g=1;for(o=u-l.length+1;g<l.length-1;g++)if(a(e.getLine(o+g))!=l[g])continue e;var v=e.getLine(u+1-l.length),x=a(v);if(x.slice(x.length-l[0].length)==l[0])return{from:i(u+1-l.length,p(v,x,v.length-l[0].length,a)),to:i(u,p(h,f,m.length,a))}}}}function f(e,t,r,o){var l;this.atOccurrence=!1,this.afterEmptyMatch=!1,this.doc=e,r=r?e.clipPos(r):i(0,0),this.pos={from:r,to:r},"object"==typeof o?l=o.caseFold:(l=o,o=null),"string"==typeof t?(null==l&&(l=!1),this.matches=function(r,i){return(r?h:d)(e,t,i,l)}):(t=n(t,"gm"),o&&!1===o.multiline?this.matches=function(r,i){return(r?u:s)(e,t,i)}:this.matches=function(r,i){return(r?c:a)(e,t,i)})}String.prototype.normalize?(t=function(e){return e.normalize("NFD").toLowerCase()},r=function(e){return e.normalize("NFD")}):(t=function(e){return e.toLowerCase()},r=function(e){return e}),f.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){var r=this.doc.clipPos(t?this.pos.from:this.pos.to);if(this.afterEmptyMatch&&this.atOccurrence&&(r=i(r.line,r.ch),t?(r.ch--,r.ch<0&&(r.line--,r.ch=(this.doc.getLine(r.line)||"").length)):(r.ch++,r.ch>(this.doc.getLine(r.line)||"").length&&(r.ch=0,r.line++)),0!=e.cmpPos(r,this.doc.clipPos(r))))return this.atOccurrence=!1;var n=this.matches(t,r);if(this.afterEmptyMatch=n&&0==e.cmpPos(n.from,n.to),n)return this.pos=n,this.atOccurrence=!0,this.pos.match||!0;var o=i(t?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:o,to:o},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,r){if(this.atOccurrence){var n=e.splitLines(t);this.doc.replaceRange(n,this.pos.from,this.pos.to,r),this.pos.to=i(this.pos.from.line+n.length-1,n[n.length-1].length+(1==n.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",(function(e,t,r){return new f(this.doc,e,t,r)})),e.defineDocExtension("getSearchCursor",(function(e,t,r){return new f(this,e,t,r)})),e.defineExtension("selectMatches",(function(t,r){for(var i=[],n=this.getSearchCursor(t,this.getCursor("from"),r);n.findNext()&&!(e.cmpPos(n.to(),this.getCursor("to"))>0);)i.push({anchor:n.from(),head:n.to()});i.length&&this.setSelections(i,0)}))}(r(1719))},666:(e,t,r)=>{!function(e){"use strict";function t(t){return function(r,i){var n=i.line,o=r.getLine(n);function s(t){for(var s,a=i.ch,l=0;;){var u=a<=0?-1:o.lastIndexOf(t[0],a-1);if(-1!=u){if(1==l&&u<i.ch)break;if(s=r.getTokenTypeAt(e.Pos(n,u+1)),!/^(comment|string)/.test(s))return{ch:u+1,tokenType:s,pair:t};a=u-1}else{if(1==l)break;l=1,a=o.length}}}function a(t){var i,o,s=1,a=r.lastLine(),l=t.ch;e:for(var u=n;u<=a;++u)for(var c=r.getLine(u),p=u==n?l:0;;){var d=c.indexOf(t.pair[0],p),h=c.indexOf(t.pair[1],p);if(d<0&&(d=c.length),h<0&&(h=c.length),(p=Math.min(d,h))==c.length)break;if(r.getTokenTypeAt(e.Pos(u,p+1))==t.tokenType)if(p==d)++s;else if(!--s){i=u,o=p;break e}++p}return null==i||n==i?null:{from:e.Pos(n,l),to:e.Pos(i,o)}}for(var l=[],u=0;u<t.length;u++){var c=s(t[u]);c&&l.push(c)}for(l.sort((function(e,t){return e.ch-t.ch})),u=0;u<l.length;u++){var p=a(l[u]);if(p)return p}return null}}e.registerHelper("fold","brace",t([["{","}"],["[","]"]])),e.registerHelper("fold","brace-paren",t([["{","}"],["[","]"],["(",")"]])),e.registerHelper("fold","import",(function(t,r){function i(r){if(r<t.firstLine()||r>t.lastLine())return null;var i=t.getTokenAt(e.Pos(r,1));if(/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(r,i.end+1))),"keyword"!=i.type||"import"!=i.string)return null;for(var n=r,o=Math.min(t.lastLine(),r+10);n<=o;++n){var s=t.getLine(n).indexOf(";");if(-1!=s)return{startCh:i.end,end:e.Pos(n,s)}}}var n,o=r.line,s=i(o);if(!s||i(o-1)||(n=i(o-2))&&n.end.line==o-1)return null;for(var a=s.end;;){var l=i(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(o,s.startCh+1)),to:a}})),e.registerHelper("fold","include",(function(t,r){function i(r){if(r<t.firstLine()||r>t.lastLine())return null;var i=t.getTokenAt(e.Pos(r,1));return/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(r,i.end+1))),"meta"==i.type&&"#include"==i.string.slice(0,8)?i.start+8:void 0}var n=r.line,o=i(n);if(null==o||null!=i(n-1))return null;for(var s=n;null!=i(s+1);)++s;return{from:e.Pos(n,o+1),to:t.clipPos(e.Pos(s))}}))}(r(1719))},732:(e,t,r)=>{var i=r(7589),n=i.Global,o=i.trim;e.exports={name:"cookieStorage",read:function(e){if(!e||!u(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(s.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;s.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:a,remove:l,clearAll:function(){a((function(e,t){l(t)}))}};var s=n.document;function a(e){for(var t=s.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(o(t[r])){var i=t[r].split("="),n=unescape(i[0]);e(unescape(i[1]),n)}}function l(e){e&&u(e)&&(s.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function u(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(s.cookie)}},761:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var i=r(8086);const n=function(e){if("string"==typeof e||(0,i.A)(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},815:()=>{"object"!=typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var r,i,n,o,s,a=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(l)){for(o=l.length,r=0;r<o;r+=1)s[r]=str(r,l)||"null";return n=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,n}if(rep&&"object"==typeof rep)for(o=rep.length,r=0;r<o;r+=1)"string"==typeof rep[r]&&(n=str(i=rep[r],l))&&s.push(quote(i)+(gap?": ":":")+n);else for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(n=str(i,l))&&s.push(quote(i)+(gap?": ":":")+n);return n=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,n}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value),"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var i;if(gap="",indent="","number"==typeof r)for(i=0;i<r;i+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){var j;function walk(e,t){var r,i,n=e[t];if(n&&"object"==typeof n)for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(void 0!==(i=walk(n,r))?n[r]=i:delete n[r]);return reviver.call(e,t,n)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,(function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},946:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});const i=function(e){return function(){return e}}},991:(e,t,r)=>{"use strict";r.r(t)},1100:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});const i=function(e){return e}},1115:(e,t,r)=>{var i=r(1461),n=r(1907);e.exports=function(e,t,r,o,s){return new n(i().w(e,t,r,o),s||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1273:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var i=r(5168);const n=function(e){var t=new e.constructor(e.byteLength);return new i.A(t).set(new i.A(e)),t}},1461:(e,t,r)=>{var i=r(6918);function n(){var t,r,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function l(e,n,o,s){var a=n&&n.prototype instanceof c?n:c,l=Object.create(a.prototype);return i(l,"_invoke",function(e,i,n){var o,s,a,l=0,c=n||[],p=!1,d={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return o=e,s=0,a=t,d.n=r,u}};function h(e,i){for(s=e,a=i,r=0;!p&&l&&!n&&r<c.length;r++){var n,o=c[r],h=d.p,f=o[2];e>3?(n=f===i)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=h&&((n=e<2&&h<o[1])?(s=0,d.v=i,d.n=o[1]):h<f&&(n=e<3||o[0]>i||i>f)&&(o[4]=e,o[5]=i,d.n=f,s=0))}if(n||e>1)return u;throw p=!0,i}return function(n,c,f){if(l>1)throw TypeError("Generator is already running");for(p&&1===c&&h(c,f),s=c,a=f;(r=s<2?t:a)||!p;){o||(s?s<3?(s>1&&(d.n=-1),h(s,a)):d.n=a:d.v=a);try{if(l=2,o){if(s||(n="next"),r=o[n]){if(!(r=r.call(o,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,s<2&&(s=0)}else 1===s&&(r=o.return)&&r.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=t}else if((r=(p=d.n<0)?a:e.call(i,d))!==u)break}catch(e){o=t,s=1,a=e}finally{l=1}}return{value:r,done:p}}}(e,o,s),!0),l}var u={};function c(){}function p(){}function d(){}r=Object.getPrototypeOf;var h=[][s]?r(r([][s]())):(i(r={},s,(function(){return this})),r),f=d.prototype=c.prototype=Object.create(h);function E(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return p.prototype=d,i(f,"constructor",d),i(d,"constructor",p),p.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(f),i(f,a,"Generator"),i(f,s,(function(){return this})),i(f,"toString",(function(){return"[object Generator]"})),(e.exports=n=function(){return{w:l,m:E}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},1671:(e,t,r)=>{"use strict";r.d(t,{A:()=>v});var i=r(9790);const n=r(8377).A["__core-js_shared__"];var o,s=(o=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";const a=function(e){return!!s&&s in e};var l=r(6809),u=r(5549),c=/^\[object .+?Constructor\]$/,p=Function.prototype,d=Object.prototype,h=p.toString,f=d.hasOwnProperty,E=RegExp("^"+h.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const m=function(e){return!(!(0,l.A)(e)||a(e))&&((0,i.A)(e)?E:c).test((0,u.A)(e))};const g=function(e,t){return null==e?void 0:e[t]};const v=function(e,t){var r=g(e,t);return m(r)?r:void 0}},1697:e=>{e.exports=function(e){var t=Object(e),r=[];for(var i in t)r.unshift(i);return function e(){for(;r.length;)if((i=r.pop())in t)return e.value=i,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},1719:function(e){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\/(\d+)/.exec(e),p=c&&+c[1],d=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),E=/PhantomJS/.test(e),m=h&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),g=/Android/.test(e),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),x=m||/Mac/.test(t),N=/\bCrOS\b/.test(e),A=/win/i.test(t),y=d&&e.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1])),y&&y>=15&&(d=!1,l=!0);var L=x&&(u||d&&(null==y||y<12.11)),T=r||s&&a>=9;function I(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,C=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 R(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function b(e,t){return R(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 _(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 D(e){var t,r=e.ownerDocument||e;try{t=e.activeElement}catch(e){t=r.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function w(e,t){var r=e.className;I(t).test(r)||(e.className+=(r?" ":"")+t)}function M(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 k=function(e){e.select()};function F(e){return e.display.wrapper.ownerDocument}function G(e){return U(e.display.wrapper)}function U(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function B(e){return F(e).defaultView}function V(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function H(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 j(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}}m?k=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:s&&(k=function(e){try{e.select()}catch(e){}});var q=function(){this.id=null,this.f=null,this.time=0,this.handler=V(this.onTimeout,this)};function W(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.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 z={toString:function(){return"CodeMirror.Pass"}},Y={scroll:!1},K={origin:"*mouse"},X={origin:"+move"};function $(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 Q=[""];function Z(e){for(;Q.length<=e;)Q.push(J(Q)+" ");return Q[e]}function J(e){return e[e.length-1]}function ee(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function te(){}function re(e,t){var r;return Object.create?r=Object.create(e):(te.prototype=e,r=new te),t&&H(t,r),r}var ie=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ne(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ie.test(e))}function oe(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ne(e))||t.test(e):ne(e)}function se(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ae=/[\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 le(e){return e.charCodeAt(0)>=768&&ae.test(e)}function ue(e,t,r){for(;(r<0?t>0:t<e.length)&&le(e.charAt(t));)t+=r;return t}function ce(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 pe=null;function de(e,t,r){var i;pe=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:pe=n),o.from==t&&(o.from!=o.to&&"before"!=r?i=n:pe=n)}return null!=i?i:pe}var he=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 m=0,g=l;m<c;++m){var v=p[m];"1"==v&&"r"==g?p[m]="n":r.test(v)&&(g=v,"r"==v&&(p[m]="R"))}for(var x=1,N=p[0];x<c-1;++x){var A=p[x];"+"==A&&"1"==N&&"1"==p[x+1]?p[x]="1":","!=A||N!=p[x+1]||"1"!=N&&"n"!=N||(p[x]=N),N=A}for(var y=0;y<c;++y){var L=p[y];if(","==L)p[y]="N";else if("%"==L){var T=void 0;for(T=y+1;T<c&&"%"==p[T];++T);for(var I=y&&"!"==p[y-1]||T<c&&"1"==p[T]?"1":"N",S=y;S<T;++S)p[S]=I;y=T-1}}for(var C=0,R=l;C<c;++C){var b=p[C];"L"==R&&"1"==b?p[C]="L":r.test(b)&&(R=b)}for(var O=0;O<c;++O)if(t.test(p[O])){var _=void 0;for(_=O+1;_<c&&t.test(p[_]);++_);for(var P="L"==(O?p[O-1]:l),D=P==("L"==(_<c?p[_]:l))?P?"L":"R":l,w=O;w<_;++w)p[w]=D;O=_-1}for(var M,k=[],F=0;F<c;)if(i.test(p[F])){var G=F;for(++F;F<c&&i.test(p[F]);++F);k.push(new o(0,G,F))}else{var U=F,B=k.length,V="rtl"==a?1:0;for(++F;F<c&&"L"!=p[F];++F);for(var H=U;H<F;)if(n.test(p[H])){U<H&&(k.splice(B,0,new o(1,U,H)),B+=V);var j=H;for(++H;H<F&&n.test(p[H]);++H);k.splice(B,0,new o(2,j,H)),B+=V,U=H}else++H;U<F&&k.splice(B,0,new o(1,U,F))}return"ltr"==a&&(1==k[0].level&&(M=s.match(/^\s+/))&&(k[0].from=M[0].length,k.unshift(new o(0,0,M[0].length))),1==J(k).level&&(M=s.match(/\s+$/))&&(J(k).to-=M[0].length,k.push(new o(0,c-M[0].length,c)))),"rtl"==a?k.reverse():k}}();function fe(e,t){var r=e.order;return null==r&&(r=e.order=he(e.text,t)),r}var Ee=[],me=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]||Ee).concat(r)}};function ge(e,t){return e._handlers&&e._handlers[t]||Ee}function ve(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=W(n,r);o>-1&&(i[t]=n.slice(0,o).concat(n.slice(o+1)))}}}function xe(e,t){var r=ge(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 Ne(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),xe(e,r||t.type,e,t),Se(t)||t.codemirrorIgnore}function Ae(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==W(r,t[i])&&r.push(t[i])}function ye(e,t){return ge(e,t).length>0}function Le(e){e.prototype.on=function(e,t){me(this,e,t)},e.prototype.off=function(e,t){ve(this,e,t)}}function Te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Se(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){Te(e),Ie(e)}function Re(e){return e.target||e.srcElement}function be(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),x&&e.ctrlKey&&1==t&&(t=3),t}var Oe,_e,Pe=function(){if(s&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function De(e){if(null==Oe){var t=O("span","");b(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Oe=t.offsetWidth<=1&&t.offsetHeight>2&&!(s&&a<8))}var r=Oe?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function we(e){if(null!=_e)return _e;var t=b(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),i=S(t,1,2).getBoundingClientRect();return R(e),!(!r||r.left==r.right)&&(_e=i.right-r.right<3)}var Me,ke=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/)},Fe=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)},Ge="oncopy"in(Me=O("div"))||(Me.setAttribute("oncopy","return;"),"function"==typeof Me.oncopy),Ue=null,Be={},Ve={};function He(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Be[e]=t}function je(e){if("string"==typeof e&&Ve.hasOwnProperty(e))e=Ve[e];else if(e&&"string"==typeof e.name&&Ve.hasOwnProperty(e.name)){var t=Ve[e.name];"string"==typeof t&&(t={name:t}),(e=re(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return je("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function qe(e,t){t=je(t);var r=Be[t.name];if(!r)return qe(e,"text/plain");var i=r(e,t);if(We.hasOwnProperty(t.name)){var n=We[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 We={};function ze(e,t){H(t,We.hasOwnProperty(e)?We[e]:We[e]={})}function Ye(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 Ke(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 Xe(e,t,r){return!e.startState||e.startState(t,r)}var $e=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 Qe(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 Ze(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 Je(e,t,r){var i=[];return e.iter(t,r,(function(e){i.push(e.text)})),i}function et(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function tt(e){if(null==e.parent)return null;for(var t=e.parent,r=W(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 rt(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 it(e,t){return t>=e.first&&t<e.first+e.size}function nt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ot(e,t,r){if(void 0===r&&(r=null),!(this instanceof ot))return new ot(e,t,r);this.line=e,this.ch=t,this.sticky=r}function st(e,t){return e.line-t.line||e.ch-t.ch}function at(e,t){return e.sticky==t.sticky&&0==st(e,t)}function lt(e){return ot(e.line,e.ch)}function ut(e,t){return st(e,t)<0?t:e}function ct(e,t){return st(e,t)<0?e:t}function pt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function dt(e,t){if(t.line<e.first)return ot(e.first,0);var r=e.first+e.size-1;return t.line>r?ot(r,Qe(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?ot(e.line,t):r<0?ot(e.line,0):e}(t,Qe(e,t.line).text.length)}function ht(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=dt(e,t[i]);return r}$e.prototype.eol=function(){return this.pos>=this.string.length},$e.prototype.sol=function(){return this.pos==this.lineStart},$e.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},$e.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},$e.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},$e.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},$e.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},$e.prototype.skipToEnd=function(){this.pos=this.string.length},$e.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},$e.prototype.backUp=function(e){this.pos-=e},$e.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},$e.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},$e.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},$e.prototype.current=function(){return this.string.slice(this.start,this.pos)},$e.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},$e.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},$e.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ft=function(e,t){this.state=e,this.lookAhead=t},Et=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 mt(e,t,r,i){var n=[e.state.modeGen],o={};It(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,It(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 gt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=vt(e,tt(t)),n=t.text.length>e.options.maxHighlightLength&&Ye(e.doc.mode,i.state),o=mt(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 vt(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return new Et(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=Qe(o,a-1),u=l.stateAfter;if(u&&(!r||a+(u instanceof ft?u.lookAhead:0)<=o.modeFrontier))return a;var c=j(l.text,null,e.options.tabSize);(null==n||i>c)&&(n=a-1,i=c)}return n}(e,t,r),s=o>i.first&&Qe(i,o-1).stateAfter,a=s?Et.fromSaved(i,s,o):new Et(i,Xe(i.mode),o);return i.iter(o,t,(function(r){xt(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 xt(e,t,r,i){var n=e.doc.mode,o=new $e(t,e.options.tabSize,r);for(o.start=o.pos=i||0,""==t&&Nt(n,r.state);!o.eol();)At(n,o,r.state),o.start=o.pos}function Nt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ke(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function At(e,t,r,i){for(var n=0;n<10;n++){i&&(i[0]=Ke(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.")}Et.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.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,r){return t instanceof ft?new Et(e,Ye(e.mode,t.state),r,t.lookAhead):new Et(e,Ye(e.mode,t),r)},Et.prototype.save=function(e){var t=!1!==e?Ye(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ft(t,this.maxLookAhead):t};var yt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Lt(e,t,r,i){var n,o,s=e.doc,a=s.mode,l=Qe(s,(t=dt(s,t)).line),u=vt(e,t.line,r),c=new $e(l.text,e.options.tabSize,u);for(i&&(o=[]);(i||c.pos<t.ch)&&!c.eol();)c.start=c.pos,n=At(a,c,u.state),i&&o.push(new yt(c,n,Ye(s.mode,u.state)));return i?o:new yt(c,n,u.state)}function Tt(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 It(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 $e(t,e.options.tabSize,i),d=e.options.addModeClass&&[null];for(""==t&&Tt(Nt(r,i.state),o);!p.eol();){if(p.pos>e.options.maxHighlightLength?(a=!1,s&&xt(e,t,i,p.pos),p.pos=t.length,l=null):l=Tt(At(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 St=!1,Ct=!1;function Rt(e,t,r){this.marker=e,this.from=t,this.to=r}function bt(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function Ot(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function _t(e,t){if(t.full)return null;var r=it(e,t.from.line)&&Qe(e,t.from.line).markedSpans,i=it(e,t.to.line)&&Qe(e,t.to.line).markedSpans;if(!r&&!i)return null;var n=t.from.ch,o=t.to.ch,s=0==st(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 Rt(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 Rt(s,a?null:o.from-t,null==o.to?null:o.to-t))}}return i}(i,o,s),u=1==t.text.length,c=J(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=bt(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?bt(a,E.marker)||(E.from=c,u&&(a||(a=[])).push(E)):(E.from+=c,u&&(a||(a=[])).push(E))}a&&(a=Pt(a)),l&&l!=a&&(l=Pt(l));var m=[a];if(!u){var g,v=t.text.length-2;if(v>0&&a)for(var x=0;x<a.length;++x)null==a[x].to&&(g||(g=[])).push(new Rt(a[x].marker,null,null));for(var N=0;N<v;++N)m.push(g);m.push(l)}return m}function Pt(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 Dt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function wt(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Mt(e){return e.inclusiveLeft?-1:0}function kt(e){return e.inclusiveRight?1:0}function Ft(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var i=e.find(),n=t.find(),o=st(i.from,n.from)||Mt(e)-Mt(t);if(o)return-o;var s=st(i.to,n.to)||kt(e)-kt(t);return s||t.id-e.id}function Gt(e,t){var r,i=Ct&&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||Ft(r,n.marker)<0)&&(r=n.marker);return r}function Ut(e){return Gt(e,!0)}function Bt(e){return Gt(e,!1)}function Vt(e,t){var r,i=Ct&&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||Ft(r,o.marker)<0)&&(r=o.marker)}return r}function Ht(e,t,r,i,n){var o=Qe(e,t),s=Ct&&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=st(u.from,r)||Mt(l.marker)-Mt(n),p=st(u.to,i)||kt(l.marker)-kt(n);if(!(c>=0&&p<=0||c<=0&&p>=0)&&(c<=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?st(u.to,r)>=0:st(u.to,r)>0)||c>=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?st(u.from,i)<=0:st(u.from,i)<0)))return!0}}}function jt(e){for(var t;t=Ut(e);)e=t.find(-1,!0).line;return e}function qt(e,t){var r=Qe(e,t),i=jt(r);return r==i?t:tt(i)}function Wt(e,t){if(t>e.lastLine())return t;var r,i=Qe(e,t);if(!zt(e,i))return t;for(;r=Bt(i);)i=r.find(1,!0).line;return tt(i)+1}function zt(e,t){var r=Ct&&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&&Yt(e,t,i))return!0}}function Yt(e,t,r){if(null==r.to){var i=r.marker.find(1,!0);return Yt(e,i.line,bt(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)&&Yt(e,t,n))return!0}function Kt(e){for(var t=0,r=(e=jt(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 Xt(e){if(0==e.height)return 0;for(var t,r=e.text.length,i=e;t=Ut(i);){var n=t.find(0,!0);i=n.from.line,r+=n.from.ch-n.to.ch}for(i=e;t=Bt(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 $t(e){var t=e.display,r=e.doc;t.maxLine=Qe(r,r.first),t.maxLineLength=Xt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=Xt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var Qt=function(e,t,r){this.text=e,wt(this,t),this.height=r?r(this):1};function Zt(e){e.parent=null,Dt(e)}Qt.prototype.lineNo=function(){return tt(this)},Le(Qt);var Jt={},er={};function tr(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?er:Jt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function rr(e,t){var r=_("span",null,null,l?"padding-right: .1px":null),i={pre:_("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=nr,we(e.display.measure)&&(s=fe(o,e.doc.direction))&&(i.addToken=or(i.addToken,s)),i.map=[],ar(o,i,gt(e,o,t!=e.display.externalMeasured&&tt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=M(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=M(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(De(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 xe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=M(i.pre.className,i.textClass||"")),i}function ir(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function nr(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 m=document.createTextNode(c.slice(h,h+E));s&&a<9?u.appendChild(O("span",[m])):u.appendChild(m),e.map.push(e.pos,e.pos+E,m),e.col+=E,e.pos+=E}if(!f)break;h+=E+1;var g=void 0;if("\t"==f[0]){var v=e.cm.options.tabSize,x=v-e.col%v;(g=u.appendChild(O("span",Z(x),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=x}else"\r"==f[0]||"\n"==f[0]?((g=u.appendChild(O("span","\r"==f[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",f[0]),e.col+=1):((g=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),s&&a<9?u.appendChild(O("span",[g])):u.appendChild(g),e.col+=1);e.map.push(e.pos,e.pos+1,g),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||l){var N=r||"";i&&(N+=i),n&&(N+=n);var A=O("span",[u],N,o);if(l)for(var y in l)l.hasOwnProperty(y)&&"style"!=y&&"class"!=y&&A.setAttribute(y,l[y]);return e.content.appendChild(A)}e.content.appendChild(u)}}function or(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 sr(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 ar(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,m="",g=0;;){if(g==f){l=u=c=a="",d=null,p=null,g=1/0;for(var v=[],x=void 0,N=0;N<i.length;++N){var A=i[N],y=A.marker;if("bookmark"==y.type&&A.from==f&&y.widgetNode)v.push(y);else if(A.from<=f&&(null==A.to||A.to>f||y.collapsed&&A.to==f&&A.from==f)){if(null!=A.to&&A.to!=f&&g>A.to&&(g=A.to,u=""),y.className&&(l+=" "+y.className),y.css&&(a=(a?a+";":"")+y.css),y.startStyle&&A.from==f&&(c+=" "+y.startStyle),y.endStyle&&A.to==g&&(x||(x=[])).push(y.endStyle,A.to),y.title&&((d||(d={})).title=y.title),y.attributes)for(var L in y.attributes)(d||(d={}))[L]=y.attributes[L];y.collapsed&&(!p||Ft(p.marker,y)<0)&&(p=A)}else A.from>f&&g>A.from&&(g=A.from)}if(x)for(var T=0;T<x.length;T+=2)x[T+1]==g&&(u+=" "+x[T]);if(!p||p.from==f)for(var I=0;I<v.length;++I)sr(t,0,v[I]);if(p&&(p.from||0)==f){if(sr(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 S=Math.min(h,g);;){if(m){var C=f+m.length;if(!p){var R=C>S?m.slice(0,S-f):m;t.addToken(t,R,s?s+l:l,c,f+R.length==g?u:"",a,d)}if(C>=S){m=m.slice(S-f),f=S;break}f=C,c=""}m=n.slice(o,o=r[E++]),s=tr(r[E++],t.cm.options)}}else for(var b=1;b<r.length;b+=2)t.addToken(t,n.slice(o,o=r[b]),tr(r[b+1],t.cm.options))}function lr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Bt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?tt(J(this.rest))-r+1:1,this.node=this.text=null,this.hidden=zt(e,t)}function ur(e,t,r){for(var i,n=[],o=t;o<r;o=i){var s=new lr(e.doc,Qe(e.doc,o),o);i=o+s.size,n.push(s)}return n}var cr=null,pr=null;function dr(e,t){var r=ge(e,t);if(r.length){var i,n=Array.prototype.slice.call(arguments,2);cr?i=cr.delayedCallbacks:pr?i=pr:(i=pr=[],setTimeout(hr,0));for(var o=function(e){i.push((function(){return r[e].apply(null,n)}))},s=0;s<r.length;++s)o(s)}}function hr(){var e=pr;pr=null;for(var t=0;t<e.length;++t)e[t]()}function fr(e,t,r,i){for(var n=0;n<t.changes.length;n++){var o=t.changes[n];"text"==o?gr(e,t):"gutter"==o?xr(e,t,r,i):"class"==o?vr(e,t):"widget"==o&&Nr(e,t,i)}t.changes=null}function Er(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 mr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):rr(e,t)}function gr(e,t){var r=t.text.className,i=mr(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,vr(e,t)):r&&(t.text.className=r)}function vr(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=Er(t);t.background=i.insertBefore(O("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?Er(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 xr(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=Er(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