diff --git a/packages/api-explorer/__tests__/CodeSample.test.jsx b/packages/api-explorer/__tests__/CodeSample.test.jsx index 8e1690898..86159a177 100644 --- a/packages/api-explorer/__tests__/CodeSample.test.jsx +++ b/packages/api-explorer/__tests__/CodeSample.test.jsx @@ -196,6 +196,42 @@ describe('code examples', () => { expect(codeSample.find('.hub-code-auto pre').length).toBe(1); expect(codeSample.find('.hub-lang-switch-node').text()).toBe('Node'); }); + + test('should not display more than one example block at a time', () => { + const docProps = { + setLanguage: () => {}, + operation: new Operation({}, '/pet/{id}', 'get'), + formData: {}, + language: 'javascript', + examples: [ + { + name: 'Javascript/Node.js', + code: 'console.log(1);', + language: 'javascript', + }, + { + name: 'TypeScript', + code: 'console.log(1)', + language: 'javascript', + }, + ], + }; + + const codeSample = shallow( + , + ); + + expect(codeSample.find('.code-sample-tabs a.selected').length).toBe(1); + }); }); describe('updating language', () => { diff --git a/packages/api-explorer/dist/index.js b/packages/api-explorer/dist/index.js index 9d598e887..99d99fbc2 100644 --- a/packages/api-explorer/dist/index.js +++ b/packages/api-explorer/dist/index.js @@ -1 +1,54792 @@ -module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},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=160)}([function(e,t,r){"use strict";e.exports=r(163)},function(e,t,r){e.exports=r(167)()},function(e,t){var r=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(e,t,r){(function(e,n){var a=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],r=0;r=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),h(r)?n.showHidden=r:r&&t._extend(n,r),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),c(n,e,n.depth)}function u(e,t){var r=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.colors[r][1]+"m":e}function l(e,t){return e}function c(e,r,n){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var a=r.inspect(n,e);return g(a)||(a=c(e,a,n)),a}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(v(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(o)return o;var i=Object.keys(r),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(r)),_(r)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return f(r);if(0===i.length){if(k(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(x(r))return e.stylize(Date.prototype.toString.call(r),"date");if(_(r))return f(r)}var l,w="",S=!1,E=["{","}"];(p(r)&&(S=!0,E=["[","]"]),k(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(w=" "+RegExp.prototype.toString.call(r)),x(r)&&(w=" "+Date.prototype.toUTCString.call(r)),_(r)&&(w=" "+f(r)),0!==i.length||S&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=S?function(e,t,r,n,a){for(var o=[],i=0,s=t.length;i=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,w,E)):E[0]+w+E[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,n,a,o){var i,s,u;if((u=Object.getOwnPropertyDescriptor(t,a)||{value:t[a]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),P(n,a)||(i="["+a+"]"),s||(e.seen.indexOf(u.value)<0?(s=m(r)?c(e,u.value,null):c(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),y(i)){if(o&&a.match(/^\d+$/))return s;(i=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+s}function p(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function m(e){return null===e}function v(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function b(e){return w(e)&&"[object RegExp]"===S(e)}function w(e){return"object"==typeof e&&null!==e}function x(e){return w(e)&&"[object Date]"===S(e)}function _(e){return w(e)&&("[object Error]"===S(e)||e instanceof Error)}function k(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(y(o)&&(o=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=n.pid;i[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else i[e]=function(){};return i[e]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=h,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=v,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=b,t.isObject=w,t.isDate=x,t.isError=_,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(373);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":"),[e.getDate(),O[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(374),t._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(t,r(11),r(17))},function(e,t,r){"use strict";var n=r(3),a=function(e,t){this.code=[],this.indentation=e,this.lineJoin=t||"\n"};a.prototype.buildLine=function(e,t){var r="",a=2;if("[object String]"===Object.prototype.toString.call(e))a=1,t=e,e=0;else if(null===e)return null;for(;e;)r+=this.indentation,e--;var o=Array.prototype.slice.call(arguments,a,arguments.length);return o.unshift(r+t),n.format.apply(this,o)},a.prototype.unshift=function(){return this.code.unshift(this.buildLine.apply(this,arguments)),this},a.prototype.push=function(){return this.code.push(this.buildLine.apply(this,arguments)),this},a.prototype.blank=function(){return this.code.push(null),this},a.prototype.join=function(){return this.code.join(this.lineJoin)},e.exports=a},function(e,t,r){"use strict";t.__esModule=!0;var n,a=r(104),o=(n=a)&&n.__esModule?n:{default:n};t.default=o.default||function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{};var a=w(t);if("function"==typeof r)return function(e){if(!e.MergedWidget){var t=e.defaultProps&&e.defaultProps.options||{};e.MergedWidget=function(r){var n=r.options,a=void 0===n?{}:n,o=(0,h.default)(r,["options"]);return m.default.createElement(e,(0,p.default)({options:(0,p.default)({},t,a)},o))}}return e.MergedWidget}(r);if("string"!=typeof r)throw new Error("Unsupported widget definition: "+(void 0===r?"undefined":(0,d.default)(r)));if(n.hasOwnProperty(r)){var o=n[r];return e(t,o,n)}if(!b.hasOwnProperty(a))throw new Error('No widget for type "'+a+'"');if(b[a].hasOwnProperty(r)){var i=n[b[a][r]];return e(t,i,n)}throw new Error('No widget "'+r+'" for type "'+a+'"')},t.getDefaultFormState=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!x(e))throw new Error("Invalid schema: "+e);var n=function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var a=r;if(x(a)&&x(t.default))a=_(a,t.default);else if("default"in t)a=t.default;else{if("$ref"in t){var o=C(t.$ref,n);return e(o,a,n)}P(t)&&(a=t.items.map(function(t){return e(t,void 0,n)}))}void 0===a&&(a=t.default);switch(t.type){case"object":return(0,f.default)(t.properties||{}).reduce(function(r,o){return r[o]=e(t.properties[o],(a||{})[o],n),r},{});case"array":if(t.minItems){if(O(t,n))return[];var i=a?a.length:0;if(t.minItems>i){var s=a||[],u=(0,g.default)(new Array(t.minItems-i),e(t.items,t.items.defaults,n));return s.concat(u)}}}return a}(j(e,r,t),e.default,r);if(void 0===t)return n;if(x(t))return _(n,t);return t||n},t.getUiOptions=function(e){return(0,f.default)(e).filter(function(e){return 0===e.indexOf("ui:")}).reduce(function(t,r){var n=e[r];return"ui:widget"===r&&x(n)?(console.warn("Setting options via ui:widget object is deprecated, use ui:options instead"),(0,p.default)({},t,n.options||{},{widget:n.component})):"ui:options"===r&&x(n)?(0,p.default)({},t,n):(0,p.default)({},t,(0,c.default)({},r.substring(3),n))},{})},t.isObject=x,t.mergeObjects=_,t.asNumber=function(e){if(""===e)return;if(/\.$/.test(e))return e;if(/\.0$/.test(e))return e;var t=Number(e),r="number"==typeof t&&!(0,u.default)(t);if(/\.\d*0$/.test(e))return e;return r?t:e},t.orderProperties=function(e,t){if(!Array.isArray(t))return e;var r=function(e){return e.reduce(function(e,t){return e[t]=!0,e},{})},n=function(e){return e.length>1?"properties '"+e.join("', '")+"'":"property '"+e[0]+"'"},a=r(e),o=r(t),i=t.filter(function(e){return"*"!==e&&!a[e]});if(i.length)throw new Error("uiSchema order list contains extraneous "+n(i));var u=e.filter(function(e){return!o[e]}),l=t.indexOf("*");if(-1===l){if(u.length)throw new Error("uiSchema order list does not contain "+n(u));return t}if(l!==t.lastIndexOf("*"))throw new Error("uiSchema order list contains more than one wildcard item");var c=[].concat((0,s.default)(t));return c.splice.apply(c,[l,1].concat((0,s.default)(u))),c},t.isConstant=k,t.toConstant=S,t.isSelect=E,t.isMultiSelect=O,t.isFilesArray=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("files"===t["ui:widget"])return!0;if(e.items){var n=j(e.items,r);return"string"===n.type&&"data-url"===n.format}return!1},t.isFixedItems=P,t.allowAdditionalItems=function(e){!0===e.additionalItems&&console.warn("additionalItems=true is currently not supported");return x(e.additionalItems)},t.optionsList=function(e){if(e.enum)return e.enum.map(function(t,r){var n=e.enumNames&&e.enumNames[r]||String(t);return{label:n,value:t}});var t=e.oneOf||e.anyOf;return t.map(function(e,t){var r=S(e),n=e.title||String(r);return{label:n,value:r}})},t.retrieveSchema=j,t.deepEquals=L,t.shouldRender=function(e,t,r){var n=e.props,a=e.state;return!L(n,t)||!L(a,r)},t.toIdSchema=function e(t,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"root";var i={$id:r||o};if("$ref"in t){var s=j(t,n,a);return e(s,r,n,a,o)}if("items"in t&&!t.items.$ref)return e(t.items,r,n,a,o);if("object"!==t.type)return i;for(var u in t.properties||{}){var l=t.properties[u],c=i.$id+"_"+u;i[u]=e(l,c,n,a[u],o)}return i},t.parseDateString=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return{year:-1,month:-1,day:-1,hour:t?-1:0,minute:t?-1:0,second:t?-1:0};var r=new Date(e);if((0,u.default)(r.getTime()))throw new Error("Unable to parse date "+e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:t?r.getUTCHours():0,minute:t?r.getUTCMinutes():0,second:t?r.getUTCSeconds():0}},t.toDateString=function(e){var t=e.year,r=e.month,n=e.day,a=e.hour,o=void 0===a?0:a,i=e.minute,s=void 0===i?0:i,u=e.second,l=void 0===u?0:u,c=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],f=Date.UTC(t,r-1,n,o,s,l),d=new Date(f).toJSON();return c?d:d.slice(0,10)},t.pad=function(e,t){var r=String(e);for(;r.length2&&void 0!==arguments[2]&&arguments[2],n=(0,l.default)({},e);return(0,f.default)(t).reduce(function(n,a){var o=e[a],i=t[a];return e.hasOwnProperty(a)&&x(i)?n[a]=_(o,i,r):r&&Array.isArray(o)&&Array.isArray(i)?n[a]=o.concat(i):n[a]=i,n},n)}function k(e){return Array.isArray(e.enum)&&1===e.enum.length||e.hasOwnProperty("const")}function S(e){if(Array.isArray(e.enum)&&1===e.enum.length)return e.enum[0];if(e.hasOwnProperty("const"))return e.const;throw new Error("schema cannot be inferred as a constant")}function E(e){var t=j(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r=t.oneOf||t.anyOf;return!!Array.isArray(t.enum)||!!Array.isArray(r)&&r.every(function(e){return k(e)})}function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!(!e.uniqueItems||!e.items)&&E(e.items,t)}function P(e){return Array.isArray(e.items)&&e.items.length>0&&e.items.every(function(e){return x(e)})}function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=/^#(?:\/definitions)?\/(.*)$/.exec(e);if(r&&r[1]){var n=r[1].split("/"),a=t,o=!0,s=!1,u=void 0;try{for(var l,c=(0,i.default)(n);!(o=(l=c.next()).done);o=!0){var f=l.value;if(f=f.replace(/~1/g,"/").replace(/~0/g,"~"),!a.hasOwnProperty(f))throw new Error("Could not find a definition for "+e+".");a=a[f]}}catch(e){s=!0,u=e}finally{try{!o&&c.return&&c.return()}finally{if(s)throw u}}return a}throw new Error("Could not find a definition for "+e+".")}function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.hasOwnProperty("$ref")){var n=C(e.$ref,t),a=(e.$ref,(0,h.default)(e,["$ref"]));return j((0,p.default)({},n,a),t,r)}return e.hasOwnProperty("dependencies")?j(function(e,t,r){var n=e.dependencies,a=void 0===n?{}:n,o=(0,h.default)(e,["dependencies"]);for(var i in a)if(void 0!==r[i]){var s=a[i];Array.isArray(s)?o=T(o,s):x(s)&&(o=A(o,t,r,i,s))}return o}(e,t,r),t,r):e}function T(e,t){if(!t)return e;var r=Array.isArray(e.required)?(0,o.default)(new a.default([].concat((0,s.default)(e.required),(0,s.default)(t)))):t;return(0,p.default)({},e,{required:r})}function A(e,t,r,n,a){var o=j(a,t,r),i=o.oneOf;return e=R(e,(0,h.default)(o,["oneOf"])),void 0===i?e:function(e,t,r,n,a){if(!Array.isArray(a))throw new Error("invalid oneOf: it is some "+(void 0===a?"undefined":(0,d.default)(a))+" instead of an array");var o=a.filter(function(e){if(!e.properties)return!1;var t=e.properties[n];if(t){var a={type:"object",properties:(0,c.default)({},n,t)},o=(0,v.default)(r,a),i=o.errors;return 0===i.length}});if(1!==o.length)return console.warn("ignoring oneOf in dependencies because there isn't exactly one subschema that is valid"),e;var i=o[0],s=i.properties,u=(s[n],(0,h.default)(s,[n])),l=(0,p.default)({},i,{properties:u});return R(e,j(l,t,r))}(e,t,r,n,i)}function R(e,t){return _(e,t,!0)}function M(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function L(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(e===t)return!0;if("function"==typeof e||"function"==typeof t)return!0;if("object"!==(void 0===e?"undefined":(0,d.default)(e))||"object"!==(void 0===t?"undefined":(0,d.default)(t)))return!1;if(null===e||null===t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(M(e)||M(t)){if(!M(e)||!M(t))return!1;var a=Array.prototype.slice;return L(a.call(e),a.call(t),r,n)}if(e.constructor!==t.constructor)return!1;var o=(0,f.default)(e),i=(0,f.default)(t);if(0===o.length&&0===i.length)return!0;if(o.length!==i.length)return!1;for(var s=r.length;s--;)if(r[s]===e)return n[s]===t;r.push(e),n.push(t),o.sort(),i.sort();for(var u=o.length-1;u>=0;u--)if(o[u]!==i[u])return!1;for(var l=void 0,c=o.length-1;c>=0;c--)if(!L(e[l=o[c]],t[l],r,n))return!1;return r.pop(),n.pop(),!0}},function(e,t,r){var n;n=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),i=n||a||o,s=i&&(n?document.documentMode||6:+(o||a)[1]),u=!o&&/WebKit\//.test(e),l=u&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),h=/PhantomJS/.test(e),m=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),g=m||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=f&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(f=!1,u=!0);var _=y&&(l||f&&(null==x||x<12.11)),k=r||i&&s>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E,O=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var a=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(a?n[1]+a:"")}};function P(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function C(e,t){return P(e).appendChild(t)}function j(e,t,r,n){var a=document.createElement(e);if(r&&(a.className=r),n&&(a.style.cssText=n),"string"==typeof t)a.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return i+(t-o);i+=s-o,i+=r-i%r,o=s+1}}m?D=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:i&&(D=function(e){try{e.select()}catch(e){}});var I=function(){this.id=null};function z(e,t){for(var r=0;r=t)return n+Math.min(i,t-a);if(a+=o-n,n=o+1,(a+=r-a%r)>=t)return n}}var K=[""];function J(e){for(;K.length<=e;)K.push(G(K)+" ");return K[e]}function G(e){return e[e.length-1]}function Y(e,t){for(var r=[],n=0;n"€"&&(e.toUpperCase()!=e.toLowerCase()||X.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ae(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var a=(t+r)/2,o=n<0?Math.ceil(a):Math.floor(a);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var a=r.children[n],o=a.chunkSize();if(t=e.first&&tr?me(r,se(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?me(e.line,t):r<0?me(e.line,0):e}(t,se(e,t.line).text.length)}function ke(e,t){for(var r=[],n=0;n=t:o.to>t);(n||(n=[])).push(new Oe(i,o.from,s?null:o.to))}}return n}(r,a,i),u=function(e,t,r){var n;if(e)for(var a=0;a=t:o.to>t)||o.from==t&&"bookmark"==i.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(i.inclusiveLeft?o.from<=t:o.from0&&s)for(var b=0;b=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(u.marker.inclusiveRight&&a.inclusiveLeft?ve(l.to,r)>=0:ve(l.to,r)>0)||c>=0&&(u.marker.inclusiveRight&&a.inclusiveLeft?ve(l.from,n)<=0:ve(l.from,n)<0)))return!0}}}function ze(e){for(var t;t=qe(e);)e=t.find(-1,!0).line;return e}function Be(e,t){var r=se(e,t),n=ze(r);return r==n?t:fe(n)}function Ue(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!$e(e,n))return t;for(;r=Fe(n);)n=r.find(1,!0).line;return fe(n)+1}function $e(e,t){var r=Ee&&t.markedSpans;if(r)for(var n=void 0,a=0;at.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var Je=null;function Ge(e,t,r){var n;Je=null;for(var a=0;at)return a;o.to==t&&(o.from!=o.to&&"before"==r?n=a:Je=a),o.from==t&&(o.from!=o.to&&"before"!=r?n=a:Je=a)}return null!=n?n:Je}var Ye=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,a=/[LRr]/,o=/[Lb1n]/,i=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(u,l){var c="ltr"==l?"L":"R";if(0==u.length||"ltr"==l&&!r.test(u))return!1;for(var f,d=u.length,p=[],h=0;h-1&&(n[t]=a.slice(0,o).concat(a.slice(o+1)))}}}function rt(e,t){var r=et(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),a=0;a0}function it(e){e.prototype.on=function(e,t){Xe(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ut(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function lt(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ct(e){st(e),ut(e)}function ft(e){return e.target||e.srcElement}function dt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var pt,ht,mt=function(){if(i&&s<9)return!1;var e=j("div");return"draggable"in e||"dragDrop"in e}();function vt(e){if(null==pt){var t=j("span","​");C(e,j("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(pt=t.offsetWidth<=1&&t.offsetHeight>2&&!(i&&s<8))}var r=pt?j("span","​"):j("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function gt(e){if(null!=ht)return ht;var t=C(e,document.createTextNode("AخA")),r=E(t,0,1).getBoundingClientRect(),n=E(t,1,2).getBoundingClientRect();return P(e),!(!r||r.left==r.right)&&(ht=n.right-r.right<3)}var yt,bt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var a=e.indexOf("\n",t);-1==a&&(a=e.length);var o=e.slice(t,"\r"==e.charAt(a-1)?a-1:a),i=o.indexOf("\r");-1!=i?(r.push(o.slice(0,i)),t+=i+1):(r.push(o),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},wt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},xt="oncopy"in(yt=j("div"))||(yt.setAttribute("oncopy","return;"),"function"==typeof yt.oncopy),_t=null;var kt={},St={};function Et(e){if("string"==typeof e&&St.hasOwnProperty(e))e=St[e];else if(e&&"string"==typeof e.name&&St.hasOwnProperty(e.name)){var t=St[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Et("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Et("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ot(e,t){t=Et(t);var r=kt[t.name];if(!r)return Ot(e,"text/plain");var n=r(e,t);if(Pt.hasOwnProperty(t.name)){var a=Pt[t.name];for(var o in a)a.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=a[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var i in t.modeProps)n[i]=t.modeProps[i];return n}var Pt={};function Ct(e,t){q(t,Pt.hasOwnProperty(e)?Pt[e]:Pt[e]={})}function jt(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var a=t[n];a instanceof Array&&(a=a.concat([])),r[n]=a}return r}function Tt(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 At(e,t,r){return!e.startState||e.startState(t,r)}var Rt=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};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.post},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var a=function(e){return r?e.toLowerCase():e};if(a(this.string.substr(this.pos,e.length))==a(e))return!1!==t&&(this.pos+=e.length),!0},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Mt=function(e,t){this.state=e,this.lookAhead=t},Lt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Dt(e,t,r,n){var a=[e.state.modeGen],o={};Ht(e,t.text,e.doc.mode,r,function(e,t){return a.push(e,t)},o,n);for(var i=r.state,s=function(n){r.baseTokens=a;var s=e.state.overlays[n],u=1,l=0;r.state=!0,Ht(e,t.text,s.mode,r,function(e,t){for(var r=u;le&&a.splice(u,1,e,a[u+1],n),u+=2,l=Math.min(e,n)}if(t)if(s.opaque)a.splice(r,u-r,e,"overlay "+t),u=r+2;else for(;re.options.maxHighlightLength&&jt(e.doc.mode,n.state),o=Dt(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),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 qt(e,t,r){var n=e.doc,a=e.display;if(!n.mode.startState)return new Lt(n,!0,t);var o=function(e,t,r){for(var n,a,o=e.doc,i=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>i;--s){if(s<=o.first)return o.first;var u=se(o,s-1),l=u.stateAfter;if(l&&(!r||s+(l instanceof Mt?l.lookAhead:0)<=o.modeFrontier))return s;var c=F(u.text,null,e.options.tabSize);(null==a||n>c)&&(a=s-1,n=c)}return a}(e,t,r),i=o>n.first&&se(n,o-1).stateAfter,s=i?Lt.fromSaved(n,i,o):new Lt(n,At(n.mode),o);return n.iter(o,t,function(r){Ft(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=a.viewFrom&&nt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Lt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Lt.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}},Lt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Lt.fromSaved=function(e,t,r){return t instanceof Mt?new Lt(e,jt(e.mode,t.state),r,t.lookAhead):new Lt(e,jt(e.mode,t),r)},Lt.prototype.save=function(e){var t=!1!==e?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Mt(t,this.maxLookAhead):t};var Bt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ut(e,t,r,n){var a,o,i=e.doc,s=i.mode,u=se(i,(t=_e(i,t)).line),l=qt(e,t.line,r),c=new Rt(u.text,e.options.tabSize,l);for(n&&(o=[]);(n||c.pose.options.maxHighlightLength?(s=!1,i&&Ft(e,t,n,f.pos),f.pos=t.length,u=null):u=$t(zt(r,f,n.state,d),o),d){var p=d[0].name;p&&(u="m-"+(u?p+" "+u:p))}if(!s||c!=u){for(;l1&&!/ /.test(e))return e;for(var r=t,n="",a=0;al&&f.from<=l);d++);if(f.to>=c)return e(r,n,a,o,i,s,u);e(r,n.slice(0,f.to-l),a,o,null,s,u),o=null,n=n.slice(f.to-l),l=f.to}}}function er(e,t,r,n){var a=!n&&r.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!n&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",r.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function tr(e,t,r){var n=e.markedSpans,a=e.text,o=0;if(n)for(var i,s,u,l,c,f,d,p=a.length,h=0,m=1,v="",g=0;;){if(g==h){u=l=c=f=s="",d=null,g=1/0;for(var y=[],b=void 0,w=0;wh||_.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&g>x.to&&(g=x.to,l=""),_.className&&(u+=" "+_.className),_.css&&(s=(s?s+";":"")+_.css),_.startStyle&&x.from==h&&(c+=" "+_.startStyle),_.endStyle&&x.to==g&&(b||(b=[])).push(_.endStyle,x.to),_.title&&!f&&(f=_.title),_.collapsed&&(!d||De(d.marker,_)<0)&&(d=x)):x.from>h&&g>x.from&&(g=x.from)}if(b)for(var k=0;k=p)break;for(var E=Math.min(p,g);;){if(v){var O=h+v.length;if(!d){var P=O>E?v.slice(0,E-h):v;t.addToken(t,P,i?i+u:u,c,h+P.length==g?l:"",f,s)}if(O>=E){v=v.slice(E-h),h=E;break}h=O,c=""}v=a.slice(o,o=r[m++]),i=Gt(r[m++],t.cm.options)}}else for(var C=1;Cr)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Cr(e,t,r,n){return Ar(e,Tr(e,t),r,n)}function jr(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&t2&&o.push((u.bottom+l.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var a,o=Lr(t.map,r,n),u=o.node,l=o.start,c=o.end,f=o.collapse;if(3==u.nodeType){for(var d=0;d<4;d++){for(;l&&ae(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+c1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,a))}else{var p;l>0&&(f=n="right"),a=e.options.lineWrapping&&(p=u.getClientRects()).length>1?p["right"==n?p.length-1:0]:u.getBoundingClientRect()}if(i&&s<9&&!l&&(!a||!a.left&&!a.right)){var h=u.parentNode.getClientRects()[0];a=h?{left:h.left,right:h.left+en(e.display),top:h.top,bottom:h.bottom}:Mr}for(var m=a.top-t.rect.top,v=a.bottom-t.rect.top,g=(m+v)/2,y=t.view.measure.heights,b=0;bt)&&(a=(o=u-s)-1,t>=u&&(i="right")),null!=a){if(n=e[l+2],s==u&&r==(n.insertLeft?"left":"right")&&(i=r),"left"==r&&0==a)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[2+(l-=3)],i="left";if("right"==r&&a==u-s)for(;l=0&&(r=e[a]).left==r.right;a--);return r}function Nr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=n.text.length?(u=n.text.length,l="before"):u<=0&&(u=0,l="after"),!s)return i("before"==l?u-1:u,"before"==l);function c(e,t,r){var n=1==s[t].level;return i(r?e-1:e,n!=r)}var f=Ge(s,u,l),d=Je,p=c(u,f,"before"==l);return null!=d&&(p.other=c(u,d,"before"!=l)),p}function Vr(e,t){var r=0;t=_e(e.doc,t),e.options.lineWrapping||(r=en(e.display)*t.ch);var n=se(e.doc,t.line),a=We(n)+xr(e.display);return{left:r,right:r,top:a,bottom:a+n.height}}function Kr(e,t,r,n,a){var o=me(e,t,r);return o.xRel=a,n&&(o.outside=!0),o}function Jr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Kr(n.first,0,null,!0,-1);var a=de(n,r),o=n.first+n.size-1;if(a>o)return Kr(n.first+n.size-1,se(n,o).text.length,null,!0,1);t<0&&(t=0);for(var i=se(n,a);;){var s=Zr(e,i,a,t,r),u=Fe(i),l=u&&u.find(0,!0);if(!u||!(s.ch>l.from.ch||s.ch==l.from.ch&&s.xRel>0))return s;a=fe(i=l.to.line)}}function Gr(e,t,r,n){n-=Br(t);var a=t.text.length,o=ie(function(t){return Ar(e,r,t-1).bottom<=n},a,0);return{begin:o,end:a=ie(function(t){return Ar(e,r,t).top>n},o,a)}}function Yr(e,t,r,n){return r||(r=Tr(e,t)),Gr(e,t,r,Ur(e,t,Ar(e,r,n),"line").top)}function Qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Zr(e,t,r,n,a){a-=We(t);var o=Tr(e,t),i=Br(t),s=0,u=t.text.length,l=!0,c=Qe(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?function(e,t,r,n,a,o,i){var s=Gr(e,t,n,i),u=s.begin,l=s.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var c=null,f=null,d=0;d=l||p.to<=u)){var h=1!=p.level,m=Ar(e,n,h?Math.min(l,p.to)-1:Math.max(u,p.from)).right,v=mv)&&(c=p,f=v)}}c||(c=a[a.length-1]);c.froml&&(c={from:c.from,to:l,level:c.level});return c}:function(e,t,r,n,a,o,i){var s=ie(function(s){var u=a[s],l=1!=u.level;return Qr(Wr(e,me(r,l?u.to:u.from,l?"before":"after"),"line",t,n),o,i,!0)},0,a.length-1),u=a[s];if(s>0){var l=1!=u.level,c=Wr(e,me(r,l?u.from:u.to,l?"after":"before"),"line",t,n);Qr(c,o,i,!0)&&c.top>i&&(u=a[s-1])}return u})(e,t,r,o,c,n,a);s=(l=1!=f.level)?f.from:f.to-1,u=l?f.to:f.from-1}var d,p,h=null,m=null,v=ie(function(t){var r=Ar(e,o,t);return r.top+=i,r.bottom+=i,!!Qr(r,n,a,!1)&&(r.top<=a&&r.left<=n&&(h=t,m=r),!0)},s,u),g=!1;if(m){var y=n-m.left=w.bottom}return Kr(r,v=oe(t.text,v,1),p,g,n-d)}function Xr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Rr){Rr=j("pre");for(var t=0;t<49;++t)Rr.appendChild(document.createTextNode("x")),Rr.appendChild(j("br"));Rr.appendChild(document.createTextNode("x"))}C(e.measure,Rr);var r=Rr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),P(e.measure),r||1}function en(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=j("span","xxxxxxxxxx"),r=j("pre",[t]);C(e.measure,r);var n=t.getBoundingClientRect(),a=(n.right-n.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function tn(e){for(var t=e.display,r={},n={},a=t.gutters.clientLeft,o=t.gutters.firstChild,i=0;o;o=o.nextSibling,++i)r[e.options.gutters[i]]=o.offsetLeft+o.clientLeft+a,n[e.options.gutters[i]]=o.clientWidth;return{fixedPos:rn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function rn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function nn(e){var t=Xr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/en(e.display)-3);return function(a){if($e(e.doc,a))return 0;var o=0;if(a.widgets)for(var i=0;i=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n=e.display.viewTo||s.to().linet||t==r&&i.to==t)&&(n(Math.max(i.from,t),Math.min(i.to,r),1==i.level?"rtl":"ltr",o),a=!0)}a||n(t,r,"ltr")}(m,r||0,null==n?d:n,function(e,t,a,f){var v="ltr"==a,g=p(e,v?"left":"right"),y=p(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==d,x=0==f,_=!m||f==m.length-1;if(y.top-g.top<=3){var k=(l?w:b)&&_,S=(l?b:w)&&x?s:(v?g:y).left,E=k?u:(v?y:g).right;c(S,g.top,E-S,g.bottom)}else{var O,P,C,j;v?(O=l&&b&&x?s:g.left,P=l?u:h(e,a,"before"),C=l?s:h(t,a,"after"),j=l&&w&&_?u:y.right):(O=l?h(e,a,"before"):s,P=!l&&b&&x?u:g.right,C=!l&&w&&_?s:y.left,j=l?h(t,a,"after"):u),c(O,g.top,P-O,g.bottom),g.bottom0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function hn(e){e.state.focused||(e.display.input.focus(),vn(e))}function mn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function vn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(rt(e,"focus",e,t),e.state.focused=!0,M(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),u&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),pn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(rt(e,"blur",e,t),e.state.focused=!1,O(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||c<-.005)&&(ce(a.line,o),bn(a.line),a.rest))for(var f=0;f=i&&(o=de(t,We(se(t,u))-e.wrapper.clientHeight),i=u)}return{from:o,to:Math.max(i,o+1)}}function xn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=rn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,o=n+"px",i=0;io&&(t.bottom=t.top+o);var s=e.doc.height+_r(r),u=t.tops-n;if(t.topa+o){var c=Math.min(t.top,(l?s:t.bottom)-o);c!=a&&(i.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Er(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?i.scrollLeft=0:t.leftd+f-3&&(i.scrollLeft=t.right+(p?0:10)-d),i}function Sn(e,t){null!=t&&(Pn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function En(e){Pn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function On(e,t,r){null==t&&null==r||Pn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Pn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Cn(e,Vr(e,t.from),Vr(e,t.to),t.margin))}function Cn(e,t,r,n){var a=kn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});On(e,a.scrollLeft,a.scrollTop)}function jn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ia(e,{top:t}),Tn(e,t,!0),r&&ia(e),ta(e,100))}function Tn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function An(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,xn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Rn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+_r(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Sr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Mn=function(e,t,r){this.cm=r;var n=this.vert=j("div",[j("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=j("div",[j("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(a),Xe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Xe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,i&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Mn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var a=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Mn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Mn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Mn.prototype.zeroWidthHack=function(){var e=y&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new I,this.disableVert=new I},Mn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,function n(){var a=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)})},Mn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ln=function(){};function Dn(e,t){t||(t=Rn(e));var r=e.display.barWidth,n=e.display.barHeight;Nn(e,t);for(var a=0;a<4&&r!=e.display.barWidth||n!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&yn(e),Nn(e,Rn(e)),r=e.display.barWidth,n=e.display.barHeight}function Nn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Ln.prototype.update=function(){return{bottom:0,right:0}},Ln.prototype.setScrollLeft=function(){},Ln.prototype.setScrollTop=function(){},Ln.prototype.clear=function(){};var qn={native:Mn,null:Ln};function Fn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new qn[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Xe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?An(e,t):jn(e,t)},e),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)}var In=0;function zn(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++In},t=e.curOp,ar?ar.ops.push(t):t.ownsGroup=ar={ops:[t],delayedCallbacks:[]}}function Bn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new na(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $n(e){var t=e.cm,r=t.display;e.updatedDisplay&&yn(t),e.barMeasure=Rn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Cr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Sr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Er(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Hn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),null!=a&&!h){var o=j("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-xr(e.display))+"px;\n height: "+(t.bottom-t.top+Sr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(a),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var a;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?me(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?me(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var i=!1,s=Wr(e,t),u=r&&r!=t?Wr(e,r):s,l=kn(e,a={left:Math.min(s.left,u.left),top:Math.min(s.top,u.top)-n,right:Math.max(s.left,u.left),bottom:Math.max(s.bottom,u.bottom)+n}),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=l.scrollTop&&(jn(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(i=!0)),null!=l.scrollLeft&&(An(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(i=!0)),!i)break}return a}(t,_e(n,e.scrollToPos.from),_e(n,e.scrollToPos.to),e.scrollToPos.margin));var a=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(a)for(var i=0;it)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Ee&&Be(e.doc,t)a.viewFrom?Zn(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&r>=a.viewTo)Zn(e);else if(t<=a.viewFrom){var o=Xn(e,r,r+n,1);o?(a.view=a.view.slice(o.index),a.viewFrom=o.lineN,a.viewTo+=n):Zn(e)}else if(r>=a.viewTo){var i=Xn(e,t,t,-1);i?(a.view=a.view.slice(0,i.index),a.viewTo=i.lineN):Zn(e)}else{var s=Xn(e,t,t,-1),u=Xn(e,r,r+n,1);s&&u?(a.view=a.view.slice(0,s.index).concat(nr(e,s.lineN,u.lineN)).concat(a.view.slice(u.index)),a.viewTo+=n):Zn(e)}var l=a.externalMeasured;l&&(r=a.lineN&&t=n.viewTo)){var o=n.view[sn(e,t)];if(null!=o.node){var i=o.changes||(o.changes=[]);-1==z(i,r)&&i.push(r)}}}function Zn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Xn(e,t,r,n){var a,o=sn(e,t),i=e.display.view;if(!Ee||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,u=0;u0){if(o==i.length-1)return null;a=s+i[o].size-t,o++}else a=s-t;t+=a,r+=a}for(;Be(e.doc,r)!=r;){if(o==(n<0?0:i.length-1))return null;r+=n*i[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function ea(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo)){var r=+new Date+e.options.workTime,n=qt(e,t.highlightFrontier),a=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var i=o.styles,s=o.text.length>e.options.maxHighlightLength?jt(t.mode,n.state):null,u=Dt(e,o,n,!0);s&&(n.state=s),o.styles=u.styles;var l=o.styleClasses,c=u.classes;c?o.styleClasses=c:l&&(o.styleClasses=null);for(var f=!i||i.length!=o.styles.length||l!=c&&(!l||!c||l.bgClass!=c.bgClass||l.textClass!=c.textClass),d=0;!f&&dr)return ta(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),a.length&&Vn(e,function(){for(var t=0;t=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==ea(e))return!1;_n(e)&&(Zn(e),t.dims=tn(e));var a=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),i=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFromi&&r.viewTo-i<20&&(i=Math.min(a,r.viewTo)),Ee&&(o=Be(e.doc,o),i=Ue(e.doc,i));var s=o!=r.viewFrom||i!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=nr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=nr(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,sn(e,r)))),n.viewTo=r}(e,o,i),r.viewOffset=We(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=ea(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=R();if(!t||!A(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&A(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return l>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,a=e.options.lineNumbers,o=n.lineDiv,i=o.firstChild;function s(t){var r=t.nextSibling;return u&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var l=n.view,c=n.viewFrom,f=0;f-1&&(p=!1),ur(e,d,c,r)),p&&(P(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(he(e.options,c)))),i=d.node.nextSibling}else{var h=mr(e,d,c,r);o.insertBefore(h,i)}c+=d.size}for(;i;)i=s(i)}(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=R()&&(e.activeElt.focus(),e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),P(r.cursorDiv),P(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ta(e,400)),r.updateLineNumbers=null,!0}function oa(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Er(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+_r(e.display)-Or(e),r.top)}),t.visible=wn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&aa(e,t);n=!1){yn(e);var a=Rn(e);un(e),Dn(e,a),ua(e,a),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ia(e,t){var r=new na(e,t);if(aa(e,r)){yn(e),oa(e,r);var n=Rn(e);un(e),Dn(e,n),ua(e,n),r.finish()}}function sa(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function ua(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sr(e)+"px"}function la(e){var t=e.display.gutters,r=e.options.gutters;P(t);for(var n=0;n-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}na.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},na.prototype.finish=function(){for(var e=0;es.clientWidth,c=s.scrollHeight>s.clientHeight;if(a&&l||o&&c){if(o&&y&&u)e:for(var d=t.target,p=i.view;d!=s;d=d.parentNode)for(var h=0;h=0&&ve(e,n.to())<=0)return r}return-1};var ga=function(e,t){this.anchor=e,this.head=t};function ya(e,t){var r=e[t];e.sort(function(e,t){return ve(e.from(),t.from())}),t=z(e,r);for(var n=1;n=0){var i=we(o.from(),a.from()),s=be(o.to(),a.to()),u=o.empty()?a.from()==a.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new ga(u?s:i,u?i:s))}}return new va(e,t)}function ba(e,t){return new va([new ga(e,t||e)],0)}function wa(e){return e.text?me(e.from.line+e.text.length-1,G(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xa(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return wa(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=wa(t).ch-t.to.ch),me(r,n)}function _a(e,t){for(var r=[],n=0;n1&&e.remove(s.line+1,h-1),e.insert(s.line+1,g)}ir(e,"change",e,t)}function Ca(e,t,r){!function e(n,a,o){if(n.linked)for(var i=0;is-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ma(e.done),G(e.done)):e.done.length&&!G(e.done).ranges?G(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),G(e.done)):void 0}(a,a.lastOp==n)))i=G(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,i.to)?i.to=wa(t):o.changes.push(Ra(e,t));else{var u=G(a.done);for(u&&u.ranges||Na(e.sel,a.done),o={changes:[Ra(e,t)],generation:a.generation},a.done.push(o);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=s,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,i||rt(e,"historyAdded")}function Da(e,t,r,n){var a=e.history,o=n&&n.origin;r==a.lastSelOp||o&&a.lastSelOrigin==o&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==o||function(e,t,r,n){var a=t.charAt(0);return"*"==a||"+"==a&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,G(a.done),t))?a.done[a.done.length-1]=t:Na(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=o,a.lastSelOp=r,n&&!1!==n.clearRedo&&Ma(a.undone)}function Na(e,t){var r=G(t);r&&r.ranges&&r.equals(e)||t.push(e)}function qa(e,t,r,n){var a=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((a||(a=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Fa(e){if(!e)return null;for(var t,r=0;r-1&&(G(s)[f]=l[f],delete l[f])}}}return n}function Ba(e,t,r,n){if(n){var a=e.anchor;if(r){var o=ve(t,a)<0;o!=ve(r,a)<0?(a=t,t=r):o!=ve(t,r)<0&&(t=r)}return new ga(a,t)}return new ga(r||t,t)}function Ua(e,t,r,n,a){null==a&&(a=e.cm&&(e.cm.display.shift||e.extend)),Ka(e,new va([Ba(e.sel.primary(),t,r,a)],0),n)}function $a(e,t,r){for(var n=[],a=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(a&&(rt(u,"beforeCursorEnter"),u.explicitlyCleared)){if(o.markedSpans){--i;continue}break}if(!u.atomic)continue;if(r){var l=u.find(n<0?1:-1),c=void 0;if((n<0?u.inclusiveRight:u.inclusiveLeft)&&(l=eo(e,l,-n,l&&l.line==t.line?o:null)),l&&l.line==t.line&&(c=ve(l,r))&&(n<0?c<0:c>0))return Za(e,l,t,n,a)}var f=u.find(n<0?-1:1);return(n<0?u.inclusiveLeft:u.inclusiveRight)&&(f=eo(e,f,n,f.line==t.line?o:null)),f?Za(e,f,t,n,a):null}}return t}function Xa(e,t,r,n,a){var o=n||1,i=Za(e,t,r,o,a)||!a&&Za(e,t,r,o,!0)||Za(e,t,r,-o,a)||!a&&Za(e,t,r,-o,!0);return i||(e.cantEdit=!0,me(e.first,0))}function eo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?_e(e,me(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line0)){var c=[u,1],f=ve(l.from,s.from),d=ve(l.to,s.to);(f<0||!i.inclusiveLeft&&!f)&&c.push({from:l.from,to:s.from}),(d>0||!i.inclusiveRight&&!d)&&c.push({from:s.to,to:l.to}),a.splice.apply(a,c),u+=c.length-3}}return a}(e,t.from,t.to);if(n)for(var a=n.length-1;a>=0;--a)ao(e,{from:n[a].from,to:n[a].to,text:a?[""]:t.text,origin:t.origin});else ao(e,t)}}function ao(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ve(t.from,t.to)){var r=_a(e,t);La(e,t,r,e.cm?e.cm.curOp.id:NaN),so(e,t,r,je(e,t));var n=[];Ca(e,function(e,r){r||-1!=z(n,e.history)||(fo(e.history,t),n.push(e.history)),so(e,t,null,je(e,t))})}}function oo(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,a=e.history,o=e.sel,i="undo"==t?a.done:a.undone,s="undo"==t?a.undone:a.done,u=0;u=0;--d){var p=f(d);if(p)return p.v}}}}function io(e,t){if(0!=t&&(e.first+=t,e.sel=new va(Y(e.sel.ranges,function(e){return new ga(me(e.anchor.line+t,e.anchor.ch),me(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Yn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:me(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ue(e,t.from,t.to),r||(r=_a(e,t)),e.cm?function(e,t,r){var n=e.doc,a=e.display,o=t.from,i=t.to,s=!1,u=o.line;e.options.lineWrapping||(u=fe(ze(se(n,o.line))),n.iter(u,i.line+1,function(e){if(e==a.maxLine)return s=!0,!0}));n.sel.contains(t.from,t.to)>-1&&at(e);Pa(n,t,r,nn(e)),e.options.lineWrapping||(n.iter(u,o.line+t.text.length,function(e){var t=Ve(e);t>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=t,a.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var a=se(e,n).stateAfter;if(a&&(!(a instanceof Mt)||n+a.lookAhead1||!(this.children[0]instanceof ho))){var s=[];this.collapse(s),this.children=[new ho(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var i=a.lines.length%25+25,s=i;s10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n0||0==i&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=T("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Ie(e,t.line,t,r,o)||t.line!=r.line&&Ie(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ee=!0}o.addToHistory&&La(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,u=t.line,l=e.cm;if(e.iter(u,r.line+1,function(e){l&&o.collapsed&&!l.options.lineWrapping&&ze(e)==l.display.maxLine&&(s=!0),o.collapsed&&u!=t.line&&ce(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Oe(o,u==t.line?t.ch:null,u==r.line?r.ch:null)),++u}),o.collapsed&&e.iter(t.line,r.line+1,function(t){$e(e,t)&&ce(t,0)}),o.clearOnEnter&&Xe(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),l){if(s&&(l.curOp.updateMaxLine=!0),o.collapsed)Yn(l,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)Qn(l,c,"text");o.atomic&&Ya(l.doc),ir(l,"markerAdded",l,o)}return o}bo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&zn(e),ot(this,"clear")){var r=this.find();r&&ir(this,"clear",r.from,r.to)}for(var n=null,a=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Yn(e,n,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ya(e.doc)),e&&ir(e,"markerCleared",e,this,n,a),t&&Bn(e),this.parent&&this.parent.clear()}},bo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var a=0;a=0;u--)no(this,n[u]);s?Va(this,s):this.cm&&En(this.cm)}),undo:Gn(function(){oo(this,"undo")}),redo:Gn(function(){oo(this,"redo")}),undoSelection:Gn(function(){oo(this,"undo",!0)}),redoSelection:Gn(function(){oo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,r){e=_e(this,e),t=_e(this,t);var n=[],a=e.line;return this.iter(e.line,t.line+1,function(o){var i=o.markedSpans;if(i)for(var s=0;s=u.to||null==u.from&&a!=e.line||null!=u.from&&a==t.line&&u.from>=t.ch||r&&!r(u.marker)||n.push(u.marker.parent||u.marker)}++a}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=o,++r}),_e(this,me(r,t))},indexFromPos:function(e){var t=(e=_e(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Ja(t.doc,ba(r,r)),f)for(var d=0;d=0;t--)uo(e.doc,"",n[t].from,n[t].to,"+delete");En(e)})}function Vo(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ko(e,t,r){var n=Vo(e,t.ch,r);return null==n?null:new me(t.line,n,r<0?"after":"before")}function Jo(e,t,r,n,a){if(e){var o=Qe(r,t.doc.direction);if(o){var i,s=a<0?G(o):o[0],u=a<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var l=Tr(t,r);i=a<0?r.text.length-1:0;var c=Ar(t,l,i).top;i=ie(function(e){return Ar(t,l,e).top==c},a<0==(1==s.level)?s.from:s.to-1,i),"before"==u&&(i=Vo(r,i,1))}else i=a<0?s.to:s.from;return new me(n,i,u)}}return new me(n,a<0?r.text.length:0,a<0?"before":"after")}qo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},qo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},qo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},qo.default=y?qo.macDefault:qo.pcDefault;var Go={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),$)},killLine:function(e){return Wo(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)a=new me(a.line,a.ch+1),e.replaceRange(o.charAt(a.ch-1)+o.charAt(a.ch-2),me(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var i=se(e.doc,a.line-1).text;i&&(a=new me(a.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+i.charAt(i.length-1),me(a.line-1,i.length-1),a,"+transpose"))}r.push(new ga(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return Vn(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n-1&&(ve((a=l.ranges[a]).from(),t)<0||t.xRel>0)&&(ve(a.to(),t)>0||t.xRel<0)?function(e,t,r,n){var a=e.display,o=!1,l=Kn(e,function(t){u&&(a.scroller.draggable=!1),e.state.draggingText=!1,tt(document,"mouseup",l),tt(document,"mousemove",c),tt(a.scroller,"dragstart",f),tt(a.scroller,"drop",l),o||(st(t),n.addNew||Ua(e.doc,r,null,null,n.extend),u||i&&9==s?setTimeout(function(){document.body.focus(),a.input.focus()},20):a.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};u&&(a.scroller.draggable=!0);e.state.draggingText=l,l.copy=!n.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop();Xe(document,"mouseup",l),Xe(document,"mousemove",c),Xe(a.scroller,"dragstart",f),Xe(a.scroller,"drop",l),mn(e),setTimeout(function(){return a.input.focus()},20)}(e,n,t,o):function(e,t,r,n){var a=e.display,o=e.doc;st(t);var i,s,u=o.sel,l=u.ranges;n.addNew&&!n.extend?(s=o.sel.contains(r),i=s>-1?l[s]:new ga(r,r)):(i=o.sel.primary(),s=o.sel.primIndex);if("rectangle"==n.unit)n.addNew||(i=new ga(r,r)),r=on(e,t,!0,!0),s=-1;else{var c=ci(e,r,n.unit);i=n.extend?Ba(i,c.anchor,c.head,n.extend):c}n.addNew?-1==s?(s=l.length,Ka(o,ya(l.concat([i]),s),{scroll:!1,origin:"*mouse"})):l.length>1&&l[s].empty()&&"char"==n.unit&&!n.extend?(Ka(o,ya(l.slice(0,s).concat(l.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Ha(o,s,i,H):(s=0,Ka(o,new va([i],0),H),u=o.sel);var f=r;function d(t){if(0!=ve(f,t))if(f=t,"rectangle"==n.unit){for(var a=[],l=e.options.tabSize,c=F(se(o,r.line).text,r.ch,l),d=F(se(o,t.line).text,t.ch,l),p=Math.min(c,d),h=Math.max(c,d),m=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));m<=v;m++){var g=se(o,m).text,y=V(g,p,l);p==h?a.push(new ga(me(m,y),me(m,y))):g.length>y&&a.push(new ga(me(m,y),me(m,V(g,h,l))))}a.length||a.push(new ga(r,r)),Ka(o,ya(u.ranges.slice(0,s).concat(a),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=i,x=ci(e,t,n.unit),_=w.anchor;ve(x.anchor,_)>0?(b=x.head,_=we(w.from(),x.anchor)):(b=x.anchor,_=be(w.to(),x.head));var k=u.ranges.slice(0);k[s]=function(e,t){var r=t.anchor,n=t.head,a=se(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Qe(a);if(!o)return t;var i=Ge(o,r.ch,r.sticky),s=o[i];if(s.from!=r.ch&&s.to!=r.ch)return t;var u,l=i+(s.from==r.ch==(1!=s.level)?0:1);if(0==l||l==o.length)return t;if(n.line!=r.line)u=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=Ge(o,n.ch,n.sticky),f=c-i||(n.ch-r.ch)*(1==s.level?-1:1);u=c==l-1||c==l?f<0:f>0}var d=o[l+(u?-1:0)],p=u==(1==d.level),h=p?d.from:d.to,m=p?"after":"before";return r.ch==h&&r.sticky==m?t:new ga(new me(r.line,h,m),n)}(e,new ga(_e(o,_),b)),Ka(o,ya(k,s),H)}}var p=a.wrapper.getBoundingClientRect(),h=0;function m(t){e.state.selectingText=!1,h=1/0,st(t),a.input.focus(),tt(document,"mousemove",v),tt(document,"mouseup",g),o.history.lastSelOrigin=null}var v=Kn(e,function(t){dt(t)?function t(r){var i=++h;var s=on(e,r,!0,"rectangle"==n.unit);if(!s)return;if(0!=ve(s,f)){e.curOp.focus=R(),d(s);var u=wn(a,o);(s.line>=u.to||s.linep.bottom?20:0;l&&setTimeout(Kn(e,function(){h==i&&(a.scroller.scrollTop+=l,t(r))}),50)}}(t):m(t)}),g=Kn(e,m);e.state.selectingText=g,Xe(document,"mousemove",v),Xe(document,"mouseup",g)}(e,n,t,o)}(t,n,o,e):ft(e)==r.scroller&&st(e):2==a?(n&&Ua(t.doc,n),setTimeout(function(){return r.input.focus()},20)):3==a&&(k?pi(t,e):mn(t)))}}function ci(e,t,r){if("char"==r)return new ga(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new ga(me(t.line,0),_e(e.doc,me(t.line+1,0)));var n=r(e,t);return new ga(n.from,n.to)}function fi(e,t,r,n){var a,o;if(t.touches)a=t.touches[0].clientX,o=t.touches[0].clientY;else try{a=t.clientX,o=t.clientY}catch(t){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&st(t);var i=e.display,s=i.lineDiv.getBoundingClientRect();if(o>s.bottom||!ot(e,r))return lt(t);o-=s.top-i.viewOffset;for(var u=0;u=a)return rt(e,r,e,de(e.doc,o),e.options.gutters[u],t),lt(t)}}function di(e,t){return fi(e,t,"gutterClick",!0)}function pi(e,t){wr(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return fi(e,t,"gutterContextMenu",!1)}(e,t)||nt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function hi(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Fr(e)}ui.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var mi={toString:function(){return"CodeMirror.Init"}},vi={},gi={};function yi(e){la(e),Yn(e),xn(e)}function bi(e,t,r){if(!t!=!(r&&r!=mi)){var n=e.display.dragFunctions,a=t?Xe:tt;a(e.display.scroller,"dragstart",n.start),a(e.display.scroller,"dragenter",n.enter),a(e.display.scroller,"dragover",n.over),a(e.display.scroller,"dragleave",n.leave),a(e.display.scroller,"drop",n.drop)}}function wi(e){e.options.lineWrapping?(M(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(O(e.display.wrapper,"CodeMirror-wrap"),Ke(e)),an(e),Yn(e),Fr(e),setTimeout(function(){return Dn(e)},100)}function xi(e,t){var n=this;if(!(this instanceof xi))return new xi(e,t);this.options=t=t?q(t):{},q(vi,t,!1),ca(t);var a=t.value;"string"==typeof a&&(a=new Eo(a,t.mode,null,t.lineSeparator,t.direction)),this.doc=a;var o=new xi.inputStyles[t.inputStyle](this),l=this.display=new function(e,t,n){var a=this;this.input=n,a.scrollbarFiller=j("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=j("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=T("div",null,"CodeMirror-code"),a.selectionDiv=j("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=j("div",null,"CodeMirror-cursors"),a.measure=j("div",null,"CodeMirror-measure"),a.lineMeasure=j("div",null,"CodeMirror-measure"),a.lineSpace=T("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var o=T("div",[a.lineSpace],"CodeMirror-lines");a.mover=j("div",[o],null,"position: relative"),a.sizer=j("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=j("div",null,null,"position: absolute; height: "+B+"px; width: 1px;"),a.gutters=j("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=j("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=j("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),i&&s<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),u||r&&g||(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,n.init(a)}(e,a,o);for(var c in l.wrapper.CodeMirror=this,la(this),hi(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Fn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new I,keySeq:null,specialChars:null},t.autofocus&&!g&&l.input.focus(),i&&s<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;Xe(t.scroller,"mousedown",Kn(e,li)),Xe(t.scroller,"dblclick",i&&s<11?Kn(e,function(t){if(!nt(e,t)){var r=on(e,t);if(r&&!di(e,t)&&!wr(e.display,t)){st(t);var n=e.findWordAt(r);Ua(e.doc,n.anchor,n.head)}}}):function(t){return nt(e,t)||st(t)});k||Xe(t.scroller,"contextmenu",function(t){return pi(e,t)});var r,n={end:0};function a(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Xe(t.scroller,"touchstart",function(a){if(!nt(e,a)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(a)&&!di(e,a)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==a.touches.length&&(t.activeTouch.left=a.touches[0].pageX,t.activeTouch.top=a.touches[0].pageY)}}),Xe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Xe(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!wr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var i,s=e.coordsChar(t.activeTouch,"page");i=!n.prev||o(n,n.prev)?new ga(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new ga(me(s.line,0),_e(e.doc,me(s.line+1,0))),e.setSelection(i.anchor,i.head),e.focus(),st(r)}a()}),Xe(t.scroller,"touchcancel",a),Xe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(jn(e,t.scroller.scrollTop),An(e,t.scroller.scrollLeft,!0),rt(e,"scroll",e))}),Xe(t.scroller,"mousewheel",function(t){return ma(e,t)}),Xe(t.scroller,"DOMMouseScroll",function(t){return ma(e,t)}),Xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){nt(e,t)||ct(t)},over:function(t){nt(e,t)||(!function(e,t){var r=on(e,t);if(r){var n=document.createDocumentFragment();cn(e,r,n),e.display.dragCursor||(e.display.dragCursor=j("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),C(e.display.dragCursor,n)}}(e,t),ct(t))},start:function(t){return function(e,t){if(i&&(!e.state.draggingText||+new Date-Oo<100))ct(t);else if(!nt(e,t)&&!wr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var r=j("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),f&&r.parentNode.removeChild(r)}}(e,t)},drop:Kn(e,Po),leave:function(t){nt(e,t)||Co(e)}};var u=t.input.getField();Xe(u,"keyup",function(t){return ai.call(e,t)}),Xe(u,"keydown",Kn(e,ni)),Xe(u,"keypress",Kn(e,oi)),Xe(u,"focus",function(t){return vn(e,t)}),Xe(u,"blur",function(t){return gn(e,t)})}(this),Ao(),zn(this),this.curOp.forceUpdate=!0,ja(this,a),t.autofocus&&!g||this.hasFocus()?setTimeout(N(vn,this),20):gn(this),gi)gi.hasOwnProperty(c)&&gi[c](n,t[c],mi);_n(this),t.finishInit&&t.finishInit(this);for(var p=0;p<_i.length;++p)_i[p](n);Bn(this),u&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}xi.defaults=vi,xi.optionHandlers=gi;var _i=[];function ki(e,t,r,n){var a,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?a=qt(e,t).state:r="prev");var i=e.options.tabSize,s=se(o,t),u=F(s.text,null,i);s.stateAfter&&(s.stateAfter=null);var l,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((l=o.mode.indent(a,s.text.slice(c.length),s.text))==U||l>150)){if(!n)return;r="prev"}}else l=0,r="not";"prev"==r?l=t>o.first?F(se(o,t-1).text,null,i):0:"add"==r?l=u+e.options.indentUnit:"subtract"==r?l=u-e.options.indentUnit:"number"==typeof r&&(l=u+r),l=Math.max(0,l);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/i);p;--p)d+=i,f+="\t";if(d1)if(Si&&Si.text.join("\n")==t){if(n.ranges.length%Si.text.length==0){l=[];for(var c=0;c=0;f--){var d=n.ranges[f],p=d.from(),h=d.to();d.empty()&&(r&&r>0?p=me(p.line,p.ch-r):e.state.overwrite&&!s?h=me(h.line,Math.min(se(o,h.line).text.length,h.ch+G(u).length)):Si&&Si.lineWise&&Si.text.join("\n")==t&&(p=h=me(p.line,0))),i=e.curOp.updateInput;var m={from:p,to:h,text:l?l[f%l.length]:u,origin:a||(s?"paste":e.state.cutIncoming?"cut":"+input")};no(e.doc,m),ir(e,"inputRead",e,m)}t&&!s&&Ci(e,t),En(e),e.curOp.updateInput=i,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Pi(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Vn(t,function(){return Oi(t,r,0,null,"paste")}),!0}function Ci(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var a=r.ranges[n];if(!(a.head.ch>100||n&&r.ranges[n-1].head.line==a.head.line)){var o=e.getModeAt(a.head),i=!1;if(o.electricChars){for(var s=0;s-1){i=ki(e,a.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,a.head.line).text.slice(0,a.head.ch))&&(i=ki(e,a.head.line,"smart"));i&&ir(e,"electricInput",e,a.head.line)}}}function ji(e){for(var t=[],r=[],n=0;n=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=Ge(a,r.ch,r.sticky),i=a[o];if("ltr"==e.doc.direction&&i.level%2==0&&(n>0?i.to>r.ch:i.from=i.from&&d>=c.begin)){var p=f?"before":"after";return new me(r.line,d,p)}}var h=function(e,t,n){for(var o=function(e,t){return t?new me(r.line,u(e,1),"before"):new me(r.line,e,"after")};e>=0&&e0==(1!=i.level),l=s?n.begin:u(n.end,-1);if(i.from<=l&&l0?c.end:u(c.begin,-1);return null==v||n>0&&v==t.text.length||!(m=h(n>0?0:a.length-1,n,l(v)))?null:m}(e.cm,s,t,r):Ko(s,t,r))){if(n||(i=t.line+r)=e.first+e.size||(t=new me(i,t.ch,t.sticky),!(s=se(e,i))))return!1;t=Jo(a,e.cm,s,t.line,r)}else t=o;return!0}if("char"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var l=null,c="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(r<0)||u(!d);d=!1){var p=s.text.charAt(t.ch)||"\n",h=te(p,f)?"w":c&&"\n"==p?"n":!c||/\s/.test(p)?null:"p";if(!c||d||h||(h="s"),l&&l!=h){r<0&&(r=1,u(),t.sticky="after");break}if(h&&(l=h),r>0&&!u(!d))break}var m=Xa(e,t,o,i,!0);return ge(o,m)&&(m.hitSide=!0),m}function Mi(e,t,r,n){var a,o,i=e.doc,s=t.left;if("page"==n){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(u-.5*Xr(e.display),3);a=(r>0?t.bottom:t.top)+r*l}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);for(;(o=Jr(e,s,a)).outside;){if(r<0?a<=0:a>=i.height){o.hitSide=!0;break}a+=5*r}return o}var Li=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new I,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Di(e,t){var r=jr(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),a=Pr(r,n,t.line),o=Qe(n,e.doc.direction),i="left";o&&(i=Ge(o,t.ch)%2?"right":"left");var s=Lr(a.map,t.ch,i);return s.offset="right"==s.collapse?s.end:s.start,s}function Ni(e,t){return t&&(e.bad=!0),e}function qi(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Ni(e.clipPos(me(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var a=0;a=t.display.viewTo||o.line=t.display.viewFrom&&Di(t,a)||{node:u[0].measure.map[2],offset:0},c=o.linen.firstLine()&&(i=me(i.line-1,se(n.doc,i.line-1).length)),s.ch==se(n.doc,s.line).text.length&&s.linea.viewTo-1)return!1;i.line==a.viewFrom||0==(e=sn(n,i.line))?(t=fe(a.view[0].line),r=a.view[0].node):(t=fe(a.view[e].line),r=a.view[e-1].node.nextSibling);var u,l,c=sn(n,s.line);if(c==a.view.length-1?(u=a.viewTo-1,l=a.lineDiv.lastChild):(u=fe(a.view[c+1].line)-1,l=a.view[c+1].node.previousSibling),!r)return!1;for(var f=n.doc.splitLines(function(e,t,r,n,a){var o="",i=!1,s=e.doc.lineSeparator();function u(){i&&(o+=s,i=!1)}function l(e){e&&(u(),o+=e)}function c(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void l(r||t.textContent.replace(/\u200b/g,""));var o,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(me(n,0),me(a+1,0),(m=+f,function(e){return e.id==m}));return void(d.length&&(o=d[0].find(0))&&l(ue(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p)$/i.test(t.nodeName);p&&u();for(var h=0;h1&&d.length>1;)if(G(f)==G(d))f.pop(),d.pop(),u--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}for(var p=0,h=0,m=f[0],v=d[0],g=Math.min(m.length,v.length);pi.ch&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)p--,h++;f[f.length-1]=y.slice(0,y.length-h).replace(/^\u200b+/,""),f[0]=f[0].slice(p).replace(/\u200b+$/,"");var x=me(t,p),_=me(u,d.length?G(d).length-h:0);return f.length>1||f[0]||ve(x,_)?(uo(n.doc,f,x,_,"+input"),!0):void 0},Li.prototype.ensurePolled=function(){this.forceCompositionEnd()},Li.prototype.reset=function(){this.forceCompositionEnd()},Li.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Li.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Li.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Vn(this.cm,function(){return Yn(e.cm)})},Li.prototype.setUneditable=function(e){e.contentEditable="false"},Li.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||Kn(this.cm,Oi)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Li.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Li.prototype.onContextMenu=function(){},Li.prototype.resetPosition=function(){},Li.prototype.needsContentAttribute=!0;var Ii=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new I,this.hasSelection=!1,this.composing=null};Ii.prototype.init=function(e){var t=this,r=this,n=this.cm,a=this.wrapper=Ai(),o=this.textarea=a.firstChild;function u(e){if(!nt(n,e)){if(n.somethingSelected())Ei({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=ji(n);Ei({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,$):(r.prevInput="",o.value=t.text.join("\n"),D(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}e.wrapper.insertBefore(a,e.wrapper.firstChild),m&&(o.style.width="0px"),Xe(o,"input",function(){i&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Xe(o,"paste",function(e){nt(n,e)||Pi(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Xe(o,"cut",u),Xe(o,"copy",u),Xe(e.scroller,"paste",function(t){wr(e,t)||nt(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Xe(e.lineSpace,"selectstart",function(t){wr(e,t)||st(t)}),Xe(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Xe(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=ln(e);if(e.options.moveInputWithCursor){var a=Wr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),i=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+i.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+i.left-o.left))}return n},Ii.prototype.showSelection=function(e){var t=this.cm.display;C(t.cursorDiv,e.cursors),C(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ii.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&D(this.textarea),i&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",i&&s>=9&&(this.hasSelection=null))}},Ii.prototype.getField=function(){return this.textarea},Ii.prototype.supportsTouch=function(){return!1},Ii.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ii.prototype.blur=function(){this.textarea.blur()},Ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ii.prototype.receivedFocus=function(){this.slowPoll()},Ii.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},Ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==n&&!t.somethingSelected())return!1;if(i&&s>=9&&this.hasSelection===a||y&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=a.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var u=0,l=Math.min(n.length,a.length);u1e3||a.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ii.prototype.onKeyPress=function(){i&&s>=9&&(this.hasSelection=null),this.fastPoll()},Ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,a=t.textarea,o=on(r,e),l=n.scroller.scrollTop;if(o&&!f){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&Kn(r,Ka)(r.doc,ba(o),$);var c=a.style.cssText,d=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var p,h=t.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-h.top-5)+"px; left: "+(e.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(i?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",u&&(p=window.scrollY),n.input.focus(),u&&window.scrollTo(null,p),n.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),i&&s>=9&&v(),k){ct(e);var m=function(){tt(window,"mouseup",m),setTimeout(g,20)};Xe(window,"mouseup",m)}else setTimeout(g,50)}function v(){if(null!=a.selectionStart){var e=r.somethingSelected(),o="​"+(e?a.value:"");a.value="⇚",a.value=o,t.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function g(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=d,a.style.cssText=c,i&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=l),null!=a.selectionStart){(!i||i&&s<9)&&v();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==t.prevInput?Kn(r,to)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},Ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ii.prototype.setUneditable=function(){},Ii.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,a,o){e.defaults[r]=n,a&&(t[r]=o?function(e,t,r){r!=mi&&a(e,t,r)}:a)}e.defineOption=r,e.Init=mi,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,Sa(e)},!0),r("indentUnit",2,Sa,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){Ea(e),Fr(e),Yn(e)},!0),r("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var a=0;;){var o=e.text.indexOf(t,a);if(-1==o)break;a=o+t.length,r.push(me(n,o))}n++});for(var a=r.length-1;a>=0;a--)uo(e.doc,t,r[a],me(r[a].line,r[a].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=mi&&e.refresh()}),r("specialCharPlaceholder",Qt,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",g?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){hi(e),yi(e)},!0),r("keyMap","default",function(e,t,r){var n=Ho(t),a=r!=mi&&Ho(r);a&&a.detach&&a.detach(e,n),n.attach&&n.attach(e,a||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,wi,!0),r("gutters",[],function(e){ca(e.options),yi(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rn(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return Dn(e)},!0),r("scrollbarStyle","native",function(e){Fn(e),Dn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e){ca(e.options),yi(e)},!0),r("firstLineNumber",1,yi,!0),r("lineNumberFormatter",function(e){return e},yi,!0),r("showCursorWhenSelecting",!1,un,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,bi),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,un,!0),r("singleCursorHeightPerLine",!0,un,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Ea,!0),r("addModeClass",!1,Ea,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,Ea,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(xi),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,a=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&Kn(this,t[e])(this,r,a),rt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ho(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(ki(this,a.head.line,e,!0),r=a.head.line,n==this.doc.sel.primIndex&&En(this));else{var o=a.from(),i=a.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),i.line-(i.ch?0:1))+1;for(var u=s;u0&&Ha(this.doc,n,new ga(o,l[n].to()),$)}}}),getTokenAt:function(e,t){return Ut(this,e,t)},getLineTokens:function(e,t){return Ut(this,me(e),t,!0)},getTokenTypeAt:function(e){e=_e(this.doc,e);var t,r=Nt(this,se(this.doc,e.line)),n=0,a=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var i=n+a>>1;if((i?r[2*i-1]:0)>=o)a=i;else{if(!(r[2*i+1]o&&(e=o,a=!0),n=se(this.doc,e)}else n=e;return Ur(this,n,{top:0,left:0},t||"page",r||a).top+(a?this.doc.height-We(n):0)},defaultTextHeight:function(){return Xr(this.display)},defaultCharWidth:function(){return en(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,a){var o,i,s,u=this.display,l=(e=Wr(this,_e(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),u.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var f=Math.max(u.wrapper.clientHeight,this.doc.height),d=Math.max(u.sizer.clientWidth,u.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(l=e.bottom),c+t.offsetWidth>d&&(c=d-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==a?(c=u.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==a?c=0:"middle"==a&&(c=(u.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,i={left:c,top:l,right:c+t.offsetWidth,bottom:l+t.offsetHeight},null!=(s=kn(o,i)).scrollTop&&jn(o,s.scrollTop),null!=s.scrollLeft&&An(o,s.scrollLeft))},triggerOnKeyDown:Jn(ni),triggerOnKeyPress:Jn(oi),triggerOnKeyUp:ai,triggerOnMouseDown:Jn(li),execCommand:function(e){if(Go.hasOwnProperty(e))return Go[e].call(null,this)},triggerElectric:Jn(function(e){Ci(this,e)}),findPosH:function(e,t,r,n){var a=1;t<0&&(a=-1,t=-t);for(var o=_e(this.doc,e),i=0;i0&&i(t.charAt(r-1));)--r;for(;n.5)&&an(this),rt(this,"refresh",this)}),swapDoc:Jn(function(e){var t=this.doc;return t.cm=null,ja(this,e),Fr(this),this.display.input.reset(),On(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ir(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},it(e),e.registerHelper=function(t,n,a){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=a},e.registerGlobalHelper=function(t,n,a,o){e.registerHelper(t,n,o),r[t]._global.push({pred:a,val:o})}}(xi);var zi,Bi="iter insert remove copy getEditor constructor".split(" ");for(var Ui in Eo.prototype)Eo.prototype.hasOwnProperty(Ui)&&z(Bi,Ui)<0&&(xi.prototype[Ui]=function(e){return function(){return e.apply(this.doc,arguments)}}(Eo.prototype[Ui]));return it(Eo),xi.inputStyles={textarea:Ii,contenteditable:Li},xi.defineMode=function(e){xi.defaults.mode||"null"==e||(xi.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}.apply(this,arguments)},xi.defineMIME=function(e,t){St[e]=t},xi.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),xi.defineMIME("text/plain","null"),xi.defineExtension=function(e,t){xi.prototype[e]=t},xi.defineDocExtension=function(e,t){Eo.prototype[e]=t},xi.fromTextArea=function(e,t){if((t=t?q(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=R();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var a;if(e.form&&(Xe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;a=o.submit;try{var i=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=i}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=a))}},e.style.display="none";var s=xi(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},(zi=xi).off=tt,zi.on=Xe,zi.wheelEventPixels=ha,zi.Doc=Eo,zi.splitLines=bt,zi.countColumn=F,zi.findColumn=V,zi.isWordChar=ee,zi.Pass=U,zi.signal=rt,zi.Line=Wt,zi.changeEnd=wa,zi.scrollbarModel=qn,zi.Pos=me,zi.cmpPos=ve,zi.modes=kt,zi.mimeModes=St,zi.resolveMode=Et,zi.getMode=Ot,zi.modeExtensions=Pt,zi.extendMode=Ct,zi.copyState=jt,zi.startState=At,zi.innerMode=Tt,zi.commands=Go,zi.keyMap=qo,zi.keyName=$o,zi.isModifierKey=Bo,zi.lookupKey=zo,zi.normalizeKeyMap=Io,zi.StringStream=Rt,zi.SharedTextMarker=xo,zi.TextMarker=bo,zi.LineWidget=vo,zi.e_preventDefault=st,zi.e_stopPropagation=ut,zi.e_stop=ct,zi.addClass=M,zi.contains=A,zi.rmClass=O,zi.keyNames=Mo,xi.version="5.31.0",xi},e.exports=n()},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports={EXPLORER_ENABLED:"x-explorer-enabled",SAMPLES_ENABLED:"x-samples-enabled",SAMPLES_LANGUAGES:"x-samples-languages",PROXY_ENABLED:"x-proxy-enabled",HEADERS:"x-headers",SEND_DEFAULTS:"x-send-defaults"},e.exports.defaults={"x-explorer-enabled":!0,"x-samples-enabled":!0,"x-samples-languages":["curl","node","ruby","javascript","python"],"x-proxy-enabled":!0,"x-headers":void 0,"x-send-defaults":!1}},function(e,t,r){var n=r(15),a=r(103),o=r(66),i=Object.defineProperty;t.f=r(16)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),a)try{return i(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){var n=r(14);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(24)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var r,n,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,l=[],c=!1,f=-1;function d(){c&&u&&(c=!1,u.length?l=u.concat(l):f=-1,l.length&&p())}function p(){if(!c){var e=s(d);c=!0;for(var t=l.length;t;){for(u=l,l=[];++f1)for(var r=1;r=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}},function(e,t,r){"use strict";function n(e,t,r){var n=r?" !== ":" === ",a=r?" || ":" && ",o=r?"!":"",i=r?"":"!";switch(e){case"null":return t+n+"null";case"array":return o+"Array.isArray("+t+")";case"object":return"("+o+t+a+"typeof "+t+n+'"object"'+a+i+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+n+'"number"'+a+i+"("+t+" % 1)"+a+t+n+t+")";default:return"typeof "+t+n+'"'+e+'"'}}e.exports={copy:function(e,t){for(var r in t=t||{},e)t[r]=e[r];return t},checkDataType:n,checkDataTypes:function(e,t){switch(e.length){case 1:return n(e[0],t,!0);default:var r="",a=o(e);for(var i in a.array&&a.object&&(r=a.null?"(":"(!"+t+" || ",r+="typeof "+t+' !== "object")',delete a.null,delete a.array,delete a.object),a.number&&delete a.integer,a)r+=(r?" && ":"")+n(i,t,!0);return r}},coerceToTypes:function(e,t){if(Array.isArray(t)){for(var r=[],n=0;n=t)throw new Error("Cannot access property/index "+n+" levels up, current level is "+t);return r[t-n]}if(n>t)throw new Error("Cannot access data "+n+" levels up, current level is "+t);if(o="data"+(t-n||""),!a)return o}for(var s=o,l=a.split("/"),c=0;c":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'/]/g,function(e){return t[e]})}(e):'').concat(n(e,t),"")},e.exports.uppercase=r(333)},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";(function(e){var n=r(177),a=r(178),o=r(96);function i(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,a);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,a){var o,i=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i=2,s/=2,u/=2,r/=2}function l(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(a){var c=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var f=!0,d=0;da&&(n=a):n=a;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var i=0;i>8,a=r%256,o.push(a),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],a=t;a239?4:l>223?3:l>191?2:1;if(a+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[a+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[a+1],i=e[a+2],128==(192&o)&&128==(192&i)&&(u=(15&l)<<12|(63&o)<<6|63&i)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[a+1],i=e[a+2],s=e[a+3],128==(192&o)&&128==(192&i)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&i)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),a+=f}return function(e){var t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,a){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,i=r-t,s=Math.min(o,i),l=this.slice(n,a),c=e.slice(t,r),f=0;fa)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var a=t;an)&&(r=n);for(var a="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,a,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function M(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,o=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,o=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function D(e,t,r,n,a,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return o||D(e,0,r,4),a.write(e,t,r,n,23,4),r+4}function q(e,t,r,n,o){return o||D(e,0,r,8),a.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(a*=256);)n+=this[e+--t]*a;return n},u.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],a=1,o=0;++o=(a*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=t,a=1,o=this[e+--n];n>0&&(a*=256);)o+=this[e+--n]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),a.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),a.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),a.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),a.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+a]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);R(this,e,t,r,a-1,-a)}var o=0,i=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);R(this,e,t,r,a-1,-a)}var o=r-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return q(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return q(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&o.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}}).call(t,r(11))},function(e,t,r){var n=r(99),a=r(64);e.exports=Object.keys||function(e){return n(e,a)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,r){var n=r(61),a=Math.min;e.exports=function(e){return e>0?a(n(e),9007199254740991):0}},function(e,t){e.exports=!0},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){"use strict";var n=r(209)(!0);r(69)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports={}},function(e,t,r){var n=r(13).f,a=r(23),o=r(8)("toStringTag");e.exports=function(e,t,r){e&&!a(e=r?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},function(e,t,r){var n=r(19),a=r(114),o=r(115),i=r(15),s=r(40),u=r(78),l={},c={};(t=e.exports=function(e,t,r,f,d){var p,h,m,v,g=d?function(){return e}:u(e),y=n(r,f,t?2:1),b=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(p=s(e.length);p>b;b++)if((v=t?y(i(h=e[b])[0],h[1]):y(e[b]))===l||v===c)return v}else for(m=g.call(e);!(h=m.next()).done;)if((v=a(m,y,h.value,t))===l||v===c)return v}).BREAK=l,t.RETURN=c},function(e,t,r){"use strict";t.__esModule=!0;var n,a=r(106),o=(n=a)&&n.__esModule?n:{default:n};t.default=function(e,t,r){return t in e?(0,o.default)(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){var n=r(146),a=r(322).emoji,o=r(35),i=r(334),s=r(335),u=new a;e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.setOptions({sanitize:!0,preserveNumbering:!0,renderer:s,emoji:function(e){var t=e.replace(/[^-_+a-zA-Z0-9]/g,"").toLowerCase();return"fa-"===t.substr(0,3)?''):u.is(t)?':').concat(t,'+:'):":".concat(t,":")},highlight:function(e,t){if(t)return o(e,t)},gfm:!0,breaks:!t.correctnewlines,sanitizer:t.stripHtml?void 0:i}),n(e)}},function(e,t,r){e.exports=a;var n=r(86).EventEmitter;function a(){n.call(this)}r(36)(a,n),a.Readable=r(87),a.Writable=r(359),a.Duplex=r(360),a.Transform=r(361),a.PassThrough=r(362),a.Stream=a,a.prototype.pipe=function(e,t){var r=this;function a(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",a),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var i=!1;function s(){i||(i=!0,e.end())}function u(){i||(i=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",a),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",l),e.on("error",l),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(t,r(37).Buffer)},function(e,t,r){"use strict";t.decode=t.parse=r(173),t.encode=t.stringify=r(174)},function(e,t){var r=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+n).toString(36))}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var n=r(15),a=r(211),o=r(64),i=r(62)("IE_PROTO"),s=function(){},u=function(){var e,t=r(65)("iframe"),n=o.length;for(t.style.display="none",r(108).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("