text: var Formwork=function(){"use strict";var e,t,v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={exports:{}};t=v,k=function(){var p,u,d,m,i,o,a,s,l,n,r,c,e,f,t={version:"0.11.4"};function h(e,t,n,i,r,o){o=s.extend({command:r?e.toLowerCase():e.toUpperCase()},t,o?{data:o}:{});n.splice(i,0,o)}function g(r,o){r.forEach(function(n,i){l[n.command.toLowerCase()].forEach(function(e,t){o(n,e,i,t,r)})})}return p=t,u=(e=this||v).window,d=e.document,p.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},p.noop=function(e){return e},p.alphaNumerate=function(e){return String.fromCharCode(97+e%26)},p.extend=function(e){var t,n,i;for(e=e||{},t=1;t<arguments.length;t++)for(var r in n=arguments[t])"object"!=typeof(i=n[r])||null===i||i instanceof Array?e[r]=i:e[r]=p.extend(e[r],i);return e},p.replaceAll=function(e,t,n){return e.replace(new RegExp(t,"g"),n)},p.ensureUnit=function(e,t){return"number"==typeof e&&(e+=t),e},p.quantity=function(e){if("string"!=typeof e)return{value:e};e=/^(\d+)\s*(.*)$/g.exec(e);return{value:+e[1],unit:e[2]||void 0}},p.querySelector=function(e){return e instanceof Node?e:d.querySelector(e)},p.times=function(e){return Array.apply(null,new Array(e))},p.sum=function(e,t){return e+(t||0)},p.mapMultiply=function(t){return function(e){return e*t}},p.mapAdd=function(t){return function(e){return e+t}},p.serialMap=function(i,r){var o=[],e=Math.max.apply(null,i.map(function(e){return e.length}));return p.times(e).forEach(function(e,t){var n=i.map(function(e){return e[t]});o[t]=r.apply(null,n)}),o},p.roundWithPrecision=function(e,t){t=Math.pow(10,t||p.precision);return Math.round(e*t)/t},p.precision=8,p.escapingMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"},p.serialize=function(e){return null==e?e:("number"==typeof e?e=""+e:"object"==typeof e&&(e=JSON.stringify({data:e})),Object.keys(p.escapingMap).reduce(function(e,t){return p.replaceAll(e,t,p.escapingMap[t])},e))},p.deserialize=function(e){if("string"!=typeof e)return e;e=Object.keys(p.escapingMap).reduce(function(e,t){return p.replaceAll(e,p.escapingMap[t],t)},e);try{e=void 0!==(e=JSON.parse(e)).data?e.data:e}catch(e){}return e},p.createSvg=function(t,e,n,i){return e=e||"100%",n=n||"100%",Array.prototype.slice.call(t.querySelectorAll("svg")).filter(function(e){return e.getAttributeNS(p.namespaces.xmlns,"ct")}).forEach(function(e){t.removeChild(e)}),(i=new p.Svg("svg").attr({width:e,height:n}).addClass(i))._node.style.width=e,i._node.style.height=n,t.appendChild(i._node),i},p.normalizeData=function(e,t,n){var i={raw:e,normalized:{}};return i.normalized.series=p.getDataArray({series:e.series||[]},t,n),n=i.normalized.series.every(function(e){return e instanceof Array})?Math.max.apply(null,i.normalized.series.map(function(e){return e.length})):i.normalized.series.length,i.normalized.labels=(e.labels||[]).slice(),Array.prototype.push.apply(i.normalized.labels,p.times(Math.max(0,n-i.normalized.labels.length)).map(function(){return""})),t&&p.reverseData(i.normalized),i},p.safeHasProperty=function(e,t){return null!==e&&"object"==typeof e&&e.hasOwnProperty(t)},p.isDataHoleValue=function(e){return null==e||"number"==typeof e&&isNaN(e)},p.reverseData=function(e){e.labels.reverse(),e.series.reverse();for(var t=0;t<e.series.length;t++)"object"==typeof e.series[t]&&void 0!==e.series[t].data?e.series[t].data.reverse():e.series[t]instanceof Array&&e.series[t].reverse()},p.getDataArray=function(e,t,i){return e.series.map(function e(t){if(p.safeHasProperty(t,"value"))return e(t.value);if(p.safeHasProperty(t,"data"))return e(t.data);if(t instanceof Array)return t.map(e);if(!p.isDataHoleValue(t)){if(i){var n={};return"string"==typeof i?n[i]=p.getNumberOrUndefined(t):n.y=p.getNumberOrUndefined(t),n.x=t.hasOwnProperty("x")?p.getNumberOrUndefined(t.x):n.x,n.y=t.hasOwnProperty("y")?p.getNumberOrUndefined(t.y):n.y,n}return p.getNumberOrUndefined(t)}})},p.normalizePadding=function(e,t){return t=t||0,"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:"number"==typeof e.top?e.top:t,right:"number"==typeof e.right?e.right:t,bottom:"number"==typeof e.bottom?e.bottom:t,left:"number"==typeof e.left?e.left:t}},p.getMetaData=function(e,t){t=(e.data||e)[t];return t?t.meta:void 0},p.orderOfMagnitude=function(e){return Math.floor(Math.log(Math.abs(e))/Math.LN10)},p.projectLength=function(e,t,n){return t/n.range*e},p.getAvailableHeight=function(e,t){return Math.max((p.quantity(t.height).value||e.height())-(t.chartPadding.top+t.chartPadding.bottom)-t.axisX.offset,0)},p.getHighLow=function(e,t,r){var o={high:void 0===(t=p.extend({},t,r?t["axis"+r.toUpperCase()]:{})).high?-Number.MAX_VALUE:+t.high,low:void 0===t.low?Number.MAX_VALUE:+t.low},a=void 0===t.high,s=void 0===t.low;return(a||s)&&function e(t){if(void 0!==t)if(t instanceof Array)for(var n=0;n<t.length;n++)e(t[n]);else{var i=r?+t[r]:+t;a&&i>o.high&&(o.high=i),s&&i<o.low&&(o.low=i)}}(e),!t.referenceValue&&0!==t.referenceValue||(o.high=Math.max(t.referenceValue,o.high),o.low=Math.min(t.referenceValue,o.low)),o.high<=o.low&&(0===o.low?o.high=1:o.low<0?o.high=0:(0<o.high||(o.high=1),o.low=0)),o},p.isNumeric=function(e){return null!==e&&isFinite(e)},p.isFalseyButZero=function(e){return!e&&0!==e},p.getNumberOrUndefined=function(e){return p.isNumeric(e)?+e:void 0},p.isMultiValue=function(e){return"object"==typeof e&&("x"in e||"y"in e)},p.getMultiValue=function(e,t){return p.isMultiValue(e)?p.getNumberOrUndefined(e[t||"y"]):p.getNumberOrUndefined(e)},p.rho=function(e){if(1===e)return e;function t(e){return e*e+1}var n,i=2,r=2;if(e%2==0)return 2;for(;i=t(i)%e,r=t(t(r))%e,1===(n=function e(t,n){return t%n==0?n:e(n,t%n)}(Math.abs(i-r),e)););return n},p.getBounds=function(e,t,n,i){var r,o,a=0,s={high:t.high,low:t.low};s.valueRange=s.high-s.low,s.oom=p.orderOfMagnitude(s.valueRange),s.step=Math.pow(10,s.oom),s.min=Math.floor(s.low/s.step)*s.step,s.max=Math.ceil(s.high/s.step)*s.step,s.range=s.max-s.min,s.numberOfSteps=Math.round(s.range/s.step);var l=p.projectLength(e,s.step,s)<n,t=i?p.rho(s.range):0;if(i&&p.projectLength(e,1,s)>=n)s.step=1;else if(i&&t<s.step&&p.projectLength(e,t,s)>=n)s.step=t;else for(;;){if(l&&p.projectLength(e,s.step,s)<=n)s.step*=2;else{if(l||!(p.projectLength(e,s.step/2,s)>=n))break;if(s.step/=2,i&&s.step%1!=0){s.step*=2;break}}if(1e3<a++)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var u=2221e-19;function c(e,t){return e===(e+=t)&&(e*=1+(0<t?u:-u)),e}for(s.step=Math.max(s.step,u),r=s.min,o=s.max;r+s.step<=s.low;)r=c(r,s.step);for(;o-s.step>=s.high;)o=c(o,-s.step);s.min=r,s.max=o,s.range=s.max-s.min;for(var f=[],d=s.min;d<=s.max;d=c(d,s.step)){var h=p.roundWithPrecision(d);h!==f[f.length-1]&&f.push(h)}return s.values=f,s},p.polarToCartesian=function(e,t,n,i){i=(i-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}},p.createChartRect=function(e,t,n){var i=!(!t.axisX&&!t.axisY),r=i?t.axisY.offset:0,o=i?t.axisX.offset:0,a=e.width()||p.quantity(t.width).value||0,s=e.height()||p.quantity(t.height).value||0,e=p.normalizePadding(t.chartPadding,n),a=Math.max(a,r+e.left+e.right),s=Math.max(s,o+e.top+e.bottom),n={padding:e,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return i?("start"===t.axisX.position?(n.y2=e.top+o,n.y1=Math.max(s-e.bottom,n.y2+1)):(n.y2=e.top,n.y1=Math.max(s-e.bottom-o,n.y2+1)),"start"===t.axisY.position?(n.x1=e.left+r,n.x2=Math.max(a-e.right,n.x1+1)):(n.x1=e.left,n.x2=Math.max(a-e.right-r,n.x1+1))):(n.x1=e.left,n.x2=Math.max(a-e.right,n.x1+1),n.y2=e.top,n.y1=Math.max(s-e.bottom,n.y2+1)),n},p.createGrid=function(e,t,n,i,r,o,a,s){var l={};l[n.units.pos+"1"]=e,l[n.units.pos+"2"]=e,l[n.counterUnits.pos+"1"]=i,l[n.counterUnits.pos+"2"]=i+r;a=o.elem("line",l,a.join(" "));s.emit("draw",p.extend({type:"grid",axis:n,index:t,group:o,element:a},l))},p.createGridBackground=function(e,t,n,i){n=e.elem("rect",{x:t.x1,y:t.y2,width:t.width(),height:t.height()},n,!0);i.emit("draw",{type:"gridBackground",group:e,element:n})},p.createLabel=function(e,t,n,i,r,o,a,s,l,u,c){var f={};f[r.units.pos]=e+a[r.units.pos],f[r.counterUnits.pos]=a[r.counterUnits.pos],f[r.units.len]=t,f[r.counterUnits.len]=Math.max(0,o-10),l=u?((u=d.createElement("span")).className=l.join(" "),u.setAttribute("xmlns",p.namespaces.xhtml),u.innerText=i[n],u.style[r.units.len]=Math.round(f[r.units.len])+"px",u.style[r.counterUnits.len]=Math.round(f[r.counterUnits.len])+"px",s.foreignObject(u,p.extend({style:"overflow: visible;"},f))):s.elem("text",f,l.join(" ")).text(i[n]),c.emit("draw",p.extend({type:"label",axis:r,index:n,group:s,element:l,text:i[n]},f))},p.getSeriesOption=function(e,t,n){if(e.name&&t.series&&t.series[e.name]){e=t.series[e.name];return(e.hasOwnProperty(n)?e:t)[n]}return t[n]},p.optionsProvider=function(e,n,i){var r,o,a=p.extend({},e),t=[];function s(e){var t=r;if(r=p.extend({},a),n)for(o=0;o<n.length;o++)u.matchMedia(n[o][0]).matches&&(r=p.extend(r,n[o][1]));i&&e&&i.emit("optionsChanged",{previousOptions:t,currentOptions:r})}if(!u.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(n)for(o=0;o<n.length;o++){var l=u.matchMedia(n[o][0]);l.addListener(s),t.push(l)}return s(),{removeMediaQueryListeners:function(){t.forEach(function(e){e.removeListener(s)})},getCurrentOptions:function(){return p.extend({},r)}}},p.splitIntoSegments=function(e,t,n){n=p.extend({},{increasingX:!1,fillHoles:!1},n);for(var i=[],r=!0,o=0;o<e.length;o+=2)void 0===p.getMultiValue(t[o/2].value)?n.fillHoles||(r=!0):((r=n.increasingX&&2<=o&&e[o]<=e[o-2]?!0:r)&&(i.push({pathCoordinates:[],valueData:[]}),r=!1),i[i.length-1].pathCoordinates.push(e[o],e[o+1]),i[i.length-1].valueData.push(t[o/2]));return i},(m=t).Interpolation={},m.Interpolation.none=function(l){return l=m.extend({},{fillHoles:!1},l),function(e,t){for(var n=new m.Svg.Path,i=!0,r=0;r<e.length;r+=2){var o=e[r],a=e[r+1],s=t[r/2];void 0!==m.getMultiValue(s.value)?(i?n.move(o,a,!1,s):n.line(o,a,!1,s),i=!1):l.fillHoles||(i=!0)}return n}},m.Interpolation.simple=function(f){f=m.extend({},{divisor:2,fillHoles:!1},f);var d=1/Math.max(1,f.divisor);return function(e,t){for(var n,i,r,o=new m.Svg.Path,a=0;a<e.length;a+=2){var s=e[a],l=e[a+1],u=(s-n)*d,c=t[a/2];void 0!==c.value?(void 0===r?o.move(s,l,!1,c):o.curve(n+u,i,s-u,l,s,l,!1,c),n=s,i=l,r=c):f.fillHoles||(n=s=r=void 0)}return o}},m.Interpolation.cardinal=function(u){u=m.extend({},{tension:1,fillHoles:!1},u);var c=Math.min(1,Math.max(0,u.tension)),f=1-c;return function t(e,n){var i=m.splitIntoSegments(e,n,{fillHoles:u.fillHoles});if(i.length){if(1<i.length){var r=[];return i.forEach(function(e){r.push(t(e.pathCoordinates,e.valueData))}),m.Svg.Path.join(r)}if(e=i[0].pathCoordinates,n=i[0].valueData,e.length<=4)return m.Interpolation.none()(e,n);for(var o=(new m.Svg.Path).move(e[0],e[1],!1,n[0]),a=0,s=e.length;a<s-2;a+=2){var l=[{x:+e[a-2],y:+e[a-1]},{x:+e[a],y:+e[a+1]},{x:+e[a+2],y:+e[a+3]},{x:+e[a+4],y:+e[a+5]}];s-4===a?l[3]=l[2]:a||(l[0]={x:+e[a],y:+e[a+1]}),o.curve(c*(-l[0].x+6*l[1].x+l[2].x)/6+f*l[2].x,c*(-l[0].y+6*l[1].y+l[2].y)/6+f*l[2].y,c*(l[1].x+6*l[2].x-l[3].x)/6+f*l[2].x,c*(l[1].y+6*l[2].y-l[3].y)/6+f*l[2].y,l[2].x,l[2].y,!1,n[(a+2)/2])}return o}return m.Interpolation.none()([])}},m.Interpolation.monotoneCubic=function(p){return p=m.extend({},{fillHoles:!1},p),function t(e,n){var i=m.splitIntoSegments(e,n,{fillHoles:p.fillHoles,increasingX:!0});if(i.length){if(1<i.length){var r=[];return i.forEach(function(e){r.push(t(e.pathCoordinates,e.valueData))}),m.Svg.Path.join(r)}if(e=i[0].pathCoordinates,n=i[0].valueData,e.length<=4)return m.Interpolation.none()(e,n);for(var o,a=[],s=[],l=e.length/2,u=[],c=[],f=[],d=[],h=0;h<l;h++)a[h]=e[2*h],s[h]=e[2*h+1];for(h=0;h<l-1;h++)f[h]=s[h+1]-s[h],d[h]=a[h+1]-a[h],c[h]=f[h]/d[h];for(u[0]=c[0],u[l-1]=c[l-2],h=1;h<l-1;h++)0===c[h]||0===c[h-1]||0<c[h-1]!=0<c[h]?u[h]=0:(u[h]=3*(d[h-1]+d[h])/((2*d[h]+d[h-1])/c[h-1]+(d[h]+2*d[h-1])/c[h]),isFinite(u[h])||(u[h]=0));for(o=(new m.Svg.Path).move(a[0],s[0],!1,n[0]),h=0;h<l-1;h++)o.curve(a[h]+d[h]/3,s[h]+u[h]*d[h]/3,a[h+1]-d[h]/3,s[h+1]-u[h+1]*d[h]/3,a[h+1],s[h+1],!1,n[h+1]);return o}return m.Interpolation.none()([])}},m.Interpolation.step=function(c){return c=m.extend({},{postpone:!0,fillHoles:!1},c),function(e,t){for(var n,i,r,o=new m.Svg.Path,a=0;a<e.length;a+=2){var s=e[a],l=e[a+1],u=t[a/2];void 0!==u.value?(void 0===r?o.move(s,l,!1,u):(c.postpone?o.line(s,i,!1,r):o.line(n,l,!1,u),o.line(s,l,!1,u)),n=s,i=l,r=u):c.fillHoles||(n=i=r=void 0)}return o}},t.EventEmitter=function(){var i=[];return{addEventHandler:function(e,t){i[e]=i[e]||[],i[e].push(t)},removeEventHandler:function(e,t){i[e]&&(t?(i[e].splice(i[e].indexOf(t),1),0===i[e].length&&delete i[e]):delete i[e])},emit:function(t,n){i[t]&&i[t].forEach(function(e){e(n)}),i["*"]&&i["*"].forEach(function(e){e(t,n)})}}},(i=t).Class={extend:function(e,t){var t=t||this.prototype||i.Class,n=Object.create(t);return i.Class.cloneDefinitions(n,e),(e=function(){var e=n.constructor||function(){},t=this===i?Object.create(n):this;return e.apply(t,Array.prototype.slice.call(arguments,0)),t}).prototype=n,e.super=t,e.extend=this.extend,e},cloneDefinitions:function(){var e=function(e){var t=[];if(e.length)for(var n=0;n<e.length;n++)t.push(e[n]);return t}(arguments),n=e[0];return e.splice(1,e.length-1).forEach(function(t){Object.getOwnPropertyNames(t).forEach(function(e){delete n[e],Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}),n}},o=t,a=(this||v).window,o.Base=o.Class.extend({constructor:function(e,t,n,i,r){this.container=o.querySelector(e),this.data=t||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.defaultOptions=n,this.options=i,this.responsiveOptions=r,this.eventEmitter=o.EventEmitter(),this.supportsForeignObject=o.Svg.isSupported("Extensibility"),this.supportsAnimations=o.Svg.isSupported("AnimationEventsAttribute"),this.resizeListener=function(){this.update()}.bind(this),this.container&&(this.container.__chartist__&&this.container.__chartist__.detach(),this.container.__chartist__=this),this.initializeTimeoutId=setTimeout(function(){a.addEventListener("resize",this.resizeListener),this.optionsProvider=o.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.addEventHandler("optionsChanged",function(){this.update()}.bind(this)),this.options.plugins&&this.options.plugins.forEach(function(e){e instanceof Array?e[0](this,e[1]):e(this)}.bind(this)),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=void 0}.bind(this),0)},optionsProvider:void 0,container:void 0,svg:void 0,eventEmitter:void 0,createChart:function(){throw new Error("Base chart type can't be instantiated!")},update:function(e,t,n){return e&&(this.data=e||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),t&&(this.options=o.extend({},n?this.options:this.defaultOptions,t),this.initializeTimeoutId||(this.optionsProvider.removeMediaQueryListeners(),this.optionsProvider=o.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter))),this.initializeTimeoutId||this.createChart(this.optionsProvider.getCurrentOptions()),this},detach:function(){return this.initializeTimeoutId?a.clearTimeout(this.initializeTimeoutId):(a.removeEventListener("resize",this.resizeListener),this.optionsProvider.removeMediaQueryListeners()),this},on:function(e,t){return this.eventEmitter.addEventHandler(e,t),this},off:function(e,t){return this.eventEmitter.removeEventHandler(e,t),this},version:o.version,supportsForeignObject:!1}),function(e,l){var o=e.document;l.Svg=l.Class.extend({constructor:function(e,t,n,i,r){e instanceof Element?this._node=e:(this._node=o.createElementNS(l.namespaces.svg,e),"svg"===e&&this.attr({"xmlns:ct":l.namespaces.ct})),t&&this.attr(t),n&&this.addClass(n),i&&(r&&i._node.firstChild?i._node.insertBefore(this._node,i._node.firstChild):i._node.appendChild(this._node))},attr:function(n,e){return"string"==typeof n?e?this._node.getAttributeNS(e,n):this._node.getAttribute(n):(Object.keys(n).forEach(function(e){var t;void 0!==n[e]&&(-1!==e.indexOf(":")?(t=e.split(":"),this._node.setAttributeNS(l.namespaces[t[0]],e,n[e])):this._node.setAttribute(e,n[e]))}.bind(this)),this)},elem:function(e,t,n,i){return new l.Svg(e,t,n,this,i)},parent:function(){return this._node.parentNode instanceof SVGElement?new l.Svg(this._node.parentNode):null},root:function(){for(var e=this._node;"svg"!==e.nodeName;)e=e.parentNode;return new l.Svg(e)},querySelector:function(e){return(e=this._node.querySelector(e))?new l.Svg(e):null},querySelectorAll:function(e){return(e=this._node.querySelectorAll(e)).length?new l.Svg.List(e):null},getNode:function(){return this._node},foreignObject:function(e,t,n,i){var r;return"string"==typeof e&&((r=o.createElement("div")).innerHTML=e,e=r.firstChild),e.setAttribute("xmlns",l.namespaces.xmlns),(i=this.elem("foreignObject",t,n,i))._node.appendChild(e),i},text:function(e){return this._node.appendChild(o.createTextNode(e)),this},empty:function(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this},remove:function(){return this._node.parentNode.removeChild(this._node),this.parent()},replace:function(e){return this._node.parentNode.replaceChild(e._node,this._node),e},append:function(e,t){return t&&this._node.firstChild?this._node.insertBefore(e._node,this._node.firstChild):this._node.appendChild(e._node),this},classes:function(){return this._node.getAttribute("class")?this._node.getAttribute("class").trim().split(/\s+/):[]},addClass:function(e){return this._node.setAttribute("class",this.classes(this._node).concat(e.trim().split(/\s+/)).filter(function(e,t,n){return n.indexOf(e)===t}).join(" ")),this},removeClass:function(e){var t=e.trim().split(/\s+/);return this._node.setAttribute("class",this.classes(this._node).filter(function(e){return-1===t.indexOf(e)}).join(" ")),this},removeAllClasses:function(){return this._node.setAttribute("class",""),this},height:function(){return this._node.getBoundingClientRect().height},width:function(){return this._node.getBoundingClientRect().width},animate:function(e,n,s){return void 0===n&&(n=!0),Object.keys(e).forEach(function(a){function t(t,e){var n,i,r,o={};t.easing&&(r=t.easing instanceof Array?t.easing:l.Svg.Easing[t.easing],delete t.easing),t.begin=l.ensureUnit(t.begin,"ms"),t.dur=l.ensureUnit(t.dur,"ms"),r&&(t.calcMode="spline",t.keySplines=r.join(" "),t.keyTimes="0;1"),e&&(t.fill="freeze",o[a]=t.from,this.attr(o),i=l.quantity(t.begin||0).value,t.begin="indefinite"),n=this.elem("animate",l.extend({attributeName:a},t)),e&&setTimeout(function(){try{n._node.beginElement()}catch(e){o[a]=t.to,this.attr(o),n.remove()}}.bind(this),i),s&&n._node.addEventListener("beginEvent",function(){s.emit("animationBegin",{element:this,animate:n._node,params:t})}.bind(this)),n._node.addEventListener("endEvent",function(){s&&s.emit("animationEnd",{element:this,animate:n._node,params:t}),e&&(o[a]=t.to,this.attr(o),n.remove())}.bind(this))}e[a]instanceof Array?e[a].forEach(function(e){t.bind(this)(e,!1)}.bind(this)):t.bind(this)(e[a],n)}.bind(this)),this}}),l.Svg.isSupported=function(e){return o.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+e,"1.1")};l.Svg.Easing={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]},l.Svg.List=l.Class.extend({constructor:function(e){var i=this;this.svgElements=[];for(var t=0;t<e.length;t++)this.svgElements.push(new l.Svg(e[t]));Object.keys(l.Svg.prototype).filter(function(e){return-1===["constructor","parent","querySelector","querySelectorAll","replace","append","classes","height","width"].indexOf(e)}).forEach(function(n){i[n]=function(){var t=Array.prototype.slice.call(arguments,0);return i.svgElements.forEach(function(e){l.Svg.prototype[n].apply(e,t)}),i}})}})}(this||v,t),l={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},n={accuracy:3},(s=t).Svg.Path=s.Class.extend({constructor:function(e,t){this.pathElements=[],this.pos=0,this.close=e,this.options=s.extend({},n,t)},position:function(e){return void 0!==e?(this.pos=Math.max(0,Math.min(this.pathElements.length,e)),this):this.pos},remove:function(e){return this.pathElements.splice(this.pos,e),this},move:function(e,t,n,i){return h("M",{x:+e,y:+t},this.pathElements,this.pos++,n,i),this},line:function(e,t,n,i){return h("L",{x:+e,y:+t},this.pathElements,this.pos++,n,i),this},curve:function(e,t,n,i,r,o,a,s){return h("C",{x1:+e,y1:+t,x2:+n,y2:+i,x:+r,y:+o},this.pathElements,this.pos++,a,s),this},arc:function(e,t,n,i,r,o,a,s,l){return h("A",{rx:+e,ry:+t,xAr:+n,lAf:+i,sf:+r,x:+o,y:+a},this.pathElements,this.pos++,s,l),this},scale:function(n,i){return g(this.pathElements,function(e,t){e[t]*="x"===t[0]?n:i}),this},translate:function(n,i){return g(this.pathElements,function(e,t){e[t]+="x"===t[0]?n:i}),this},transform:function(o){return g(this.pathElements,function(e,t,n,i,r){r=o(e,t,n,i,r);!r&&0!==r||(e[t]=r)}),this},parse:function(e){var t=e.replace(/([A-Za-z])([0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(function(e,t){return t.match(/[A-Za-z]/)&&e.push([]),e[e.length-1].push(t),e},[]);return"Z"===t[t.length-1][0].toUpperCase()&&t.pop(),e=t.map(function(i){var e=i.shift(),t=l[e.toLowerCase()];return s.extend({command:e},t.reduce(function(e,t,n){return e[t]=+i[n],e},{}))}),t=[this.pos,0],Array.prototype.push.apply(t,e),Array.prototype.splice.apply(this.pathElements,t),this.pos+=e.length,this},stringify:function(){var i=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(e,t){var n=l[t.command.toLowerCase()].map(function(e){return this.options.accuracy?Math.round(t[e]*i)/i:t[e]}.bind(this));return e+t.command+n.join(",")}.bind(this),"")+(this.close?"Z":"")},clone:function(e){return(e=new s.Svg.Path(e||this.close)).pos=this.pos,e.pathElements=this.pathElements.slice().map(function(e){return s.extend({},e)}),e.options=s.extend({},this.options),e},splitByCommand:function(t){var n=[new s.Svg.Path];return this.pathElements.forEach(function(e){e.command===t.toUpperCase()&&0!==n[n.length-1].pathElements.length&&n.push(new s.Svg.Path),n[n.length-1].pathElements.push(e)}),n}}),s.Svg.Path.elementDescriptions=l,s.Svg.Path.join=function(e,t,n){for(var i=new s.Svg.Path(t,n),r=0;r<e.length;r++)for(var o=e[r],a=0;a<o.pathElements.length;a++)i.pathElements.push(o.pathElements[a]);return i},function(e,d){e.window,e.document;var r={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}};d.Axis=d.Class.extend({constructor:function(e,t,n,i){this.units=e,this.counterUnits=e===r.x?r.y:r.x,this.chartRect=t,this.axisLength=t[e.rectEnd]-t[e.rectStart],this.gridOffset=t[e.rectOffset],this.ticks=n,this.options=i},createGridAndLabels:function(r,o,a,s,l){var u=s["axis"+this.units.pos.toUpperCase()],c=this.ticks.map(this.projectValue.bind(this)),f=this.ticks.map(u.labelInterpolationFnc);c.forEach(function(e,t){var n={x:0,y:0},i=c[t+1]?c[t+1]-e:Math.max(this.axisLength-e,30);d.isFalseyButZero(f[t])&&""!==f[t]||("x"===this.units.pos?(e=this.chartRect.x1+e,n.x=s.axisX.labelOffset.x,"start"===s.axisX.position?n.y=this.chartRect.padding.top+s.axisX.labelOffset.y+(a?5:20):n.y=this.chartRect.y1+s.axisX.labelOffset.y+(a?5:20)):(e=this.chartRect.y1-e,n.y=s.axisY.labelOffset.y-(a?i:0),"start"===s.axisY.position?n.x=a?this.chartRect.padding.left+s.axisY.labelOffset.x:this.chartRect.x1-10:n.x=this.chartRect.x2+s.axisY.labelOffset.x+10),u.showGrid&&d.createGrid(e,t,this,this.gridOffset,this.chartRect[this.counterUnits.len](),r,[s.classNames.grid,s.classNames[this.units.dir]],l),u.showLabel&&d.createLabel(e,i,t,f,this,u.offset,n,o,[s.classNames.label,s.classNames[this.units.dir],"start"===u.position?s.classNames[u.position]:s.classNames.end],a,l))}.bind(this))},projectValue:function(e,t,n){throw new Error("Base axis can't be instantiated!")}}),d.Axis.units=r}(this||v,t),r=t,(e=this||v).window,e.document,r.AutoScaleAxis=r.Axis.extend({constructor:function(e,t,n,i){t=i.highLow||r.getHighLow(t,i,e.pos),this.bounds=r.getBounds(n[e.rectEnd]-n[e.rectStart],t,i.scaleMinSpace||20,i.onlyInteger),this.range={min:this.bounds.min,max:this.bounds.max},r.AutoScaleAxis.super.constructor.call(this,e,n,this.bounds.values,i)},projectValue:function(e){return this.axisLength*(+r.getMultiValue(e,this.units.pos)-this.bounds.min)/this.bounds.range}}),c=t,(e=this||v).window,e.document,c.FixedScaleAxis=c.Axis.extend({constructor:function(e,t,n,i){var r=i.highLow||c.getHighLow(t,i,e.pos);this.divisor=i.divisor||1,this.ticks=i.ticks||c.times(this.divisor).map(function(e,t){return r.low+(r.high-r.low)/this.divisor*t}.bind(this)),this.ticks.sort(function(e,t){return e-t}),this.range={min:r.low,max:r.high},c.FixedScaleAxis.super.constructor.call(this,e,n,this.ticks,i),this.stepLength=this.axisLength/this.divisor},projectValue:function(e){return this.axisLength*(+c.getMultiValue(e,this.units.pos)-this.range.min)/(this.range.max-this.range.min)}}),f=t,(e=this||v).window,e.document,f.StepAxis=f.Axis.extend({constructor:function(e,t,n,i){f.StepAxis.super.constructor.call(this,e,n,i.ticks,i),i=Math.max(1,i.ticks.length-(i.stretch?1:0)),this.stepLength=this.axisLength/i},projectValue:function(e,t){return this.stepLength*t}}),function(e,m){e.window,e.document;var r={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:m.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:m.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};m.Line=m.Base.extend({constructor:function(e,t,n,i){m.Line.super.constructor.call(this,e,t,r,m.extend({},r,n),i)},createChart:function(u){var c=m.normalizeData(this.data,u.reverseData,!0);this.svg=m.createSvg(this.container,u.width,u.height,u.classNames.chart);var e=this.svg.elem("g").addClass(u.classNames.gridGroup),f=this.svg.elem("g"),t=this.svg.elem("g").addClass(u.classNames.labelGroup),d=m.createChartRect(this.svg,u,r.padding),h=void 0===u.axisX.type?new m.StepAxis(m.Axis.units.x,c.normalized.series,d,m.extend({},u.axisX,{ticks:c.normalized.labels,stretch:u.fullWidth})):u.axisX.type.call(m,m.Axis.units.x,c.normalized.series,d,u.axisX),p=void 0===u.axisY.type?new m.AutoScaleAxis(m.Axis.units.y,c.normalized.series,d,m.extend({},u.axisY,{high:(m.isNumeric(u.high)?u:u.axisY).high,low:(m.isNumeric(u.low)?u:u.axisY).low})):u.axisY.type.call(m,m.Axis.units.y,c.normalized.series,d,u.axisY);h.createGridAndLabels(e,t,this.supportsForeignObject,u,this.eventEmitter),p.createGridAndLabels(e,t,this.supportsForeignObject,u,this.eventEmitter),u.showGridBackground&&m.createGridBackground(e,d,u.classNames.gridBackground,this.eventEmitter),c.raw.series.forEach(function(i,r){var n=f.elem("g");n.attr({"ct:series-name":i.name,"ct:meta":m.serialize(i.meta)}),n.addClass([u.classNames.series,i.className||u.classNames.series+"-"+m.alphaNumerate(r)].join(" "));var o=[],a=[];c.normalized.series[r].forEach(function(e,t){var n={x:d.x1+h.projectValue(e,t,c.normalized.series[r]),y:d.y1-p.projectValue(e,t,c.normalized.series[r])};o.push(n.x,n.y),a.push({value:e,valueIndex:t,meta:m.getMetaData(i,t)})}.bind(this));var e,s,t={lineSmooth:m.getSeriesOption(i,u,"lineSmooth"),showPoint:m.getSeriesOption(i,u,"showPoint"),showLine:m.getSeriesOption(i,u,"showLine"),showArea:m.getSeriesOption(i,u,"showArea"),areaBase:m.getSeriesOption(i,u,"areaBase")},l=("function"==typeof t.lineSmooth?t.lineSmooth:t.lineSmooth?m.Interpolation.monotoneCubic():m.Interpolation.none())(o,a);t.showPoint&&l.pathElements.forEach(function(e){var t=n.elem("line",{x1:e.x,y1:e.y,x2:e.x+.01,y2:e.y},u.classNames.point).attr({"ct:value":[e.data.value.x,e.data.value.y].filter(m.isNumeric).join(","),"ct:meta":m.serialize(e.data.meta)});this.eventEmitter.emit("draw",{type:"point",value:e.data.value,index:e.data.valueIndex,meta:e.data.meta,series:i,seriesIndex:r,axisX:h,axisY:p,group:n,element:t,x:e.x,y:e.y})}.bind(this)),t.showLine&&(e=n.elem("path",{d:l.stringify()},u.classNames.line,!0),this.eventEmitter.emit("draw",{type:"line",values:c.normalized.series[r],path:l.clone(),chartRect:d,index:r,series:i,seriesIndex:r,seriesMeta:i.meta,axisX:h,axisY:p,group:n,element:e})),t.showArea&&p.range&&(t=Math.max(Math.min(t.areaBase,p.range.max),p.range.min),s=d.y1-p.projectValue(t),l.splitByCommand("M").filter(function(e){return 1<e.pathElements.length}).map(function(e){var t=e.pathElements[0],n=e.pathElements[e.pathElements.length-1];return e.clone(!0).position(0).remove(1).move(t.x,s).line(t.x,t.y).position(e.pathElements.length+1).line(n.x,s)}).forEach(function(e){var t=n.elem("path",{d:e.stringify()},u.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:c.normalized.series[r],path:e.clone(),series:i,seriesIndex:r,axisX:h,axisY:p,chartRect:d,index:r,group:n,element:t})}.bind(this)))}.bind(this)),this.eventEmitter.emit("created",{bounds:p.bounds,chartRect:d,axisX:h,axisY:p,svg:this.svg,options:u})}})}(this||v,t),function(e,x){e.window,e.document;var o={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:x.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:x.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};x.Bar=x.Base.extend({constructor:function(e,t,n,i){x.Bar.super.constructor.call(this,e,t,o,x.extend({},o,n),i)},createChart:function(c){var f;c.distributeSeries?(f=x.normalizeData(this.data,c.reverseData,c.horizontalBars?"x":"y")).normalized.series=f.normalized.series.map(function(e){return[e]}):f=x.normalizeData(this.data,c.reverseData,c.horizontalBars?"x":"y"),this.svg=x.createSvg(this.container,c.width,c.height,c.classNames.chart+(c.horizontalBars?" "+c.classNames.horizontalBars:""));var e,t=this.svg.elem("g").addClass(c.classNames.gridGroup),n=this.svg.elem("g"),i=this.svg.elem("g").addClass(c.classNames.labelGroup);(e=c.stackBars&&0!==f.normalized.series.length?(r=x.serialMap(f.normalized.series,function(){return Array.prototype.slice.call(arguments).map(function(e){return e}).reduce(function(e,t){return{x:e.x+(t&&t.x)||0,y:e.y+(t&&t.y)||0}},{x:0,y:0})}),x.getHighLow([r],c,c.horizontalBars?"x":"y")):x.getHighLow(f.normalized.series,c,c.horizontalBars?"x":"y")).high=+c.high||(0===c.high?0:e.high),e.low=+c.low||(0===c.low?0:e.low);var d,h,p,m,g=x.createChartRect(this.svg,c,o.padding),r=c.distributeSeries&&c.stackBars?f.normalized.labels.slice(0,1):f.normalized.labels;c.horizontalBars?(d=p=void 0===c.axisX.type?new x.AutoScaleAxis(x.Axis.units.x,f.normalized.series,g,x.extend({},c.axisX,{highLow:e,referenceValue:0})):c.axisX.type.call(x,x.Axis.units.x,f.normalized.series,g,x.extend({},c.axisX,{highLow:e,referenceValue:0})),h=m=void 0===c.axisY.type?new x.StepAxis(x.Axis.units.y,f.normalized.series,g,{ticks:r}):c.axisY.type.call(x,x.Axis.units.y,f.normalized.series,g,c.axisY)):(h=p=void 0===c.axisX.type?new x.StepAxis(x.Axis.units.x,f.normalized.series,g,{ticks:r}):c.axisX.type.call(x,x.Axis.units.x,f.normalized.series,g,c.axisX),d=m=void 0===c.axisY.type?new x.AutoScaleAxis(x.Axis.units.y,f.normalized.series,g,x.extend({},c.axisY,{highLow:e,referenceValue:0})):c.axisY.type.call(x,x.Axis.units.y,f.normalized.series,g,x.extend({},c.axisY,{highLow:e,referenceValue:0})));var v=c.horizontalBars?g.x1+d.projectValue(0):g.y1-d.projectValue(0),y=[];h.createGridAndLabels(t,i,this.supportsForeignObject,c,this.eventEmitter),d.createGridAndLabels(t,i,this.supportsForeignObject,c,this.eventEmitter),c.showGridBackground&&x.createGridBackground(t,g,c.classNames.gridBackground,this.eventEmitter),f.raw.series.forEach(function(o,a){var s=a-(f.raw.series.length-1)/2,l=c.distributeSeries&&!c.stackBars?h.axisLength/f.normalized.series.length/2:c.distributeSeries&&c.stackBars?h.axisLength/2:h.axisLength/f.normalized.series[a].length/2,u=n.elem("g");u.attr({"ct:series-name":o.name,"ct:meta":x.serialize(o.meta)}),u.addClass([c.classNames.series,o.className||c.classNames.series+"-"+x.alphaNumerate(a)].join(" ")),f.normalized.series[a].forEach(function(e,t){var n,i=c.distributeSeries&&!c.stackBars?a:c.distributeSeries&&c.stackBars?0:t,r=c.horizontalBars?{x:g.x1+d.projectValue(e&&e.x?e.x:0,t,f.normalized.series[a]),y:g.y1-h.projectValue(e&&e.y?e.y:0,i,f.normalized.series[a])}:{x:g.x1+h.projectValue(e&&e.x?e.x:0,i,f.normalized.series[a]),y:g.y1-d.projectValue(e&&e.y?e.y:0,t,f.normalized.series[a])};h instanceof x.StepAxis&&(h.options.stretch||(r[h.units.pos]+=l*(c.horizontalBars?-1:1)),r[h.units.pos]+=c.stackBars||c.distributeSeries?0:s*c.seriesBarDistance*(c.horizontalBars?-1:1)),n=y[t]||v,y[t]=n-(v-r[h.counterUnits.pos]),void 0!==e&&((i={})[h.units.pos+"1"]=r[h.units.pos],i[h.units.pos+"2"]=r[h.units.pos],!c.stackBars||"accumulate"!==c.stackMode&&c.stackMode?(i[h.counterUnits.pos+"1"]=v,i[h.counterUnits.pos+"2"]=r[h.counterUnits.pos]):(i[h.counterUnits.pos+"1"]=n,i[h.counterUnits.pos+"2"]=y[t]),i.x1=Math.min(Math.max(i.x1,g.x1),g.x2),i.x2=Math.min(Math.max(i.x2,g.x1),g.x2),i.y1=Math.min(Math.max(i.y1,g.y2),g.y1),i.y2=Math.min(Math.max(i.y2,g.y2),g.y1),r=x.getMetaData(o,t),n=u.elem("line",i,c.classNames.bar).attr({"ct:value":[e.x,e.y].filter(x.isNumeric).join(","),"ct:meta":x.serialize(r)}),this.eventEmitter.emit("draw",x.extend({type:"bar",value:e,index:t,meta:r,series:o,seriesIndex:a,axisX:p,axisY:m,chartRect:g,group:u,element:n},i)))}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:d.bounds,chartRect:g,axisX:p,axisY:m,svg:this.svg,options:c})}})}(this||v,t),function(e,y){e.window,e.document;var r={width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:y.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1};function x(e,t,n){e=t.x>e.x;return e&&"explode"===n||!e&&"implode"===n?"start":e&&"implode"===n||!e&&"explode"===n?"end":"middle"}y.Pie=y.Base.extend({constructor:function(e,t,n,i){y.Pie.super.constructor.call(this,e,t,r,y.extend({},r,n),i)},createChart:function(s){var l,u,c=y.normalizeData(this.data),f=[],d=s.startAngle;this.svg=y.createSvg(this.container,s.width,s.height,s.donut?s.classNames.chartDonut:s.classNames.chartPie);var e=y.createChartRect(this.svg,s,r.padding),h=Math.min(e.width()/2,e.height()/2),p=s.total||c.normalized.series.reduce(function(e,t){return e+t},0),m=y.quantity(s.donutWidth);"%"===m.unit&&(m.value*=h/100),h-=s.donut&&!s.donutSolid?m.value/2:0,u="outside"===s.labelPosition||s.donut&&!s.donutSolid?h:"center"===s.labelPosition?0:s.donutSolid?h-m.value/2:h/2,u+=s.labelOffset;var g={x:e.x1+e.width()/2,y:e.y2+e.height()/2},v=1===c.raw.series.filter(function(e){return e.hasOwnProperty("value")?0!==e.value:0!==e}).length;c.raw.series.forEach(function(e,t){f[t]=this.svg.elem("g",null,null)}.bind(this)),s.showLabel&&(l=this.svg.elem("g",null,null)),c.raw.series.forEach(function(e,t){var n,i,r,o,a;0===c.normalized.series[t]&&s.ignoreEmptyValues||(f[t].attr({"ct:series-name":e.name}),f[t].addClass([s.classNames.series,e.className||s.classNames.series+"-"+y.alphaNumerate(t)].join(" ")),359.99<=(n=0<p?d+c.normalized.series[t]/p*360:0)-(o=Math.max(0,d-(0===t||v?0:.2)))&&(n=o+359.99),i=y.polarToCartesian(g.x,g.y,h,o),r=y.polarToCartesian(g.x,g.y,h,n),o=new y.Svg.Path(!s.donut||s.donutSolid).move(r.x,r.y).arc(h,h,0,180<n-d,0,i.x,i.y),s.donut?s.donutSolid&&(r=h-m.value,i=y.polarToCartesian(g.x,g.y,r,d-(0===t||v?0:.2)),a=y.polarToCartesian(g.x,g.y,r,n),o.line(i.x,i.y),o.arc(r,r,0,180<n-d,1,a.x,a.y)):o.line(g.x,g.y),a=s.classNames.slicePie,s.donut&&(a=s.classNames.sliceDonut,s.donutSolid&&(a=s.classNames.sliceDonutSolid)),(a=f[t].elem("path",{d:o.stringify()},a)).attr({"ct:value":c.normalized.series[t],"ct:meta":y.serialize(e.meta)}),s.donut&&!s.donutSolid&&(a._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:c.normalized.series[t],totalDataSum:p,index:t,meta:e.meta,series:e,group:f[t],element:a,path:o.clone(),center:g,radius:h,startAngle:d,endAngle:n}),s.showLabel&&(e=1===c.raw.series.length?{x:g.x,y:g.y}:y.polarToCartesian(g.x,g.y,u,d+(n-d)/2),a=(c.normalized.labels&&!y.isFalseyButZero(c.normalized.labels[t])?c.normalized.labels:c.normalized.series)[t],!(o=s.labelInterpolationFnc(a,t))&&0!==o||(a=l.elem("text",{dx:e.x,dy:e.y,"text-anchor":x(g,e,s.labelDirection)},s.classNames.label).text(""+o),this.eventEmitter.emit("draw",{type:"label",index:t,group:l,element:a,text:""+o,x:e.x,y:e.y}))),d=n)}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:s})},determineAnchorPosition:x})}(this||v,t),t},(e=n).exports?e.exports=k():t.Chartist=k();var i=n.exports,x={escapeRegExp:function(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")},makeDiacriticsRegExp:function(e){var t,n={a:"[aáàăâǎåäãȧąāảȁạ]",b:"[bḃḅ]",c:"[cćĉčċç]",d:"[dďḋḑḍ]",e:"[eéèĕêěëẽėȩęēẻȅẹ]",g:"[gǵğĝǧġģḡ]",h:"[hĥȟḧḣḩḥ]",i:"[iiíìĭîǐïĩįīỉȉịı]",j:"[jĵǰ]",k:"[kḱǩķḳ]",l:"[lĺľļḷ]",m:"[mḿṁṃ]",n:"[nńǹňñṅņṇ]",o:"[oóòŏôǒöőõȯǿǫōỏȍơọ]",p:"[pṕṗ]",r:"[rŕřṙŗȑṛ]",s:"[sśŝšṡşṣș]",t:"[tťẗṫţṭț]",u:"[uúùŭûǔůüűũųūủȕưụ]",v:"[vṽṿ]",w:"[wẃẁŵẘẅẇẉ]",x:"[xẍẋ]",y:"[yýỳŷẙÿỹẏȳỷỵ]",z:"[zźẑžżẓ]"};for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e=(e=e.split(t).join(n[t])).split(t.toUpperCase()).join(n[t].toUpperCase()));return e},slug:function(e){var t,n={"\t":"","\r":"","!":"",'"':"","#":"",$:"","%":"","'":"-","(":"",")":"","*":"","+":"",",":"",".":"",":":"",";":"","<":"","=":"",">":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","¡":"","£":"","¤":"","¥":"","¦":"","§":"","«":"","°":"","»":"","‘":"","’":"","“":"","”":"","\n":"-"," ":"-","-":"-","–":"-","—":"-","/":"-","\\":"-",_:"-","~":"-","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"Ae","Ç":"C","Ð":"D","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Œ":"Oe","Š":"S","Þ":"Th","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","¢":"c","ç":"c","ð":"d","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ø":"o","œ":"oe","š":"s","ß":"ss","þ":"th","ù":"u","ú":"u","û":"u","ü":"ue","ý":"y","ÿ":"y","Ÿ":"y"};for(t in e=e.toLowerCase(),n)Object.prototype.hasOwnProperty.call(n,t)&&(e=e.split(t).join(n[t]));return e.replace(/[^a-z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/-+/g,"-")},validateSlug:function(e){return e.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")},debounce:function(e,t,n){var i,r,o,a=null;return function(){return i=this,r=arguments,a&&clearTimeout(a),n&&!a&&(o=e.apply(i,r)),a=setTimeout(function(){n||(o=e.apply(i,r)),a=null},t),o}},throttle:function(n,i){var r,o,a,s=0,l=null;return function(){var e=Date.now(),t=(s=0===s?e:s)+i-e;return r=this,o=arguments,t<=0||i<t?(l&&(clearTimeout(l),l=null),s=e,a=n.apply(r,o)):l=l||setTimeout(function(){s=Date.now(),a=n.apply(r,o),l=null},t),a}},outerWidth:function(e){var t=e.offsetWidth,e=getComputedStyle(e);return t+=parseInt(e.marginLeft)+parseInt(e.marginRight)},outerHeight:function(e){var t=e.offsetHeight,e=getComputedStyle(e);return t+=parseInt(e.marginTop)+parseInt(e.marginBottom)},toggleElement:function(e,t){var n=e.style.display||getComputedStyle(e).display;void 0===t&&(t="block"),e.style.display="none"===n?t:"none"},sameArray:function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},extendObject:function(e){var t,n,i;for(e=e||{},t=1;t<arguments.length;t++)for(i in n=arguments[t])e[i]=n[i];return e},serializeObject:function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.join("&")},serializeForm:function(e){for(var t,n,i=[],r=0;r<e.elements.length;r++)if((t=e.elements[r]).name&&!t.disabled&&"file"!==t.type&&"reset"!==t.type&&"submit"!==t.type&&"button"!==t.type)if("select-multiple"===t.type)for(n=e.elements[r].options.length-1;0<=n;n--)t.options[n].selected&&i.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[n].value));else("checkbox"!==t.type&&"radio"!==t.type||t.checked)&&i.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value));return i.join("&")},triggerEvent:function(e,t){var n;try{n=new Event(t)}catch(e){(n=document.createEvent("HTMLEvents")).initEvent(t,!0,!0)}e.dispatchEvent(n)},triggerDownload:function(e,t){var n=document.createElement("form"),i=document.createElement("input");n.action=e,n.method="post",i.type="hidden",i.name="csrf-token",i.value=t,n.appendChild(i),document.body.appendChild(n),n.submit(),document.body.removeChild(n)},longClick:function(e,n,i,r){var o;function a(){clearTimeout(o)}e.addEventListener("mousedown",function(e){var t=this;1!==e.which?a():(n.call(t,e),o=setTimeout(function(){o=setInterval(n.bind(t,e),r)},i))}),e.addEventListener("mouseout",a),window.addEventListener("mouseup",a)},firstFocusableElement:function(e){return(e=void 0===e?document.body:e).querySelector("button, .button, input:not([type=hidden]), select, textarea")||e},getCookies:function(){for(var e,t=[],n=document.cookie.split(";"),i=0;i<n.length;i++)2===(e=n[i].split("=",2)).length&&(t[e[0].trim()]=decodeURIComponent(e[1].trim()));return t},setCookie:function(e,t,n){var i,r=e+"="+t;for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r+=";"+i+"="+n[i]);document.cookie=r},getMaxSafeInteger:function(){return Number.MAX_SAFE_INTEGER||9007199254740991},toSafeInteger:function(e){var t=this.getMaxSafeInteger(),n=-t;return t<e?t:e<n?n:parseInt(e,10)||0}};function r(t,a){var n,e,i,r={container:document.body,referenceElement:document.body,position:"top",offset:{x:0,y:0},delay:500,timeout:null,removeOnMouseout:!0,removeOnClick:!1},s=a.referenceElement;function o(){clearTimeout(e),clearTimeout(i),void 0!==n&&a.container.contains(n)&&a.container.removeChild(n)}return a=x.extendObject({},r,a),s instanceof HTMLElement&&("button"!==s.tagName.toLowerCase()&&!s.classList.contains("button")||(s.addEventListener("click",o),s.addEventListener("blur",o))),a.removeOnMouseout&&s.addEventListener("mouseout",o),a.removeOnClick&&s.addEventListener("click",o),{show:function(){e=setTimeout(function(){var e;(n=document.createElement("div")).className="tooltip",n.setAttribute("role","tooltip"),n.style.display="block",n.innerHTML=t,a.container.appendChild(n),e=function(e){var t=s.getBoundingClientRect(),n=t.top+window.pageYOffset,i=t.left+window.pageXOffset,r=(t.width-e.offsetWidth)/2,o=(t.height-e.offsetHeight)/2;switch(a.position){case"top":return{top:Math.round(n-e.offsetHeight+a.offset.y),left:Math.round(i+r+a.offset.x)};case"right":return{top:Math.round(n+o+a.offset.y),left:Math.round(i+s.offsetWidth+a.offset.x)};case"bottom":return{top:Math.round(n+s.offsetHeight+a.offset.y),left:Math.round(i+r+a.offset.x)};case"left":return{top:Math.round(n+o+a.offset.y),left:Math.round(i-e.offsetWidth+a.offset.x)};case"center":return{top:Math.round(n+o+a.offset.y),left:Math.round(i+r+a.offset.x)}}}(n),n.style.top=e.top+"px",n.style.left=e.left+"px",null!==a.timeout&&(i=setTimeout(o,a.timeout))},a.delay)},remove:o}}var o={},u={pass:function(t,n){var e;t in o?n(o[t]):((e=new XMLHttpRequest).onload=function(){var e=200===this.status?this.response:"";""!==e&&(o[t]=e),n(e)},e.open("GET",Formwork.config.baseUri+"assets/icons/svg/"+t+".svg"),e.send())},inject:function(e,t,n){void 0===n&&(n="afterBegin"),this.pass(e,function(e){t.insertAdjacentHTML(n,e)})}};function c(t,n,i){var r,o,a=$(".notification-container");function s(e,t,n){a||((a=document.createElement("div")).className="notification-container",document.body.appendChild(a)),(r=document.createElement("div")).className="notification notification-"+t,r.innerHTML=e,i.newestOnTop&&0<a.childNodes.length?a.insertBefore(r,a.childNodes[0]):a.appendChild(r),o=setTimeout(l,n),r.addEventListener("click",l),r.addEventListener("mouseenter",function(){clearTimeout(o)}),r.addEventListener("mouseleave",function(){o=setTimeout(l,i.mouseleaveDelay)})}function l(){r.classList.add("fadeout"),setTimeout(function(){r&&r.parentNode&&a.removeChild(r),a&&a.childNodes.length<1&&(a.parentNode&&document.body.removeChild(a),a=null)},i.fadeOutDelay)}return i=x.extendObject({},{interval:5e3,icon:null,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3},i),{show:function(){null!==i.icon?u.pass(i.icon,function(e){s(t,n,i.interval),r.insertAdjacentHTML("afterBegin",e)}):s(t,n,i.interval)},remove:l}}function f(e,t){var n,i,r=new XMLHttpRequest;return r.open(e.method,e.url,!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.send(x.serializeObject(e.data)),"function"==typeof t&&(r.onload=e=function(){n=JSON.parse(this.response),i=n.code||this.status,400===parseInt(i)?location.reload():t(n,r)},r.onerror=e),r}var a=function(){var e=$("[data-command=clear-cache]"),t=$("[data-command=make-backup]");e&&e.addEventListener("click",function(){f({method:"POST",url:Formwork.config.baseUri+"cache/clear/",data:{"csrf-token":$("meta[name=csrf-token]").getAttribute("content")}},function(e){new c(e.message,e.status,{icon:"check-circle"}).show()})}),t&&t.addEventListener("click",function(){var t=this;t.setAttribute("disabled",""),f({method:"POST",url:Formwork.config.baseUri+"backup/make/",data:{"csrf-token":$("meta[name=csrf-token]").getAttribute("content")}},function(e){new c(e.message,e.status,{icon:"check-circle"}).show(),setTimeout(function(){"success"===e.status&&x.triggerDownload(e.data.uri,$("meta[name=csrf-token]").getAttribute("content")),t.removeAttribute("disabled")},1e3)})})},s=function(){$(".dropdown")&&document.addEventListener("click",function(e){var t,n,i=e.target.closest(".dropdown-button");i&&(t=document.getElementById(i.getAttribute("data-dropdown")),n="none"!==getComputedStyle(t).display,e.preventDefault()),$$(".dropdown-menu").forEach(function(e){e.style.display=""}),t&&!n&&(t.style.display="block")})};function l(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function A(i){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach(function(e){var t,n;t=i,e=r[n=e],n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(r,e))})}return i}function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function p(e,t){if(null==e)return{};var n,i=function(e,t){if(null==e)return{};for(var n,i={},r=Object.keys(e),o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols)for(var r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}function m(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var b=m(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),w=m(/Edge/i),g=m(/firefox/i),y=m(/safari/i)&&!m(/chrome/i)&&!m(/android/i),k=m(/iP(ad|od|hone)/i),n=m(/chrome/i)&&m(/android/i),C={capture:!1,passive:!1};function S(e,t,n){e.addEventListener(t,n,!b&&C)}function L(e,t,n){e.removeEventListener(t,n,!b&&C)}function E(e,t){if(t&&(">"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function O(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===n)&&E(e,t)||i&&e===n)return e}while(e!==n&&(e=(r=e).host&&r!==document&&r.host.nodeType?r.host:r.parentNode))}var r;return null}var M,T=/\s+/g;function N(e,t,n){var i;e&&t&&(e.classList?e.classList[n?"add":"remove"](t):(i=(" "+e.className+" ").replace(T," ").replace(" "+t+" "," "),e.className=(i+(n?" "+t:"")).replace(T," ")))}function F(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];i[t=!(t in i||-1!==t.indexOf("webkit"))?"-webkit-"+t:t]=n+("string"==typeof n?"":"px")}}function D(e,t){var n="";if("string"==typeof e)n=e;else do{var i=F(e,"transform")}while(i&&"none"!==i&&(n=i+" "+n),!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function I(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r<o;r++)n(i[r],r);return i}return[]}function P(){var e=document.scrollingElement;return e||document.documentElement}function H(e,t,n,i,r){if(e.getBoundingClientRect||e===window){var o,a,s,l,u,c,f=e!==window&&e.parentNode&&e!==P()?(a=(o=e.getBoundingClientRect()).top,s=o.left,l=o.bottom,u=o.right,c=o.height,o.width):(s=a=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,window.innerWidth);if((t||n)&&e!==window&&(r=r||e.parentNode,!b))do{if(r&&r.getBoundingClientRect&&("none"!==F(r,"transform")||n&&"static"!==F(r,"position"))){var d=r.getBoundingClientRect();a-=d.top+parseInt(F(r,"border-top-width")),s-=d.left+parseInt(F(r,"border-left-width")),l=a+o.height,u=s+o.width;break}}while(r=r.parentNode);return i&&e!==window&&(i=(t=D(r||e))&&t.a,e=t&&t.d,t&&(l=(a/=e)+(c/=e),u=(s/=i)+(f/=i))),{top:a,left:s,bottom:l,right:u,width:f,height:c}}}function z(e,t,n){for(var i=_(e,!0),r=H(e)[t];i;){var o=H(i)[n];if(!("top"===n||"left"===n?o<=r:r<=o))return i;if(i===P())break;i=_(i,!1)}return!1}function B(e,t,n,i){for(var r=0,o=0,a=e.children;o<a.length;){if("none"!==a[o].style.display&&a[o]!==qe.ghost&&(i||a[o]!==qe.dragged)&&O(a[o],n.draggable,e,!1)){if(r===t)return a[o];r++}o++}return null}function W(e,t){for(var n=e.lastElementChild;n&&(n===qe.ghost||"none"===F(n,"display")||t&&!E(n,t));)n=n.previousElementSibling;return n||null}function R(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===qe.clone||t&&!E(e,t)||n++;return n}function j(e){var t=0,n=0,i=P();if(e)do{var r=D(e),o=r.a,r=r.d}while(t+=e.scrollLeft*o,n+=e.scrollTop*r,e!==i&&(e=e.parentNode));return[t,n]}function _(e,t){if(!e||!e.getBoundingClientRect)return P();var n=e,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=F(n);if(n.clientWidth<n.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!n.getBoundingClientRect||n===document.body)return P();if(i||t)return n;i=!0}}}while(n=n.parentNode);return P()}function Y(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function U(t,n){return function(){var e;M||(1===(e=arguments).length?t.call(this,e[0]):t.apply(this,e),M=setTimeout(function(){M=void 0},n))}}function q(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function X(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var G="Sortable"+(new Date).getTime();function V(){var t,i=[];return{captureAnimationState:function(){i=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(e){var t,n;"none"!==F(e,"display")&&e!==qe.ghost&&(i.push({target:e,rect:H(e)}),t=A({},i[i.length-1].rect),!e.thisAnimationDuration||(n=D(e,!0))&&(t.top-=n.f,t.left-=n.e),e.fromRect=t)})},addAnimationState:function(e){i.push(e)},removeAnimationState:function(e){i.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[n][i])return Number(n);return-1}(i,{target:e}),1)},animateAll:function(e){var u=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof e&&e());var c=!1,f=0;i.forEach(function(e){var t=0,n=e.target,i=n.fromRect,r=H(n),o=n.prevFromRect,a=n.prevToRect,s=e.rect,l=D(n,!0);l&&(r.top-=l.f,r.left-=l.e),n.toRect=r,n.thisAnimationDuration&&Y(o,r)&&!Y(i,r)&&(s.top-r.top)/(s.left-r.left)==(i.top-r.top)/(i.left-r.left)&&(e=s,l=o,o=a,a=u.options,t=Math.sqrt(Math.pow(l.top-e.top,2)+Math.pow(l.left-e.left,2))/Math.sqrt(Math.pow(l.top-o.top,2)+Math.pow(l.left-o.left,2))*a.animation),Y(r,i)||(n.prevFromRect=i,n.prevToRect=r,t=t||u.options.animation,u.animate(n,s,r,t)),t&&(c=!0,f=Math.max(f,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout(function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null},t),n.thisAnimationDuration=t)}),clearTimeout(t),c?t=setTimeout(function(){"function"==typeof e&&e()},f):"function"==typeof e&&e(),i=[]},animate:function(e,t,n,i){var r,o;i&&(F(e,"transition",""),F(e,"transform",""),r=(o=D(this.el))&&o.a,o=o&&o.d,r=(t.left-n.left)/(r||1),o=(t.top-n.top)/(o||1),e.animatingX=!!r,e.animatingY=!!o,F(e,"transform","translate3d("+r+"px,"+o+"px,0)"),this.forRepaintDummy=e.offsetWidth,F(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),F(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout(function(){F(e,"transition",""),F(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1},i))}}}var K=[],Q={initializeByDefault:!0},Z={mount:function(t){for(var e in Q)!Q.hasOwnProperty(e)||e in t||(t[e]=Q[e]);K.forEach(function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),K.push(t)},pluginEvent:function(t,n,i){var e=this;this.eventCanceled=!1,i.cancel=function(){e.eventCanceled=!0};var r=t+"Global";K.forEach(function(e){n[e.pluginName]&&(n[e.pluginName][r]&&n[e.pluginName][r](A({sortable:n},i)),n.options[e.pluginName]&&n[e.pluginName][t]&&n[e.pluginName][t](A({sortable:n},i)))})},initializePlugins:function(n,i,r,e){for(var t in K.forEach(function(e){var t=e.pluginName;(n.options[t]||e.initializeByDefault)&&((e=new e(n,i,n.options)).sortable=n,e.options=n.options,n[t]=e,h(r,e.defaults))}),n.options){var o;n.options.hasOwnProperty(t)&&(void 0!==(o=this.modifyOption(n,t,n.options[t]))&&(n.options[t]=o))}},getEventProperties:function(t,n){var i={};return K.forEach(function(e){"function"==typeof e.eventProperties&&h(i,e.eventProperties.call(n[e.pluginName],t))}),i},modifyOption:function(t,n,i){var r;return K.forEach(function(e){t[e.pluginName]&&e.optionListeners&&"function"==typeof e.optionListeners[n]&&(r=e.optionListeners[n].call(t[e.pluginName],i))}),r}};function J(e,t){var n=(i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).evt,i=p(i,ee);Z.pluginEvent.bind(qe)(e,t,A({dragEl:ae,parentEl:se,ghostEl:le,rootEl:ue,nextEl:ce,lastDownEl:fe,cloneEl:de,cloneHidden:he,dragStarted:Ee,putSortable:xe,activeSortable:qe.active,originalEvent:n,oldIndex:pe,oldDraggableIndex:ge,newIndex:me,newDraggableIndex:ve,hideGhostForTarget:re,unhideGhostForTarget:oe,cloneNowHidden:function(){he=!0},cloneNowShown:function(){he=!1},dispatchSortableEvent:function(e){te({sortable:t,name:e,originalEvent:n})}},i))}var ee=["evt"];function te(e){!function(e){var t=e.sortable,n=e.rootEl,i=e.name,r=e.targetEl,o=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,f=e.newDraggableIndex,d=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[G]){var m,g=t.options,e="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||b||w?(m=document.createEvent("Event")).initEvent(i,!0,!0):m=new CustomEvent(i,{bubbles:!0,cancelable:!0}),m.to=a||n,m.from=s||n,m.item=r||n,m.clone=o,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=c,m.newDraggableIndex=f,m.originalEvent=d,m.pullMode=h?h.lastPutMode:void 0;var v,y=A(A({},p),Z.getEventProperties(i,t));for(v in y)m[v]=y[v];n&&n.dispatchEvent(m),g[e]&&g[e].call(t,m)}}(A({putSortable:xe,cloneEl:de,targetEl:ae,rootEl:ue,oldIndex:pe,oldDraggableIndex:ge,newIndex:me,newDraggableIndex:ve},e))}function ne(e,t){var n=F(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=B(e,0,t),o=B(e,1,t),a=r&&F(r),s=o&&F(o),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+H(r).width,e=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+H(o).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&"none"!==a.float){t="left"===a.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==t?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||i<=l&&"none"===n[Re]||o&&"none"===n[Re]&&i<l+e)?"vertical":"horizontal"}function ie(e){function s(o,a){return function(e,t,n,i){var r=e.options.group.name&&t.options.group.name&&e.options.group.name===t.options.group.name;if(null==o&&(a||r))return!0;if(null==o||!1===o)return!1;if(a&&"clone"===o)return o;if("function"==typeof o)return s(o(e,t,n,i),a)(e,t,n,i);t=(a?e:t).options.group.name;return!0===o||"string"==typeof o&&o===t||o.join&&-1<o.indexOf(t)}}var t={},n=e.group;n&&"object"==d(n)||(n={name:n}),t.name=n.name,t.checkPull=s(n.pull,!0),t.checkPut=s(n.put),t.revertClone=n.revertClone,e.group=t}function re(){!_e&&le&&F(le,"display","none")}function oe(){!_e&&le&&F(le,"display","")}var ae,se,le,ue,ce,fe,de,he,pe,me,ge,ve,ye,xe,be,we,ke,Ce,Se,Le,Ee,Me,Te,De,Ae,Oe=!1,Ne=!1,Fe=[],Ie=!1,Pe=!1,He=[],$e=!1,ze=[],Be="undefined"!=typeof document,We=k,Re=w||b?"cssFloat":"float",je=Be&&!n&&!k&&"draggable"in document.createElement("div"),_e=function(){if(Be){if(b)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}();Be&&document.addEventListener("click",function(e){if(Ne)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ne=!1},!0);function Ye(e){if(ae){e=e.touches?e.touches[0]:e;var t=(r=e.clientX,o=e.clientY,Fe.some(function(e){var t=e[G].options.emptyInsertThreshold;if(t&&!W(e)){var n=H(e),i=r>=n.left-t&&r<=n.right+t,t=o>=n.top-t&&o<=n.bottom+t;return i&&t?a=e:void 0}}),a);if(t){var n,i={};for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);i.target=i.rootEl=t,i.preventDefault=void 0,i.stopPropagation=void 0,t[G]._onDragOver(i)}}var r,o,a}function Ue(e){ae&&ae.parentNode[G]._isOutsideThisEl(e.target)}function qe(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=h({},t),e[G]=this;var n,i,r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ne(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==qe.supportPointer&&"PointerEvent"in window&&!y,emptyInsertThreshold:5};for(n in Z.initializePlugins(this,e,r),r)n in t||(t[n]=r[n]);for(i in ie(t),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!t.forceFallback&&je,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?S(e,"pointerdown",this._onTapStart):(S(e,"mousedown",this._onTapStart),S(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(S(e,"dragover",this),S(e,"dragenter",this)),Fe.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),h(this,V())}function Xe(e,t,n,i,r,o,a,s){var l,u,c=e[G],f=c.options.onMove;return!window.CustomEvent||b||w?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=i,l.related=r||t,l.relatedRect=o||H(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),u=f?f.call(c,l,a):u}function Ge(e){e.draggable=!1}function Ve(){$e=!1}function Ke(e){return setTimeout(e,0)}function Qe(e){return clearTimeout(e)}qe.prototype={constructor:qe,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Me=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,ae):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,i=this.el,e=this.options,r=e.preventOnFilter,o=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(a||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,u=e.filter;if(!function(e){ze.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&ze.push(i)}}(i),!ae&&!(/mousedown|pointerdown/.test(o)&&0!==t.button||e.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!y||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=O(s,e.draggable,i,!1))&&s.animated||fe===s)){if(pe=R(s),ge=R(s,e.draggable),"function"==typeof u){if(u.call(this,t,s,this))return te({sortable:n,rootEl:l,name:"filter",targetEl:s,toEl:i,fromEl:i}),J("filter",n,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(u=u&&u.split(",").some(function(e){if(e=O(l,e.trim(),i,!1))return te({sortable:n,rootEl:e,name:"filter",targetEl:s,fromEl:i,toEl:i}),J("filter",n,{evt:t}),!0}))return void(r&&t.cancelable&&t.preventDefault());e.handle&&!O(l,e.handle,i,!1)||this._prepareDragStart(t,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;n&&!ae&&n.parentNode===o&&(i=H(n),ue=o,se=(ae=n).parentNode,ce=ae.nextSibling,fe=n,ye=a.group,be={target:qe.dragged=ae,clientX:(t||e).clientX,clientY:(t||e).clientY},Se=be.clientX-i.left,Le=be.clientY-i.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ae.style["will-change"]="all",i=function(){J("delayEnded",r,{evt:e}),qe.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!g&&r.nativeDraggable&&(ae.draggable=!0),r._triggerDragStart(e,t),te({sortable:r,name:"choose",originalEvent:e}),N(ae,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){I(ae,e.trim(),Ge)}),S(s,"dragover",Ye),S(s,"mousemove",Ye),S(s,"touchmove",Ye),S(s,"mouseup",r._onDrop),S(s,"touchend",r._onDrop),S(s,"touchcancel",r._onDrop),g&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ae.draggable=!0),J("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(w||b)?i():qe.eventCanceled?this._onDrop():(S(s,"mouseup",r._disableDelayedDrag),S(s,"touchend",r._disableDelayedDrag),S(s,"touchcancel",r._disableDelayedDrag),S(s,"mousemove",r._delayedDragTouchMoveHandler),S(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&S(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)))},_delayedDragTouchMoveHandler:function(e){e=e.touches?e.touches[0]:e;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ae&&Ge(ae),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._disableDelayedDrag),L(e,"touchend",this._disableDelayedDrag),L(e,"touchcancel",this._disableDelayedDrag),L(e,"mousemove",this._delayedDragTouchMoveHandler),L(e,"touchmove",this._delayedDragTouchMoveHandler),L(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?S(document,"pointermove",this._onTouchMove):S(document,t?"touchmove":"mousemove",this._onTouchMove):(S(ae,"dragend",this),S(ue,"dragstart",this._onDragStart));try{document.selection?Ke(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){var n;Oe=!1,ue&&ae?(J("dragStarted",this,{evt:t}),this.nativeDraggable&&S(document,"dragover",Ue),n=this.options,e||N(ae,n.dragClass,!1),N(ae,n.ghostClass,!0),qe.active=this,e&&this._appendGhost(),te({sortable:this,name:"start",originalEvent:t})):this._nulling()},_emulateDragOver:function(){if(we){this._lastX=we.clientX,this._lastY=we.clientY,re();for(var e=document.elementFromPoint(we.clientX,we.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(we.clientX,we.clientY))!==t;)t=e;if(ae.parentNode[G]._isOutsideThisEl(e),t)do{if(t[G])if(t[G]._onDragOver({clientX:we.clientX,clientY:we.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}while(t=(e=t).parentNode);oe()}},_onTouchMove:function(e){if(be){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=le&&D(le,!0),a=le&&o&&o.a,s=le&&o&&o.d,t=We&&Ae&&j(Ae),a=(r.clientX-be.clientX+i.x)/(a||1)+(t?t[0]-He[0]:0)/(a||1),s=(r.clientY-be.clientY+i.y)/(s||1)+(t?t[1]-He[1]:0)/(s||1);if(!qe.active&&!Oe){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}le&&(o?(o.e+=a-(ke||0),o.f+=s-(Ce||0)):o={a:1,b:0,c:0,d:1,e:a,f:s},o="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")"),F(le,"webkitTransform",o),F(le,"mozTransform",o),F(le,"msTransform",o),F(le,"transform",o),ke=a,Ce=s,we=r),e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!le){var e=this.options.fallbackOnBody?document.body:ue,t=H(ae,!0,We,!0,e),n=this.options;if(We){for(Ae=e;"static"===F(Ae,"position")&&"none"===F(Ae,"transform")&&Ae!==document;)Ae=Ae.parentNode;Ae!==document.body&&Ae!==document.documentElement?(Ae===document&&(Ae=P()),t.top+=Ae.scrollTop,t.left+=Ae.scrollLeft):Ae=P(),He=j(Ae)}N(le=ae.cloneNode(!0),n.ghostClass,!1),N(le,n.fallbackClass,!0),N(le,n.dragClass,!0),F(le,"transition",""),F(le,"transform",""),F(le,"box-sizing","border-box"),F(le,"margin",0),F(le,"top",t.top),F(le,"left",t.left),F(le,"width",t.width),F(le,"height",t.height),F(le,"opacity","0.8"),F(le,"position",We?"absolute":"fixed"),F(le,"zIndex","100000"),F(le,"pointerEvents","none"),qe.ghost=le,e.appendChild(le),F(le,"transform-origin",Se/parseInt(le.style.width)*100+"% "+Le/parseInt(le.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,i=e.dataTransfer,r=n.options;J("dragStart",this,{evt:e}),qe.eventCanceled?this._onDrop():(J("setupClone",this),qe.eventCanceled||((de=X(ae)).draggable=!1,de.style["will-change"]="",this._hideClone(),N(de,this.options.chosenClass,!1),qe.clone=de),n.cloneId=Ke(function(){J("clone",n),qe.eventCanceled||(n.options.removeCloneOnHide||ue.insertBefore(de,ae),n._hideClone(),te({sortable:n,name:"clone"}))}),t||N(ae,r.dragClass,!0),t?(Ne=!0,n._loopId=setInterval(n._emulateDragOver,50)):(L(document,"mouseup",n._onDrop),L(document,"touchend",n._onDrop),L(document,"touchcancel",n._onDrop),i&&(i.effectAllowed="move",r.setData&&r.setData.call(n,i,ae)),S(document,"drop",n),F(ae,"transform","translateZ(0)")),Oe=!0,n._dragStartId=Ke(n._dragStarted.bind(n,t,e)),S(document,"selectstart",n),Ee=!0,y&&F(document.body,"user-select","none"))},_onDragOver:function(n){var i,r,o,e,a=this.el,s=n.target,t=this.options,l=t.group,u=qe.active,c=ye===l,f=t.sort,d=xe||u,h=this,p=!1;if(!$e){if(void 0!==n.preventDefault&&n.cancelable&&n.preventDefault(),s=O(s,t.draggable,a,!0),E("dragOver"),qe.eventCanceled)return p;if(ae.contains(n.target)||s.animated&&s.animatingX&&s.animatingY||h._ignoreWhileAnimating===s)return T(!1);if(Ne=!1,u&&!t.disabled&&(c?f||(r=se!==ue):xe===this||(this.lastPutMode=ye.checkPull(this,u,ae,n))&&l.checkPut(this,u,ae,n))){if(o="vertical"===this._getDirection(n,s),i=H(ae),E("dragOverValid"),qe.eventCanceled)return p;if(r)return se=ue,M(),this._hideClone(),E("revert"),qe.eventCanceled||(ce?ue.insertBefore(ae,ce):ue.appendChild(ae)),T(!0);var m=W(a,t.draggable);if(!m||function(e,t,n){n=H(W(n.el,n.options.draggable));return t?e.clientX>n.right+10||e.clientX<=n.right&&e.clientY>n.bottom&&e.clientX>=n.left:e.clientX>n.right&&e.clientY>n.top||e.clientX<=n.right&&e.clientY>n.bottom+10}(n,o,this)&&!m.animated){if(m===ae)return T(!1);if((s=m&&a===n.target?m:s)&&(b=H(s)),!1!==Xe(ue,a,ae,i,s,b,n,!!s))return M(),a.appendChild(ae),se=a,D(),T(!0)}else if(m&&function(e,t,n){n=H(B(n.el,0,n.options,!0));return t?e.clientX<n.left-10||e.clientY<n.top&&e.clientX<n.right:e.clientY<n.top-10||e.clientY<n.bottom&&e.clientX<n.left}(n,o,this)){var g=B(a,0,t,!0);if(g===ae)return T(!1);if(b=H(s=g),!1!==Xe(ue,a,ae,i,s,b,n,!1))return M(),a.insertBefore(ae,g),se=a,D(),T(!0)}else if(s.parentNode===a){var v,y,x,b=H(s),w=ae.parentNode!==a,k=(k=ae.animated&&ae.toRect||i,L=s.animated&&s.toRect||b,C=(e=o)?k.left:k.top,l=e?k.right:k.bottom,m=e?k.width:k.height,g=e?L.left:L.top,k=e?L.right:L.bottom,L=e?L.width:L.height,!(C===g||l===k||C+m/2===g+L/2)),C=o?"top":"left",m=z(s,"top","top")||z(ae,"top","top"),g=m?m.scrollTop:void 0;if(Me!==s&&(y=b[C],Ie=!1,Pe=!k&&t.invertSwap||w),0!==(v=function(e,t,n,i,r,o,a,s){var l=i?e.clientY:e.clientX,u=i?n.height:n.width,e=i?n.top:n.left,i=i?n.bottom:n.right,n=!1;if(!a)if(s&&De<u*r){if(Ie=!Ie&&(1===Te?e+u*o/2<l:l<i-u*o/2)?!0:Ie)n=!0;else if(1===Te?l<e+De:i-De<l)return-Te}else if(e+u*(1-r)/2<l&&l<i-u*(1-r)/2)return function(e){return R(ae)<R(e)?1:-1}(t);if((n=n||a)&&(l<e+u*o/2||i-u*o/2<l))return e+u/2<l?1:-1;return 0}(n,s,b,o,k?1:t.swapThreshold,null==t.invertedSwapThreshold?t.swapThreshold:t.invertedSwapThreshold,Pe,Me===s)))for(var S=R(ae);(x=se.children[S-=v])&&("none"===F(x,"display")||x===le););if(0===v||x===s)return T(!1);Te=v;var L=(Me=s).nextElementSibling,w=!1,k=Xe(ue,a,ae,i,s,b,n,w=1===v);if(!1!==k)return 1!==k&&-1!==k||(w=1===k),$e=!0,setTimeout(Ve,30),M(),w&&!L?a.appendChild(ae):s.parentNode.insertBefore(ae,w?L:s),m&&q(m,0,g-m.scrollTop),se=ae.parentNode,void 0===y||Pe||(De=Math.abs(y-H(s)[C])),D(),T(!0)}if(a.contains(ae))return T(!1)}return!1}function E(e,t){J(e,h,A({evt:n,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:i,targetRect:b,canSort:f,fromSortable:d,target:s,completed:T,onMove:function(e,t){return Xe(ue,a,ae,i,e,H(e),n,t)},changed:D},t))}function M(){E("dragOverAnimationCapture"),h.captureAnimationState(),h!==d&&d.captureAnimationState()}function T(e){return E("dragOverCompleted",{insertion:e}),e&&(c?u._hideClone():u._showClone(h),h!==d&&(N(ae,(xe||u).options.ghostClass,!1),N(ae,t.ghostClass,!0)),xe!==h&&h!==qe.active?xe=h:h===qe.active&&xe&&(xe=null),d===h&&(h._ignoreWhileAnimating=s),h.animateAll(function(){E("dragOverAnimationComplete"),h._ignoreWhileAnimating=null}),h!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(s===ae&&!ae.animated||s===a&&!s.animated)&&(Me=null),t.dragoverBubble||n.rootEl||s===document||(ae.parentNode[G]._isOutsideThisEl(n.target),e||Ye(n)),!t.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),p=!0}function D(){me=R(ae),ve=R(ae,t.draggable),te({sortable:h,name:"change",toEl:a,newIndex:me,newDraggableIndex:ve,originalEvent:n})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){L(document,"mousemove",this._onTouchMove),L(document,"touchmove",this._onTouchMove),L(document,"pointermove",this._onTouchMove),L(document,"dragover",Ye),L(document,"mousemove",Ye),L(document,"touchmove",Ye)},_offUpEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._onDrop),L(e,"touchend",this._onDrop),L(e,"pointerup",this._onDrop),L(e,"touchcancel",this._onDrop),L(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;me=R(ae),ve=R(ae,n.draggable),J("drop",this,{evt:e}),se=ae&&ae.parentNode,me=R(ae),ve=R(ae,n.draggable),qe.eventCanceled||(Ie=Pe=Oe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Qe(this.cloneId),Qe(this._dragStartId),this.nativeDraggable&&(L(document,"drop",this),L(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),y&&F(document.body,"user-select",""),F(ae,"transform",""),e&&(Ee&&(e.cancelable&&e.preventDefault(),n.dropBubble||e.stopPropagation()),le&&le.parentNode&&le.parentNode.removeChild(le),(ue===se||xe&&"clone"!==xe.lastPutMode)&&de&&de.parentNode&&de.parentNode.removeChild(de),ae&&(this.nativeDraggable&&L(ae,"dragend",this),Ge(ae),ae.style["will-change"]="",Ee&&!Oe&&N(ae,(xe||this).options.ghostClass,!1),N(ae,this.options.chosenClass,!1),te({sortable:this,name:"unchoose",toEl:se,newIndex:null,newDraggableIndex:null,originalEvent:e}),ue!==se?(0<=me&&(te({rootEl:se,name:"add",toEl:se,fromEl:ue,originalEvent:e}),te({sortable:this,name:"remove",toEl:se,originalEvent:e}),te({rootEl:se,name:"sort",toEl:se,fromEl:ue,originalEvent:e}),te({sortable:this,name:"sort",toEl:se,originalEvent:e})),xe&&xe.save()):me!==pe&&0<=me&&(te({sortable:this,name:"update",toEl:se,originalEvent:e}),te({sortable:this,name:"sort",toEl:se,originalEvent:e})),qe.active&&(null!=me&&-1!==me||(me=pe,ve=ge),te({sortable:this,name:"end",toEl:se,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){J("nulling",this),ue=ae=se=le=ce=de=fe=he=be=we=Ee=me=ve=pe=ge=Me=Te=xe=ye=qe.dragged=qe.ghost=qe.clone=qe.active=null,ze.forEach(function(e){e.checked=!0}),ze.length=ke=Ce=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":ae&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,i=0,r=n.length,o=this.options;i<r;i++)O(e=n[i],o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||function(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;for(;n--;)i+=t.charCodeAt(n);return i.toString(36)}(e));return t},sort:function(e,t){var n={},i=this.el;this.toArray().forEach(function(e,t){t=i.children[t];O(t,this.options.draggable,i,!1)&&(n[e]=t)},this),t&&this.captureAnimationState(),e.forEach(function(e){n[e]&&(i.removeChild(n[e]),i.appendChild(n[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return O(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var i=Z.modifyOption(this,e,t);n[e]=void 0!==i?i:t,"group"===e&&ie(n)},destroy:function(){J("destroy",this);var e=this.el;e[G]=null,L(e,"mousedown",this._onTapStart),L(e,"touchstart",this._onTapStart),L(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(L(e,"dragover",this),L(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Fe.splice(Fe.indexOf(this.el),1),this.el=e=null},_hideClone:function(){he||(J("hideClone",this),qe.eventCanceled||(F(de,"display","none"),this.options.removeCloneOnHide&&de.parentNode&&de.parentNode.removeChild(de),he=!0))},_showClone:function(e){"clone"===e.lastPutMode?he&&(J("showClone",this),qe.eventCanceled||(ae.parentNode!=ue||this.options.group.revertClone?ce?ue.insertBefore(de,ce):ue.appendChild(de):ue.insertBefore(de,ae),this.options.group.revertClone&&this.animate(ae,de),F(de,"display",""),he=!1)):this._hideClone()}},Be&&S(document,"touchmove",function(e){(qe.active||Oe)&&e.cancelable&&e.preventDefault()}),qe.utils={on:S,off:L,css:F,find:I,is:function(e,t){return!!O(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:U,closest:O,toggleClass:N,clone:X,index:R,nextTick:Ke,cancelNextTick:Qe,detectDirection:ne,getChild:B},qe.get=function(e){return e[G]},qe.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];(t=t[0].constructor===Array?t[0]:t).forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(qe.utils=A(A({},qe.utils),e.utils)),Z.mount(e)})},qe.create=function(e,t){return new qe(e,t)};var Ze,Je,et,tt,nt,it,rt=[],ot=!(qe.version="1.14.0");function at(){rt.forEach(function(e){clearInterval(e.pid)}),rt=[]}function st(){clearInterval(it)}var lt=U(function(n,e,t,i){if(e.scroll){var r,o=(n.touches?n.touches[0]:n).clientX,a=(n.touches?n.touches[0]:n).clientY,s=e.scrollSensitivity,l=e.scrollSpeed,u=P(),c=!1;Je!==t&&(Je=t,at(),Ze=e.scroll,r=e.scrollFn,!0===Ze&&(Ze=_(t,!0)));var f=0,d=Ze;do{var h=d,p=H(h),m=p.top,g=p.bottom,v=p.left,y=p.right,x=p.width,b=p.height,w=void 0,k=void 0,C=h.scrollWidth,S=h.scrollHeight,L=F(h),E=h.scrollLeft,p=h.scrollTop,k=h===u?(w=x<C&&("auto"===L.overflowX||"scroll"===L.overflowX||"visible"===L.overflowX),b<S&&("auto"===L.overflowY||"scroll"===L.overflowY||"visible"===L.overflowY)):(w=x<C&&("auto"===L.overflowX||"scroll"===L.overflowX),b<S&&("auto"===L.overflowY||"scroll"===L.overflowY)),E=w&&(Math.abs(y-o)<=s&&E+x<C)-(Math.abs(v-o)<=s&&!!E),p=k&&(Math.abs(g-a)<=s&&p+b<S)-(Math.abs(m-a)<=s&&!!p);if(!rt[f])for(var M=0;M<=f;M++)rt[M]||(rt[M]={});rt[f].vx==E&&rt[f].vy==p&&rt[f].el===h||(rt[f].el=h,rt[f].vx=E,rt[f].vy=p,clearInterval(rt[f].pid),0==E&&0==p||(c=!0,rt[f].pid=setInterval(function(){i&&0===this.layer&&qe.active._onTouchMove(nt);var e=rt[this.layer].vy?rt[this.layer].vy*l:0,t=rt[this.layer].vx?rt[this.layer].vx*l:0;"function"==typeof r&&"continue"!==r.call(qe.dragged.parentNode[G],t,e,n,nt,rt[this.layer].el)||q(rt[this.layer].el,t,e)}.bind({layer:f}),24))),f++}while(e.bubbleScroll&&d!==u&&(d=_(d,!1)));ot=c}},30),k=function(e){var t=e.originalEvent,n=e.putSortable,i=e.dragEl,r=e.activeSortable,o=e.dispatchSortableEvent,a=e.hideGhostForTarget,e=e.unhideGhostForTarget;t&&(r=n||r,a(),t=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,t=document.elementFromPoint(t.clientX,t.clientY),e(),r&&!r.el.contains(t)&&(o("spill"),this.onSpill({dragEl:i,putSortable:n})))};function ut(){}function ct(){}function ft(e){var i=e.classList.contains("input-array-associative"),n=e.getAttribute("data-name");function r(e){var t;i&&((t=$(".input-array-key",e)).value="",t.removeAttribute("value")),(e=$(".input-array-value",e)).value="",e.removeAttribute("value"),e.name=n+"[]"}function o(e){var t=$(".input-array-key",e);$(".input-array-value",e).name=n+"["+t.value.trim()+"]"}function a(e){var t=$(".input-array-add",e),n=$(".input-array-remove",e);t.addEventListener("click",function(e){var t=e.cloneNode(!0);r(t),a(t),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t)}.bind(t,e)),n.addEventListener("click",function(e){1<$$(".input-array-row",e.parentNode).length?e.parentNode.removeChild(e):r(e)}.bind(n,e)),i&&(t=$(".input-array-key",e),n=$(".input-array-value",e),t.addEventListener("keyup",o.bind(t,e)),n.addEventListener("keyup",o.bind(n,e)))}$$(".input-array-row",e).forEach(function(e){a(e)}),qe.create(e,{handle:".sort-handle",forceFallback:!0})}function dt(a,f){var d,h,p,e=new Date;function i(e){var t=new Date(d.year,d.month,d.day,d.hours,d.minutes);r(d.year,d.month,d.day),n(d.hours,d.minutes),e.value=h.formatDateTime(t),e.setAttribute("data-date",t)}function m(){return document.activeElement.classList.contains("input-date")?document.activeElement:null}function n(e,t){var n="",i=h.has12HourFormat(f.format)?12:24;f.time&&(12==i&&(n=e<12?"AM":"PM"),e=12==i?h.mod(e,12)||12:e,$(".calendar-hours",p).innerHTML=h.pad(e,2),$(".calendar-minutes",p).innerHTML=h.pad(t,2),$(".calendar-meridiem",p).innerHTML=n)}function r(e,t,n){var i,r,o=1,a=new Date(e,t,1).getDay(),s=h.daysInMonth(t,e),l=f.labels.months.long[t],u=h.mod(a-f.weekStarts,7),c="";for(c+='<tr><th class="calendar-header" colspan="7">',c+=l+"&nbsp;"+e,c+="</th></tr>",c+="<tr>",i=0;i<7;i++)c+='<td class="calendar-header-day">',c+=f.labels.weekdays.short[h.mod(i+f.weekStarts,7)],c+="</td>";for(c+="</tr><tr>",i=0;i<6;i++){for(r=0;r<7;r++)o<=s&&(0<i||u<=r)?(c+=o===n?'<td class="calendar-day selected">':'<td class="calendar-day">',c+=o++):1===o?(c+='<td class="calendar-prev-month-day">',c+=h.daysInMonth(h.mod(t-1,12),e)-u+r+1):(c+='<td class="calendar-next-month-day">',c+=o++-s),c+="</td>";c+="</tr><tr>"}c+="</tr>",$(".calendar-table",p).innerHTML=c,$$(".calendar-day",p).forEach(function(e){e.addEventListener("mousedown",function(e){e.stopPropagation(),e.preventDefault()}),e.addEventListener("click",function(){var e=m(),t=new Date(d.year,d.month,parseInt(this.textContent));e.setAttribute("data-date",t),e.value=h.formatDateTime(t),e.blur()})})}function t(){var e,t,n,i,r,o;(a=m())&&"block"===p.style.display&&(i=(n=a.getBoundingClientRect()).top+window.pageYOffset,r=n.left+window.pageXOffset,p.style.top=i+a.offsetHeight+"px",p.style.left=r+a.offsetLeft+"px",e=(o=p.getBoundingClientRect()).top+window.pageYOffset,t=o.left+window.pageXOffset,n=x.outerWidth(p),i=x.outerHeight(p),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,r<t+n&&(p.style.left=r-n+"px"),(e<window.pageYOffset||window.pageYOffset<e+i-o)&&window.scrollTo(window.pageXOffset,e+i-o))}f=x.extendObject({},{weekStarts:0,format:"YYYY-MM-DD",time:!1,labels:{today:"Today",weekdays:{long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},months:{long:["January","February","March","April","May","June","July","August","September","October","November","December"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}}},f),d={year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),setDate:function(e){this.year=e.getFullYear(),this.month=e.getMonth(),this.day=e.getDate(),this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds()},lastDay:function(){this.day=h.daysInMonth(this.month,this.year)},prevYear:function(){this.year--},nextYear:function(){this.year++},prevMonth:function(){this.month=h.mod(this.month-1,12),11===this.month&&this.prevYear(),this.day>h.daysInMonth(this.month,this.year)&&this.lastDay()},nextMonth:function(){this.month=h.mod(this.month+1,12),0===this.month&&this.nextYear(),this.day>h.daysInMonth(this.month,this.year)&&this.lastDay()},prevWeek:function(){this.day-=7,this.day<1&&(this.prevMonth(),this.day+=h.daysInMonth(this.month,this.year))},nextWeek:function(){this.day+=7,this.day>h.daysInMonth(this.month,this.year)&&(this.day-=h.daysInMonth(this.month,this.year),this.nextMonth())},prevDay:function(){this.day--,this.day<1&&(this.prevMonth(),this.lastDay())},nextDay:function(){this.day++,this.day>h.daysInMonth(this.month,this.year)&&(this.nextMonth(),this.day=1)},nextHour:function(){this.hours=h.mod(this.hours+1,24),0===this.hours&&this.nextDay()},prevHour:function(){this.hours=h.mod(this.hours-1,24),23===this.hours&&this.prevDay()},nextMinute:function(){this.minutes=h.mod(this.minutes+1,60),0===this.minutes&&this.nextHour()},prevMinute:function(){this.minutes=h.mod(this.minutes-1,60),59===this.minutes&&this.prevHour()},nextSecond:function(){this.seconds=h.mod(this.seconds+1,60),0===this.seconds&&this.nextMinute()},prevSecond:function(){this.seconds=h.mod(this.seconds-1,60),59===this.minutes&&this.prevMinute()}},h={_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],mod:function(e,t){return e-t*Math.floor(e/t)},pad:function(e,t){for(var n=e.toString();n.length<t;)n="0"+n;return n},isValidDate:function(e){return e&&!isNaN(Date.parse(e))},isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},daysInMonth:function(e,t){return 1===e&&this.isLeapYear(t)?29:this._daysInMonth[e]},weekStart:function(e,t){var n=e.getDate();return void 0===t&&(t=f.weekStarts),n-=this.mod(e.getDay()-t,7),new Date(e.getFullYear(),e.getMonth(),n)},weekNumberingYear:function(e){var t=e.getFullYear(),n=this.weekStart(new Date(t,0,4),1),i=this.weekStart(new Date(t+1,0,4),1);return e.getTime()>=i.getTime()?t+1:e.getTime()>=n.getTime()?t:t-1},weekOfYear:function(e){var t=this.weekNumberingYear(e),t=this.weekStart(new Date(t,0,4),1),e=this.weekStart(e,1);return Math.round((e.getTime()-t.getTime())/6048e5)+1},has12HourFormat:function(e){e=e.match(/\[([^\]]*)\]|H{1,2}/);return null!==e&&"H"===e[0][0]},formatDateTime:function(n,e){var i=this;function r(e){var t=0<e?"-":"+",n=Math.floor(Math.abs(e)/60),e=Math.abs(e)%60;return[t+h.pad(n,2),h.pad(e,2)]}return(e=void 0===e?f.format:e).replace(/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g,function(e,t){switch(e){case"YY":return n.getFullYear().toString().substr(-2);case"YYYY":return n.getFullYear();case"M":return n.getMonth()+1;case"MM":return i.pad(n.getMonth()+1,2);case"MMM":return f.labels.months.short[n.getMonth()];case"MMMM":return f.labels.months.long[n.getMonth()];case"D":return n.getDate();case"DD":return i.pad(n.getDate(),2);case"DDD":return f.labels.weekdays.short[i.mod(n.getDay()+f.weekStarts,7)];case"DDDD":return f.labels.weekdays.long[i.mod(n.getDay()+f.weekStarts,7)];case"W":return i.weekOfYear(n);case"WW":return i.pad(i.weekOfYear(n),2);case"RR":return i.weekNumberingYear(n).toString().substr(-2);case"RRRR":return i.weekNumberingYear(n);case"H":return i.mod(n.getHours(),12)||12;case"HH":return i.pad(i.mod(n.getHours(),12)||12,2);case"h":return n.getHours();case"hh":return i.pad(n.getHours(),2);case"m":return n.getMinutes();case"mm":return i.pad(n.getMinutes(),2);case"s":return n.getSeconds();case"ss":return i.pad(n.getSeconds(),2);case"uuu":return i.pad(n.getMilliseconds(),3);case"A":return n.getHours()<12?"AM":"PM";case"a":return n.getHours()<12?"am":"pm";case"Z":return r(n.getTimezoneOffset()).join(":");case"z":return r(n.getTimezoneOffset()).join("");default:return t||e}})}},p=$(".calendar")?$(".calendar"):function(){(p=document.createElement("div")).className="calendar",p.innerHTML='<div class="calendar-buttons"><button type="button" class="prevMonth"></button><button class="currentMonth">'+f.labels.today+'</button><button type="button" class="nextMonth"></button></div><div class="calendar-separator"></div><table class="calendar-table"></table>',!0===f.time&&(p.innerHTML+='<div class="calendar-separator"></div><table class="calendar-time"><tr><td><button type="button" class="nextHour"></button></td><td></td><td><button type="button" class="nextMinute"></button></td></tr><tr><td class="calendar-hours"></td><td>:</td><td class="calendar-minutes"></td><td class="calendar-meridiem"></td></tr><tr><td><button type="button" class="prevHour"></button></td><td></td><td><button type="button" class="prevMinute"></button></td></tr></table></div>',u.inject("chevron-down",$(".prevHour",p)),u.inject("chevron-up",$(".nextHour",p)),u.inject("chevron-down",$(".prevMinute",p)),u.inject("chevron-up",$(".nextMinute",p)),x.longClick($(".nextHour",p),function(e){d.nextHour(),i(a),e.preventDefault()},750,250),x.longClick($(".prevHour",p),function(e){d.prevHour(),i(a),e.preventDefault()},750,250),x.longClick($(".nextMinute",p),function(e){d.nextMinute(),i(a),e.preventDefault()},750,250),x.longClick($(".prevMinute",p),function(e){d.prevMinute(),i(a),e.preventDefault()},750,250));return document.body.appendChild(p),u.inject("calendar-clock",$(".currentMonth",p)),u.inject("chevron-left",$(".prevMonth",p)),u.inject("chevron-right",$(".nextMonth",p)),$(".currentMonth",p).addEventListener("mousedown",function(e){var t=m(),n=new Date;d.setDate(n),i(t),t.blur(),e.preventDefault()}),x.longClick($(".prevMonth",p),function(e){d.prevMonth(),i(a),e.preventDefault()},750,500),x.longClick($(".nextMonth",p),function(e){d.nextMonth(),i(a),e.preventDefault()},750,500),window.addEventListener("mousedown",function(e){"none"!==p.style.display&&e.target.closest(".calendar")&&e.preventDefault()}),window.addEventListener("resize",x.throttle(t,100)),p}(),function(){var e=a.value;a.readOnly=!0,a.size=f.format.length,h.isValidDate(e)&&(e=new Date(e),a.setAttribute("data-date",e),a.value=h.formatDateTime(e));a.addEventListener("change",function(){""===this.value?this.setAttribute("data-date",""):this.value=h.formatDateTime(this.getAttribute("data-date"))}),a.addEventListener("keydown",function(e){var t=this.getAttribute("data-date");switch(d.setDate(h.isValidDate(t)?new Date(t):new Date),e.which){case 13:$(".calendar-day.selected",p).click(),p.style.display="none";break;case 8:this.value="",this.blur(),p.style.display="none";break;case 27:this.blur(),p.style.display="none";break;case 37:e.ctrlKey||e.metaKey?e.shiftKey?d.prevYear():d.prevMonth():d.prevDay(),i(this);break;case 38:d.prevWeek(),i(this);break;case 39:e.ctrlKey||e.metaKey?e.shiftKey?d.nextYear():d.nextMonth():d.nextDay(),i(this);break;case 40:d.nextWeek(),i(this);break;case 48:(e.ctrlKey||e.metaKey)&&d.setDate(new Date),i(this);break;default:return}e.stopPropagation(),e.preventDefault()}),a.addEventListener("focus",function(){var e=h.isValidDate(this.getAttribute("data-date"))?new Date(this.getAttribute("data-date")):new Date;d.setDate(e),r(d.year,d.month,d.day),n(d.hours,d.minutes),p.style.display="block",t()}),a.addEventListener("blur",function(){p.style.display="none"})}()}function ht(s,l){var u,c,f={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1},d={},h={};function p(e,t){var n,i={};for(n in e=x.toSafeInteger(e),void 0===t&&(t=l.intervals),f)Object.prototype.hasOwnProperty.call(f,n)&&-1!==t.indexOf(n)&&(i[n]=Math.floor(e/f[n]),e-=i[n]*f[n]);return i}function m(){var e,t={},n=0,i=0;for(i in d)Object.prototype.hasOwnProperty.call(d,i)&&(t[i]=d[i].value);n=function(e){var t,n=0;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(f,t)&&(n+=e[t]*f[t]);return x.toSafeInteger(n)}(t),c.step&&(e=c.step*f[l.unit],n=Math.floor(n/e)*e),c.min&&(n=Math.max(n,c.min)),c.max&&(n=Math.min(n,c.max)),c.value=Math.round(n/f[l.unit])}function g(){for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(d[e].style.width=Math.max(3,d[e].value.length+2)+"ch")}function v(){for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(h[e].innerHTML=l.labels[e][1===parseInt(d[e].value)?0:1])}l=x.extendObject({},{unit:"seconds",intervals:["years","months","weeks","days","hours","minutes","seconds"],labels:{years:["year","years"],months:["month","months"],weeks:["week","weeks"],days:["day","days"],hours:["hour","hours"],minutes:["minute","minutes"],seconds:["second","seconds"]}},l),function(){var e,t;(c=document.createElement("input")).className="input-duration-hidden",c.name=s.name,c.id=s.id,c.type="text",c.value=s.value,c.readOnly=!0,c.hidden=!0,s.min&&(c.min=s.min);s.max&&(c.max=s.max);s.step&&(c.step=s.step);s.required&&(c.required=!0);s.disabled&&(c.disabled=!0);s.hasAttribute("data-intervals")&&(l.intervals=s.getAttribute("data-intervals").split(", "));s.hasAttribute("data-unit")&&(l.unit=s.getAttribute("data-unit"));e=s.value*f[l.unit],t=s.step*f[l.unit],t=function(e,t){var n,i,r,o,a;for((u=document.createElement("div")).className="input-duration",a=0;a<l.intervals.length;a++)i=l.intervals[a],(n=document.createElement("span")).className="duration-"+i,(r=document.createElement("input")).type="number",r.value=e[i]||0,r.style.width=Math.max(3,r.value.length+2)+"ch",1<t[i]&&(r.step=t[i]),s.disabled&&(r.disabled=!0),(d[i]=r).addEventListener("input",function(){for(;"0"===this.value.charAt(0)&&1<this.value.length&&!this.value.charAt(1).match(/[.,]/);)this.value=this.value.slice(1);for(;this.value>x.getMaxSafeInteger();)this.value=this.value.slice(0,-1);g(),m(),v()}),r.addEventListener("blur",function(){m(),function(){var e,t=p(c.value*f[l.unit]);for(e in d)Object.prototype.hasOwnProperty.call(d,e)&&(d[e].value=t[e])}(),g(),v()}),r.addEventListener("focus",function(){u.classList.add("focused")}),r.addEventListener("blur",function(){u.classList.remove("focused")}),n.addEventListener("mousedown",function(e){var t=$("input",this);t&&e.target!==t&&(t.focus(),e.preventDefault())}),(o=document.createElement("label")).innerHTML=l.labels[i][1===parseInt(r.value)?0:1],h[i]=o,n.appendChild(r),n.appendChild(o),u.appendChild(n);return u.addEventListener("mousedown",function(e){e.target===this&&(r.focus(),e.preventDefault())}),u}(p(e||0),p(t||1)),s.parentNode.replaceChild(t,s),t.appendChild(c)}()}ut.prototype={startIndex:null,dragStart:function(e){e=e.oldDraggableIndex;this.startIndex=e},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();e=B(this.sortable.el,this.startIndex,this.options);e?this.sortable.el.insertBefore(t,e):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:k},h(ut,{pluginName:"revertOnSpill"}),ct.prototype={onSpill:function(e){var t=e.dragEl,e=e.putSortable||this.sortable;e.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),e.animateAll()},drop:k},h(ct,{pluginName:"removeOnSpill"}),qe.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){e=e.originalEvent;this.sortable.nativeDraggable?S(document,"dragover",this._handleAutoScroll):this.options.supportPointer?S(document,"pointermove",this._handleFallbackAutoScroll):e.touches?S(document,"touchmove",this._handleFallbackAutoScroll):S(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){e=e.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?L(document,"dragover",this._handleAutoScroll):(L(document,"pointermove",this._handleFallbackAutoScroll),L(document,"touchmove",this._handleFallbackAutoScroll),L(document,"mousemove",this._handleFallbackAutoScroll)),st(),at(),clearTimeout(M),M=void 0},nulling:function(){nt=Je=Ze=ot=it=et=tt=null,rt.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(t,n){var i,r=this,o=(t.touches?t.touches[0]:t).clientX,a=(t.touches?t.touches[0]:t).clientY,e=document.elementFromPoint(o,a);nt=t,n||this.options.forceAutoScrollFallback||w||b||y?(lt(t,this.options,e,n),i=_(e,!0),!ot||it&&o===et&&a===tt||(it&&st(),it=setInterval(function(){var e=_(document.elementFromPoint(o,a),!0);e!==i&&(i=e,at()),lt(t,r.options,e,n)},10),et=o,tt=a)):this.options.bubbleScroll&&_(e,!0)!==P()?lt(t,this.options,_(e,!1),!1):at()}},h(e,{pluginName:"scroll",initializeByDefault:!0})}),qe.mount(ct,ut);var pt,k={exports:{}},mt=k.exports=function(){var e=navigator.userAgent,t=navigator.platform,g=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),r=/Edge\/(\d+)/.exec(e),S=n||i||r,w=S&&(n?document.documentMode||6:+(r||i)[1]),v=!r&&/WebKit\//.test(e),o=v&&/Qt\/\d+\.\d+/.test(e),a=!r&&/Chrome\//.test(e),y=/Opera\//.test(e),c=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),l=/PhantomJS/.test(e),u=c&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),f=/Android/.test(e),d=u||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),x=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),m=y&&e.match(/Version\/(\d*\.\d*)/);if(m)m=Number(m[1]);if(m&&m>=15){y=false;v=true}var b=x&&(o||y&&(m==null||m<12.11)),k=g||S&&w>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L=function(e,t){var n=e.className;var i=C(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}},E;function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return M(e).appendChild(t)}function O(e,t,n,i){var r=document.createElement(e);if(n)r.className=n;if(i)r.style.cssText=i;if(typeof t=="string")r.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)r.appendChild(t[o]);return r}function D(e,t,n,i){var r=O(e,t,n,i);r.setAttribute("role","presentation");return r}if(document.createRange)E=function(e,t,n,i){var r=document.createRange();r.setEnd(i||e,n);r.setStart(e,t);return r};else E=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(e){return i}i.collapse(true);i.moveEnd("character",n);i.moveStart("character",t);return i};function A(e,t){if(t.nodeType==3)t=t.parentNode;if(e.contains)return e.contains(t);do{if(t.nodeType==11)t=t.host;if(t==e)return true}while(t=t.parentNode)}function N(){var t;try{t=document.activeElement}catch(e){t=document.body||null}while(t&&t.shadowRoot&&t.shadowRoot.activeElement)t=t.shadowRoot.activeElement;return t}function F(e,t){var n=e.className;if(!C(t).test(n))e.className+=(n?" ":"")+t}function I(e,t){var n=e.split(" ");for(var i=0;i<n.length;i++)if(n[i]&&!C(n[i]).test(t))t+=" "+n[i];return t}var P=function(e){e.select()};if(u)P=function(e){e.selectionStart=0;e.selectionEnd=e.value.length};else if(S)P=function(e){try{e.select()}catch(e){}};function H(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function $(e,t,n){if(!t)t={};for(var i in e)if(e.hasOwnProperty(i)&&(n!==false||!t.hasOwnProperty(i)))t[i]=e[i];return t}function z(e,t,n,i,r){if(t==null){t=e.search(/[^\s\u00a0]/);if(t==-1)t=e.length}for(var o=i||0,a=r||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return a+(t-o);a+=s-o;a+=n-a%n;o=s+1}}var B=function(){this.id=null;this.f=null;this.time=0;this.handler=H(this.onTimeout,this)};function W(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}B.prototype.onTimeout=function(e){e.id=0;if(e.time<=+new Date)e.f();else setTimeout(e.handler,e.time-+new Date)},B.prototype.set=function(e,t){this.f=t;var n=+new Date+e;if(!this.id||n<this.time){clearTimeout(this.id);this.id=setTimeout(this.handler,e);this.time=n}};var R=50,j={toString:function(){return"CodeMirror.Pass"}},_={scroll:false},Y={origin:"*mouse"},U={origin:"+move"};function q(e,t,n){for(var i=0,r=0;;){var o=e.indexOf("\t",i);if(o==-1)o=e.length;var a=o-i;if(o==e.length||r+a>=t)return i+Math.min(a,t-r);r+=o-i;r+=n-r%n;i=o+1;if(r>=t)return i}}var X=[""];function G(e){while(X.length<=e)X.push(V(X)+" ");return X[e]}function V(e){return e[e.length-1]}function K(e,t){var n=[];for(var i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Q(e,t,n){var i=0,r=n(t);while(i<e.length&&n(e[i])<=r)i++;e.splice(i,0,t)}function Z(){}function J(e,t){var n;if(Object.create)n=Object.create(e);else{Z.prototype=e;n=new Z}if(t)$(t,n);return n}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){if(!t)return te(e);if(t.source.indexOf("\\w")>-1&&te(e))return true;return t.test(e)}function ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return false;return true}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function oe(e){return e.charCodeAt(0)>=768&&re.test(e)}function ae(e,t,n){while((n<0?t>0:t<e.length)&&oe(e.charAt(t)))t+=n;return t}function se(e,t,n){var i=t>n?-1:1;for(;;){if(t==n)return t;var r=(t+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==t)return e(o)?t:n;if(e(o))n=o;else t=o+i}}function le(e,t,n,i){if(!e)return i(t,n,"ltr",0);var r=false;for(var o=0;o<e.length;++o){var a=e[o];if(a.from<n&&a.to>t||t==n&&a.to==t){i(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o);r=true}}if(!r)i(t,n,"ltr")}var ue=null;function ce(e,t,n){var i;ue=null;for(var r=0;r<e.length;++r){var o=e[r];if(o.from<t&&o.to>t)return r;if(o.to==t)if(o.from!=o.to&&n=="before")i=r;else ue=r;if(o.from==t)if(o.from!=o.to&&n!="before")i=r;else ue=r}return i!=null?i:ue}var fe=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function z(e){if(e<=247)return t.charAt(e);else if(1424<=e&&e<=1524)return"R";else if(1536<=e&&e<=1785)return n.charAt(e-1536);else if(1774<=e&&e<=2220)return"r";else if(8192<=e&&e<=8203)return"w";else if(e==8204)return"b";else return"L"}var B=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var W=/[stwN]/,R=/[LRr]/,j=/[Lb1n]/,_=/[1n]/;function Y(e,t,n){this.level=e;this.from=t;this.to=n}return function(e,t){var n=t=="ltr"?"L":"R";if(e.length==0||t=="ltr"&&!B.test(e))return false;var i=e.length,r=[];for(var o=0;o<i;++o)r.push(z(e.charCodeAt(o)));for(var a=0,s=n;a<i;++a){var l=r[a];if(l=="m")r[a]=s;else s=l}for(var u=0,c=n;u<i;++u){var f=r[u];if(f=="1"&&c=="r")r[u]="n";else if(R.test(f)){c=f;if(f=="r")r[u]="R"}}for(var d=1,h=r[0];d<i-1;++d){var p=r[d];if(p=="+"&&h=="1"&&r[d+1]=="1")r[d]="1";else if(p==","&&h==r[d+1]&&(h=="1"||h=="n"))r[d]=h;h=p}for(var m=0;m<i;++m){var g=r[m];if(g==",")r[m]="N";else if(g=="%"){var v=void 0;for(v=m+1;v<i&&r[v]=="%";++v);var y=m&&r[m-1]=="!"||v<i&&r[v]=="1"?"1":"N";for(var x=m;x<v;++x)r[x]=y;m=v-1}}for(var b=0,w=n;b<i;++b){var k=r[b];if(w=="L"&&k=="1")r[b]="L";else if(R.test(k))w=k}for(var C=0;C<i;++C)if(W.test(r[C])){var S=void 0;for(S=C+1;S<i&&W.test(r[S]);++S);var L=(C?r[C-1]:n)=="L";var E=(S<i?r[S]:n)=="L";var M=L==E?L?"L":"R":n;for(var T=C;T<S;++T)r[T]=M;C=S-1}var D=[],A;for(var O=0;O<i;)if(j.test(r[O])){var N=O;for(++O;O<i&&j.test(r[O]);++O);D.push(new Y(0,N,O))}else{var F=O,I=D.length,P=t=="rtl"?1:0;for(++O;O<i&&r[O]!="L";++O);for(var H=F;H<O;)if(_.test(r[H])){if(F<H){D.splice(I,0,new Y(1,F,H));I+=P}var $=H;for(++H;H<O&&_.test(r[H]);++H);D.splice(I,0,new Y(2,$,H));I+=P;F=H}else++H;if(F<O)D.splice(I,0,new Y(1,F,O))}if(t=="ltr"){if(D[0].level==1&&(A=e.match(/^\s+/))){D[0].from=A[0].length;D.unshift(new Y(0,0,A[0].length))}if(V(D).level==1&&(A=e.match(/\s+$/))){V(D).to-=A[0].length;D.push(new Y(0,i-A[0].length,i))}}return t=="rtl"?D.reverse():D}}();function de(e,t){var n=e.order;if(n==null)n=e.order=fe(e.text,t);return n}var he=[],pe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,false);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||he).concat(n)}};function me(e,t){return e._handlers&&e._handlers[t]||he}function ge(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,false);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,r=i&&i[t];if(r){var o=W(r,n);if(o>-1)i[t]=r.slice(0,o).concat(r.slice(o+1))}}}function ve(e,t){var n=me(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2);for(var r=0;r<n.length;++r)n[r].apply(null,i)}function ye(e,t,n){if(typeof t=="string")t={type:t,preventDefault:function(){this.defaultPrevented=true}};ve(e,n||t.type,e,t);return Se(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(var i=0;i<t.length;++i)if(W(n,t[i])==-1)n.push(t[i])}function be(e,t){return me(e,t).length>0}function we(e){e.prototype.on=function(e,t){pe(this,e,t)};e.prototype.off=function(e,t){ge(this,e,t)}}function ke(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false}function Ce(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true}function Se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Le(e){ke(e);Ce(e)}function Ee(e){return e.target||e.srcElement}function Me(e){var t=e.which;if(t==null)if(e.button&1)t=1;else if(e.button&2)t=3;else if(e.button&4)t=2;if(x&&e.ctrlKey&&t==1)t=3;return t}var Te=function(){if(S&&w<9)return false;var e=O("div");return"draggable"in e||"dragDrop"in e}(),De,Ae;function Oe(e){if(De==null){var t=O("span","​");T(e,O("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0)De=t.offsetWidth<=1&&t.offsetHeight>2&&!(S&&w<8)}var n=De?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");n.setAttribute("cm-text","");return n}function Ne(e){if(Ae!=null)return Ae;var t=T(e,document.createTextNode("AخA"));var n=E(t,0,1).getBoundingClientRect();var i=E(t,1,2).getBoundingClientRect();M(e);if(!n||n.left==n.right)return false;return Ae=i.right-n.right<3}var Fe="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],i=e.length;while(t<=i){var r=e.indexOf("\n",t);if(r==-1)r=e.length;var o=e.slice(t,e.charAt(r-1)=="\r"?r-1:r);var a=o.indexOf("\r");if(a!=-1){n.push(o.slice(0,a));t+=a+1}else{n.push(o);t=r+1}}return n}:function(e){return e.split(/\r\n?|\n/)},Ie=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return false}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}if(!t||t.parentElement()!=e)return false;return t.compareEndPoints("StartToEnd",t)!=0},Pe=function(){var e=O("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}(),He=null;function $e(e){if(He!=null)return He;var t=T(e,O("span","x"));var n=t.getBoundingClientRect();var i=E(t,0,1).getBoundingClientRect();return He=Math.abs(n.left-i.left)>1}var ze={},Be={};function We(e,t){if(arguments.length>2)t.dependencies=Array.prototype.slice.call(arguments,2);ze[e]=t}function Re(e,t){Be[e]=t}function je(e){if(typeof e=="string"&&Be.hasOwnProperty(e))e=Be[e];else if(e&&typeof e.name=="string"&&Be.hasOwnProperty(e.name)){var t=Be[e.name];if(typeof t=="string")t={name:t};e=J(t,e);e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return je("application/xml");else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json");if(typeof e=="string")return{name:e};else return e||{name:"null"}}function _e(e,t){t=je(t);var n=ze[t.name];if(!n)return _e(e,"text/plain");var i=n(e,t);if(Ye.hasOwnProperty(t.name)){var r=Ye[t.name];for(var o in r){if(!r.hasOwnProperty(o))continue;if(i.hasOwnProperty(o))i["_"+o]=i[o];i[o]=r[o]}}i.name=t.name;if(t.helperType)i.helperType=t.helperType;if(t.modeProps)for(var a in t.modeProps)i[a]=t.modeProps[a];return i}var Ye={};function Ue(e,t){var n=Ye.hasOwnProperty(e)?Ye[e]:Ye[e]={};$(t,n)}function qe(e,t){if(t===true)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];if(r instanceof Array)r=r.concat([]);n[i]=r}return n}function Xe(e,t){var n;while(e.innerMode){n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state;e=n.mode}return n||{mode:e,state:t}}function Ge(e,t,n){return e.startState?e.startState(t,n):true}var Ve=function(e,t,n){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=n};function Ke(e,t){t-=e.first;if(t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var n=e;while(!n.lines)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t<o){n=r;break}t-=o}return n.lines[t]}function Qe(e,n,i){var r=[],o=n.line;e.iter(n.line,i.line+1,function(e){var t=e.text;if(o==i.line)t=t.slice(0,i.ch);if(o==n.line)t=t.slice(n.ch);r.push(t);++o});return r}function Ze(e,t,n){var i=[];e.iter(t,n,function(e){i.push(e.text)});return i}function Je(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function et(e){if(e.parent==null)return null;var t=e.parent,n=W(t.lines,e);for(var i=t.parent;i;t=i,i=i.parent)for(var r=0;;++r){if(i.children[r]==t)break;n+=i.children[r].chunkSize()}return n+t.first}function tt(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var r=e.children[i],o=r.height;if(t<o){e=r;continue e}t-=o;n+=r.chunkSize()}return n}while(!e.lines);var a=0;for(;a<e.lines.length;++a){var s=e.lines[a],l=s.height;if(t<l)break;t-=l}return n+a}function nt(e,t){return t>=e.first&&t<e.first+e.size}function it(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function rt(e,t,n){if(n===void 0)n=null;if(!(this instanceof rt))return new rt(e,t,n);this.line=e;this.ch=t;this.sticky=n}function ot(e,t){return e.line-t.line||e.ch-t.ch}function at(e,t){return e.sticky==t.sticky&&ot(e,t)==0}function st(e){return rt(e.line,e.ch)}function lt(e,t){return ot(e,t)<0?t:e}function ut(e,t){return ot(e,t)<0?e:t}function ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return rt(e.first,0);var n=e.first+e.size-1;if(t.line>n)return rt(n,Ke(e,n).text.length);return dt(t,Ke(e,t.line).text.length)}function dt(e,t){var n=e.ch;if(n==null||n>t)return rt(e.line,t);else if(n<0)return rt(e.line,0);else return e}function ht(e,t){var n=[];for(var i=0;i<t.length;i++)n[i]=ft(e,t[i]);return n}Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||undefined},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.prototype.eat=function(e){var t=this.string.charAt(this.pos);var n;if(typeof e=="string")n=t==e;else n=t&&(e.test?e.test(t):e(t));if(n){++this.pos;return t}},Ve.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t},Ve.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){if(this.lastColumnPos<this.start){this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(e){return n?e.toLowerCase():e};var r=this.string.substr(this.pos,e.length);if(i(r)==i(e)){if(t!==false)this.pos+=e.length;return true}}else{var o=this.string.slice(this.pos).match(e);if(o&&o.index>0)return null;if(o&&t!==false)this.pos+=o[0].length;return o}},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var pt=function(e,t){this.state=e;this.lookAhead=t},mt=function(e,t,n,i){this.state=t;this.doc=e;this.line=n;this.maxLookAhead=i||0;this.baseTokens=null;this.baseTokenPos=1};function gt(t,n,i,e){var l=[t.state.modeGen],r={};Lt(t,n.text,t.doc.mode,i,function(e,t){return l.push(e,t)},r,e);var u=i.state;var o=function(e){i.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;i.state=true;Lt(t,n.text,o.mode,i,function(e,t){var n=a;while(s<e){var i=l[a];if(i>e)l.splice(a,1,e,l[a+1],i);a+=2;s=Math.min(e,i)}if(!t)return;if(o.opaque){l.splice(n,a-n,e,"overlay "+t);a=n+2}else for(;n<a;n+=2){var r=l[n+1];l[n+1]=(r?r+" ":"")+"overlay "+t}},r);i.state=u;i.baseTokens=null;i.baseTokenPos=1};for(var a=0;a<t.state.overlays.length;++a)o(a);return{styles:l,classes:r.bgClass||r.textClass?r:null}}function vt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=yt(e,et(t));var r=t.text.length>e.options.maxHighlightLength&&qe(e.doc.mode,i.state);var o=gt(e,t,i);if(r)i.state=r;t.stateAfter=i.save(!r);t.styles=o.styles;if(o.classes)t.styleClasses=o.classes;else if(t.styleClasses)t.styleClasses=null;if(n===e.doc.highlightFrontier)e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier)}return t.styles}function yt(n,i,e){var t=n.doc,r=n.display;if(!t.mode.startState)return new mt(t,true,i);var o=Et(n,i,e);var a=o>t.first&&Ke(t,o-1).stateAfter;var s=a?mt.fromSaved(t,a,o):new mt(t,Ge(t.mode),o);t.iter(o,i,function(e){xt(n,e.text,s);var t=s.line;e.stateAfter=t==i-1||t%5==0||t>=r.viewFrom&&t<r.viewTo?s.save():null;s.nextLine()});if(e)t.modeFrontier=s.line;return s}function xt(e,t,n,i){var r=e.doc.mode;var o=new Ve(t,e.options.tabSize,n);o.start=o.pos=i||0;if(t=="")bt(r,n.state);while(!o.eol()){wt(r,o,n.state);o.start=o.pos}}function bt(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Xe(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function wt(e,t,n,i){for(var r=0;r<10;r++){if(i)i[0]=Xe(e,n).mode;var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}mt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);if(t!=null&&e>this.maxLookAhead)this.maxLookAhead=e;return t},mt.prototype.baseToken=function(e){if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=e)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0)this.maxLookAhead--},mt.fromSaved=function(e,t,n){if(t instanceof pt)return new mt(e,qe(e.mode,t.state),n,t.lookAhead);else return new mt(e,qe(e.mode,t),n)},mt.prototype.save=function(e){var t=e!==false?qe(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new pt(t,this.maxLookAhead):t};var kt=function(e,t,n){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=n};function Ct(e,t,n,i){var r=e.doc,o=r.mode,a;t=ft(r,t);var s=Ke(r,t.line),l=yt(e,t.line,n);var u=new Ve(s.text,e.options.tabSize,l),c;if(i)c=[];while((i||u.pos<t.ch)&&!u.eol()){u.start=u.pos;a=wt(o,u,l.state);if(i)c.push(new kt(u,a,qe(r.mode,l.state)))}return i?c:new kt(u,a,l.state)}function St(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";if(t[i]==null)t[i]=n[2];else if(!new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i]))t[i]+=" "+n[2]}return e}function Lt(e,t,n,i,r,o,a){var s=n.flattenSpans;if(s==null)s=e.options.flattenSpans;var l=0,u=null;var c=new Ve(t,e.options.tabSize,i),f;var d=e.options.addModeClass&&[null];if(t=="")St(bt(n,i.state),o);while(!c.eol()){if(c.pos>e.options.maxHighlightLength){s=false;if(a)xt(e,t,i,c.pos);c.pos=t.length;f=null}else f=St(wt(n,c,i.state,d),o);if(d){var h=d[0].name;if(h)f="m-"+(f?h+" "+f:h)}if(!s||u!=f){while(l<c.start){l=Math.min(c.start,l+5e3);r(l,u)}u=f}c.start=c.pos}while(l<c.pos){var p=Math.min(c.pos,l+5e3);r(p,u);l=p}}function Et(e,t,n){var i,r,o=e.doc;var a=n?-1:t-(e.doc.mode.innerMode?1e3:100);for(var s=t;s>a;--s){if(s<=o.first)return o.first;var l=Ke(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof pt?u.lookAhead:0)<=o.modeFrontier))return s;var c=z(l.text,null,e.options.tabSize);if(r==null||i>c){r=s-1;i=c}}return r}function Mt(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontier<t-10)return;var n=e.first;for(var i=t-1;i>n;i--){var r=Ke(e,i).stateAfter;if(r&&(!(r instanceof pt)||i+r.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Tt=false,Dt=false;function At(){Tt=true}function Ot(){Dt=true}function Nt(e,t,n){this.marker=e;this.from=t;this.to=n}function Ft(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function It(e,t){var n;for(var i=0;i<e.length;++i)if(e[i]!=t)(n||(n=[])).push(e[i]);return n}function Pt(e,t,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));if(i&&i.has(e.markedSpans))e.markedSpans.push(t);else{e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t];if(i)i.add(e.markedSpans)}t.marker.attachLine(e)}function Ht(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o=e[r],a=o.marker;var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&a.type=="bookmark"&&(!n||!o.marker.insertLeft)){var l=o.to==null||(a.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new Nt(a,o.from,l?null:o.to))}}return i}function $t(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o=e[r],a=o.marker;var s=o.to==null||(a.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var l=o.from==null||(a.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new Nt(a,l?null:o.from-t,o.to==null?null:o.to-t))}}return i}function zt(e,t){if(t.full)return null;var n=nt(e,t.from.line)&&Ke(e,t.from.line).markedSpans;var i=nt(e,t.to.line)&&Ke(e,t.to.line).markedSpans;if(!n&&!i)return null;var r=t.from.ch,o=t.to.ch,a=ot(t.from,t.to)==0;var s=Ht(n,r,a);var l=$t(i,o,a);var u=t.text.length==1,c=V(t.text).length+(u?r:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(d.to==null){var h=Ft(l,d.marker);if(!h)d.to=r;else if(u)d.to=h.to==null?null:h.to+c}}if(l)for(var p=0;p<l.length;++p){var m=l[p];if(m.to!=null)m.to+=c;if(m.from==null){var g=Ft(s,m.marker);if(!g){m.from=c;if(u)(s||(s=[])).push(m)}}else{m.from+=c;if(u)(s||(s=[])).push(m)}}if(s)s=Bt(s);if(l&&l!=s)l=Bt(l);var v=[s];if(!u){var y=t.text.length-2,x;if(y>0&&s)for(var b=0;b<s.length;++b)if(s[b].to==null)(x||(x=[])).push(new Nt(s[b].marker,null,null));for(var w=0;w<y;++w)v.push(x);v.push(l)}return v}function Bt(e){for(var t=0;t<e.length;++t){var n=e[t];if(n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==false)e.splice(t--,1)}if(!e.length)return null;return e}function Wt(e,t,n){var i=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;if(n.readOnly&&(!i||W(i,n)==-1))(i||(i=[])).push(n)}});if(!i)return null;var r=[{from:t,to:n}];for(var o=0;o<i.length;++o){var a=i[o],s=a.find(0);for(var l=0;l<r.length;++l){var u=r[l];if(ot(u.to,s.from)<0||ot(u.from,s.to)>0)continue;var c=[l,1],f=ot(u.from,s.from),d=ot(u.to,s.to);if(f<0||!a.inclusiveLeft&&!f)c.push({from:u.from,to:s.from});if(d>0||!a.inclusiveRight&&!d)c.push({from:s.to,to:u.to});r.splice.apply(r,c);l+=c.length-3}}return r}function Rt(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function jt(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function _t(e){return e.inclusiveLeft?-1:0}function Yt(e){return e.inclusiveRight?1:0}function Ut(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),r=t.find();var o=ot(i.from,r.from)||_t(e)-_t(t);if(o)return-o;var a=ot(i.to,r.to)||Yt(e)-Yt(t);if(a)return a;return t.id-e.id}function qt(e,t){var n=Dt&&e.markedSpans,i;if(n)for(var r=void 0,o=0;o<n.length;++o){r=n[o];if(r.marker.collapsed&&(t?r.from:r.to)==null&&(!i||Ut(i,r.marker)<0))i=r.marker}return i}function Xt(e){return qt(e,true)}function Gt(e){return qt(e,false)}function Vt(e,t){var n=Dt&&e.markedSpans,i;if(n)for(var r=0;r<n.length;++r){var o=n[r];if(o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!i||Ut(i,o.marker)<0))i=o.marker}return i}function Kt(e,t,n,i,r){var o=Ke(e,t);var a=Dt&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(!l.marker.collapsed)continue;var u=l.marker.find(0);var c=ot(u.from,n)||_t(l.marker)-_t(r);var f=ot(u.to,i)||Yt(l.marker)-Yt(r);if(c>=0&&f<=0||c<=0&&f>=0)continue;if(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.to,n)>=0:ot(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ot(u.from,i)<=0:ot(u.from,i)<0))return true}}function Qt(e){var t;while(t=Xt(e))e=t.find(-1,true).line;return e}function Zt(e){var t;while(t=Gt(e))e=t.find(1,true).line;return e}function Jt(e){var t,n;while(t=Gt(e)){e=t.find(1,true).line;(n||(n=[])).push(e)}return n}function en(e,t){var n=Ke(e,t),i=Qt(n);if(n==i)return t;return et(i)}function tn(e,t){if(t>e.lastLine())return t;var n=Ke(e,t),i;if(!nn(e,n))return t;while(i=Gt(n))n=i.find(1,true).line;return et(n)+1}function nn(e,t){var n=Dt&&t.markedSpans;if(n)for(var i=void 0,r=0;r<n.length;++r){i=n[r];if(!i.marker.collapsed)continue;if(i.from==null)return true;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&rn(e,t,i))return true}}function rn(e,t,n){if(n.to==null){var i=n.marker.find(1,true);return rn(e,i.line,Ft(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return true;for(var r=void 0,o=0;o<t.markedSpans.length;++o){r=t.markedSpans[o];if(r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(r.to==null||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&rn(e,t,r))return true}}function on(e){e=Qt(e);var t=0,n=e.parent;for(var i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==e)break;else t+=r.height}for(var o=n.parent;o;n=o,o=n.parent)for(var a=0;a<o.children.length;++a){var s=o.children[a];if(s==n)break;else t+=s.height}return t}function an(e){if(e.height==0)return 0;var t=e.text.length,n,i=e;while(n=Xt(i)){var r=n.find(0,true);i=r.from.line;t+=r.from.ch-r.to.ch}i=e;while(n=Gt(i)){var o=n.find(0,true);t-=i.text.length-o.from.ch;i=o.to.line;t+=i.text.length-o.to.ch}return t}function sn(e){var n=e.display,t=e.doc;n.maxLine=Ke(t,t.first);n.maxLineLength=an(n.maxLine);n.maxLineChanged=true;t.iter(function(e){var t=an(e);if(t>n.maxLineLength){n.maxLineLength=t;n.maxLine=e}})}var ln=function(e,t,n){this.text=e;jt(this,t);this.height=n?n(this):1};function un(e,t,n,i){e.text=t;if(e.stateAfter)e.stateAfter=null;if(e.styles)e.styles=null;if(e.order!=null)e.order=null;Rt(e);jt(e,n);var r=i?i(e):1;if(r!=e.height)Je(e,r)}function cn(e){e.parent=null;Rt(e)}ln.prototype.lineNo=function(){return et(this)},we(ln);var fn={},dn={};function hn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?dn:fn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function pn(e,t){var n=D("span",null,null,v?"padding-right: .1px":null);var i={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:false,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,a=void 0;i.pos=0;i.addToken=gn;if(Ne(e.display.measure)&&(a=de(o,e.doc.direction)))i.addToken=yn(i.addToken,a);i.map=[];var s=t!=e.display.externalMeasured&&et(o);bn(o,i,vt(e,o,s));if(o.styleClasses){if(o.styleClasses.bgClass)i.bgClass=I(o.styleClasses.bgClass,i.bgClass||"");if(o.styleClasses.textClass)i.textClass=I(o.styleClasses.textClass,i.textClass||"")}if(i.map.length==0)i.map.push(0,0,i.content.appendChild(Oe(e.display.measure)));if(r==0){t.measure.map=i.map;t.measure.cache={}}else{(t.measure.maps||(t.measure.maps=[])).push(i.map);(t.measure.caches||(t.measure.caches=[])).push({})}}if(v){var l=i.content.lastChild;if(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))i.content.className="cm-tab-wrap-hack"}ve(e,"renderLine",e,t.line,i.pre);if(i.pre.className)i.textClass=I(i.pre.className,i.textClass||"");return i}function mn(e){var t=O("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function gn(e,t,n,i,r,o,a){if(!t)return;var s=e.splitSpaces?vn(t,e.trailingSpace):t;var l=e.cm.state.specialChars,u=false;var c;if(!l.test(t)){e.col+=t.length;c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c);if(S&&w<9)u=true;e.pos+=t.length}else{c=document.createDocumentFragment();var f=0;while(true){l.lastIndex=f;var d=l.exec(t);var h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(s.slice(f,f+h));if(S&&w<9)c.appendChild(O("span",[p]));else c.appendChild(p);e.map.push(e.pos,e.pos+h,p);e.col+=h;e.pos+=h}if(!d)break;f+=h+1;var m=void 0;if(d[0]=="\t"){var g=e.cm.options.tabSize,v=g-e.col%g;m=c.appendChild(O("span",G(v),"cm-tab"));m.setAttribute("role","presentation");m.setAttribute("cm-text","\t");e.col+=v}else if(d[0]=="\r"||d[0]=="\n"){m=c.appendChild(O("span",d[0]=="\r"?"␍":"␤","cm-invalidchar"));m.setAttribute("cm-text",d[0]);e.col+=1}else{m=e.cm.options.specialCharPlaceholder(d[0]);m.setAttribute("cm-text",d[0]);if(S&&w<9)c.appendChild(O("span",[m]));else c.appendChild(m);e.col+=1}e.map.push(e.pos,e.pos+1,m);e.pos++}}e.trailingSpace=s.charCodeAt(t.length-1)==32;if(n||i||r||u||o||a){var y=n||"";if(i)y+=i;if(r)y+=r;var x=O("span",[c],y,o);if(a)for(var b in a)if(a.hasOwnProperty(b)&&b!="style"&&b!="class")x.setAttribute(b,a[b]);return e.content.appendChild(x)}e.content.appendChild(c)}function vn(e,t){if(e.length>1&&!/  /.test(e))return e;var n=t,i="";for(var r=0;r<e.length;r++){var o=e.charAt(r);if(o==" "&&n&&(r==e.length-1||e.charCodeAt(r+1)==32))o=" ";i+=o;n=o==" "}return i}function yn(f,d){return function(e,t,n,i,r,o,a){n=n?n+" cm-force-border":"cm-force-border";var s=e.pos,l=s+t.length;for(;;){var u=void 0;for(var c=0;c<d.length;c++){u=d[c];if(u.to>s&&u.from<=s)break}if(u.to>=l)return f(e,t,n,i,r,o,a);f(e,t.slice(0,u.to-s),n,i,null,o,a);i=null;t=t.slice(u.to-s);s=u.to}}}function xn(e,t,n,i){var r=!i&&n.widgetNode;if(r)e.map.push(e.pos,e.pos+t,r);if(!i&&e.cm.display.input.needsContentAttribute){if(!r)r=e.content.appendChild(document.createElement("span"));r.setAttribute("cm-marker",n.id)}if(r){e.cm.display.input.setUneditable(r);e.content.appendChild(r)}e.pos+=t;e.trailingSpace=false}function bn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(!i){for(var a=1;a<n.length;a+=2)t.addToken(t,r.slice(o,o=n[a]),hn(n[a+1],t.cm.options));return}var s=r.length,l=0,u=1,c="",f,d;var h=0,p,m,g,v,y;for(;;){if(h==l){p=m=g=d="";y=null;v=null;h=Infinity;var x=[],b=void 0;for(var w=0;w<i.length;++w){var k=i[w],C=k.marker;if(C.type=="bookmark"&&k.from==l&&C.widgetNode)x.push(C);else if(k.from<=l&&(k.to==null||k.to>l||C.collapsed&&k.to==l&&k.from==l)){if(k.to!=null&&k.to!=l&&h>k.to){h=k.to;m=""}if(C.className)p+=" "+C.className;if(C.css)d=(d?d+";":"")+C.css;if(C.startStyle&&k.from==l)g+=" "+C.startStyle;if(C.endStyle&&k.to==h)(b||(b=[])).push(C.endStyle,k.to);if(C.title)(y||(y={})).title=C.title;if(C.attributes)for(var S in C.attributes)(y||(y={}))[S]=C.attributes[S];if(C.collapsed&&(!v||Ut(v.marker,C)<0))v=k}else if(k.from>l&&h>k.from)h=k.from}if(b)for(var L=0;L<b.length;L+=2)if(b[L+1]==h)m+=" "+b[L];if(!v||v.from==l)for(var E=0;E<x.length;++E)xn(t,0,x[E]);if(v&&(v.from||0)==l){xn(t,(v.to==null?s+1:v.to)-l,v.marker,v.from==null);if(v.to==null)return;if(v.to==l)v=false}}if(l>=s)break;var M=Math.min(s,h);while(true){if(c){var T=l+c.length;if(!v){var D=T>M?c.slice(0,M-l):c;t.addToken(t,D,f?f+p:p,g,l+D.length==h?m:"",d,y)}if(T>=M){c=c.slice(M-l);l=M;break}l=T;g=""}c=r.slice(o,o=n[u++]);f=hn(n[u++],t.cm.options)}}}function wn(e,t,n){this.line=t;this.rest=Jt(t);this.size=this.rest?et(V(this.rest))-n+1:1;this.node=this.text=null;this.hidden=nn(e,t)}function kn(e,t,n){var i=[],r;for(var o=t;o<n;o=r){var a=new wn(e.doc,Ke(e.doc,o),o);r=o+a.size;i.push(a)}return i}var Cn=null;function Sn(e){if(Cn)Cn.ops.push(e);else e.ownsGroup=Cn={ops:[e],delayedCallbacks:[]}}function Ln(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var r=e.ops[i];if(r.cursorActivityHandlers)while(r.cursorActivityCalled<r.cursorActivityHandlers.length)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(n<t.length)}function En(e,t){var n=e.ownsGroup;if(!n)return;try{Ln(n)}finally{Cn=null;t(n)}}var Mn=null;function Tn(e,t){var n=me(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),r;if(Cn)r=Cn.delayedCallbacks;else if(Mn)r=Mn;else{r=Mn=[];setTimeout(Dn,0)}var o=function(e){r.push(function(){return n[e].apply(null,i)})};for(var a=0;a<n.length;++a)o(a)}function Dn(){var e=Mn;Mn=null;for(var t=0;t<e.length;++t)e[t]()}function An(e,t,n,i){for(var r=0;r<t.changes.length;r++){var o=t.changes[r];if(o=="text")In(e,t);else if(o=="gutter")Hn(e,t,n,i);else if(o=="class")Pn(e,t);else if(o=="widget")$n(e,t,i)}t.changes=null}function On(e){if(e.node==e.text){e.node=O("div",null,null,"position: relative");if(e.text.parentNode)e.text.parentNode.replaceChild(e.node,e.text);e.node.appendChild(e.text);if(S&&w<8)e.node.style.zIndex=2}return e.node}function Nn(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n)n+=" CodeMirror-linebackground";if(t.background)if(n)t.background.className=n;else{t.background.parentNode.removeChild(t.background);t.background=null}else if(n){var i=On(t);t.background=i.insertBefore(O("div",null,n),i.firstChild);e.display.input.setUneditable(t.background)}}function Fn(e,t){var n=e.display.externalMeasured;if(n&&n.line==t.line){e.display.externalMeasured=null;t.measure=n.measure;return n.built}return pn(e,t)}function In(e,t){var n=t.text.className;var i=Fn(e,t);if(t.text==t.node)t.node=i.pre;t.text.parentNode.replaceChild(i.pre,t.text);t.text=i.pre;if(i.bgClass!=t.bgClass||i.textClass!=t.textClass){t.bgClass=i.bgClass;t.textClass=i.textClass;Pn(e,t)}else if(n)t.text.className=n}function Pn(e,t){Nn(e,t);if(t.line.wrapClass)On(t).className=t.line.wrapClass;else if(t.node!=t.text)t.node.className="";var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Hn(e,t,n,i){if(t.gutter){t.node.removeChild(t.gutter);t.gutter=null}if(t.gutterBackground){t.node.removeChild(t.gutterBackground);t.gutterBackground=null}if(t.line.gutterClass){var r=On(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px");e.display.input.setUneditable(t.gutterBackground);r.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=On(t);var s=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");s.setAttribute("aria-hidden","true");e.display.input.setUneditable(s);a.insertBefore(s,t.text);if(t.line.gutterClass)s.className+=" "+t.line.gutterClass;if(e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"]))t.lineNumber=s.appendChild(O("div",it(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"));if(o)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,c=o.hasOwnProperty(u)&&o[u];if(c)s.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+i.gutterLeft[u]+"px; width: "+i.gutterWidth[u]+"px"))}}}function $n(e,t,n){if(t.alignable)t.alignable=null;var i=C("CodeMirror-linewidget");for(var r=t.node.firstChild,o=void 0;r;r=o){o=r.nextSibling;if(i.test(r.className))t.node.removeChild(r)}Bn(e,t,n)}function zn(e,t,n,i){var r=Fn(e,t);t.text=t.node=r.pre;if(r.bgClass)t.bgClass=r.bgClass;if(r.textClass)t.textClass=r.textClass;Pn(e,t);Hn(e,t,n,i);Bn(e,t,i);return t.node}function Bn(e,t,n){Wn(e,t.line,t,n,true);if(t.rest)for(var i=0;i<t.rest.length;i++)Wn(e,t.rest[i],t,n,false)}function Wn(e,t,n,i,r){if(!t.widgets)return;var o=On(n);for(var a=0,s=t.widgets;a<s.length;++a){var l=s[a],u=O("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));if(!l.handleMouseEvents)u.setAttribute("cm-ignore-events","true");Rn(l,u,n,i);e.display.input.setUneditable(u);if(r&&l.above)o.insertBefore(u,n.gutter||n.text);else o.appendChild(u);Tn(l,"redraw")}}function Rn(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var r=i.wrapperWidth;t.style.left=i.fixedPos+"px";if(!e.coverGutter){r-=i.gutterTotalWidth;t.style.paddingLeft=i.gutterTotalWidth+"px"}t.style.width=r+"px"}if(e.coverGutter){t.style.zIndex=5;t.style.position="relative";if(!e.noHScroll)t.style.marginLeft=-i.gutterTotalWidth+"px"}}function jn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!A(document.body,e.node)){var n="position: relative;";if(e.coverGutter)n+="margin-left: -"+t.display.gutters.offsetWidth+"px;";if(e.noHScroll)n+="width: "+t.display.wrapper.clientWidth+"px;";T(t.display.measure,O("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function _n(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return true}function Yn(e){return e.lineSpace.offsetTop}function Un(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,O("pre","x","CodeMirror-line-like"));var n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle;var i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};if(!isNaN(i.left)&&!isNaN(i.right))e.cachedPaddingH=i;return i}function Xn(e){return R-e.display.nativeBarWidth}function Gn(e){return e.display.scroller.clientWidth-Xn(e)-e.display.barWidth}function Vn(e){return e.display.scroller.clientHeight-Xn(e)-e.display.barHeight}function Kn(e,t,n){var i=e.options.lineWrapping;var r=i&&Gn(e);if(!t.measure.heights||i&&t.measure.width!=r){var o=t.measure.heights=[];if(i){t.measure.width=r;var a=t.text.firstChild.getClientRects();for(var s=0;s<a.length-1;s++){var l=a[s],u=a[s+1];if(Math.abs(l.bottom-u.bottom)>2)o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Qn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var r=0;r<e.rest.length;r++)if(et(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}function Zn(e,t){t=Qt(t);var n=et(t);var i=e.display.externalMeasured=new wn(e.doc,t,n);i.lineN=n;var r=i.built=pn(e,i);i.text=r.pre;T(e.display.lineMeasure,r.pre);return i}function Jn(e,t,n,i){return ni(e,ti(e,t),n,i)}function ei(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pi(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function ti(e,t){var n=et(t);var i=ei(e,n);if(i&&!i.text)i=null;else if(i&&i.changes){An(e,i,n,Ai(e));e.curOp.forceUpdate=true}if(!i)i=Zn(e,t);var r=Qn(i,t,n);return{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:false}}function ni(e,t,n,i,r){if(t.before)n=-1;var o=n+(i||""),a;if(t.cache.hasOwnProperty(o))a=t.cache[o];else{if(!t.rect)t.rect=t.view.text.getBoundingClientRect();if(!t.hasHeights){Kn(e,t.view,t.rect);t.hasHeights=true}a=si(e,t,n,i);if(!a.bogus)t.cache[o]=a}return{left:a.left,right:a.right,top:r?a.rtop:a.top,bottom:r?a.rbottom:a.bottom}}var ii={left:0,right:0,top:0,bottom:0},ri;function oi(e,t,n){var i,r,o,a,s,l;for(var u=0;u<e.length;u+=3){s=e[u];l=e[u+1];if(t<s){r=0;o=1;a="left"}else if(t<l){r=t-s;o=r+1}else if(u==e.length-3||t==l&&e[u+3]>t){o=l-s;r=o-1;if(t>=l)a="right"}if(r!=null){i=e[u+2];if(s==l&&n==(i.insertLeft?"left":"right"))a=n;if(n=="left"&&r==0)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft){i=e[(u-=3)+2];a="left"}if(n=="right"&&r==l-s)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft){i=e[(u+=3)+2];a="right"}break}}return{node:i,start:r,end:o,collapse:a,coverStart:s,coverEnd:l}}function ai(e,t){var n=ii;if(t=="left"){for(var i=0;i<e.length;i++)if((n=e[i]).left!=n.right)break}else for(var r=e.length-1;r>=0;r--)if((n=e[r]).left!=n.right)break;return n}function si(e,t,n,i){var r=oi(t.map,n,i);var o=r.node,a=r.start,s=r.end,l=r.collapse;var u;if(o.nodeType==3){for(var c=0;c<4;c++){while(a&&oe(t.line.text.charAt(r.coverStart+a)))--a;while(r.coverStart+s<r.coverEnd&&oe(t.line.text.charAt(r.coverStart+s)))++s;if(S&&w<9&&a==0&&s==r.coverEnd-r.coverStart)u=o.parentNode.getBoundingClientRect();else u=ai(E(o,a,s).getClientRects(),i);if(u.left||u.right||a==0)break;s=a;a=a-1;l="right"}if(S&&w<11)u=li(e.display.measure,u)}else{if(a>0)l=i="right";var f;if(e.options.lineWrapping&&(f=o.getClientRects()).length>1)u=f[i=="right"?f.length-1:0];else u=o.getBoundingClientRect()}if(S&&w<9&&!a&&(!u||!u.left&&!u.right)){var d=o.parentNode.getClientRects()[0];if(d)u={left:d.left,right:d.left+Di(e.display),top:d.top,bottom:d.bottom};else u=ii}var h=u.top-t.rect.top,p=u.bottom-t.rect.top;var m=(h+p)/2;var g=t.view.measure.heights;var v=0;for(;v<g.length-1;v++)if(m<g[v])break;var y=v?g[v-1]:0,x=g[v];var b={left:(l=="right"?u.right:u.left)-t.rect.left,right:(l=="left"?u.left:u.right)-t.rect.left,top:y,bottom:x};if(!u.left&&!u.right)b.bogus=true;if(!e.options.singleCursorHeightPerLine){b.rtop=h;b.rbottom=p}return b}function li(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!$e(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI;var i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function ui(e){if(e.measure){e.measure.cache={};e.measure.heights=null;if(e.rest)for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}}function ci(e){e.display.externalMeasure=null;M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ui(e.display.view[t])}function fi(e){ci(e);e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null;if(!e.options.lineWrapping)e.display.maxLineChanged=true;e.display.lineNumChars=null}function di(){if(a&&f)return-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft));return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function hi(){if(a&&f)return-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop));return window.pageYOffset||(document.documentElement||document.body).scrollTop}function pi(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)if(e.widgets[n].above)t+=jn(e.widgets[n]);return t}function mi(e,t,n,i,r){if(!r){var o=pi(t);n.top+=o;n.bottom+=o}if(i=="line")return n;if(!i)i="local";var a=on(t);if(i=="local")a+=Yn(e.display);else a-=e.display.viewOffset;if(i=="page"||i=="window"){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+(i=="window"?0:hi());var l=s.left+(i=="window"?0:di());n.left+=l;n.right+=l}n.top+=a;n.bottom+=a;return n}function gi(e,t,n){if(n=="div")return t;var i=t.left,r=t.top;if(n=="page"){i-=di();r-=hi()}else if(n=="local"||!n){var o=e.display.sizer.getBoundingClientRect();i+=o.left;r+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:i-a.left,top:r-a.top}}function vi(e,t,n,i,r){if(!i)i=Ke(e.doc,t.line);return mi(e,i,Jn(e,i,t.ch,r),n)}function yi(i,e,r,o,a,s){o=o||Ke(i.doc,e.line);if(!a)a=ti(i,o);function l(e,t){var n=ni(i,a,e,t?"right":"left",s);if(t)n.left=n.right;else n.right=n.left;return mi(i,o,n,r)}var u=de(o,i.doc.direction),t=e.ch,n=e.sticky;if(t>=o.text.length){t=o.text.length;n="before"}else if(t<=0){t=0;n="after"}if(!u)return l(n=="before"?t-1:t,n=="before");function c(e,t,n){var i=u[t],r=i.level==1;return l(n?e-1:e,r!=n)}var f=ce(u,t,n);var d=ue;var h=c(t,f,n=="before");if(d!=null)h.other=c(t,d,n!="before");return h}function xi(e,t){var n=0;t=ft(e.doc,t);if(!e.options.lineWrapping)n=Di(e.display)*t.ch;var i=Ke(e.doc,t.line);var r=on(i)+Yn(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function bi(e,t,n,i,r){var o=rt(e,t,n);o.xRel=r;if(i)o.outside=i;return o}function wi(e,t,n){var i=e.doc;n+=e.display.viewOffset;if(n<0)return bi(i.first,0,null,-1,-1);var r=tt(i,n),o=i.first+i.size-1;if(r>o)return bi(i.first+i.size-1,Ke(i,o).text.length,null,1,1);if(t<0)t=0;var a=Ke(i,r);for(;;){var s=Li(e,a,r,t,n);var l=Vt(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var u=l.find(1);if(u.line==r)return u;a=Ke(i,r=u.line)}}function ki(t,e,n,i){i-=pi(e);var r=e.text.length;var o=se(function(e){return ni(t,n,e-1).bottom<=i},r,0);r=se(function(e){return ni(t,n,e).top>i},o,r);return{begin:o,end:r}}function Ci(e,t,n,i){if(!n)n=ti(e,t);var r=mi(e,t,ni(e,n,i),"line").top;return ki(e,t,n,r)}function Si(e,t,n,i){return e.bottom<=n?false:e.top>n?true:(i?e.left:e.right)>t}function Li(n,e,t,i,r){r-=on(e);var o=ti(n,e);var a=pi(e);var s=0,l=e.text.length,u=true;var c=de(e,n.doc.direction);if(c){var f=(n.options.lineWrapping?Mi:Ei)(n,e,t,o,c,i,r);u=f.level!=1;s=u?f.from:f.to-1;l=u?f.to:f.from-1}var d=null,h=null;var p=se(function(e){var t=ni(n,o,e);t.top+=a;t.bottom+=a;if(!Si(t,i,r,false))return false;if(t.top<=r&&t.left<=i){d=e;h=t}return true},s,l);var m,g,v=false;if(h){var y=i-h.left<h.right-i,x=y==u;p=d+(x?0:1);g=x?"after":"before";m=y?h.left:h.right}else{if(!u&&(p==l||p==s))p++;g=p==0?"after":p==e.text.length?"before":ni(n,o,p-(u?1:0)).bottom+a<=r==u?"after":"before";var b=yi(n,rt(t,p,g),"line",e,o);m=b.left;v=r<b.top?-1:r>=b.bottom?1:0}p=ae(e.text,p,1);return bi(t,p,g,v,i-m)}function Ei(i,r,o,a,s,l,u){var e=se(function(e){var t=s[e],n=t.level!=1;return Si(yi(i,rt(o,n?t.to:t.from,n?"before":"after"),"line",r,a),l,u,true)},0,s.length-1);var t=s[e];if(e>0){var n=t.level!=1;var c=yi(i,rt(o,n?t.from:t.to,n?"after":"before"),"line",r,a);if(Si(c,l,u,true)&&c.top>u)t=s[e-1]}return t}function Mi(e,t,n,i,r,o,a){var s=ki(e,t,i,a);var l=s.begin;var u=s.end;if(/\s/.test(t.text.charAt(u-1)))u--;var c=null,f=null;for(var d=0;d<r.length;d++){var h=r[d];if(h.from>=u||h.to<=l)continue;var p=h.level!=1;var m=ni(e,i,p?Math.min(u,h.to)-1:Math.max(l,h.from)).right;var g=m<o?o-m+1e9:m-o;if(!c||f>g){c=h;f=g}}if(!c)c=r[r.length-1];if(c.from<l)c={from:l,to:c.to,level:c.level};if(c.to>u)c={from:c.from,to:u,level:c.level};return c}function Ti(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ri==null){ri=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){ri.appendChild(document.createTextNode("x"));ri.appendChild(O("br"))}ri.appendChild(document.createTextNode("x"))}T(e.measure,ri);var n=ri.offsetHeight/50;if(n>3)e.cachedTextHeight=n;M(e.measure);return n||1}function Di(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx");var n=O("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;if(r>2)e.cachedCharWidth=r;return r||10}function Ai(e){var t=e.display,n={},i={};var r=t.gutters.clientLeft;for(var o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+r;i[s]=o.clientWidth}return{fixedPos:Oi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function Oi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ni(i){var r=Ti(i.display),o=i.options.lineWrapping;var a=o&&Math.max(5,i.display.scroller.clientWidth/Di(i.display)-3);return function(e){if(nn(i.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)if(e.widgets[n].height)t+=e.widgets[n].height;if(o)return t+(Math.ceil(e.text.length/a)||1)*r;else return t+r}}function Fi(e){var t=e.doc,n=Ni(e);t.iter(function(e){var t=n(e);if(t!=e.height)Je(e,t)})}function Ii(e,t,n,i){var r=e.display;if(!n&&Ee(t).getAttribute("cm-not-content")=="true")return null;var o,a,s=r.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left;a=t.clientY-s.top}catch(e){return null}var l=wi(e,o,a),u;if(i&&l.xRel>0&&(u=Ke(e.doc,l.line).text).length==l.ch){var c=z(u,u.length,e.options.tabSize)-u.length;l=rt(l.line,Math.max(0,Math.round((o-qn(e.display).left)/Di(e.display))-c))}return l}function Pi(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var n=e.display.view;for(var i=0;i<n.length;i++){t-=n[i].size;if(t<0)return i}}function Hi(e,t,n,i){if(t==null)t=e.doc.first;if(n==null)n=e.doc.first+e.doc.size;if(!i)i=0;var r=e.display;if(i&&n<r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>t))r.updateLineNumbers=t;e.curOp.viewChanged=true;if(t>=r.viewTo){if(Dt&&en(e.doc,t)<r.viewTo)zi(e)}else if(n<=r.viewFrom)if(Dt&&tn(e.doc,n+i)>r.viewFrom)zi(e);else{r.viewFrom+=i;r.viewTo+=i}else if(t<=r.viewFrom&&n>=r.viewTo)zi(e);else if(t<=r.viewFrom){var o=Bi(e,n,n+i,1);if(o){r.view=r.view.slice(o.index);r.viewFrom=o.lineN;r.viewTo+=i}else zi(e)}else if(n>=r.viewTo){var a=Bi(e,t,t,-1);if(a){r.view=r.view.slice(0,a.index);r.viewTo=a.lineN}else zi(e)}else{var s=Bi(e,t,t,-1);var l=Bi(e,n,n+i,1);if(s&&l){r.view=r.view.slice(0,s.index).concat(kn(e,s.lineN,l.lineN)).concat(r.view.slice(l.index));r.viewTo+=i}else zi(e)}var u=r.externalMeasured;if(u)if(n<u.lineN)u.lineN+=i;else if(t<u.lineN+u.size)r.externalMeasured=null}function $i(e,t,n){e.curOp.viewChanged=true;var i=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)i.externalMeasured=null;if(t<i.viewFrom||t>=i.viewTo)return;var o=i.view[Pi(e,t)];if(o.node==null)return;var a=o.changes||(o.changes=[]);if(W(a,n)==-1)a.push(n)}function zi(e){e.display.viewFrom=e.display.viewTo=e.doc.first;e.display.view=[];e.display.viewOffset=0}function Bi(e,t,n,i){var r=Pi(e,t),o,a=e.display.view;if(!Dt||n==e.doc.first+e.doc.size)return{index:r,lineN:n};var s=e.display.viewFrom;for(var l=0;l<r;l++)s+=a[l].size;if(s!=t){if(i>0){if(r==a.length-1)return null;o=s+a[r].size-t;r++}else o=s-t;t+=o;n+=o}while(en(e.doc,n)!=n){if(r==(i<0?0:a.length-1))return null;n+=i*a[r-(i<0?1:0)].size;r+=i}return{index:r,lineN:n}}function Wi(e,t,n){var i=e.display,r=i.view;if(r.length==0||t>=i.viewTo||n<=i.viewFrom){i.view=kn(e,t,n);i.viewFrom=t}else{if(i.viewFrom>t)i.view=kn(e,t,i.viewFrom).concat(i.view);else if(i.viewFrom<t)i.view=i.view.slice(Pi(e,t));i.viewFrom=t;if(i.viewTo<n)i.view=i.view.concat(kn(e,i.viewTo,n));else if(i.viewTo>n)i.view=i.view.slice(0,Pi(e,n))}i.viewTo=n}function Ri(e){var t=e.display.view,n=0;for(var i=0;i<t.length;i++){var r=t[i];if(!r.hidden&&(!r.node||r.changes))++n}return n}function ji(e){e.display.input.showSelection(e.display.input.prepareSelection())}function _i(e,t){if(t===void 0)t=true;var n=e.doc,i={};var r=i.cursors=document.createDocumentFragment();var o=i.selection=document.createDocumentFragment();for(var a=0;a<n.sel.ranges.length;a++){if(!t&&a==n.sel.primIndex)continue;var s=n.sel.ranges[a];if(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)continue;var l=s.empty();if(l||e.options.showCursorWhenSelecting)Yi(e,s.head,r);if(!l)qi(e,s,o)}return i}function Yi(e,t,n){var i=yi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine);var r=n.appendChild(O("div"," ","CodeMirror-cursor"));r.style.left=i.left+"px";r.style.top=i.top+"px";r.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px";if(/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=vi(e,t,"div",null,null);if(o.right-o.left>0)r.style.width=o.right-o.left+"px"}if(i.other){var a=n.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="";a.style.left=i.other.left+"px";a.style.top=i.other.top+"px";a.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function Ui(e,t){return e.top-t.top||e.left-t.left}function qi(s,e,t){var n=s.display,i=s.doc;var r=document.createDocumentFragment();var o=qn(s.display),M=o.left;var T=Math.max(n.sizerWidth,Gn(s)-n.sizer.offsetLeft)-o.right;var D=i.direction=="ltr";function A(e,t,n,i){if(t<0)t=0;t=Math.round(t);i=Math.round(i);r.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(n==null?T-e:n)+"px;\n                             height: "+(i-t)+"px"))}function a(n,x,b){var a=Ke(i,n);var w=a.text.length;var k,C;function S(e,t){return vi(s,rt(n,e),"div",a,t)}function L(e,t,n){var i=Ci(s,a,null,e);var r=t=="ltr"==(n=="after")?"left":"right";var o=n=="after"?i.begin:i.end-(/\s/.test(a.text.charAt(i.end-1))?2:1);return S(o,r)[r]}var E=de(a,i.direction);le(E,x||0,b==null?w:b,function(e,t,n,i){var r=n=="ltr";var o=S(e,r?"left":"right");var a=S(t-1,r?"right":"left");var s=x==null&&e==0,l=b==null&&t==w;var u=i==0,c=!E||i==E.length-1;if(a.top-o.top<=3){var f=(D?s:l)&&u;var d=(D?l:s)&&c;var h=f?M:(r?o:a).left;var p=d?T:(r?a:o).right;A(h,o.top,p-h,o.bottom)}else{var m,g,v,y;if(r){m=D&&s&&u?M:o.left;g=D?T:L(e,n,"before");v=D?M:L(t,n,"after");y=D&&l&&c?T:a.right}else{m=!D?M:L(e,n,"before");g=!D&&s&&u?T:o.right;v=!D&&l&&c?M:a.left;y=!D?T:L(t,n,"after")}A(m,o.top,g-m,o.bottom);if(o.bottom<a.top)A(M,o.bottom,null,a.top);A(v,a.top,y-v,a.bottom)}if(!k||Ui(o,k)<0)k=o;if(Ui(a,k)<0)k=a;if(!C||Ui(o,C)<0)C=o;if(Ui(a,C)<0)C=a});return{start:k,end:C}}var l=e.from(),u=e.to();if(l.line==u.line)a(l.line,l.ch,u.ch);else{var c=Ke(i,l.line),f=Ke(i,u.line);var d=Qt(c)==Qt(f);var h=a(l.line,l.ch,d?c.text.length+1:null).end;var p=a(u.line,d?0:null,u.ch).start;if(d)if(h.top<p.top-2){A(h.right,h.top,null,h.bottom);A(M,p.top,p.left,p.bottom)}else A(h.right,h.top,p.left-h.right,h.bottom);if(h.bottom<p.top)A(M,h.bottom,null,p.top)}t.appendChild(r)}function Xi(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=true;t.cursorDiv.style.visibility="";if(e.options.cursorBlinkRate>0)t.blinker=setInterval(function(){if(!e.hasFocus())Qi(e);t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate);else if(e.options.cursorBlinkRate<0)t.cursorDiv.style.visibility="hidden"}function Gi(e){if(!e.hasFocus()){e.display.input.focus();if(!e.state.focused)Ki(e)}}function Vi(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;if(e.state.focused)Qi(e)}},100)}function Ki(e,t){if(e.state.delayingBlurEvent&&!e.state.draggingText)e.state.delayingBlurEvent=false;if(e.options.readOnly=="nocursor")return;if(!e.state.focused){ve(e,"focus",e,t);e.state.focused=true;F(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(v)setTimeout(function(){return e.display.input.reset(true)},20)}e.display.input.receivedFocus()}Xi(e)}function Qi(e,t){if(e.state.delayingBlurEvent)return;if(e.state.focused){ve(e,"blur",e,t);e.state.focused=false;L(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused)e.display.shift=false},150)}function Zi(e){var t=e.display;var n=t.lineDiv.offsetTop;var i=Math.max(0,t.scroller.getBoundingClientRect().top);var r=t.lineDiv.getBoundingClientRect().top;var o=0;for(var a=0;a<t.view.length;a++){var s=t.view[a],l=e.options.lineWrapping;var u=void 0,c=0;if(s.hidden)continue;r+=s.line.height;if(S&&w<8){var f=s.node.offsetTop+s.node.offsetHeight;u=f-n;n=f}else{var d=s.node.getBoundingClientRect();u=d.bottom-d.top;if(!l&&s.text.firstChild)c=s.text.firstChild.getBoundingClientRect().right-d.left-1}var h=s.line.height-u;if(h>.005||h<-.005){if(r<i)o-=h;Je(s.line,u);Ji(s.line);if(s.rest)for(var p=0;p<s.rest.length;p++)Ji(s.rest[p])}if(c>e.display.sizerWidth){var m=Math.ceil(c/Di(e.display));if(m>e.display.maxLineLength){e.display.maxLineLength=m;e.display.maxLine=s.line;e.display.maxLineChanged=true}}}if(Math.abs(o)>2)t.scroller.scrollTop+=o}function Ji(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;if(i)n.height=i.offsetHeight}}function er(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Yn(e));var r=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight;var o=tt(t,i),a=tt(t,r);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;if(s<o){o=s;a=tt(t,on(Ke(t,s))+e.wrapper.clientHeight)}else if(Math.min(l,t.lastLine())>=a){o=tt(t,on(Ke(t,l))-e.wrapper.clientHeight);a=l}}return{from:o,to:Math.max(a,o+1)}}function tr(e,t){if(ye(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;if(t.top+i.top<0)r=true;else if(t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight))r=false;if(r!=null&&!l){var o=O("div","​",null,"position: absolute;\n                         top: "+(t.top-n.viewOffset-Yn(e.display))+"px;\n                         height: "+(t.bottom-t.top+Xn(e)+n.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o);o.scrollIntoView(r);e.display.lineSpace.removeChild(o)}}function nr(e,t,n,i){if(i==null)i=0;var r;if(!e.options.lineWrapping&&t==n){n=t.sticky=="before"?rt(t.line,t.ch+1,"before"):t;t=t.ch?rt(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t}for(var o=0;o<5;o++){var a=false;var s=yi(e,t);var l=!n||n==t?s:yi(e,n);r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-i,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+i};var u=rr(e,r);var c=e.doc.scrollTop,f=e.doc.scrollLeft;if(u.scrollTop!=null){fr(e,u.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1)a=true}if(u.scrollLeft!=null){hr(e,u.scrollLeft);if(Math.abs(e.doc.scrollLeft-f)>1)a=true}if(!a)break}return r}function ir(e,t){var n=rr(e,t);if(n.scrollTop!=null)fr(e,n.scrollTop);if(n.scrollLeft!=null)hr(e,n.scrollLeft)}function rr(e,t){var n=e.display,i=Ti(e.display);if(t.top<0)t.top=0;var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop;var o=Vn(e),a={};if(t.bottom-t.top>o)t.bottom=t.top+o;var s=e.doc.height+Un(n);var l=t.top<i,u=t.bottom>s-i;if(t.top<r)a.scrollTop=l?0:t.top;else if(t.bottom>r+o){var c=Math.min(t.top,(u?s:t.bottom)-o);if(c!=r)a.scrollTop=c}var f=e.options.fixedGutter?0:n.gutters.offsetWidth;var d=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-f;var h=Gn(e)-n.gutters.offsetWidth;var p=t.right-t.left>h;if(p)t.right=t.left+h;if(t.left<10)a.scrollLeft=0;else if(t.left<d)a.scrollLeft=Math.max(0,t.left+f-(p?0:10));else if(t.right>h+d-3)a.scrollLeft=t.right+(p?0:10)-h;return a}function or(e,t){if(t==null)return;ur(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ar(e){ur(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sr(e,t,n){if(t!=null||n!=null)ur(e);if(t!=null)e.curOp.scrollLeft=t;if(n!=null)e.curOp.scrollTop=n}function lr(e,t){ur(e);e.curOp.scrollToPos=t}function ur(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=xi(e,t.from),i=xi(e,t.to);cr(e,n,i,t.margin)}}function cr(e,t,n,i){var r=rr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});sr(e,r.scrollLeft,r.scrollTop)}function fr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;if(!g)jr(e,{top:t});dr(e,t,true);if(g)jr(e);Ir(e,100)}function dr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t));if(e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t;e.display.scrollbars.setScrollTop(t);if(e.display.scroller.scrollTop!=t)e.display.scroller.scrollTop=t}function hr(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth));if((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t;qr(e);if(e.display.scroller.scrollLeft!=t)e.display.scroller.scrollLeft=t;e.display.scrollbars.setScrollLeft(t)}function pr(e){var t=e.display,n=t.gutters.offsetWidth;var i=Math.round(e.doc.height+Un(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Xn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var mr=function(e,t,n){this.cm=n;var i=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1;e(i);e(r);pe(i,"scroll",function(){if(i.clientHeight)t(i.scrollTop,"vertical")});pe(r,"scroll",function(){if(r.clientWidth)t(r.scrollLeft,"horizontal")});this.checkedZeroWidth=false;if(S&&w<8)this.horiz.style.minHeight=this.vert.style.minWidth="18px"};mr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1;var n=e.scrollHeight>e.clientHeight+1;var i=e.nativeBarWidth;if(n){this.vert.style.display="block";this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(t){this.horiz.style.display="block";this.horiz.style.right=n?i+"px":"0";this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?i: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"}if(!this.checkedZeroWidth&&e.clientHeight>0){if(i==0)this.zeroWidthHack();this.checkedZeroWidth=true}return{right:n?i:0,bottom:t?i:0}},mr.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e)this.horiz.scrollLeft=e;if(this.disableHoriz)this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},mr.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e)this.vert.scrollTop=e;if(this.disableVert)this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},mr.prototype.zeroWidthHack=function(){var e=x&&!s?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new B;this.disableVert=new B},mr.prototype.enableZeroWidthBar=function(n,i,r){n.style.pointerEvents="auto";function o(){var e=n.getBoundingClientRect();var t=r=="vert"?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);if(t!=n)n.style.pointerEvents="none";else i.set(1e3,o)}i.set(1e3,o)},mr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)};var gr=function(){};function vr(e,t){if(!t)t=pr(e);var n=e.display.barWidth,i=e.display.barHeight;yr(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++){if(n!=e.display.barWidth&&e.options.lineWrapping)Zi(e);yr(e,pr(e));n=e.display.barWidth;i=e.display.barHeight}}function yr(e,t){var n=e.display;var i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px";n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px";n.heightForcer.style.borderBottom=i.bottom+"px solid transparent";if(i.right&&i.bottom){n.scrollbarFiller.style.display="block";n.scrollbarFiller.style.height=i.bottom+"px";n.scrollbarFiller.style.width=i.right+"px"}else n.scrollbarFiller.style.display="";if(i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){n.gutterFiller.style.display="block";n.gutterFiller.style.height=i.bottom+"px";n.gutterFiller.style.width=t.gutterWidth+"px"}else n.gutterFiller.style.display=""}gr.prototype.update=function(){return{bottom:0,right:0}},gr.prototype.setScrollLeft=function(){},gr.prototype.setScrollTop=function(){},gr.prototype.clear=function(){};var xr={native:mr,null:gr};function br(n){if(n.display.scrollbars){n.display.scrollbars.clear();if(n.display.scrollbars.addClass)L(n.display.wrapper,n.display.scrollbars.addClass)}n.display.scrollbars=new xr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller);pe(e,"mousedown",function(){if(n.state.focused)setTimeout(function(){return n.display.input.focus()},0)});e.setAttribute("cm-not-content","true")},function(e,t){if(t=="horizontal")hr(n,e);else fr(n,e)},n);if(n.display.scrollbars.addClass)F(n.display.wrapper,n.display.scrollbars.addClass)}var wr=0;function kr(e){e.curOp={cm:e,viewChanged:false,startHeight:e.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++wr,markArrays:null};Sn(e.curOp)}function Cr(e){var t=e.curOp;if(t)En(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;Sr(e)})}function Sr(e){var t=e.ops;for(var n=0;n<t.length;n++)Lr(t[n]);for(var i=0;i<t.length;i++)Er(t[i]);for(var r=0;r<t.length;r++)Mr(t[r]);for(var o=0;o<t.length;o++)Tr(t[o]);for(var a=0;a<t.length;a++)Dr(t[a])}function Lr(e){var t=e.cm,n=t.display;$r(t);if(e.updateMaxLine)sn(t);e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new Hr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Er(e){e.updatedDisplay=e.mustUpdate&&Wr(e.cm,e.update)}function Mr(e){var t=e.cm,n=t.display;if(e.updatedDisplay)Zi(t);e.barMeasure=pr(t);if(n.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=Jn(t,n.maxLine,n.maxLine.text.length).left+3;t.display.sizerWidth=e.adjustWidthTo;e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Xn(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Gn(t))}if(e.updatedDisplay||e.selectionChanged)e.preparedSelection=n.input.prepareSelection()}function Tr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft<t.doc.scrollLeft)hr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),true);t.display.maxLineChanged=false}var n=e.focus&&e.focus==N();if(e.preparedSelection)t.display.input.showSelection(e.preparedSelection,n);if(e.updatedDisplay||e.startHeight!=t.doc.height)vr(t,e.barMeasure);if(e.updatedDisplay)Ur(t,e.barMeasure);if(e.selectionChanged)Xi(t);if(t.state.focused&&e.updateInput)t.display.input.reset(e.typing);if(n)Gi(e.cm)}function Dr(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay)Rr(t,e.update);if(n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos))n.wheelStartX=n.wheelStartY=null;if(e.scrollTop!=null)dr(t,e.scrollTop,e.forceScroll);if(e.scrollLeft!=null)hr(t,e.scrollLeft,true,true);if(e.scrollToPos){var r=nr(t,ft(i,e.scrollToPos.from),ft(i,e.scrollToPos.to),e.scrollToPos.margin);tr(t,r)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)if(!o[s].lines.length)ve(o[s],"hide");if(a)for(var l=0;l<a.length;++l)if(a[l].lines.length)ve(a[l],"unhide");if(n.wrapper.offsetHeight)i.scrollTop=t.display.scroller.scrollTop;if(e.changeObjs)ve(t,"changes",t,e.changeObjs);if(e.update)e.update.finish()}function Ar(e,t){if(e.curOp)return t();kr(e);try{return t()}finally{Cr(e)}}function Or(e,t){return function(){if(e.curOp)return t.apply(e,arguments);kr(e);try{return t.apply(e,arguments)}finally{Cr(e)}}}function Nr(e){return function(){if(this.curOp)return e.apply(this,arguments);kr(this);try{return e.apply(this,arguments)}finally{Cr(this)}}}function Fr(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);kr(e);try{return t.apply(this,arguments)}finally{Cr(e)}}}function Ir(e,t){if(e.doc.highlightFrontier<e.display.viewTo)e.state.highlight.set(t,H(Pr,e))}function Pr(l){var u=l.doc;if(u.highlightFrontier>=l.display.viewTo)return;var c=+new Date+l.options.workTime;var f=yt(l,u.highlightFrontier);var d=[];u.iter(f.line,Math.min(u.first+u.size,l.display.viewTo+500),function(e){if(f.line>=l.display.viewFrom){var t=e.styles;var n=e.text.length>l.options.maxHighlightLength?qe(u.mode,f.state):null;var i=gt(l,e,f,true);if(n)f.state=n;e.styles=i.styles;var r=e.styleClasses,o=i.classes;if(o)e.styleClasses=o;else if(r)e.styleClasses=null;var a=!t||t.length!=e.styles.length||r!=o&&(!r||!o||r.bgClass!=o.bgClass||r.textClass!=o.textClass);for(var s=0;!a&&s<t.length;++s)a=t[s]!=e.styles[s];if(a)d.push(f.line);e.stateAfter=f.save();f.nextLine()}else{if(e.text.length<=l.options.maxHighlightLength)xt(l,e.text,f);e.stateAfter=f.line%5==0?f.save():null;f.nextLine()}if(+new Date>c){Ir(l,l.options.workDelay);return true}});u.highlightFrontier=f.line;u.modeFrontier=Math.max(u.modeFrontier,f.line);if(d.length)Ar(l,function(){for(var e=0;e<d.length;e++)$i(l,d[e],"text")})}var Hr=function(e,t,n){var i=e.display;this.viewport=t;this.visible=er(i,e.doc,t);this.editorIsHidden=!i.wrapper.offsetWidth;this.wrapperHeight=i.wrapper.clientHeight;this.wrapperWidth=i.wrapper.clientWidth;this.oldDisplayWidth=Gn(e);this.force=n;this.dims=Ai(e);this.events=[]};function $r(e){var t=e.display;if(!t.scrollbarsClipped&&t.scroller.offsetWidth){t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth;t.heightForcer.style.height=Xn(e)+"px";t.sizer.style.marginBottom=-t.nativeBarWidth+"px";t.sizer.style.borderRightWidth=Xn(e)+"px";t.scrollbarsClipped=true}}function zr(e){if(e.hasFocus())return null;var t=N();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();if(i.anchorNode&&i.extend&&A(e.display.lineDiv,i.anchorNode)){n.anchorNode=i.anchorNode;n.anchorOffset=i.anchorOffset;n.focusNode=i.focusNode;n.focusOffset=i.focusOffset}}return n}function Br(e){if(!e||!e.activeElt||e.activeElt==N())return;e.activeElt.focus();if(!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset);n.collapse(false);t.removeAllRanges();t.addRange(n);t.extend(e.focusNode,e.focusOffset)}}function Wr(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden){zi(e);return false}if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Ri(e)==0)return false;if(Xr(e)){zi(e);t.dims=Ai(e)}var r=i.first+i.size;var o=Math.max(t.visible.from-e.options.viewportMargin,i.first);var a=Math.min(r,t.visible.to+e.options.viewportMargin);if(n.viewFrom<o&&o-n.viewFrom<20)o=Math.max(i.first,n.viewFrom);if(n.viewTo>a&&n.viewTo-a<20)a=Math.min(r,n.viewTo);if(Dt){o=en(e.doc,o);a=tn(e.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Wi(e,o,a);n.viewOffset=on(Ke(e.doc,n.viewFrom));e.display.mover.style.top=n.viewOffset+"px";var l=Ri(e);if(!s&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return false;var u=zr(e);if(l>4)n.lineDiv.style.display="none";_r(e,n.updateLineNumbers,t.dims);if(l>4)n.lineDiv.style.display="";n.renderedView=n.view;Br(u);M(n.cursorDiv);M(n.selectionDiv);n.gutters.style.height=n.sizer.style.minHeight=0;if(s){n.lastWrapHeight=t.wrapperHeight;n.lastWrapWidth=t.wrapperWidth;Ir(e,400)}n.updateLineNumbers=null;return true}function Rr(e,t){var n=t.viewport;for(var i=true;;i=false){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Gn(e)){if(n&&n.top!=null)n={top:Math.min(e.doc.height+Un(e.display)-Vn(e),n.top)};t.visible=er(e.display,e.doc,n);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else if(i)t.visible=er(e.display,e.doc,n);if(!Wr(e,t))break;Zi(e);var r=pr(e);ji(e);vr(e,r);Ur(e,r);t.force=false}t.signal(e,"update",e);if(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 jr(e,t){var n=new Hr(e,t);if(Wr(e,n)){Zi(e);Rr(e,n);var i=pr(e);ji(e);vr(e,i);Ur(e,i);n.finish()}}function _r(n,e,t){var i=n.display,r=n.options.lineNumbers;var o=i.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;if(v&&x&&n.display.currentWheelTarget==e)e.style.display="none";else e.parentNode.removeChild(e);return t}var l=i.view,u=i.viewFrom;for(var c=0;c<l.length;c++){var f=l[c];if(f.hidden);else if(!f.node||f.node.parentNode!=o){var d=zn(n,f,u,t);o.insertBefore(d,a)}else{while(a!=f.node)a=s(a);var h=r&&e!=null&&e<=u&&f.lineNumber;if(f.changes){if(W(f.changes,"gutter")>-1)h=false;An(n,f,u,t)}if(h){M(f.lineNumber);f.lineNumber.appendChild(document.createTextNode(it(n.options,u)))}a=f.node.nextSibling}u+=f.size}while(a)a=s(a)}function Yr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px";Tn(e,"gutterChanged",e)}function Ur(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+Xn(e)+"px"}function qr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var i=Oi(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=i+"px";for(var a=0;a<n.length;a++)if(!n[a].hidden){if(e.options.fixedGutter){if(n[a].gutter)n[a].gutter.style.left=o;if(n[a].gutterBackground)n[a].gutterBackground.style.left=o}var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}if(e.options.fixedGutter)t.gutters.style.left=i+r+"px"}function Xr(e){if(!e.options.lineNumbers)return false;var t=e.doc,n=it(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var r=i.measure.appendChild(O("div",[O("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var o=r.firstChild.offsetWidth,a=r.offsetWidth-o;i.lineGutter.style.width="";i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-a)+1;i.lineNumWidth=i.lineNumInnerWidth+a;i.lineNumChars=i.lineNumInnerWidth?n.length:-1;i.lineGutter.style.width=i.lineNumWidth+"px";Yr(e.display);return true}return false}function Gr(e,t){var n=[],i=false;for(var r=0;r<e.length;r++){var o=e[r],a=null;if(typeof o!="string"){a=o.style;o=o.className}if(o=="CodeMirror-linenumbers")if(!t)continue;else i=true;n.push({className:o,style:a})}if(t&&!i)n.push({className:"CodeMirror-linenumbers",style:null});return n}function Vr(e){var t=e.gutters,n=e.gutterSpecs;M(t);e.lineGutter=null;for(var i=0;i<n.length;++i){var r=n[i];var o=r.className;var a=r.style;var s=t.appendChild(O("div",null,"CodeMirror-gutter "+o));if(a)s.style.cssText=a;if(o=="CodeMirror-linenumbers"){e.lineGutter=s;s.style.width=(e.lineNumWidth||1)+"px"}}t.style.display=n.length?"":"none";Yr(e)}function Kr(e){Vr(e.display);Hi(e);qr(e)}function Qr(e,t,n,i){var r=this;this.input=n;r.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler");r.scrollbarFiller.setAttribute("cm-not-content","true");r.gutterFiller=O("div",null,"CodeMirror-gutter-filler");r.gutterFiller.setAttribute("cm-not-content","true");r.lineDiv=D("div",null,"CodeMirror-code");r.selectionDiv=O("div",null,null,"position: relative; z-index: 1");r.cursorDiv=O("div",null,"CodeMirror-cursors");r.measure=O("div",null,"CodeMirror-measure");r.lineMeasure=O("div",null,"CodeMirror-measure");r.lineSpace=D("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var o=D("div",[r.lineSpace],"CodeMirror-lines");r.mover=O("div",[o],null,"position: relative");r.sizer=O("div",[r.mover],"CodeMirror-sizer");r.sizerWidth=null;r.heightForcer=O("div",null,null,"position: absolute; height: "+R+"px; width: 1px;");r.gutters=O("div",null,"CodeMirror-gutters");r.lineGutter=null;r.scroller=O("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll");r.scroller.setAttribute("tabIndex","-1");r.wrapper=O("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror");r.wrapper.setAttribute("translate","no");if(S&&w<8){r.gutters.style.zIndex=-1;r.scroller.style.paddingRight=0}if(!v&&!(g&&d))r.scroller.draggable=true;if(e)if(e.appendChild)e.appendChild(r.wrapper);else e(r.wrapper);r.viewFrom=r.viewTo=t.first;r.reportedViewFrom=r.reportedViewTo=t.first;r.view=[];r.renderedView=null;r.externalMeasured=null;r.viewOffset=0;r.lastWrapHeight=r.lastWrapWidth=0;r.updateLineNumbers=null;r.nativeBarWidth=r.barHeight=r.barWidth=0;r.scrollbarsClipped=false;r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null;r.alignWidgets=false;r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null;r.maxLine=null;r.maxLineLength=0;r.maxLineChanged=false;r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null;r.shift=false;r.selForContextMenu=null;r.activeTouch=null;r.gutterSpecs=Gr(i.gutters,i.lineNumbers);Vr(r);n.init(r)}Hr.prototype.signal=function(e,t){if(be(e,t))this.events.push(arguments)},Hr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ve.apply(null,this.events[e])};var Zr=0,Jr=null;if(S)Jr=-.53;else if(g)Jr=15;else if(a)Jr=-.7;else if(c)Jr=-1/3;function eo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;if(t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS)t=e.detail;if(n==null&&e.detail&&e.axis==e.VERTICAL_AXIS)n=e.detail;else if(n==null)n=e.wheelDelta;return{x:t,y:n}}function to(e){var t=eo(e);t.x*=Jr;t.y*=Jr;return t}function no(e,t){var n=eo(t),i=n.x,r=n.y;var o=Jr;if(event.deltaMode===0){i=t.deltaX;r=t.deltaY;o=1}var a=e.display,s=a.scroller;var l=s.scrollWidth>s.clientWidth;var u=s.scrollHeight>s.clientHeight;if(!(i&&l||r&&u))return;if(r&&x&&v)e:for(var c=t.target,f=a.view;c!=s;c=c.parentNode)for(var d=0;d<f.length;d++)if(f[d].node==c){e.display.currentWheelTarget=c;break e}if(i&&!g&&!y&&o!=null){if(r&&u)fr(e,Math.max(0,s.scrollTop+r*o));hr(e,Math.max(0,s.scrollLeft+i*o));if(!r||r&&u)ke(t);a.wheelStartX=null;return}if(r&&o!=null){var h=r*o;var p=e.doc.scrollTop,m=p+a.wrapper.clientHeight;if(h<0)p=Math.max(0,p+h-50);else m=Math.min(e.doc.height,m+h+50);jr(e,{top:p,bottom:m})}if(Zr<20&&t.deltaMode!==0)if(a.wheelStartX==null){a.wheelStartX=s.scrollLeft;a.wheelStartY=s.scrollTop;a.wheelDX=i;a.wheelDY=r;setTimeout(function(){if(a.wheelStartX==null)return;var e=s.scrollLeft-a.wheelStartX;var t=s.scrollTop-a.wheelStartY;var n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null;if(!n)return;Jr=(Jr*Zr+n)/(Zr+1);++Zr},200)}else{a.wheelDX+=i;a.wheelDY+=r}}var io=function(e,t){this.ranges=e;this.primIndex=t};io.prototype.primary=function(){return this.ranges[this.primIndex]},io.prototype.equals=function(e){if(e==this)return true;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return false;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],i=e.ranges[t];if(!at(n.anchor,i.anchor)||!at(n.head,i.head))return false}return true},io.prototype.deepCopy=function(){var e=[];for(var t=0;t<this.ranges.length;t++)e[t]=new ro(st(this.ranges[t].anchor),st(this.ranges[t].head));return new io(e,this.primIndex)},io.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return true;return false},io.prototype.contains=function(e,t){if(!t)t=e;for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(ot(t,i.from())>=0&&ot(e,i.to())<=0)return n}return-1};var ro=function(e,t){this.anchor=e;this.head=t};function oo(e,t,n){var i=e&&e.options.selectionsMayTouch;var r=t[n];t.sort(function(e,t){return ot(e.from(),t.from())});n=W(t,r);for(var o=1;o<t.length;o++){var a=t[o],s=t[o-1];var l=ot(s.to(),a.from());if(i&&!a.empty()?l>0:l>=0){var u=ut(s.from(),a.from()),c=lt(s.to(),a.to());var f=s.empty()?a.from()==a.head:s.from()==s.head;if(o<=n)--n;t.splice(--o,2,new ro(f?c:u,f?u:c))}}return new io(t,n)}function ao(e,t){return new io([new ro(e,t||e)],0)}function so(e){if(!e.text)return e.to;return rt(e.from.line+e.text.length-1,V(e.text).length+(e.text.length==1?e.from.ch:0))}function lo(e,t){if(ot(e,t.from)<0)return e;if(ot(e,t.to)<=0)return so(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;if(e.line==t.to.line)i+=so(t).ch-t.to.ch;return rt(n,i)}function uo(e,t){var n=[];for(var i=0;i<e.sel.ranges.length;i++){var r=e.sel.ranges[i];n.push(new ro(lo(r.anchor,t),lo(r.head,t)))}return oo(e.cm,n,e.sel.primIndex)}function co(e,t,n){if(e.line==t.line)return rt(n.line,e.ch-t.ch+n.ch);else return rt(n.line+(e.line-t.line),e.ch)}function fo(e,t,n){var i=[];var r=rt(e.first,0),o=r;for(var a=0;a<t.length;a++){var s=t[a];var l=co(s.from,r,o);var u=co(so(s),r,o);r=s.to;o=u;if(n=="around"){var c=e.sel.ranges[a],f=ot(c.head,c.anchor)<0;i[a]=new ro(f?u:l,f?l:u)}else i[a]=new ro(l,l)}return new io(i,e.sel.primIndex)}function ho(e){e.doc.mode=_e(e.options,e.doc.modeOption);po(e)}function po(e){e.doc.iter(function(e){if(e.stateAfter)e.stateAfter=null;if(e.styles)e.styles=null});e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first;Ir(e,100);e.state.modeGen++;if(e.curOp)Hi(e)}function mo(e,t){return t.from.ch==0&&t.to.ch==0&&V(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function go(e,i,t,r){function o(e){return t?t[e]:null}function n(e,t,n){un(e,t,n,r);Tn(e,"change",e,i)}function a(e,t){var n=[];for(var i=e;i<t;++i)n.push(new ln(u[i],o(i),r));return n}var s=i.from,l=i.to,u=i.text;var c=Ke(e,s.line),f=Ke(e,l.line);var d=V(u),h=o(u.length-1),p=l.line-s.line;if(i.full){e.insert(0,a(0,u.length));e.remove(u.length,e.size-u.length)}else if(mo(e,i)){var m=a(0,u.length-1);n(f,f.text,h);if(p)e.remove(s.line,p);if(m.length)e.insert(s.line,m)}else if(c==f)if(u.length==1)n(c,c.text.slice(0,s.ch)+d+c.text.slice(l.ch),h);else{var g=a(1,u.length-1);g.push(new ln(d+c.text.slice(l.ch),h,r));n(c,c.text.slice(0,s.ch)+u[0],o(0));e.insert(s.line+1,g)}else if(u.length==1){n(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(l.ch),o(0));e.remove(s.line+1,p)}else{n(c,c.text.slice(0,s.ch)+u[0],o(0));n(f,d+f.text.slice(l.ch),h);var v=a(1,u.length-1);if(p>1)e.remove(s.line+1,p-1);e.insert(s.line+1,v)}Tn(e,"change",e,i)}function vo(e,a,s){function l(e,t,n){if(e.linked)for(var i=0;i<e.linked.length;++i){var r=e.linked[i];if(r.doc==t)continue;var o=n&&r.sharedHist;if(s&&!o)continue;a(r.doc,o);l(r.doc,e,o)}}l(e,null,true)}function yo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t;t.cm=e;Fi(e);ho(e);xo(e);e.options.direction=t.direction;if(!e.options.lineWrapping)sn(e);e.options.mode=t.modeOption;Hi(e)}function xo(e){(e.doc.direction=="rtl"?F:L)(e.display.lineDiv,"CodeMirror-rtl")}function bo(e){Ar(e,function(){xo(e);Hi(e)})}function wo(e){this.done=[];this.undone=[];this.undoDepth=e?e.undoDepth:Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=e?e.maxGeneration:1}function ko(e,t){var n={from:st(t.from),to:so(t),text:Qe(e,t.from,t.to)};Do(e,n,t.from.line,t.to.line+1);vo(e,function(e){return Do(e,n,t.from.line,t.to.line+1)},true);return n}function Co(e){while(e.length){var t=V(e);if(t.ranges)e.pop();else break}}function So(e,t){if(t){Co(e.done);return V(e.done)}else if(e.done.length&&!V(e.done).ranges)return V(e.done);else if(e.done.length>1&&!e.done[e.done.length-2].ranges){e.done.pop();return V(e.done)}}function Lo(e,t,n,i){var r=e.history;r.undone.length=0;var o=+new Date,a;var s;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=So(r,r.lastOp==i))){s=V(a.changes);if(ot(t.from,t.to)==0&&ot(t.from,s.to)==0)s.to=so(t);else a.changes.push(ko(e,t))}else{var l=V(r.done);if(!l||!l.ranges)To(e.sel,r.done);a={changes:[ko(e,t)],generation:r.generation};r.done.push(a);while(r.done.length>r.undoDepth){r.done.shift();if(!r.done[0].ranges)r.done.shift()}}r.done.push(n);r.generation=++r.maxGeneration;r.lastModTime=r.lastSelTime=o;r.lastOp=r.lastSelOp=i;r.lastOrigin=r.lastSelOrigin=t.origin;if(!s)ve(e,"historyAdded")}function Eo(e,t,n,i){var r=t.charAt(0);return r=="*"||r=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Mo(e,t,n,i){var r=e.history,o=i&&i.origin;if(n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Eo(e,o,V(r.done),t)))r.done[r.done.length-1]=t;else To(t,r.done);r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=n;if(i&&i.clearRedo!==false)Co(r.undone)}function To(e,t){var n=V(t);if(!(n&&n.ranges&&n.equals(e)))t.push(e)}function Do(t,n,e,i){var r=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,i),function(e){if(e.markedSpans)(r||(r=n["spans_"+t.id]={}))[o]=e.markedSpans;++o})}function Ao(e){if(!e)return null;var t;for(var n=0;n<e.length;++n)if(e[n].marker.explicitlyCleared){if(!t)t=e.slice(0,n)}else if(t)t.push(e[n]);return!t?e:t.length?t:null}function Oo(e,t){var n=t["spans_"+e.id];if(!n)return null;var i=[];for(var r=0;r<t.text.length;++r)i.push(Ao(n[r]));return i}function No(e,t){var n=Oo(e,t);var i=zt(e,t);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var o=n[r],a=i[r];if(o&&a)e:for(var s=0;s<a.length;++s){var l=a[s];for(var u=0;u<o.length;++u)if(o[u].marker==l.marker)continue e;o.push(l)}else if(a)n[r]=a}return n}function Fo(e,t,n){var i=[];for(var r=0;r<e.length;++r){var o=e[r];if(o.ranges){i.push(n?io.prototype.deepCopy.call(o):o);continue}var a=o.changes,s=[];i.push({changes:s});for(var l=0;l<a.length;++l){var u=a[l],c=void 0;s.push({from:u.from,to:u.to,text:u.text});if(t)for(var f in u)if(c=f.match(/^spans_(\d+)$/))if(W(t,Number(c[1]))>-1){V(s)[f]=u[f];delete u[f]}}}return i}function Io(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ot(t,r)<0;if(o!=ot(n,r)<0){r=t;t=n}else if(o!=ot(t,n)<0)t=n}return new ro(r,t)}else return new ro(n||t,t)}function Po(e,t,n,i,r){if(r==null)r=e.cm&&(e.cm.display.shift||e.extend);Ro(e,new io([Io(e.sel.primary(),t,n,r)],0),i)}function Ho(e,t,n){var i=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o<e.sel.ranges.length;o++)i[o]=Io(e.sel.ranges[o],t[o],null,r);var a=oo(e.cm,i,e.sel.primIndex);Ro(e,a,n)}function $o(e,t,n,i){var r=e.sel.ranges.slice(0);r[t]=n;Ro(e,oo(e.cm,r,e.sel.primIndex),i)}function zo(e,t,n,i){Ro(e,ao(t,n),i)}function Bo(n,e,t){var i={ranges:e.ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new ro(ft(n,e[t].anchor),ft(n,e[t].head))},origin:t&&t.origin};ve(n,"beforeSelectionChange",n,i);if(n.cm)ve(n.cm,"beforeSelectionChange",n.cm,i);if(i.ranges!=e.ranges)return oo(n.cm,i.ranges,i.ranges.length-1);else return e}function Wo(e,t,n){var i=e.history.done,r=V(i);if(r&&r.ranges){i[i.length-1]=t;jo(e,t,n)}else Ro(e,t,n)}function Ro(e,t,n){jo(e,t,n);Mo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function jo(e,t,n){if(be(e,"beforeSelectionChange")||e.cm&&be(e.cm,"beforeSelectionChange"))t=Bo(e,t,n);var i=n&&n.bias||(ot(t.primary().head,e.sel.primary().head)<0?-1:1);_o(e,Uo(e,t,i,true));if(!(n&&n.scroll===false)&&e.cm&&e.cm.getOption("readOnly")!="nocursor")ar(e.cm)}function _o(e,t){if(t.equals(e.sel))return;e.sel=t;if(e.cm){e.cm.curOp.updateInput=1;e.cm.curOp.selectionChanged=true;xe(e.cm)}Tn(e,"cursorActivity",e)}function Yo(e){_o(e,Uo(e,e.sel,null,false))}function Uo(e,t,n,i){var r;for(var o=0;o<t.ranges.length;o++){var a=t.ranges[o];var s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o];var l=Xo(e,a.anchor,s&&s.anchor,n,i);var u=Xo(e,a.head,s&&s.head,n,i);if(r||l!=a.anchor||u!=a.head){if(!r)r=t.ranges.slice(0,o);r[o]=new ro(l,u)}}return r?oo(e.cm,r,t.primIndex):t}function qo(e,t,n,i,r){var o=Ke(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker;var u="selectLeft"in l?!l.selectLeft:l.inclusiveLeft;var c="selectRight"in l?!l.selectRight:l.inclusiveRight;if((s.from==null||(u?s.from<=t.ch:s.from<t.ch))&&(s.to==null||(c?s.to>=t.ch:s.to>t.ch))){if(r){ve(l,"beforeCursorEnter");if(l.explicitlyCleared)if(!o.markedSpans)break;else{--a;continue}}if(!l.atomic)continue;if(n){var f=l.find(i<0?1:-1),d=void 0;if(i<0?c:u)f=Go(e,f,-i,f&&f.line==t.line?o:null);if(f&&f.line==t.line&&(d=ot(f,n))&&(i<0?d<0:d>0))return qo(e,f,t,i,r)}var h=l.find(i<0?-1:1);if(i<0?u:c)h=Go(e,h,i,h.line==t.line?o:null);return h?qo(e,h,t,i,r):null}}return t}function Xo(e,t,n,i,r){var o=i||1;var a=qo(e,t,n,o,r)||!r&&qo(e,t,n,o,true)||qo(e,t,n,-o,r)||!r&&qo(e,t,n,-o,true);if(!a){e.cantEdit=true;return rt(e.first,0)}return a}function Go(e,t,n,i){if(n<0&&t.ch==0)if(t.line>e.first)return ft(e,rt(t.line-1));else return null;else if(n>0&&t.ch==(i||Ke(e,t.line)).text.length)if(t.line<e.first+e.size-1)return rt(t.line+1,0);else return null;else return new rt(t.line,t.ch+n)}function Vo(e){e.setSelection(rt(e.firstLine(),0),rt(e.lastLine()),_)}function Ko(r,e,t){var o={canceled:false,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=true}};if(t)o.update=function(e,t,n,i){if(e)o.from=ft(r,e);if(t)o.to=ft(r,t);if(n)o.text=n;if(i!==undefined)o.origin=i};ve(r,"beforeChange",r,o);if(r.cm)ve(r.cm,"beforeChange",r.cm,o);if(o.canceled){if(r.cm)r.cm.curOp.updateInput=2;return null}return{from:o.from,to:o.to,text:o.text,origin:o.origin}}function Qo(e,t,n){if(e.cm){if(!e.cm.curOp)return Or(e.cm,Qo)(e,t,n);if(e.cm.state.suppressEdits)return}if(be(e,"beforeChange")||e.cm&&be(e.cm,"beforeChange")){t=Ko(e,t,true);if(!t)return}var i=Tt&&!n&&Wt(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)Zo(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,n){if(n.text.length==1&&n.text[0]==""&&ot(n.from,n.to)==0)return;var t=uo(e,n);Lo(e,n,t,e.cm?e.cm.curOp.id:NaN);ta(e,n,t,zt(e,n));var i=[];vo(e,function(e,t){if(!t&&W(i,e.history)==-1){aa(e.history,n);i.push(e.history)}ta(e,n,null,zt(e,n))})}function Jo(r,o,e){var t=r.cm&&r.cm.state.suppressEdits;if(t&&!e)return;var n=r.history,a,i=r.sel;var s=o=="undo"?n.done:n.undone,l=o=="undo"?n.undone:n.done;var u=0;for(;u<s.length;u++){a=s[u];if(e?a.ranges&&!a.equals(r.sel):!a.ranges)break}if(u==s.length)return;n.lastOrigin=n.lastSelOrigin=null;for(;;){a=s.pop();if(a.ranges){To(a,l);if(e&&!a.equals(r.sel)){Ro(r,a,{clearRedo:false});return}i=a}else if(t){s.push(a);return}else break}var c=[];To(i,l);l.push({changes:c,generation:n.generation});n.generation=a.generation||++n.maxGeneration;var f=be(r,"beforeChange")||r.cm&&be(r.cm,"beforeChange");var d=function(e){var n=a.changes[e];n.origin=o;if(f&&!Ko(r,n,false)){s.length=0;return{}}c.push(ko(r,n));var t=e?uo(r,n):V(s);ta(r,n,t,No(r,n));if(!e&&r.cm)r.cm.scrollIntoView({from:n.from,to:so(n)});var i=[];vo(r,function(e,t){if(!t&&W(i,e.history)==-1){aa(e.history,n);i.push(e.history)}ta(e,n,null,No(e,n))})};for(var h=a.changes.length-1;h>=0;--h){var p=d(h);if(p)return p.v}}function ea(e,t){if(t==0)return;e.first+=t;e.sel=new io(K(e.sel.ranges,function(e){return new ro(rt(e.anchor.line+t,e.anchor.ch),rt(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){Hi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)$i(e.cm,i,"gutter")}}function ta(e,t,n,i){if(e.cm&&!e.cm.curOp)return Or(e.cm,ta)(e,t,n,i);if(t.to.line<e.first){ea(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var r=t.text.length-1-(e.first-t.from.line);ea(e,r);t={from:rt(e.first,0),to:rt(t.to.line+r,t.to.ch),text:[V(t.text)],origin:t.origin}}var o=e.lastLine();if(t.to.line>o)t={from:t.from,to:rt(o,Ke(e,o).text.length),text:[t.text[0]],origin:t.origin};t.removed=Qe(e,t.from,t.to);if(!n)n=uo(e,t);if(e.cm)na(e.cm,t,i);else go(e,t,i);jo(e,n,_);if(e.cantEdit&&Xo(e,rt(e.firstLine(),0)))e.cantEdit=false}function na(e,t,n){var i=e.doc,r=e.display,o=t.from,a=t.to;var s=false,l=o.line;if(!e.options.lineWrapping){l=et(Qt(Ke(i,o.line)));i.iter(l,a.line+1,function(e){if(e==r.maxLine){s=true;return true}})}if(i.sel.contains(t.from,t.to)>-1)xe(e);go(i,t,n,Ni(e));if(!e.options.lineWrapping){i.iter(l,o.line+t.text.length,function(e){var t=an(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;s=false}});if(s)e.curOp.updateMaxLine=true}Mt(i,o.line);Ir(e,400);var u=t.text.length-(a.line-o.line)-1;if(t.full)Hi(e);else if(o.line==a.line&&t.text.length==1&&!mo(e.doc,t))$i(e,o.line,"text");else Hi(e,o.line,a.line+1,u);var c=be(e,"changes"),f=be(e,"change");if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};if(f)Tn(e,"change",e,d);if(c)(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}function ia(e,t,n,i,r){var o;if(!i)i=n;if(ot(i,n)<0)o=[i,n],n=o[0],i=o[1];if(typeof t=="string")t=e.splitLines(t);Qo(e,{from:n,to:i,text:t,origin:r})}function ra(e,t,n,i){if(n<e.line)e.line+=i;else if(t<e.line){e.line=t;e.ch=0}}function oa(e,t,n,i){for(var r=0;r<e.length;++r){var o=e[r],a=true;if(o.ranges){if(!o.copied){o=e[r]=o.deepCopy();o.copied=true}for(var s=0;s<o.ranges.length;s++){ra(o.ranges[s].anchor,t,n,i);ra(o.ranges[s].head,t,n,i)}continue}for(var l=0;l<o.changes.length;++l){var u=o.changes[l];if(n<u.from.line){u.from=rt(u.from.line+i,u.from.ch);u.to=rt(u.to.line+i,u.to.ch)}else if(t<=u.to.line){a=false;break}}if(!a){e.splice(0,r+1);r=0}}}function aa(e,t){var n=t.from.line,i=t.to.line,r=t.text.length-(i-n)-1;oa(e.done,n,i,r);oa(e.undone,n,i,r)}function sa(e,t,n,i){var r=t,o=t;if(typeof t=="number")o=Ke(e,ct(e,t));else r=et(t);if(r==null)return null;if(i(o,r)&&e.cm)$i(e.cm,r,n);return o}function la(e){this.lines=e;this.parent=null;var t=0;for(var n=0;n<e.length;++n){e[n].parent=this;t+=e[n].height}this.height=t}function ua(e){this.children=e;var t=0,n=0;for(var i=0;i<e.length;++i){var r=e[i];t+=r.chunkSize();n+=r.height;r.parent=this}this.size=t;this.height=n;this.parent=null}ro.prototype.from=function(){return ut(this.anchor,this.head)},ro.prototype.to=function(){return lt(this.anchor,this.head)},ro.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},la.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var r=this.lines[n];this.height-=r.height;cn(r);Tn(r,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n;this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return true}},ua.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],r=i.chunkSize();if(e<r){var o=Math.min(t,r-e),a=i.height;i.removeInner(e,o);this.height-=a-i.height;if(r==o){this.children.splice(n--,1);i.parent=null}if((t-=o)==0)break;e=0}else e-=r}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof la))){var s=[];this.collapse(s);this.children=[new la(s)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length;this.height+=n;for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(e<=o){r.insertInner(e,t,n);if(r.lines&&r.lines.length>50){var a=r.lines.length%25+25;for(var s=a;s<r.lines.length;){var l=new la(r.lines.slice(s,s+=25));r.height-=l.height;this.children.splice(++i,0,l);l.parent=this}r.lines=r.lines.slice(0,a);this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5);var n=new ua(t);if(!e.parent){var i=new ua(e.children);i.parent=e;e.children=[i,n];e=i}else{e.size-=n.size;e.height-=n.height;var r=W(e.parent.children,e);e.parent.children.splice(r+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(e<o){var a=Math.min(t,o-e);if(r.iterN(e,a,n))return true;if((t-=a)==0)break;e=0}else e-=o}}};var ca=function(e,t,n){if(n)for(var i in n)if(n.hasOwnProperty(i))this[i]=n[i];this.doc=e;this.node=t};function fa(e,t,n){if(on(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop))or(e,n)}function da(i,e,t,n){var r=new ca(i,t,n);var o=i.cm;if(o&&r.noHScroll)o.display.alignWidgets=true;sa(i,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(r.insertAt==null)t.push(r);else t.splice(Math.min(t.length,Math.max(0,r.insertAt)),0,r);r.line=e;if(o&&!nn(i,e)){var n=on(e)<i.scrollTop;Je(e,e.height+jn(r));if(n)or(o,r.height);o.curOp.forceUpdate=true}return true});if(o)Tn(o,"lineWidgetAdded",o,r,typeof e=="number"?e:et(e));return r}ca.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=et(n);if(i==null||!t)return;for(var r=0;r<t.length;++r)if(t[r]==this)t.splice(r--,1);if(!t.length)n.widgets=null;var o=jn(this);Je(n,Math.max(0,n.height-o));if(e){Ar(e,function(){fa(e,n,-o);$i(e,i,"widget")});Tn(e,"lineWidgetCleared",e,this,i)}},ca.prototype.changed=function(){var e=this;var t=this.height,n=this.doc.cm,i=this.line;this.height=null;var r=jn(this)-t;if(!r)return;if(!nn(this.doc,i))Je(i,i.height+r);if(n)Ar(n,function(){n.curOp.forceUpdate=true;fa(n,i,r);Tn(n,"lineWidgetChanged",n,e,et(i))})},we(ca);var ha=0,pa=function(e,t){this.lines=[];this.type=t;this.doc=e;this.id=++ha};function ma(t,n,i,e,r){if(e&&e.shared)return va(t,n,i,e,r);if(t.cm&&!t.cm.curOp)return Or(t.cm,ma)(t,n,i,e,r);var o=new pa(t,r),a=ot(n,i);if(e)$(e,o,false);if(a>0||a==0&&o.clearWhenEmpty!==false)return o;if(o.replacedWith){o.collapsed=true;o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget");if(!e.handleMouseEvents)o.widgetNode.setAttribute("cm-ignore-events","true");if(e.insertLeft)o.widgetNode.insertLeft=true}if(o.collapsed){if(Kt(t,n.line,n,i,o)||n.line!=i.line&&Kt(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ot()}if(o.addToHistory)Lo(t,{from:n,to:i,origin:"markText"},t.sel,NaN);var s=n.line,l=t.cm,u;t.iter(s,i.line+1,function(e){if(l&&o.collapsed&&!l.options.lineWrapping&&Qt(e)==l.display.maxLine)u=true;if(o.collapsed&&s!=n.line)Je(e,0);Pt(e,new Nt(o,s==n.line?n.ch:null,s==i.line?i.ch:null),t.cm&&t.cm.curOp);++s});if(o.collapsed)t.iter(n.line,i.line+1,function(e){if(nn(t,e))Je(e,0)});if(o.clearOnEnter)pe(o,"beforeCursorEnter",function(){return o.clear()});if(o.readOnly){At();if(t.history.done.length||t.history.undone.length)t.clearHistory()}if(o.collapsed){o.id=++ha;o.atomic=true}if(l){if(u)l.curOp.updateMaxLine=true;if(o.collapsed)Hi(l,n.line,i.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=n.line;c<=i.line;c++)$i(l,c,"text");if(o.atomic)Yo(l.doc);Tn(l,"markerAdded",l,o)}return o}pa.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t)kr(e);if(be(this,"clear")){var n=this.find();if(n)Tn(this,"clear",n.from,n.to)}var i=null,r=null;for(var o=0;o<this.lines.length;++o){var a=this.lines[o];var s=Ft(a.markedSpans,this);if(e&&!this.collapsed)$i(e,et(a),"text");else if(e){if(s.to!=null)r=et(a);if(s.from!=null)i=et(a)}a.markedSpans=It(a.markedSpans,s);if(s.from==null&&this.collapsed&&!nn(this.doc,a)&&e)Je(a,Ti(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var u=Qt(this.lines[l]),c=an(u);if(c>e.display.maxLineLength){e.display.maxLine=u;e.display.maxLineLength=c;e.display.maxLineChanged=true}}if(i!=null&&e&&this.collapsed)Hi(e,i,r+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e)Yo(e.doc)}if(e)Tn(e,"markerCleared",e,this,i,r);if(t)Cr(e);if(this.parent)this.parent.clear()},pa.prototype.find=function(e,t){if(e==null&&this.type=="bookmark")e=1;var n,i;for(var r=0;r<this.lines.length;++r){var o=this.lines[r];var a=Ft(o.markedSpans,this);if(a.from!=null){n=rt(t?o:et(o),a.from);if(e==-1)return n}if(a.to!=null){i=rt(t?o:et(o),a.to);if(e==1)return i}}return n&&{from:n,to:i}},pa.prototype.changed=function(){var o=this;var a=this.find(-1,true),s=this,l=this.doc.cm;if(!a||!l)return;Ar(l,function(){var e=a.line,t=et(a.line);var n=ei(l,t);if(n){ui(n);l.curOp.selectionChanged=l.curOp.forceUpdate=true}l.curOp.updateMaxLine=true;if(!nn(s.doc,e)&&s.height!=null){var i=s.height;s.height=null;var r=jn(s)-i;if(r)Je(e,e.height+r)}Tn(l,"markerChanged",l,o)})},pa.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;if(!t.maybeHiddenMarkers||W(t.maybeHiddenMarkers,this)==-1)(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},pa.prototype.detachLine=function(e){this.lines.splice(W(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},we(pa);var ga=function(e,t){this.markers=e;this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function va(e,n,i,r,o){r=$(r);r.shared=false;var a=[ma(e,n,i,r,o)],s=a[0];var l=r.widgetNode;vo(e,function(e){if(l)r.widgetNode=l.cloneNode(true);a.push(ma(e,ft(e,n),ft(e,i),r,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=V(a)});return new ga(a,s)}function ya(e){return e.findMarks(rt(e.first,0),e.clipPos(rt(e.lastLine())),function(e){return e.parent})}function xa(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.find();var o=e.clipPos(r.from),a=e.clipPos(r.to);if(ot(o,a)){var s=ma(e,o,a,i.primary,i.primary.type);i.markers.push(s);s.parent=i}}}function ba(o){var e=function(e){var t=o[e],n=[t.primary.doc];vo(t.primary.doc,function(e){return n.push(e)});for(var i=0;i<t.markers.length;i++){var r=t.markers[i];if(W(n,r.doc)==-1){r.parent=null;t.markers.splice(i--,1)}}};for(var t=0;t<o.length;t++)e(t)}ga.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=true;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Tn(this,"clear")},ga.prototype.find=function(e,t){return this.primary.find(e,t)},we(ga);var wa=0,ka=function(e,t,n,i,r){if(!(this instanceof ka))return new ka(e,t,n,i,r);if(n==null)n=0;ua.call(this,[new la([new ln("",null)])]);this.first=n;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=n;var o=rt(n,0);this.sel=ao(o);this.history=new wo(null);this.id=++wa;this.modeOption=t;this.lineSep=i;this.direction=r=="rtl"?"rtl":"ltr";this.extend=false;if(typeof e=="string")e=this.splitLines(e);go(this,{from:o,to:o,text:e});Ro(this,ao(o),_)};(ka.prototype=J(ua.prototype,{constructor:ka,iter:function(e,t,n){if(n)this.iterN(e-this.first,t-e,n);else this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ze(this,this.first,this.first+this.size);if(e===false)return t;return t.join(e||this.lineSeparator())},setValue:Fr(function(e){var t=rt(this.first,0),n=this.first+this.size-1;Qo(this,{from:t,to:rt(n,Ke(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:true},true);if(this.cm)sr(this.cm,0,0);Ro(this,ao(t),_)}),replaceRange:function(e,t,n,i){t=ft(this,t);n=n?ft(this,n):t;ia(this,e,t,n,i)},getRange:function(e,t,n){var i=Qe(this,ft(this,e),ft(this,t));if(n===false)return i;if(n==="")return i.join("");return i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(nt(this,e))return Ke(this,e)},getLineNumber:function(e){return et(e)},getLineHandleVisualStart:function(e){if(typeof e=="number")e=Ke(this,e);return Qt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t=this.sel.primary(),n;if(e==null||e=="head")n=t.head;else if(e=="anchor")n=t.anchor;else if(e=="end"||e=="to"||e===false)n=t.to();else n=t.from();return n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fr(function(e,t,n){zo(this,ft(this,typeof e=="number"?rt(e,t||0):e),null,n)}),setSelection:Fr(function(e,t,n){zo(this,ft(this,e),ft(this,t||e),n)}),extendSelection:Fr(function(e,t,n){Po(this,ft(this,e),t&&ft(this,t),n)}),extendSelections:Fr(function(e,t){Ho(this,ht(this,e),t)}),extendSelectionsBy:Fr(function(e,t){var n=K(this.sel.ranges,e);Ho(this,ht(this,n),t)}),setSelections:Fr(function(e,t,n){if(!e.length)return;var i=[];for(var r=0;r<e.length;r++)i[r]=new ro(ft(this,e[r].anchor),ft(this,e[r].head||e[r].anchor));if(t==null)t=Math.min(e.length-1,this.sel.primIndex);Ro(this,oo(this.cm,i,t),n)}),addSelection:Fr(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new ro(ft(this,e),ft(this,t||e)));Ro(this,oo(this.cm,i,i.length-1),n)}),getSelection:function(e){var t=this.sel.ranges,n;for(var i=0;i<t.length;i++){var r=Qe(this,t[i].from(),t[i].to());n=n?n.concat(r):r}if(e===false)return n;else return n.join(e||this.lineSeparator())},getSelections:function(e){var t=[],n=this.sel.ranges;for(var i=0;i<n.length;i++){var r=Qe(this,n[i].from(),n[i].to());if(e!==false)r=r.join(e||this.lineSeparator());t[i]=r}return t},replaceSelection:function(e,t,n){var i=[];for(var r=0;r<this.sel.ranges.length;r++)i[r]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:Fr(function(e,t,n){var i=[],r=this.sel;for(var o=0;o<r.ranges.length;o++){var a=r.ranges[o];i[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}var s=t&&t!="end"&&fo(this,i,t);for(var l=i.length-1;l>=0;l--)Qo(this,i[l]);if(s)Wo(this,s);else if(this.cm)ar(this.cm)}),undo:Fr(function(){Jo(this,"undo")}),redo:Fr(function(){Jo(this,"redo")}),undoSelection:Fr(function(){Jo(this,"undo",true)}),redoSelection:Fr(function(){Jo(this,"redo",true)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var i=0;i<e.done.length;i++)if(!e.done[i].ranges)++t;for(var r=0;r<e.undone.length;r++)if(!e.undone[r].ranges)++n;return{undo:t,redo:n}},clearHistory:function(){var t=this;this.history=new wo(this.history);vo(this,function(e){return e.history=t.history},true)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(e){if(e)this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Fo(this.history.done),undone:Fo(this.history.undone)}},setHistory:function(e){var t=this.history=new wo(this.history);t.done=Fo(e.done.slice(0),null,true);t.undone=Fo(e.undone.slice(0),null,true)},setGutterMarker:Fr(function(e,n,i){return sa(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});t[n]=i;if(!i&&ie(t))e.gutterMarkers=null;return true})}),clearGutter:Fr(function(t){var n=this;this.iter(function(e){if(e.gutterMarkers&&e.gutterMarkers[t])sa(n,e,"gutter",function(){e.gutterMarkers[t]=null;if(ie(e.gutterMarkers))e.gutterMarkers=null;return true})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!nt(this,e))return null;t=e;e=Ke(this,e);if(!e)return null}else{t=et(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Fr(function(e,n,i){return sa(this,e,n=="gutter"?"gutter":"class",function(e){var t=n=="text"?"textClass":n=="background"?"bgClass":n=="gutter"?"gutterClass":"wrapClass";if(!e[t])e[t]=i;else if(C(i).test(e[t]))return false;else e[t]+=" "+i;return true})}),removeLineClass:Fr(function(e,o,a){return sa(this,e,o=="gutter"?"gutter":"class",function(e){var t=o=="text"?"textClass":o=="background"?"bgClass":o=="gutter"?"gutterClass":"wrapClass";var n=e[t];if(!n)return false;else if(a==null)e[t]=null;else{var i=n.match(C(a));if(!i)return false;var r=i.index+i[0].length;e[t]=n.slice(0,i.index)+(!i.index||r==n.length?"":" ")+n.slice(r)||null}return true})}),addLineWidget:Fr(function(e,t,n){return da(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ma(this,ft(this,e),ft(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:false,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};e=ft(this,e);return ma(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],n=Ke(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];if((r.from==null||r.from<=e.ch)&&(r.to==null||r.to>=e.ch))t.push(r.marker.parent||r.marker)}return t},findMarks:function(r,o,a){r=ft(this,r);o=ft(this,o);var s=[],l=r.line;this.iter(r.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var i=t[n];if(!(i.to!=null&&l==r.line&&r.ch>=i.to||i.from==null&&l!=r.line||i.from!=null&&l==o.line&&i.from>=o.ch)&&(!a||a(i.marker)))s.push(i.marker.parent||i.marker)}++l});return s},getAllMarks:function(){var i=[];this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)if(t[n].from!=null)i.push(t[n].marker)});return i},posFromIndex:function(n){var i,r=this.first,o=this.lineSeparator().length;this.iter(function(e){var t=e.text.length+o;if(t>n){i=n;return true}n-=t;++r});return ft(this,rt(r,i))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;this.iter(this.first,e.line,function(e){t+=e.text.length+n});return t},copy:function(e){var t=new ka(Ze(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);t.scrollTop=this.scrollTop;t.scrollLeft=this.scrollLeft;t.sel=this.sel;t.extend=false;if(e){t.history.undoDepth=this.history.undoDepth;t.setHistory(this.getHistory())}return t},linkedDoc:function(e){if(!e)e={};var t=this.first,n=this.first+this.size;if(e.from!=null&&e.from>t)t=e.from;if(e.to!=null&&e.to<n)n=e.to;var i=new ka(Ze(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);if(e.sharedHist)i.history=this.history;(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist});i.linked=[{doc:this,isParent:true,sharedHist:e.sharedHist}];xa(i,ya(this));return i},unlinkDoc:function(e){if(e instanceof Hs)e=e.doc;if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1);e.unlinkDoc(this);ba(ya(this));break}if(e.history==this.history){var i=[e.id];vo(e,function(e){return i.push(e.id)},true);e.history=new wo(null);e.history.done=Fo(this.history.done,i);e.history.undone=Fo(this.history.undone,i)}},iterLinkedDocs:function(e){vo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){if(this.lineSep)return e.split(this.lineSep);return Fe(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Fr(function(e){if(e!="rtl")e="ltr";if(e==this.direction)return;this.direction=e;this.iter(function(e){return e.order=null});if(this.cm)bo(this.cm)})})).eachLine=ka.prototype.iter;var Ca=0;function Sa(e){var i=this;Ma(i);if(ye(i,e)||_n(i.display,e))return;ke(e);if(S)Ca=+new Date;var t=Ii(i,e,true),n=e.dataTransfer.files;if(!t||i.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File){var r=n.length,o=Array(r),a=0;var s=function(){if(++a==r)Or(i,function(){t=ft(i.doc,t);var e={from:t,to:t,text:i.doc.splitLines(o.filter(function(e){return e!=null}).join(i.doc.lineSeparator())),origin:"paste"};Qo(i.doc,e);Wo(i.doc,ao(ft(i.doc,t),ft(i.doc,so(e))))})()};var l=function(e,t){if(i.options.allowDropFileTypes&&W(i.options.allowDropFileTypes,e.type)==-1){s();return}var n=new FileReader;n.onerror=function(){return s()};n.onload=function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)){s();return}o[t]=e;s()};n.readAsText(e)};for(var u=0;u<n.length;u++)l(n[u],u)}else{if(i.state.draggingText&&i.doc.sel.contains(t)>-1){i.state.draggingText(e);setTimeout(function(){return i.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var f;if(i.state.draggingText&&!i.state.draggingText.copy)f=i.listSelections();jo(i.doc,ao(t,t));if(f)for(var d=0;d<f.length;++d)ia(i.doc,"",f[d].anchor,f[d].head,"drag");i.replaceSelection(c,"around","paste");i.display.input.focus()}}catch(e){}}}function La(e,t){if(S&&(!e.state.draggingText||+new Date-Ca<100)){Le(t);return}if(ye(e,t)||_n(e.display,t))return;t.dataTransfer.setData("Text",e.getSelection());t.dataTransfer.effectAllowed="copyMove";if(t.dataTransfer.setDragImage&&!c){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(y){n.width=n.height=1;e.display.wrapper.appendChild(n);n._top=n.offsetTop}t.dataTransfer.setDragImage(n,0,0);if(y)n.parentNode.removeChild(n)}}function Ea(e,t){var n=Ii(e,t);if(!n)return;var i=document.createDocumentFragment();Yi(e,n,i);if(!e.display.dragCursor){e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors");e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)}T(e.display.dragCursor,i)}function Ma(e){if(e.display.dragCursor){e.display.lineSpace.removeChild(e.display.dragCursor);e.display.dragCursor=null}}function Ta(t){if(!document.getElementsByClassName)return;var e=document.getElementsByClassName("CodeMirror"),n=[];for(var i=0;i<e.length;i++){var r=e[i].CodeMirror;if(r)n.push(r)}if(n.length)n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}var Da=false;function Aa(){if(Da)return;Oa();Da=true}function Oa(){var e;pe(window,"resize",function(){if(e==null)e=setTimeout(function(){e=null;Ta(Na)},100)});pe(window,"blur",function(){return Ta(Qi)})}function Na(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null;t.scrollbarsClipped=false;e.setSize()}for(var Fa={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ia=0;Ia<10;Ia++)Fa[Ia+48]=Fa[Ia+96]=String(Ia);for(var Pa=65;Pa<=90;Pa++)Fa[Pa]=String.fromCharCode(Pa);for(var Ha=1;Ha<=12;Ha++)Fa[Ha+111]=Fa[Ha+63235]="F"+Ha;var $a={};function za(e){var t=e.split(/-(?!$)/);e=t[t.length-1];var n,i,r,o;for(var a=0;a<t.length-1;a++){var s=t[a];if(/^(cmd|meta|m)$/i.test(s))o=true;else if(/^a(lt)?$/i.test(s))n=true;else if(/^(c|ctrl|control)$/i.test(s))i=true;else if(/^s(hift)?$/i.test(s))r=true;else throw new Error("Unrecognized modifier name: "+s)}if(n)e="Alt-"+e;if(i)e="Ctrl-"+e;if(o)e="Cmd-"+e;if(r)e="Shift-"+e;return e}function Ba(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}var r=K(n.split(" "),za);for(var o=0;o<r.length;o++){var a=void 0,s=void 0;if(o==r.length-1){s=r.join(" ");a=i}else{s=r.slice(0,o+1).join(" ");a="..."}var l=t[s];if(!l)t[s]=a;else if(l!=a)throw new Error("Inconsistent bindings for "+s)}delete e[n]}for(var u in t)e[u]=t[u];return e}function Wa(e,t,n,i){t=Ya(t);var r=t.call?t.call(e,i):t[e];if(r===false)return"nothing";if(r==="...")return"multi";if(r!=null&&n(r))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Wa(e,t.fallthrough,n,i);for(var o=0;o<t.fallthrough.length;o++){var a=Wa(e,t.fallthrough[o],n,i);if(a)return a}}}function Ra(e){var t=typeof e=="string"?e:Fa[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ja(e,t,n){var i=e;if(t.altKey&&i!="Alt")e="Alt-"+e;if((b?t.metaKey:t.ctrlKey)&&i!="Ctrl")e="Ctrl-"+e;if((b?t.ctrlKey:t.metaKey)&&i!="Mod")e="Cmd-"+e;if(!n&&t.shiftKey&&i!="Shift")e="Shift-"+e;return e}function _a(e,t){if(y&&e.keyCode==34&&e["char"])return false;var n=Fa[e.keyCode];if(n==null||e.altGraphKey)return false;if(e.keyCode==3&&e.code)n=e.code;return ja(n,e,t)}function Ya(e){return typeof e=="string"?$a[e]:e}function Ua(t,e){var n=t.doc.sel.ranges,i=[];for(var r=0;r<n.length;r++){var o=e(n[r]);while(i.length&&ot(o.from,V(i).to)<=0){var a=i.pop();if(ot(a.from,o.from)<0){o.from=a.from;break}}i.push(o)}Ar(t,function(){for(var e=i.length-1;e>=0;e--)ia(t.doc,"",i[e].from,i[e].to,"+delete");ar(t)})}function qa(e,t,n){var i=ae(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Xa(e,t,n){var i=qa(e,t.ch,n);return i==null?null:new rt(t.line,i,n<0?"after":"before")}function Ga(e,t,n,i,r){if(e){if(t.doc.direction=="rtl")r=-r;var o=de(n,t.doc.direction);if(o){var a=r<0?V(o):o[0];var s=r<0==(a.level==1);var l=s?"after":"before";var u;if(a.level>0||t.doc.direction=="rtl"){var c=ti(t,n);u=r<0?n.text.length-1:0;var f=ni(t,c,u).top;u=se(function(e){return ni(t,c,e).top==f},r<0==(a.level==1)?a.from:a.to-1,u);if(l=="before")u=qa(n,u,1)}else u=r<0?a.to:a.from;return new rt(i,u,l)}}return new rt(i,r<0?n.text.length:0,r<0?"before":"after")}function Va(t,n,s,e){var l=de(n,t.doc.direction);if(!l)return Xa(n,s,e);if(s.ch>=n.text.length){s.ch=n.text.length;s.sticky="before"}else if(s.ch<=0){s.ch=0;s.sticky="after"}var i=ce(l,s.ch,s.sticky),r=l[i];if(t.doc.direction=="ltr"&&r.level%2==0&&(e>0?r.to>s.ch:r.from<s.ch))return Xa(n,s,e);var u=function(e,t){return qa(n,e instanceof rt?e.ch:e,t)};var o;var a=function(e){if(!t.options.lineWrapping)return{begin:0,end:n.text.length};o=o||ti(t,n);return Ci(t,n,o,e)};var c=a(s.sticky=="before"?u(s,-1):s.ch);if(t.doc.direction=="rtl"||r.level==1){var f=r.level==1==e<0;var d=u(s,f?1:-1);if(d!=null&&(!f?d>=r.from&&d>=c.begin:d<=r.to&&d<=c.end)){var h=f?"before":"after";return new rt(s.line,d,h)}}var p=function(e,t,n){var i=function(e,t){return t?new rt(s.line,u(e,1),"before"):new rt(s.line,e,"after")};for(;e>=0&&e<l.length;e+=t){var r=l[e];var o=t>0==(r.level!=1);var a=o?n.begin:u(n.end,-1);if(r.from<=a&&a<r.to)return i(a,o);a=o?r.from:u(r.to,-1);if(n.begin<=a&&a<n.end)return i(a,o)}};var m=p(i+e,e,c);if(m)return m;var g=e>0?c.end:u(c.begin,-1);if(g!=null&&!(e>0&&g==n.text.length)){m=p(e>0?0:l.length-1,e,a(g));if(m)return m}return null}$a.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"},$a.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"},$a.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},$a.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"]},$a["default"]=x?$a.macDefault:$a.pcDefault;var Ka={selectAll:Vo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_)},killLine:function(n){return Ua(n,function(e){if(e.empty()){var t=Ke(n.doc,e.head.line).text.length;if(e.head.ch==t&&e.head.line<n.lastLine())return{from:e.head,to:rt(e.head.line+1,0)};else return{from:e.head,to:rt(e.head.line,t)}}else return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Ua(t,function(e){return{from:rt(e.from().line,0),to:ft(t.doc,rt(e.to().line+1,0))}})},delLineLeft:function(e){return Ua(e,function(e){return{from:rt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(i){return Ua(i,function(e){var t=i.charCoords(e.head,"div").top+5;var n=i.coordsChar({left:0,top:t},"div");return{from:n,to:e.from()}})},delWrappedLineRight:function(i){return Ua(i,function(e){var t=i.charCoords(e.head,"div").top+5;var n=i.coordsChar({left:i.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(rt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(rt(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Qa(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Ja(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return Za(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div")},U)},goLineLeft:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:0,top:t},"div")},U)},goLineLeftSmart:function(i){return i.extendSelectionsBy(function(e){var t=i.cursorCoords(e.head,"div").top+5;var n=i.coordsChar({left:0,top:t},"div");if(n.ch<i.getLine(n.line).search(/\S/))return Ja(i,e.head);return n},U)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){var t=[],n=e.listSelections(),i=e.options.tabSize;for(var r=0;r<n.length;r++){var o=n[r].from();var a=z(e.getLine(o.line),o.ch,i);t.push(G(i-a%i))}e.replaceSelections(t)},defaultTab:function(e){if(e.somethingSelected())e.indentSelection("add");else e.execCommand("insertTab")},transposeChars:function(a){return Ar(a,function(){var e=a.listSelections(),t=[];for(var n=0;n<e.length;n++){if(!e[n].empty())continue;var i=e[n].head,r=Ke(a.doc,i.line).text;if(r){if(i.ch==r.length)i=new rt(i.line,i.ch-1);if(i.ch>0){i=new rt(i.line,i.ch+1);a.replaceRange(r.charAt(i.ch-1)+r.charAt(i.ch-2),rt(i.line,i.ch-2),i,"+transpose")}else if(i.line>a.doc.first){var o=Ke(a.doc,i.line-1).text;if(o){i=new rt(i.line,1);a.replaceRange(r.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),rt(i.line-1,o.length-1),i,"+transpose")}}}t.push(new ro(i,i))}a.setSelections(t)})},newlineAndIndent:function(i){return Ar(i,function(){var e=i.listSelections();for(var t=e.length-1;t>=0;t--)i.replaceRange(i.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=i.listSelections();for(var n=0;n<e.length;n++)i.indentLine(e[n].from().line,null,true);ar(i)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Qa(e,t){var n=Ke(e.doc,t);var i=Qt(n);if(i!=n)t=et(i);return Ga(true,e,i,t,1)}function Za(e,t){var n=Ke(e.doc,t);var i=Zt(n);if(i!=n)t=et(i);return Ga(true,e,n,t,-1)}function Ja(e,t){var n=Qa(e,t.line);var i=Ke(e.doc,n.line);var r=de(i,e.doc.direction);if(!r||r[0].level==0){var o=Math.max(n.ch,i.text.search(/\S/));var a=t.line==n.line&&t.ch<=o&&t.ch;return rt(n.line,a?0:o,n.sticky)}return n}function es(e,t,n){if(typeof t=="string"){t=Ka[t];if(!t)return false}e.display.input.ensurePolled();var i=e.display.shift,r=false;try{if(e.isReadOnly())e.state.suppressEdits=true;if(n)e.display.shift=false;r=t(e)!=j}finally{e.display.shift=i;e.state.suppressEdits=false}return r}function ts(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var r=Wa(t,e.state.keyMaps[i],n,e);if(r)return r}return e.options.extraKeys&&Wa(t,e.options.extraKeys,n,e)||Wa(t,e.options.keyMap,n,e)}var ns=new B;function is(e,t,n,i){var r=e.state.keySeq;if(r){if(Ra(t))return"handled";if(/\'$/.test(t))e.state.keySeq=null;else ns.set(50,function(){if(e.state.keySeq==r){e.state.keySeq=null;e.display.input.reset()}});if(rs(e,r+" "+t,n,i))return true}return rs(e,t,n,i)}function rs(e,t,n,i){var r=ts(e,t,i);if(r=="multi")e.state.keySeq=t;if(r=="handled")Tn(e,"keyHandled",e,t,n);if(r=="handled"||r=="multi"){ke(n);Xi(e)}return!!r}function os(t,e){var n=_a(e,true);if(!n)return false;if(e.shiftKey&&!t.state.keySeq)return is(t,"Shift-"+n,e,function(e){return es(t,e,true)})||is(t,n,e,function(e){if(typeof e=="string"?/^go[A-Z]/.test(e):e.motion)return es(t,e)});else return is(t,n,e,function(e){return es(t,e)})}function as(t,e,n){return is(t,"'"+n+"'",e,function(e){return es(t,e,true)})}var ss=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;t.curOp.focus=N();if(ye(t,e))return;if(S&&w<11&&e.keyCode==27)e.returnValue=false;var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=os(t,e);if(y){ss=i?n:null;if(!i&&n==88&&!Pe&&(x?e.metaKey:e.ctrlKey))t.replaceSelection("",null,"cut")}if(g&&!x&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand)document.execCommand("cut");if(n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className))us(t)}function us(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(e){if(e.keyCode==18||!e.altKey){L(t,"CodeMirror-crosshair");ge(document,"keyup",n);ge(document,"mouseover",n)}}pe(document,"keyup",n);pe(document,"mouseover",n)}function cs(e){if(e.keyCode==16)this.doc.sel.shift=false;ye(this,e)}function fs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(_n(t.display,e)||ye(t,e)||e.ctrlKey&&!e.altKey||x&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(y&&n==ss){ss=null;ke(e);return}if(y&&(!e.which||e.which<10)&&os(t,e))return;var r=String.fromCharCode(i==null?n:i);if(r=="\b")return;if(as(t,e,r))return;t.display.input.onKeyPress(e)}var ds=400,hs=function(e,t,n){this.time=e;this.pos=t;this.button=n},ps,ms;function gs(e,t){var n=+new Date;if(ms&&ms.compare(n,e,t)){ps=ms=null;return"triple"}else if(ps&&ps.compare(n,e,t)){ms=new hs(n,e,t);ps=null;return"double"}else{ps=new hs(n,e,t);ms=null;return"single"}}function vs(e){var t=this,n=t.display;if(ye(t,e)||n.activeTouch&&n.input.supportsTouch())return;n.input.ensurePolled();n.shift=e.shiftKey;if(_n(n,e)){if(!v){n.scroller.draggable=false;setTimeout(function(){return n.scroller.draggable=true},100)}return}if(Es(t,e))return;var i=Ii(t,e),r=Me(e),o=i?gs(i,r):"single";window.focus();if(r==1&&t.state.selectingText)t.state.selectingText(e);if(i&&ys(t,r,i,o,e))return;if(r==1){if(i)bs(t,i,o,e);else if(Ee(e)==n.scroller)ke(e)}else if(r==2){if(i)Po(t.doc,i);setTimeout(function(){return n.input.focus()},20)}else if(r==3)if(k)t.display.input.onContextMenu(e);else Vi(t)}function ys(n,e,i,t,r){var o="Click";if(t=="double")o="Double"+o;else if(t=="triple")o="Triple"+o;o=(e==1?"Left":e==2?"Middle":"Right")+o;return is(n,ja(o,r),r,function(e){if(typeof e=="string")e=Ka[e];if(!e)return false;var t=false;try{if(n.isReadOnly())n.state.suppressEdits=true;t=e(n,i)!=j}finally{n.state.suppressEdits=false}return t})}function xs(e,t,n){var i=e.getOption("configureMouse");var r=i?i(e,t,n):{};if(r.unit==null){var o=h?n.shiftKey&&n.metaKey:n.altKey;r.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}if(r.extend==null||e.doc.extend)r.extend=e.doc.extend||n.shiftKey;if(r.addNew==null)r.addNew=x?n.metaKey:n.ctrlKey;if(r.moveOnDrag==null)r.moveOnDrag=!(x?n.altKey:n.ctrlKey);return r}function bs(e,t,n,i){if(S)setTimeout(H(Gi,e),0);else e.curOp.focus=N();var r=xs(e,n,i);var o=e.doc.sel,a;if(e.options.dragDrop&&Te&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(ot((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ot(a.to(),t)>0||t.xRel<0))ws(e,i,t,r);else Cs(e,i,t,r)}function ws(t,n,i,r){var o=t.display,a=false;var s=Or(t,function(e){if(v)o.scroller.draggable=false;t.state.draggingText=false;if(t.state.delayingBlurEvent)if(t.hasFocus())t.state.delayingBlurEvent=false;else Vi(t);ge(o.wrapper.ownerDocument,"mouseup",s);ge(o.wrapper.ownerDocument,"mousemove",l);ge(o.scroller,"dragstart",u);ge(o.scroller,"drop",s);if(!a){ke(e);if(!r.addNew)Po(t.doc,i,null,null,r.extend);if(v&&!c||S&&w==9)setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:true});o.input.focus()},20);else o.input.focus()}});var l=function(e){a=a||Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)>=10};var u=function(){return a=true};if(v)o.scroller.draggable=true;t.state.draggingText=s;s.copy=!r.moveOnDrag;pe(o.wrapper.ownerDocument,"mouseup",s);pe(o.wrapper.ownerDocument,"mousemove",l);pe(o.scroller,"dragstart",u);pe(o.scroller,"drop",s);t.state.delayingBlurEvent=true;setTimeout(function(){return o.input.focus()},20);if(o.scroller.dragDrop)o.scroller.dragDrop()}function ks(e,t,n){if(n=="char")return new ro(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new ro(rt(t.line,0),ft(e.doc,rt(t.line+1,0)));var i=n(e,t);return new ro(i.from,i.to)}function Cs(g,e,v,y){if(S)Vi(g);var o=g.display,x=g.doc;ke(e);var b,w,k=x.sel,t=k.ranges;if(y.addNew&&!y.extend){w=x.sel.contains(v);if(w>-1)b=t[w];else b=new ro(v,v)}else{b=x.sel.primary();w=x.sel.primIndex}if(y.unit=="rectangle"){if(!y.addNew)b=new ro(v,v);v=Ii(g,e,true,true);w=-1}else{var n=ks(g,v,y.unit);if(y.extend)b=Io(b,n.anchor,n.head,y.extend);else b=n}if(!y.addNew){w=0;Ro(x,new io([b],0),Y);k=x.sel}else if(w==-1){w=t.length;Ro(x,oo(g,t.concat([b]),w),{scroll:false,origin:"*mouse"})}else if(t.length>1&&t[w].empty()&&y.unit=="char"&&!y.extend){Ro(x,oo(g,t.slice(0,w).concat(t.slice(w+1)),0),{scroll:false,origin:"*mouse"});k=x.sel}else $o(x,w,b,Y);var C=v;function a(e){if(ot(C,e)==0)return;C=e;if(y.unit=="rectangle"){var t=[],n=g.options.tabSize;var i=z(Ke(x,v.line).text,v.ch,n);var r=z(Ke(x,e.line).text,e.ch,n);var o=Math.min(i,r),a=Math.max(i,r);for(var s=Math.min(v.line,e.line),l=Math.min(g.lastLine(),Math.max(v.line,e.line));s<=l;s++){var u=Ke(x,s).text,c=q(u,o,n);if(o==a)t.push(new ro(rt(s,c),rt(s,c)));else if(u.length>c)t.push(new ro(rt(s,c),rt(s,q(u,a,n))))}if(!t.length)t.push(new ro(v,v));Ro(x,oo(g,k.ranges.slice(0,w).concat(t),w),{origin:"*mouse",scroll:false});g.scrollIntoView(e)}else{var f=b;var d=ks(g,e,y.unit);var h=f.anchor,p;if(ot(d.anchor,h)>0){p=d.head;h=ut(f.from(),d.anchor)}else{p=d.anchor;h=lt(f.to(),d.head)}var m=k.ranges.slice(0);m[w]=Ss(g,new ro(ft(x,h),p));Ro(x,oo(g,m,w),Y)}}var s=o.wrapper.getBoundingClientRect();var l=0;function u(e){var t=++l;var n=Ii(g,e,true,y.unit=="rectangle");if(!n)return;if(ot(n,C)!=0){g.curOp.focus=N();a(n);var i=er(o,x);if(n.line>=i.to||n.line<i.from)setTimeout(Or(g,function(){if(l==t)u(e)}),150)}else{var r=e.clientY<s.top?-20:e.clientY>s.bottom?20:0;if(r)setTimeout(Or(g,function(){if(l!=t)return;o.scroller.scrollTop+=r;u(e)}),50)}}function i(e){g.state.selectingText=false;l=Infinity;if(e){ke(e);o.input.focus()}ge(o.wrapper.ownerDocument,"mousemove",r);ge(o.wrapper.ownerDocument,"mouseup",c);x.history.lastSelOrigin=null}var r=Or(g,function(e){if(e.buttons===0||!Me(e))i(e);else u(e)});var c=Or(g,i);g.state.selectingText=c;pe(o.wrapper.ownerDocument,"mousemove",r);pe(o.wrapper.ownerDocument,"mouseup",c)}function Ss(e,t){var n=t.anchor;var i=t.head;var r=Ke(e.doc,n.line);if(ot(n,i)==0&&n.sticky==i.sticky)return t;var o=de(r);if(!o)return t;var a=ce(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var l=a+(s.from==n.ch==(s.level!=1)?0:1);if(l==0||l==o.length)return t;var u;if(i.line!=n.line)u=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=ce(o,i.ch,i.sticky);var f=c-a||(i.ch-n.ch)*(s.level==1?-1:1);if(c==l-1||c==l)u=f<0;else u=f>0}var d=o[l+(u?-1:0)];var h=u==(d.level==1);var p=h?d.from:d.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new ro(new rt(n.line,p,m),i)}function Ls(e,t,n,i){var r,o;if(t.touches){r=t.touches[0].clientX;o=t.touches[0].clientY}else try{r=t.clientX;o=t.clientY}catch(e){return false}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return false;if(i)ke(t);var a=e.display;var s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!be(e,n))return Se(t);o-=s.top-a.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var u=a.gutters.childNodes[l];if(u&&u.getBoundingClientRect().right>=r){var c=tt(e.doc,o);var f=e.display.gutterSpecs[l];ve(e,n,e,c,f.className,t);return Se(t)}}}function Es(e,t){return Ls(e,t,"gutterClick",true)}function Ms(e,t){if(_n(e.display,t)||Ts(e,t))return;if(ye(e,t,"contextmenu"))return;if(!k)e.display.input.onContextMenu(t)}function Ts(e,t){if(!be(e,"gutterContextMenu"))return false;return Ls(e,t,"gutterContextMenu",false)}function Ds(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");fi(e)}hs.prototype.compare=function(e,t,n){return this.time+ds>e&&ot(t,this.pos)==0&&n==this.button};var As={toString:function(){return"CodeMirror.Init"}},Os={},Ns={};function Fs(r){var o=r.optionHandlers;function e(e,t,i,n){r.defaults[e]=t;if(i)o[e]=n?function(e,t,n){if(n!=As)i(e,t,n)}:i}r.defineOption=e;r.Init=As;e("value","",function(e,t){return e.setValue(t)},true);e("mode",null,function(e,t){e.doc.modeOption=t;ho(e)},true);e("indentUnit",2,ho,true);e("indentWithTabs",false);e("smartIndent",true);e("tabSize",4,function(e){po(e);fi(e);Hi(e)},true);e("lineSeparator",null,function(e,i){e.doc.lineSep=i;if(!i)return;var r=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(i,t);if(n==-1)break;t=n+i.length;r.push(rt(o,n))}o++});for(var t=r.length-1;t>=0;t--)ia(e.doc,i,r[t],rt(r[t].line,r[t].ch+i.length))});e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(n!=As)e.refresh()});e("specialCharPlaceholder",mn,function(e){return e.refresh()},true);e("electricChars",true);e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);e("spellcheck",false,function(e,t){return e.getInputField().spellcheck=t},true);e("autocorrect",false,function(e,t){return e.getInputField().autocorrect=t},true);e("autocapitalize",false,function(e,t){return e.getInputField().autocapitalize=t},true);e("rtlMoveVisually",!p);e("wholeLineUpdateBefore",true);e("theme","default",function(e){Ds(e);Kr(e)},true);e("keyMap","default",function(e,t,n){var i=Ya(t);var r=n!=As&&Ya(n);if(r&&r.detach)r.detach(e,i);if(i.attach)i.attach(e,r||null)});e("extraKeys",null);e("configureMouse",null);e("lineWrapping",false,Ps,true);e("gutters",[],function(e,t){e.display.gutterSpecs=Gr(t,e.options.lineNumbers);Kr(e)},true);e("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?Oi(e.display)+"px":"0";e.refresh()},true);e("coverGutterNextToScrollbar",false,function(e){return vr(e)},true);e("scrollbarStyle","native",function(e){br(e);vr(e);e.display.scrollbars.setScrollTop(e.doc.scrollTop);e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},true);e("lineNumbers",false,function(e,t){e.display.gutterSpecs=Gr(e.options.gutters,t);Kr(e)},true);e("firstLineNumber",1,Kr,true);e("lineNumberFormatter",function(e){return e},Kr,true);e("showCursorWhenSelecting",false,ji,true);e("resetSelectionOnContextMenu",true);e("lineWiseCopyCut",true);e("pasteLinesPerSelection",true);e("selectionsMayTouch",false);e("readOnly",false,function(e,t){if(t=="nocursor"){Qi(e);e.display.input.blur()}e.display.input.readOnlyChanged(t)});e("screenReaderLabel",null,function(e,t){t=t===""?null:t;e.display.input.screenReaderLabelChanged(t)});e("disableInput",false,function(e,t){if(!t)e.display.input.reset()},true);e("dragDrop",true,Is);e("allowDropFileTypes",null);e("cursorBlinkRate",530);e("cursorScrollMargin",0);e("cursorHeight",1,ji,true);e("singleCursorHeightPerLine",true,ji,true);e("workTime",100);e("workDelay",100);e("flattenSpans",true,po,true);e("addModeClass",false,po,true);e("pollInterval",100);e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t});e("historyEventDelay",1250);e("viewportMargin",10,function(e){return e.refresh()},true);e("maxHighlightLength",1e4,po,true);e("moveInputWithCursor",true,function(e,t){if(!t)e.display.input.resetPosition()});e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""});e("autofocus",null);e("direction","ltr",function(e,t){return e.doc.setDirection(t)},true);e("phrases",null)}function Is(e,t,n){var i=n&&n!=As;if(!t!=!i){var r=e.display.dragFunctions;var o=t?pe:ge;o(e.display.scroller,"dragstart",r.start);o(e.display.scroller,"dragenter",r.enter);o(e.display.scroller,"dragover",r.over);o(e.display.scroller,"dragleave",r.leave);o(e.display.scroller,"drop",r.drop)}}function Ps(e){if(e.options.lineWrapping){F(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{L(e.display.wrapper,"CodeMirror-wrap");sn(e)}Fi(e);Hi(e);fi(e);setTimeout(function(){return vr(e)},100)}function Hs(e,t){var n=this;if(!(this instanceof Hs))return new Hs(e,t);this.options=t=t?$(t):{};$(Os,t,false);var i=t.value;if(typeof i=="string")i=new ka(i,t.mode,null,t.lineSeparator,t.direction);else if(t.mode)i.modeOption=t.mode;this.doc=i;var r=new Hs.inputStyles[t.inputStyle](this);var o=this.display=new Qr(e,i,r,t);o.wrapper.CodeMirror=this;Ds(this);if(t.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";br(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new B,keySeq:null,specialChars:null};if(t.autofocus&&!d)o.input.focus();if(S&&w<11)setTimeout(function(){return n.display.input.reset(true)},20);$s(this);Aa();kr(this);this.curOp.forceUpdate=true;yo(this,i);if(t.autofocus&&!d||this.hasFocus())setTimeout(function(){if(n.hasFocus()&&!n.state.focused)Ki(n)},20);else Qi(this);for(var a in Ns)if(Ns.hasOwnProperty(a))Ns[a](this,t[a],As);Xr(this);if(t.finishInit)t.finishInit(this);for(var s=0;s<zs.length;++s)zs[s](this);Cr(this);if(v&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility")o.lineDiv.style.textRendering="auto"}function $s(r){var o=r.display;pe(o.scroller,"mousedown",Or(r,vs));if(S&&w<11)pe(o.scroller,"dblclick",Or(r,function(e){if(ye(r,e))return;var t=Ii(r,e);if(!t||Es(r,e)||_n(r.display,e))return;ke(e);var n=r.findWordAt(t);Po(r.doc,n.anchor,n.head)}));else pe(o.scroller,"dblclick",function(e){return ye(r,e)||ke(e)});pe(o.scroller,"contextmenu",function(e){return Ms(r,e)});pe(o.input.getField(),"contextmenu",function(e){if(!o.scroller.contains(e.target))Ms(r,e)});var n,i={end:0};function a(){if(o.activeTouch){n=setTimeout(function(){return o.activeTouch=null},1e3);i=o.activeTouch;i.end=+new Date}}function s(e){if(e.touches.length!=1)return false;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(t.left==null)return true;var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>20*20}pe(o.scroller,"touchstart",function(e){if(!ye(r,e)&&!s(e)&&!Es(r,e)){o.input.ensurePolled();clearTimeout(n);var t=+new Date;o.activeTouch={start:t,moved:false,prev:t-i.end<=300?i:null};if(e.touches.length==1){o.activeTouch.left=e.touches[0].pageX;o.activeTouch.top=e.touches[0].pageY}}});pe(o.scroller,"touchmove",function(){if(o.activeTouch)o.activeTouch.moved=true});pe(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!_n(o,e)&&t.left!=null&&!t.moved&&new Date-t.start<300){var n=r.coordsChar(o.activeTouch,"page"),i;if(!t.prev||l(t,t.prev))i=new ro(n,n);else if(!t.prev.prev||l(t,t.prev.prev))i=r.findWordAt(n);else i=new ro(rt(n.line,0),ft(r.doc,rt(n.line+1,0)));r.setSelection(i.anchor,i.head);r.focus();ke(e)}a()});pe(o.scroller,"touchcancel",a);pe(o.scroller,"scroll",function(){if(o.scroller.clientHeight){fr(r,o.scroller.scrollTop);hr(r,o.scroller.scrollLeft,true);ve(r,"scroll",r)}});pe(o.scroller,"mousewheel",function(e){return no(r,e)});pe(o.scroller,"DOMMouseScroll",function(e){return no(r,e)});pe(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0});o.dragFunctions={enter:function(e){if(!ye(r,e))Le(e)},over:function(e){if(!ye(r,e)){Ea(r,e);Le(e)}},start:function(e){return La(r,e)},drop:Or(r,Sa),leave:function(e){if(!ye(r,e))Ma(r)}};var e=o.input.getField();pe(e,"keyup",function(e){return cs.call(r,e)});pe(e,"keydown",Or(r,ls));pe(e,"keypress",Or(r,fs));pe(e,"focus",function(e){return Ki(r,e)});pe(e,"blur",function(e){return Qi(r,e)})}Hs.defaults=Os,Hs.optionHandlers=Ns;var zs=[];function Bs(e,t,n,i){var r=e.doc,o;if(n==null)n="add";if(n=="smart")if(!r.mode.indent)n="prev";else o=yt(e,t).state;var a=e.options.tabSize;var s=Ke(r,t),l=z(s.text,null,a);if(s.stateAfter)s.stateAfter=null;var u=s.text.match(/^\s*/)[0],c;if(!i&&!/\S/.test(s.text)){c=0;n="not"}else if(n=="smart"){c=r.mode.indent(o,s.text.slice(u.length),s.text);if(c==j||c>150){if(!i)return;n="prev"}}if(n=="prev")if(t>r.first)c=z(Ke(r,t-1).text,null,a);else c=0;else if(n=="add")c=l+e.options.indentUnit;else if(n=="subtract")c=l-e.options.indentUnit;else if(typeof n=="number")c=l+n;c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h){d+=a;f+="\t"}if(d<c)f+=G(c-d);if(f!=u){ia(r,f,rt(t,0),rt(t,u.length),"+input");s.stateAfter=null;return true}else for(var p=0;p<r.sel.ranges.length;p++){var m=r.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var g=rt(t,u.length);$o(r,p,new ro(g,g));break}}}Hs.defineInitHook=function(e){return zs.push(e)};var Ws=null;function Rs(e){Ws=e}function js(e,t,n,i,r){var o=e.doc;e.display.shift=false;if(!i)i=o.sel;var a=+new Date-200;var s=r=="paste"||e.state.pasteIncoming>a;var l=Fe(t),u=null;if(s&&i.ranges.length>1)if(Ws&&Ws.text.join("\n")==t){if(i.ranges.length%Ws.text.length==0){u=[];for(var c=0;c<Ws.text.length;c++)u.push(o.splitLines(Ws.text[c]))}}else if(l.length==i.ranges.length&&e.options.pasteLinesPerSelection)u=K(l,function(e){return[e]});var f=e.curOp.updateInput;for(var d=i.ranges.length-1;d>=0;d--){var h=i.ranges[d];var p=h.from(),m=h.to();if(h.empty())if(n&&n>0)p=rt(p.line,p.ch-n);else if(e.state.overwrite&&!s)m=rt(m.line,Math.min(Ke(o,m.line).text.length,m.ch+V(l).length));else if(s&&Ws&&Ws.lineWise&&Ws.text.join("\n")==l.join("\n"))p=m=rt(p.line,0);var g={from:p,to:m,text:u?u[d%u.length]:l,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Qo(e.doc,g);Tn(e,"inputRead",e,g)}if(t&&!s)Ys(e,t);ar(e);if(e.curOp.updateInput<2)e.curOp.updateInput=f;e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function _s(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput)Ar(t,function(){return js(t,n,0,null,"paste")});return true}}function Ys(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;var n=e.doc.sel;for(var i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)continue;var o=e.getModeAt(r.head);var a=false;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){a=Bs(e,r.head.line,"smart");break}}else if(o.electricInput)if(o.electricInput.test(Ke(e.doc,r.head.line).text.slice(0,r.head.ch)))a=Bs(e,r.head.line,"smart");if(a)Tn(e,"electricInput",e,r.head.line)}}function Us(e){var t=[],n=[];for(var i=0;i<e.doc.sel.ranges.length;i++){var r=e.doc.sel.ranges[i].head.line;var o={anchor:rt(r,0),head:rt(r+1,0)};n.push(o);t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function qs(e,t,n,i){e.setAttribute("autocorrect",n?"":"off");e.setAttribute("autocapitalize",i?"":"off");e.setAttribute("spellcheck",!!t)}function Xs(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");var t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");if(v)e.style.width="1000px";else e.setAttribute("wrap","off");if(u)e.style.border="1px solid black";qs(e);return t}function Gs(r){var o=r.optionHandlers;var u=r.helpers={};r.prototype={constructor:r,focus:function(){window.focus();this.display.input.focus()},setOption:function(e,t){var n=this.options,i=n[e];if(n[e]==t&&e!="mode")return;n[e]=t;if(o.hasOwnProperty(e))Or(this,o[e])(this,t,i);ve(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"](Ya(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if(t[n]==e||t[n].name==e){t.splice(n,1);return true}},addOverlay:Nr(function(e,t){var n=e.token?e:r.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");Q(this.state.overlays,{mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority});this.state.modeGen++;Hi(this)}),removeOverlay:Nr(function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){var i=t[n].modeSpec;if(i==e||typeof e=="string"&&i.name==e){t.splice(n,1);this.state.modeGen++;Hi(this);return}}}),indentLine:Nr(function(e,t,n){if(typeof t!="string"&&typeof t!="number")if(t==null)t=this.options.smartIndent?"smart":"prev";else t=t?"add":"subtract";if(nt(this.doc,e))Bs(this,e,t,n)}),indentSelection:Nr(function(e){var t=this.doc.sel.ranges,n=-1;for(var i=0;i<t.length;i++){var r=t[i];if(!r.empty()){var o=r.from(),a=r.to();var s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<n;++l)Bs(this,l,e);var u=this.doc.sel.ranges;if(o.ch==0&&t.length==u.length&&u[i].from().ch>0)$o(this.doc,i,new ro(o,u[i].to()),_)}else if(r.head.line>n){Bs(this,r.head.line,e,true);n=r.head.line;if(i==this.doc.sel.primIndex)ar(this)}}}),getTokenAt:function(e,t){return Ct(this,e,t)},getLineTokens:function(e,t){return Ct(this,rt(e),t,true)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t=vt(this,Ke(this.doc,e.line));var n=0,i=(t.length-1)/2,r=e.ch;var o;if(r==0)o=t[2];else for(;;){var a=n+i>>1;if((a?t[a*2-1]:0)>=r)i=a;else if(t[a*2+1]<r)n=a+1;else{o=t[a*2+2];break}}var s=o?o.indexOf("overlay "):-1;return s<0?o:s==0?null:o.slice(0,s-1)},getModeAt:function(e){var t=this.doc.mode;if(!t.innerMode)return t;return r.innerMode(t,this.getTokenAt(e).state).mode},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!u.hasOwnProperty(t))return n;var i=u[t],r=this.getModeAt(e);if(typeof r[t]=="string"){if(i[r[t]])n.push(i[r[t]])}else if(r[t])for(var o=0;o<r[t].length;o++){var a=i[r[t][o]];if(a)n.push(a)}else if(r.helperType&&i[r.helperType])n.push(i[r.helperType]);else if(i[r.name])n.push(i[r.name]);for(var s=0;s<i._global.length;s++){var l=i._global[s];if(l.pred(r,this)&&W(n,l.val)==-1)n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;e=ct(n,e==null?n.first+n.size-1:e);return yt(this,e+1,t).state},cursorCoords:function(e,t){var n,i=this.doc.sel.primary();if(e==null)n=i.head;else if(typeof e=="object")n=ft(this.doc,e);else n=e?i.from():i.to();return yi(this,n,t||"page")},charCoords:function(e,t){return vi(this,ft(this.doc,e),t||"page")},coordsChar:function(e,t){e=gi(this,e,t||"page");return wi(this,e.left,e.top)},lineAtHeight:function(e,t){e=gi(this,{top:e,left:0},t||"page").top;return tt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var i=false,r;if(typeof e=="number"){var o=this.doc.first+this.doc.size-1;if(e<this.doc.first)e=this.doc.first;else if(e>o){e=o;i=true}r=Ke(this.doc,e)}else r=e;return mi(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-on(r):0)},defaultTextHeight:function(){return Ti(this.display)},defaultCharWidth:function(){return Di(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display;e=yi(this,ft(this.doc,e));var a=e.bottom,s=e.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);o.sizer.appendChild(t);if(i=="over")a=e.top;else if(i=="above"||i=="near"){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);if((i=="above"||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight)a=e.top-t.offsetHeight;else if(e.bottom+t.offsetHeight<=l)a=e.bottom;if(s+t.offsetWidth>u)s=u-t.offsetWidth}t.style.top=a+"px";t.style.left=t.style.right="";if(r=="right"){s=o.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{if(r=="left")s=0;else if(r=="middle")s=(o.sizer.clientWidth-t.offsetWidth)/2;t.style.left=s+"px"}if(n)ir(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Nr(ls),triggerOnKeyPress:Nr(fs),triggerOnKeyUp:cs,triggerOnMouseDown:Nr(vs),execCommand:function(e){if(Ka.hasOwnProperty(e))return Ka[e].call(null,this)},triggerElectric:Nr(function(e){Ys(this,e)}),findPosH:function(e,t,n,i){var r=1;if(t<0){r=-1;t=-t}var o=ft(this.doc,e);for(var a=0;a<t;++a){o=Vs(this.doc,o,r,n,i);if(o.hitSide)break}return o},moveH:Nr(function(t,n){var i=this;this.extendSelectionsBy(function(e){if(i.display.shift||i.doc.extend||e.empty())return Vs(i.doc,e.head,t,n,i.options.rtlMoveVisually);else return t<0?e.from():e.to()},U)}),deleteH:Nr(function(n,i){var e=this.doc.sel,r=this.doc;if(e.somethingSelected())r.replaceSelection("",null,"+delete");else Ua(this,function(e){var t=Vs(r,e.head,n,i,false);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,i){var r=1,o=i;if(t<0){r=-1;t=-t}var a=ft(this.doc,e);for(var s=0;s<t;++s){var l=yi(this,a,"div");if(o==null)o=l.left;else l.left=o;a=Ks(this,l,r,n);if(a.hitSide)break}return a},moveV:Nr(function(i,r){var o=this;var a=this.doc,s=[];var l=!this.display.shift&&!a.extend&&a.sel.somethingSelected();a.extendSelectionsBy(function(e){if(l)return i<0?e.from():e.to();var t=yi(o,e.head,"div");if(e.goalColumn!=null)t.left=e.goalColumn;s.push(t.left);var n=Ks(o,t,i,r);if(r=="page"&&e==a.sel.primary())or(o,vi(o,n,"div").top-t.top);return n},U);if(s.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=this.doc,n=Ke(t,e.line).text;var i=e.ch,r=e.ch;if(n){var o=this.getHelper(e,"wordChars");if((e.sticky=="before"||r==n.length)&&i)--i;else++r;var a=n.charAt(i);var s=ne(a,o)?function(e){return ne(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ne(e)};while(i>0&&s(n.charAt(i-1)))--i;while(r<n.length&&s(n.charAt(r)))++r}return new ro(rt(e.line,i),rt(e.line,r))},toggleOverwrite:function(e){if(e!=null&&e==this.state.overwrite)return;if(this.state.overwrite=!this.state.overwrite)F(this.display.cursorDiv,"CodeMirror-overwrite");else L(this.display.cursorDiv,"CodeMirror-overwrite");ve(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Nr(function(e,t){sr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Xn(this)-this.display.barHeight,width:e.scrollWidth-Xn(this)-this.display.barWidth,clientHeight:Vn(this),clientWidth:Gn(this)}},scrollIntoView:Nr(function(e,t){if(e==null){e={from:this.doc.sel.primary().head,to:null};if(t==null)t=this.options.cursorScrollMargin}else if(typeof e=="number")e={from:rt(e,0),to:null};else if(e.from==null)e={from:e,to:null};if(!e.to)e.to=e.from;e.margin=t||0;if(e.from.line!=null)lr(this,e);else cr(this,e.from,e.to,e.margin)}),setSize:Nr(function(e,t){var n=this;var i=function(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e};if(e!=null)this.display.wrapper.style.width=i(e);if(t!=null)this.display.wrapper.style.height=i(t);if(this.options.lineWrapping)ci(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){$i(n,r,"widget");break}++r});this.curOp.forceUpdate=true;ve(this,"refresh",this)}),operation:function(e){return Ar(this,e)},startOperation:function(){return kr(this)},endOperation:function(){return Cr(this)},refresh:Nr(function(){var e=this.display.cachedTextHeight;Hi(this);this.curOp.forceUpdate=true;fi(this);sr(this,this.doc.scrollLeft,this.doc.scrollTop);Yr(this.display);if(e==null||Math.abs(e-Ti(this.display))>.5||this.options.lineWrapping)Fi(this);ve(this,"refresh",this)}),swapDoc:Nr(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText)this.state.selectingText();yo(this,e);fi(this);this.display.input.reset();sr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;Tn(this,"swapDoc",this,t);return t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}};we(r);r.registerHelper=function(e,t,n){if(!u.hasOwnProperty(e))u[e]=r[e]={_global:[]};u[e][t]=n};r.registerGlobalHelper=function(e,t,n,i){r.registerHelper(e,t,i);u[e]._global.push({pred:n,val:i})}}function Vs(r,o,a,s,l){var e=o;var t=a;var u=Ke(r,o.line);var c=l&&r.direction=="rtl"?-a:a;function f(){var e=o.line+c;if(e<r.first||e>=r.first+r.size)return false;o=new rt(e,o.ch,o.sticky);return u=Ke(r,e)}function n(e){var t;if(s=="codepoint"){var n=u.text.charCodeAt(o.ch+(a>0?0:-1));if(isNaN(n))t=null;else{var i=a>0?n>=55296&&n<56320:n>=56320&&n<57343;t=new rt(o.line,Math.max(0,Math.min(u.text.length,o.ch+a*(i?2:1))),-a)}}else if(l)t=Va(r.cm,u,o,a);else t=Xa(u,o,a);if(t==null)if(!e&&f())o=Ga(l,r.cm,u,o.line,c);else return false;else o=t;return true}if(s=="char"||s=="codepoint")n();else if(s=="column")n(true);else if(s=="word"||s=="group"){var i=null,d=s=="group";var h=r.cm&&r.cm.getHelper(o,"wordChars");for(var p=true;;p=false){if(a<0&&!n(!p))break;var m=u.text.charAt(o.ch)||"\n";var g=ne(m,h)?"w":d&&m=="\n"?"n":!d||/\s/.test(m)?null:"p";if(d&&!p&&!g)g="s";if(i&&i!=g){if(a<0){a=1;n();o.sticky="after"}break}if(g)i=g;if(a>0&&!n(!p))break}}var v=Xo(r,o,e,t,true);if(at(e,v))v.hitSide=true;return v}function Ks(e,t,n,i){var r=e.doc,o=t.left,a;if(i=="page"){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var l=Math.max(s-.5*Ti(e.display),3);a=(n>0?t.bottom:t.top)+n*l}else if(i=="line")a=n>0?t.bottom+3:t.top-3;var u;for(;;){u=wi(e,o,a);if(!u.outside)break;if(n<0?a<=0:a>=r.height){u.hitSide=true;break}a+=n*5}return u}var Qs=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new B;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};function Zs(e,t){var n=ei(e,t.line);if(!n||n.hidden)return null;var i=Ke(e.doc,t.line);var r=Qn(n,i,t.line);var o=de(i,e.doc.direction),a="left";if(o){var s=ce(o,t.ch);a=s%2?"right":"left"}var l=oi(r.map,t.ch,a);l.offset=l.collapse=="right"?l.end:l.start;return l}function Js(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return true;return false}function el(e,t){if(t)e.bad=true;return e}function tl(s,e,t,l,u){var n="",c=false,f=s.doc.lineSeparator(),d=false;function h(t){return function(e){return e.id==t}}function p(){if(c){n+=f;if(d)n+=f;c=d=false}}function m(e){if(e){p();n+=e}}function g(e){if(e.nodeType==1){var t=e.getAttribute("cm-text");if(t){m(t);return}var n=e.getAttribute("cm-marker"),i;if(n){var r=s.findMarks(rt(l,0),rt(u+1,0),h(+n));if(r.length&&(i=r[0].find(0)))m(Qe(s.doc,i.from,i.to).join(f));return}if(e.getAttribute("contenteditable")=="false")return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&e.textContent.length==0)return;if(o)p();for(var a=0;a<e.childNodes.length;a++)g(e.childNodes[a]);if(/^(pre|p)$/i.test(e.nodeName))d=true;if(o)c=true}else if(e.nodeType==3)m(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){g(e);if(e==t)break;e=e.nextSibling;d=false}return n}function nl(e,t,n){var i;if(t==e.display.lineDiv){i=e.display.lineDiv.childNodes[n];if(!i)return el(e.clipPos(rt(e.display.viewTo-1)),true);t=null;n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var o=e.display.view[r];if(o.node==i)return il(o,t,n)}}function il(u,e,t){var n=u.text.firstChild,i=false;if(!e||!A(n,e))return el(rt(et(u.line),0),true);if(e==n){i=true;e=n.childNodes[t];t=0;if(!e){var r=u.rest?V(u.rest):u.line;return el(rt(et(r),r.text.length),i)}}var o=e.nodeType==3?e:null,a=e;if(!o&&e.childNodes.length==1&&e.firstChild.nodeType==3){o=e.firstChild;if(t)t=o.nodeValue.length}while(a.parentNode!=n)a=a.parentNode;var c=u.measure,f=c.maps;function s(e,t,n){for(var i=-1;i<(f?f.length:0);i++){var r=i<0?c.map:f[i];for(var o=0;o<r.length;o+=3){var a=r[o+2];if(a==e||a==t){var s=et(i<0?u.line:u.rest[i]);var l=r[o]+n;if(n<0||a!=e)l=r[o+(n?1:0)];return rt(s,l)}}}}var l=s(o,a,t);if(l)return el(l,i);for(var d=a.nextSibling,h=o?o.nodeValue.length-t:0;d;d=d.nextSibling){l=s(d,d.firstChild,0);if(l)return el(rt(l.line,l.ch-h),i);else h+=d.textContent.length}for(var p=a.previousSibling,m=t;p;p=p.previousSibling){l=s(p,p.firstChild,-1);if(l)return el(rt(l.line,l.ch+m),i);else m+=p.textContent.length}}Qs.prototype.init=function(e){var t=this;var a=this,s=a.cm;var l=a.div=e.lineDiv;l.contentEditable=true;qs(l,s.options.spellcheck,s.options.autocorrect,s.options.autocapitalize);function u(e){for(var t=e.target;t;t=t.parentNode){if(t==l)return true;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return false}pe(l,"paste",function(e){if(!u(e)||ye(s,e)||_s(e,s))return;if(w<=11)setTimeout(Or(s,function(){return t.updateFromDOM()}),20)});pe(l,"compositionstart",function(e){t.composing={data:e.data,done:false}});pe(l,"compositionupdate",function(e){if(!t.composing)t.composing={data:e.data,done:false}});pe(l,"compositionend",function(e){if(t.composing){if(e.data!=t.composing.data)t.readFromDOMSoon();t.composing.done=true}});pe(l,"touchstart",function(){return a.forceCompositionEnd()});pe(l,"input",function(){if(!t.composing)t.readFromDOMSoon()});function n(e){if(!u(e)||ye(s,e))return;if(s.somethingSelected()){Rs({lineWise:false,text:s.getSelections()});if(e.type=="cut")s.replaceSelection("",null,"cut")}else if(!s.options.lineWiseCopyCut)return;else{var t=Us(s);Rs({lineWise:true,text:t.text});if(e.type=="cut")s.operation(function(){s.setSelections(t.ranges,0,_);s.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=Ws.text.join("\n");e.clipboardData.setData("Text",n);if(e.clipboardData.getData("Text")==n){e.preventDefault();return}}var i=Xs(),r=i.firstChild;s.display.lineSpace.insertBefore(i,s.display.lineSpace.firstChild);r.value=Ws.text.join("\n");var o=N();P(r);setTimeout(function(){s.display.lineSpace.removeChild(i);o.focus();if(o==l)a.showPrimarySelection()},50)}pe(l,"copy",n);pe(l,"cut",n)},Qs.prototype.screenReaderLabelChanged=function(e){if(e)this.div.setAttribute("aria-label",e);else this.div.removeAttribute("aria-label")},Qs.prototype.prepareSelection=function(){var e=_i(this.cm,false);e.focus=N()==this.div;return e},Qs.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;if(e.focus||t)this.showPrimarySelection();this.showMultipleSelections(e)},Qs.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Qs.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary();var i=n.from(),r=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||r.line<t.display.viewFrom){e.removeAllRanges();return}var o=nl(t,e.anchorNode,e.anchorOffset);var a=nl(t,e.focusNode,e.focusOffset);if(o&&!o.bad&&a&&!a.bad&&ot(ut(o,a),i)==0&&ot(lt(o,a),r)==0)return;var s=t.display.view;var l=i.line>=t.display.viewFrom&&Zs(t,i)||{node:s[0].measure.map[2],offset:0};var u=r.line<t.display.viewTo&&Zs(t,r);if(!u){var c=s[s.length-1].measure;var f=c.maps?c.maps[c.maps.length-1]:c.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(!l||!u){e.removeAllRanges();return}var d=e.rangeCount&&e.getRangeAt(0),h;try{h=E(l.node,l.offset,u.offset,u.node)}catch(e){}if(h){if(!g&&t.state.focused){e.collapse(l.node,l.offset);if(!h.collapsed){e.removeAllRanges();e.addRange(h)}}else{e.removeAllRanges();e.addRange(h)}if(d&&e.anchorNode==null)e.addRange(d);else if(g)this.startGracePeriod()}this.rememberSelection()},Qs.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){e.gracePeriod=false;if(e.selectionChanged())e.cm.operation(function(){return e.cm.curOp.selectionChanged=true})},20)},Qs.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors);T(this.cm.display.selectionDiv,e.selection)},Qs.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode;this.lastAnchorOffset=e.anchorOffset;this.lastFocusNode=e.focusNode;this.lastFocusOffset=e.focusOffset},Qs.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return false;var t=e.getRangeAt(0).commonAncestorContainer;return A(this.div,t)},Qs.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"){if(!this.selectionInEditor()||N()!=this.div)this.showSelection(this.prepareSelection(),true);this.div.focus()}},Qs.prototype.blur=function(){this.div.blur()},Qs.prototype.getField=function(){return this.div},Qs.prototype.supportsTouch=function(){return true},Qs.prototype.receivedFocus=function(){var e=this;var t=this;if(this.selectionInEditor())setTimeout(function(){return e.pollSelection()},20);else Ar(this.cm,function(){return t.cm.curOp.selectionChanged=true});function n(){if(t.cm.state.focused){t.pollSelection();t.polling.set(t.cm.options.pollInterval,n)}}this.polling.set(this.cm.options.pollInterval,n)},Qs.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Qs.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(f&&a&&this.cm.display.gutterSpecs.length&&Js(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs});this.blur();this.focus();return}if(this.composing)return;this.rememberSelection();var n=nl(t,e.anchorNode,e.anchorOffset);var i=nl(t,e.focusNode,e.focusOffset);if(n&&i)Ar(t,function(){Ro(t.doc,ao(n,i),_);if(n.bad||i.bad)t.curOp.selectionChanged=true})},Qs.prototype.pollContent=function(){if(this.readDOMTimeout!=null){clearTimeout(this.readDOMTimeout);this.readDOMTimeout=null}var e=this.cm,t=e.display,n=e.doc.sel.primary();var i=n.from(),r=n.to();if(i.ch==0&&i.line>e.firstLine())i=rt(i.line-1,Ke(e.doc,i.line-1).length);if(r.ch==Ke(e.doc,r.line).text.length&&r.line<e.lastLine())r=rt(r.line+1,0);if(i.line<t.viewFrom||r.line>t.viewTo-1)return false;var o,a,s;if(i.line==t.viewFrom||(o=Pi(e,i.line))==0){a=et(t.view[0].line);s=t.view[0].node}else{a=et(t.view[o].line);s=t.view[o-1].node.nextSibling}var l=Pi(e,r.line);var u,c;if(l==t.view.length-1){u=t.viewTo-1;c=t.lineDiv.lastChild}else{u=et(t.view[l+1].line)-1;c=t.view[l+1].node.previousSibling}if(!s)return false;var f=e.doc.splitLines(tl(e,s,c,a,u));var d=Qe(e.doc,rt(a,0),rt(u,Ke(e.doc,u).text.length));while(f.length>1&&d.length>1)if(V(f)==V(d)){f.pop();d.pop();u--}else if(f[0]==d[0]){f.shift();d.shift();a++}else break;var h=0,p=0;var m=f[0],g=d[0],v=Math.min(m.length,g.length);while(h<v&&m.charCodeAt(h)==g.charCodeAt(h))++h;var y=V(f),x=V(d);var b=Math.min(y.length-(f.length==1?h:0),x.length-(d.length==1?h:0));while(p<b&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1))++p;if(f.length==1&&d.length==1&&a==i.line)while(h&&h>i.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){h--;p++}f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");f[0]=f[0].slice(h).replace(/\u200b+$/,"");var w=rt(a,h);var k=rt(u,d.length?V(d).length-p:0);if(f.length>1||f[0]||ot(w,k)){ia(e.doc,f,w,k,"+input");return true}},Qs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qs.prototype.reset=function(){this.forceCompositionEnd()},Qs.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()},Qs.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){e.readDOMTimeout=null;if(e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Qs.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent())Ar(this.cm,function(){return Hi(e.cm)})},Qs.prototype.setUneditable=function(e){e.contentEditable="false"},Qs.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault();if(!this.cm.isReadOnly())Or(this.cm,js)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Qs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Qs.prototype.onContextMenu=function(){},Qs.prototype.resetPosition=function(){},Qs.prototype.needsContentAttribute=true;var rl=function(e){this.cm=e;this.prevInput="";this.pollingFast=false;this.polling=new B;this.hasSelection=false;this.composing=null};function ol(t,n){n=n?$(n):{};n.value=t.value;if(!n.tabindex&&t.tabIndex)n.tabindex=t.tabIndex;if(!n.placeholder&&t.placeholder)n.placeholder=t.placeholder;if(n.autofocus==null){var e=N();n.autofocus=e==t||t.getAttribute("autofocus")!=null&&e==document.body}function i(){t.value=s.getValue()}var r;if(t.form){pe(t.form,"submit",i);if(!n.leaveSubmitMethodAlone){var o=t.form;r=o.submit;try{var a=o.submit=function(){i();o.submit=r;o.submit();o.submit=a}}catch(e){}}}n.finishInit=function(e){e.save=i;e.getTextArea=function(){return t};e.toTextArea=function(){e.toTextArea=isNaN;i();t.parentNode.removeChild(e.getWrapperElement());t.style.display="";if(t.form){ge(t.form,"submit",i);if(!n.leaveSubmitMethodAlone&&typeof t.form.submit=="function")t.form.submit=r}}};t.style.display="none";var s=Hs(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s}function al(e){e.off=ge;e.on=pe;e.wheelEventPixels=to;e.Doc=ka;e.splitLines=Fe;e.countColumn=z;e.findColumn=q;e.isWordChar=te;e.Pass=j;e.signal=ve;e.Line=ln;e.changeEnd=so;e.scrollbarModel=xr;e.Pos=rt;e.cmpPos=ot;e.modes=ze;e.mimeModes=Be;e.resolveMode=je;e.getMode=_e;e.modeExtensions=Ye;e.extendMode=Ue;e.copyState=qe;e.startState=Ge;e.innerMode=Xe;e.commands=Ka;e.keyMap=$a;e.keyName=_a;e.isModifierKey=Ra;e.lookupKey=Wa;e.normalizeKeyMap=Ba;e.StringStream=Ve;e.SharedTextMarker=ga;e.TextMarker=pa;e.LineWidget=ca;e.e_preventDefault=ke;e.e_stopPropagation=Ce;e.e_stop=Le;e.addClass=F;e.contains=A;e.rmClass=L;e.keyNames=Fa}rl.prototype.init=function(n){var e=this;var i=this,r=this.cm;this.createField(n);var o=this.textarea;n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild);if(u)o.style.width="0px";pe(o,"input",function(){if(S&&w>=9&&e.hasSelection)e.hasSelection=null;i.poll()});pe(o,"paste",function(e){if(ye(r,e)||_s(e,r))return;r.state.pasteIncoming=+new Date;i.fastPoll()});function t(e){if(ye(r,e))return;if(r.somethingSelected())Rs({lineWise:false,text:r.getSelections()});else if(!r.options.lineWiseCopyCut)return;else{var t=Us(r);Rs({lineWise:true,text:t.text});if(e.type=="cut")r.setSelections(t.ranges,null,_);else{i.prevInput="";o.value=t.text.join("\n");P(o)}}if(e.type=="cut")r.state.cutIncoming=+new Date}pe(o,"cut",t);pe(o,"copy",t);pe(n.scroller,"paste",function(e){if(_n(n,e)||ye(r,e))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date;i.focus();return}var t=new Event("paste");t.clipboardData=e.clipboardData;o.dispatchEvent(t)});pe(n.lineSpace,"selectstart",function(e){if(!_n(n,e))ke(e)});pe(o,"compositionstart",function(){var e=r.getCursor("from");if(i.composing)i.composing.range.clear();i.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}});pe(o,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})},rl.prototype.createField=function(e){this.wrapper=Xs();this.textarea=this.wrapper.firstChild},rl.prototype.screenReaderLabelChanged=function(e){if(e)this.textarea.setAttribute("aria-label",e);else this.textarea.removeAttribute("aria-label")},rl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc;var i=_i(e);if(e.options.moveInputWithCursor){var r=yi(e,n.sel.primary().head,"div");var o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+a.top-o.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+a.left-o.left))}return i},rl.prototype.showSelection=function(e){var t=this.cm,n=t.display;T(n.cursorDiv,e.cursors);T(n.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}},rl.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n;if(t.state.focused)P(this.textarea);if(S&&w>=9)this.hasSelection=n}else if(!e){this.prevInput=this.textarea.value="";if(S&&w>=9)this.hasSelection=null}},rl.prototype.getField=function(){return this.textarea},rl.prototype.supportsTouch=function(){return false},rl.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!d||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},rl.prototype.blur=function(){this.textarea.blur()},rl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rl.prototype.receivedFocus=function(){this.slowPoll()},rl.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll();if(e.cm.state.focused)e.slowPoll()})},rl.prototype.fastPoll=function(){var t=false,n=this;n.pollingFast=true;function i(){var e=n.poll();if(!e&&!t){t=true;n.polling.set(60,i)}else{n.pollingFast=false;n.slowPoll()}}n.polling.set(20,i)},rl.prototype.poll=function(){var e=this;var t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ie(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return false;var r=n.value;if(r==i&&!t.somethingSelected())return false;if(S&&w>=9&&this.hasSelection===r||x&&/[\uf700-\uf7ff]/.test(r)){t.display.input.reset();return false}if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(o==8203&&!i)i="​";if(o==8666){this.reset();return this.cm.execCommand("undo")}}var a=0,s=Math.min(i.length,r.length);while(a<s&&i.charCodeAt(a)==r.charCodeAt(a))++a;Ar(t,function(){js(t,r.slice(a),i.length-a,null,e.composing?"*compose":null);if(r.length>1e3||r.indexOf("\n")>-1)n.value=e.prevInput="";else e.prevInput=r;if(e.composing){e.composing.range.clear();e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"})}});return true},rl.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll())this.pollingFast=false},rl.prototype.onKeyPress=function(){if(S&&w>=9)this.hasSelection=null;this.fastPoll()},rl.prototype.onContextMenu=function(e){var n=this,i=n.cm,r=i.display,o=n.textarea;if(n.contextMenuPending)n.contextMenuPending();var t=Ii(i,e),a=r.scroller.scrollTop;if(!t||y)return;var s=i.options.resetSelectionOnContextMenu;if(s&&i.doc.sel.contains(t)==-1)Or(i,Ro)(i.doc,ao(t),_);var l=o.style.cssText,u=n.wrapper.style.cssText;var c=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static";o.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n      z-index: 1000; background: "+(S?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(v)f=window.scrollY;r.input.focus();if(v)window.scrollTo(null,f);r.input.reset();if(!i.somethingSelected())o.value=n.prevInput=" ";n.contextMenuPending=h;r.selForContextMenu=i.doc.sel;clearTimeout(r.detectingSelectAll);function d(){if(o.selectionStart!=null){var e=i.somethingSelected();var t="​"+(e?o.value:"");o.value="⇚";o.value=t;n.prevInput=e?"":"​";o.selectionStart=1;o.selectionEnd=t.length;r.selForContextMenu=i.doc.sel}}function h(){if(n.contextMenuPending!=h)return;n.contextMenuPending=false;n.wrapper.style.cssText=u;o.style.cssText=l;if(S&&w<9)r.scrollbars.setScrollTop(r.scroller.scrollTop=a);if(o.selectionStart!=null){if(!S||S&&w<9)d();var e=0,t=function(){if(r.selForContextMenu==i.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&n.prevInput=="​")Or(i,Vo)(i);else if(e++<10)r.detectingSelectAll=setTimeout(t,500);else{r.selForContextMenu=null;r.input.reset()}};r.detectingSelectAll=setTimeout(t,200)}}if(S&&w>=9)d();if(k){Le(e);var p=function(){ge(window,"mouseup",p);setTimeout(h,20)};pe(window,"mouseup",p)}else setTimeout(h,50)},rl.prototype.readOnlyChanged=function(e){if(!e)this.reset();this.textarea.disabled=e=="nocursor";this.textarea.readOnly=!!e},rl.prototype.setUneditable=function(){},rl.prototype.needsContentAttribute=false,Fs(Hs),Gs(Hs);var sl="iter insert remove copy getEditor constructor".split(" "),ll;for(ll in ka.prototype)if(ka.prototype.hasOwnProperty(ll)&&W(sl,ll)<0)Hs.prototype[ll]=function(e){return function(){return e.apply(this.doc,arguments)}}(ka.prototype[ll]);return we(ka),Hs.inputStyles={textarea:rl,contenteditable:Qs},Hs.defineMode=function(e){if(!Hs.defaults.mode&&e!="null")Hs.defaults.mode=e;We.apply(this,arguments)},Hs.defineMIME=Re,Hs.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Hs.defineMIME("text/plain","null"),Hs.defineExtension=function(e,t){Hs.prototype[e]=t},Hs.defineDocExtension=function(e,t){ka.prototype[e]=t},Hs.fromTextArea=ol,al(Hs),Hs.version="5.63.1",Hs}(),gt=pt={init:function(){$$("[data-modal]").forEach(function(e){e.addEventListener("click",function(){var e=this.getAttribute("data-modal"),t=this.getAttribute("data-modal-action");t?pt.show(e,t):pt.show(e)})}),$$(".modal [data-dismiss]").forEach(function(e){e.addEventListener("click",function(){this.hasAttribute("data-validate")&&!pt.validate(this.getAttribute("data-dismiss"))||pt.hide(this.getAttribute("data-dismiss"))})}),$$(".modal").forEach(function(e){e.addEventListener("click",function(e){e.target===this&&pt.hide()})}),document.addEventListener("keyup",function(e){27===e.which&&pt.hide()}),window.addEventListener("focus",function(){var e=$(".modal.show");e&&x.firstFocusableElement(e).focus()})},show:function(e,t,n){e=document.getElementById(e);e&&(e.classList.add("show"),t&&$("form",e).setAttribute("action",t),document.activeElement.blur(),($("[autofocus]",e)?$("[autofocus]",e):x.firstFocusableElement(e)).focus(),"function"==typeof n&&n(e),$$(".tooltip").forEach(function(e){e.parentNode.removeChild(e)}),this.createBackdrop())},hide:function(e){void 0!==e?document.getElementById(e).classList.remove("show"):$$(".modal").forEach(function(e){e.classList.remove("show")}),this.removeBackdrop()},createBackdrop:function(){var e;$(".modal-backdrop")||((e=document.createElement("div")).className="modal-backdrop",document.body.appendChild(e))},removeBackdrop:function(){var e=$(".modal-backdrop");e&&e.parentNode.removeChild(e)},validate:function(e){var t=!1,n=document.getElementById(e);return $$("[required]",e).forEach(function(e){return""===e.value?(e.classList("input-invalid"),e.focus(),$(".modal-error",n).style.display="block",t=!1):void(t=!0)}),t}};!function(E){var M={autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,menuitem:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true,caseFold:true},T={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false,allowMissingTagName:false,caseFold:false};if(E.defineMode("xml",function(e,t){var a=e.indentUnit;var s={};var n=t.htmlMode?M:T;for(var i in n)s[i]=n[i];for(var i in t)s[i]=t[i];var o,l;function u(t,n){function e(e){n.tokenize=e;return e(t,n)}var i=t.next();if(i=="<")if(t.eat("!"))if(t.eat("["))if(t.match("CDATA["))return e(f("atom","]]>"));else return null;else if(t.match("--"))return e(f("comment","--\x3e"));else if(t.match("DOCTYPE",true,true)){t.eatWhile(/[\w\._\-]/);return e(d(1))}else return null;else if(t.eat("?")){t.eatWhile(/[\w\._\-]/);n.tokenize=f("meta","?>");return"meta"}else{o=t.eat("/")?"closeTag":"openTag";n.tokenize=c;return"tag bracket"}else if(i=="&"){var r;if(t.eat("#"))if(t.eat("x"))r=t.eatWhile(/[a-fA-F\d]/)&&t.eat(";");else r=t.eatWhile(/[\d]/)&&t.eat(";");else r=t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return r?"atom":"error"}else{t.eatWhile(/[^&<]/);return null}}u.isInText=true;function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">")){t.tokenize=u;o=n==">"?"endTag":"selfcloseTag";return"tag bracket"}else if(n=="="){o="equals";return null}else if(n=="<"){t.tokenize=u;t.state=v;t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}else if(/[\'\"]/.test(n)){t.tokenize=r(n);t.stringStartCol=e.column();return t.tokenize(e,t)}else{e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}function r(n){var e=function(e,t){while(!e.eol())if(e.next()==n){t.tokenize=c;break}return"string"};e.isInAttribute=true;return e}function f(n,i){return function(e,t){while(!e.eol()){if(e.match(i)){t.tokenize=u;break}e.next()}return n}}function d(i){return function(e,t){var n;while((n=e.next())!=null)if(n=="<"){t.tokenize=d(i+1);return t.tokenize(e,t)}else if(n==">")if(i==1){t.tokenize=u;break}else{t.tokenize=d(i-1);return t.tokenize(e,t)}return"meta"}}function h(e){return e&&e.toLowerCase()}function p(e,t,n){this.prev=e.context;this.tagName=t||"";this.indent=e.indented;this.startOfLine=n;if(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=true}function m(e){if(e.context)e.context=e.context.prev}function g(e,t){var n;while(true){if(!e.context)return;n=e.context.tagName;if(!s.contextGrabbers.hasOwnProperty(h(n))||!s.contextGrabbers[h(n)].hasOwnProperty(h(t)))return;m(e)}}function v(e,t,n){if(e=="openTag"){n.tagStart=t.column();return y}else if(e=="closeTag")return x;else return v}function y(e,t,n){if(e=="word"){n.tagName=t.current();l="tag";return k}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return k(e,t,n)}else{l="error";return y}}function x(e,t,n){if(e=="word"){var i=t.current();if(n.context&&n.context.tagName!=i&&s.implicitlyClosed.hasOwnProperty(h(n.context.tagName)))m(n);if(n.context&&n.context.tagName==i||s.matchClosing===false){l="tag";return b}else{l="tag error";return w}}else if(s.allowMissingTagName&&e=="endTag"){l="tag bracket";return b(e,t,n)}else{l="error";return w}}function b(e,t,n){if(e!="endTag"){l="error";return b}m(n);return v}function w(e,t,n){l="error";return b(e,t,n)}function k(e,t,n){if(e=="word"){l="attribute";return C}else if(e=="endTag"||e=="selfcloseTag"){var i=n.tagName,r=n.tagStart;n.tagName=n.tagStart=null;if(e=="selfcloseTag"||s.autoSelfClosers.hasOwnProperty(h(i)))g(n,i);else{g(n,i);n.context=new p(n,i,r==n.indented)}return v}l="error";return k}function C(e,t,n){if(e=="equals")return S;if(!s.allowMissing)l="error";return k(e,t,n)}function S(e,t,n){if(e=="string")return L;if(e=="word"&&s.allowUnquoted){l="string";return k}l="error";return k(e,t,n)}function L(e,t,n){if(e=="string")return L;return k(e,t,n)}return{startState:function(e){var t={tokenize:u,state:v,indented:e||0,tagName:null,tagStart:null,context:null};if(e!=null)t.baseIndent=e;return t},token:function(e,t){if(!t.tagName&&e.sol())t.indented=e.indentation();if(e.eatSpace())return null;o=null;var n=t.tokenize(e,t);if((n||o)&&n!="comment"){l=null;t.state=t.state(o||n,e,t);if(l)n=l=="error"?n+" error":l}return n},indent:function(e,t,n){var i=e.context;if(e.tokenize.isInAttribute)if(e.tagStart==e.indented)return e.stringStartCol+1;else return e.indented+a;if(i&&i.noIndent)return E.Pass;if(e.tokenize!=c&&e.tokenize!=u)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)if(s.multilineTagIndentPastTag!==false)return e.tagStart+e.tagName.length+2;else return e.tagStart+a*(s.multilineTagIndentFactor||1);if(s.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var r=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(r&&r[1])while(i)if(i.tagName==r[2]){i=i.prev;break}else if(s.implicitlyClosed.hasOwnProperty(h(i.tagName)))i=i.prev;else break;else if(r)while(i){var o=s.contextGrabbers[h(i.tagName)];if(o&&o.hasOwnProperty(h(r[2])))i=i.prev;else break}while(i&&i.prev&&!i.startOfLine)i=i.prev;if(i)return i.indent+a;else return e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){if(e.state==S)e.state=k},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:e.type=="closeTag"}:null},xmlCurrentContext:function(e){var t=[];for(var n=e.context;n;n=n.prev)t.push(n.tagName);return t.reverse()}}}),E.defineMIME("text/xml","xml"),E.defineMIME("application/xml","xml"),!E.mimeModes.hasOwnProperty("text/html"))E.defineMIME("text/html",{name:"xml",htmlMode:true})}(k.exports);var vt,yt,xt,bt,wt;function kt(e){var o=mt.fromTextArea(e,{mode:{name:"markdown",highlightFormatting:!0},theme:"formwork",indentUnit:4,lineWrapping:!0,addModeClass:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList"},configureMouse:function(){return{extend:!1,addNew:!1}}}),t=$(".editor-toolbar[data-for="+e.id+"]"),n=e.parentNode.classList.contains("editor-wrap")?e.parentNode:null,i=[];function r(){return/\n+===\n+/.test(o.getValue())}function a(){r()?$("[data-command=summary]",t).setAttribute("disabled",""):$("[data-command=summary]",t).removeAttribute("disabled")}function s(){var e=o.getLine(o.getCursor().line);return 0===e.length?void 0:e.slice(-1)}function l(){switch(s()){case void 0:return"";case"\n":return"\n";default:return"\n\n"}}function u(e,t,n){var i,r;void 0===t&&(t=e),i=!0===n?"":o.getSelection(),r=o.getCursor(),n=e.split("\n").length-1,o.replaceSelection(e+i+t),o.setCursor(r.line+n,r.ch+e.length-n),o.focus()}function c(e,t){for(var n=0;n<t.length;n++)e.removeLineClass(t[n],"wrap","CodeMirror-activeline")}$("[data-command=bold]",t).addEventListener("click",function(){u("**")}),$("[data-command=italic]",t).addEventListener("click",function(){u("_")}),$("[data-command=ul]",t).addEventListener("click",function(){u(l()+"- ","")}),$("[data-command=ol]",t).addEventListener("click",function(){var e,t,e=/^\d+\./.exec((e=o.getValue(),-1!==(t=e.lastIndexOf("\n"))?e.substring(t+1):e));u(e?"\n"+(parseInt(e)+1)+". ":l()+"1. ","")}),$("[data-command=quote]",t).addEventListener("click",function(){u(l()+"> ","")}),$("[data-command=link]",t).addEventListener("click",function(){var e=o.getSelection();/^(https?:\/\/|mailto:)/i.test(e)?u("[","]("+e+")",!0):""!==e?u("["+e+"](http://",")",!0):u("[","](http://)")}),$("[data-command=image]",t).addEventListener("click",function(){gt.show("imagesModal",null,function(e){var t=$(".image-picker-thumbnail.selected",e);t&&t.classList.remove("selected"),$(".image-picker-confirm",e).addEventListener("click",function e(){var t=$(".image-picker-thumbnail.selected",$("#imagesModal")).getAttribute("data-filename");void 0!==t?u(l()+"![","]("+t+")"):u(l()+"![](",")"),this.removeEventListener("click",e)})})}),$("[data-command=summary]",t).addEventListener("click",function(){var e;r()||(u((void 0===(e=s())||"\n"===e?"":"\n")+"\n===\n\n",""),this.setAttribute("disabled",""))}),$("[data-command=undo]",t).addEventListener("click",function(){o.undo(),o.focus()}),$("[data-command=redo]",t).addEventListener("click",function(){o.redo(),o.focus()}),a(),o.on("changes",x.debounce(function(){e.value=o.getValue(),a(),o.historySize().undo<1?$("[data-command=undo]").setAttribute("disabled",""):$("[data-command=undo]").removeAttribute("disabled"),o.historySize().redo<1?$("[data-command=redo]").setAttribute("disabled",""):$("[data-command=redo]").removeAttribute("disabled")},500)),o.on("beforeSelectionChange",function(e,t){var n=function(e){var t,n=[];for(t=0;t<e.length;t++)n.push(e[t].head.line);return n}(t.ranges);e.operation(function(){x.sameArray(n,i)||(c(e,i),function(e,t){var n;for(n=0;n<t.length;n++)e.addLineClass(t[n],"wrap","CodeMirror-activeline")}(e,n),i=n)}),e.refresh()}),o.on("focus",function(){null!==n&&n.classList.add("focused")}),o.on("blur",function(e){null!==n&&n.classList.remove("focused"),c(e,i),i=[]}),document.addEventListener("keydown",function(e){if(!e.altKey&&(e.ctrlKey||e.metaKey))switch(e.which){case 66:$("[data-command=bold]",t).click(),e.preventDefault();break;case 73:$("[data-command=italic]",t).click(),e.preventDefault();break;case 75:$("[data-command=link]",t).click(),e.preventDefault()}})}function Ct(t){var e=$('label[for="'+t.id+'"]'),n=$("span",e),i=!1;function r(){0<this.files.length?n.innerHTML=this.files[0].name:n.innerHTML=this.getAttribute("data-label")}function o(e){e.preventDefault()}function a(e){this.classList.add("drag"),e.preventDefault()}t.setAttribute("data-label",$('label[for="'+t.id+'"] span').innerHTML),t.addEventListener("change",r),t.addEventListener("input",r),t.form.addEventListener("submit",function(){0<t.files.length&&(n.innerHTML+=' <span class="spinner"></span>'),i=!0}),e.addEventListener("drag",o),e.addEventListener("dragstart",o),e.addEventListener("dragend",o),e.addEventListener("dragover",a),e.addEventListener("dragenter",a),e.addEventListener("dragleave",function(e){this.classList.remove("drag"),e.preventDefault()}),e.addEventListener("drop",function(e){e.preventDefault(),i||(t.files=e.dataTransfer.files,x.triggerEvent(t,"change"))}),e.addEventListener("click",function(e){i&&e.preventDefault()})}function St(i){var r=x.serializeForm(i);function e(e){n()&&(e.preventDefault(),e.returnValue="")}function o(){window.removeEventListener("beforeunload",e)}function n(e){var t,n;if(void 0===e&&(e=!0),t=$$("input[type=file]",i),!0===e&&0<t.length)for(n=0;n<t.length;n++)if(0<t[n].files.length)return 1;return x.serializeForm(i)!==r}window.addEventListener("beforeunload",e),i.addEventListener("submit",o),$$('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach(function(t){t.addEventListener("click",function(e){n()&&(e.preventDefault(),gt.show("changesModal",null,function(e){$("[data-command=continue]",e).setAttribute("data-href",t.href)}))})}),$$("input[type=file][data-auto-upload]",i).forEach(function(e){e.addEventListener("change",function(){n(!1)||i.requestSubmit($("[type=submit]",i))})}),function(){var e=document.getElementById("changesModal"),t=document.getElementById("deletePageModal"),n=document.getElementById("deleteUserModal");e&&$("[data-command=continue]",e).addEventListener("click",function(){o(),window.location.href=this.getAttribute("data-href")});t&&$("[data-command=delete]",t).addEventListener("click",o);n&&$("[data-command=delete]",n).addEventListener("click",o)}()}function Lt(i){var r,o,n,a,s,l={addKeyCodes:[32]},u=[];function c(){n.value=u.join(", "),f()}function f(){0<a.length&&(0===u.length?(o.placeholder=a,o.size=a.length):(o.placeholder="",o.size=1))}function d(t){var n=document.createElement("span"),e=document.createElement("i");n.className="tag",n.innerHTML=t,n.style.marginRight=".25rem",o.parentNode.insertBefore(n,o),e.className="tag-remove",e.setAttribute("role","button"),e.addEventListener("mousedown",function(e){p(t),n.parentNode.removeChild(n),e.preventDefault()}),n.appendChild(e)}function h(e){var t;t=e,-1!==u.indexOf(t)||s&&null===$('[data-value="'+t+'"]',s)?f():(u.push(e),d(e),c()),o.value="",s&&m()}function p(e){e=u.indexOf(e);-1<e&&(u.splice(e,1),c()),s&&m()}function m(){var t=0;$$(".dropdown-item",s).forEach(function(e){"none"!==getComputedStyle(e).display&&t++,-1===u.indexOf(e.getAttribute("data-value"))?e.style.display="block":e.style.display="none",e.classList.remove("selected")}),s.style.display=0<t?"block":"none"}function g(){var e=$(".dropdown-item.selected",s);"none"!==getComputedStyle(e).display&&(o.value=e.getAttribute("data-value"))}function v(e){var t,n,i,r,o,a=$(".dropdown-item.selected",s);a&&a.classList.remove("selected"),e&&(e.classList.add("selected"),t=e,n=s.scrollTop,i=s.clientHeight,r=n+i,o=getComputedStyle(s),a=parseInt(o.paddingTop),e=parseInt(o.paddingBottom),t=(o=t.offsetTop)+t.clientHeight,o<n?s.scrollTop=o-a:r<t&&(s.scrollTop=t-i+e))}function y(){for(var e=$$(".dropdown-item",s),t=0;t<e.length;t++)if("none"!==getComputedStyle(e[t]).display)return void v(e[t])}!function(){var e=i.hasAttribute("required"),t=i.hasAttribute("disabled");(r=document.createElement("div")).className="input-tag",(o=document.createElement("input")).className="tag-inner-input",o.type="text",o.placeholder=i.placeholder,o.setAttribute("size",""),(n=document.createElement("input")).className="input-tag-hidden",n.name=i.name,n.id=i.id,n.type="text",n.value=i.value,n.readOnly=!0,n.hidden=!0,e&&(n.required=!0);t&&(r.disabled=!0,o.disabled=!0,n.disabled=!0);i.parentNode.replaceChild(r,i),r.appendChild(o),r.appendChild(n),n.value&&(u=n.value.split(", ")).forEach(function(e,t){e=e.trim(),d(u[t]=e)});o.placeholder?(a=o.placeholder,f()):a="";r.addEventListener("mousedown",function(e){o.focus(),e.preventDefault()})}(),function(){var e,t,n;if(i.hasAttribute("data-options")){for(t in e=JSON.parse(i.getAttribute("data-options")),(s=document.createElement("div")).className="dropdown-list",e)Object.prototype.hasOwnProperty.call(e,t)&&((n=document.createElement("div")).className="dropdown-item",n.innerHTML=e[t],n.setAttribute("data-value",t),n.addEventListener("click",function(){h(this.getAttribute("data-value"))}),s.appendChild(n));r.appendChild(s),o.addEventListener("focus",function(){"none"===getComputedStyle(s).display&&(m(),s.scrollTop=0,s.style.display="block")}),o.addEventListener("blur",function(){"none"!==getComputedStyle(s).display&&(m(),s.style.display="none")}),o.addEventListener("keydown",function(e){switch(e.which){case 8:m();break;case 13:"none"!==getComputedStyle(s).display&&(g(),e.preventDefault());break;case 38:"none"!==getComputedStyle(s).display&&(function(){var e,t=$(".dropdown-item.selected",s);if(t){for(e=t.previousSibling;e&&"none"===e.style.display;)e=e.previousSibling;if(e)return v(e);v(t.previousSibling)}!function(){var e,t=$$(".dropdown-item",s);for(e=t.length-1;0<=e;e--)if("none"!==getComputedStyle(t[e]).display)return v(t[e])}()}(),e.preventDefault());break;case 40:"none"!==getComputedStyle(s).display&&(function(){var e,t=$(".dropdown-item.selected",s);if(t){for(e=t.nextSibling;e&&"none"===e.style.display;)e=e.nextSibling;if(e)return v(e)}y()}(),e.preventDefault());break;default:-1<l.addKeyCodes.indexOf(e.which)&&(g(),e.preventDefault())}}),o.addEventListener("keyup",x.debounce(function(e){var i,r,t=o.value.trim();switch(e.which){case 27:s.style.display="none";break;case 38:case 40:return!0;default:s.style.display="block",i=t,r=0,s.style.display="block",$$(".dropdown-item",s).forEach(function(e){var t=e.textContent,n=new RegExp(x.makeDiacriticsRegExp(x.escapeRegExp(i)),"i");null!==t.match(n)&&"none"!==e.style.display?(e.style.display="block",r++):e.style.display="none"}),s.style.display=0<r?"block":"none",0<t.length&&y()}},100))}}(),o.addEventListener("focus",function(){r.classList.add("focused")}),o.addEventListener("blur",function(){var e=o.value.trim();""!==e&&h(e),r.classList.remove("focused")}),o.addEventListener("keydown",function(){var e=o.value.trim();switch(event.which){case 8:""===e?(p(u[u.length-1]),o.previousSibling&&o.parentNode.removeChild(o.previousSibling),event.preventDefault()):o.size=Math.max(o.value.length,o.placeholder.length,1);break;case 13:case 188:""!==e&&h(e),event.preventDefault();break;case 27:o.value="",f(),o.blur(),event.preventDefault();break;default:if(""!==e&&-1<l.addKeyCodes.indexOf(event.which)){h(e),event.preventDefault();break}0<e.length&&(o.size=o.value.length+2)}})}!function(o){o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var e=0;e<o.modeInfo.length;e++){var t=o.modeInfo[e];if(t.mimes)t.mime=t.mimes[0]}o.findModeByMIME=function(e){e=e.toLowerCase();for(var t=0;t<o.modeInfo.length;t++){var n=o.modeInfo[t];if(n.mime==e)return n;if(n.mimes)for(var i=0;i<n.mimes.length;i++)if(n.mimes[i]==e)return n}if(/\+xml$/.test(e))return o.findModeByMIME("application/xml");if(/\+json$/.test(e))return o.findModeByMIME("application/json")},o.findModeByExtension=function(e){e=e.toLowerCase();for(var t=0;t<o.modeInfo.length;t++){var n=o.modeInfo[t];if(n.ext)for(var i=0;i<n.ext.length;i++)if(n.ext[i]==e)return n}},o.findModeByFileName=function(e){for(var t=0;t<o.modeInfo.length;t++){var n=o.modeInfo[t];if(n.file&&n.file.test(e))return n}var i=e.lastIndexOf(".");var r=i>-1&&e.substring(i+1,e.length);if(r)return o.findModeByExtension(r)},o.findModeByName=function(e){e=e.toLowerCase();for(var t=0;t<o.modeInfo.length;t++){var n=o.modeInfo[t];if(n.name.toLowerCase()==e)return n;if(n.alias)for(var i=0;i<n.alias.length;i++)if(n.alias[i].toLowerCase()==e)return n}}}(k.exports),(vt=k.exports).defineMode("markdown",function(f,d){var h=vt.getMode(f,"text/html"),r="null"==h.name;void 0===d.highlightFormatting&&(d.highlightFormatting=!1),void 0===d.maxBlockquoteDepth&&(d.maxBlockquoteDepth=0),void 0===d.taskLists&&(d.taskLists=!1),void 0===d.strikethrough&&(d.strikethrough=!1),void 0===d.emoji&&(d.emoji=!1),void 0===d.fencedCodeBlockHighlighting&&(d.fencedCodeBlockHighlighting=!0),void 0===d.fencedCodeBlockDefaultMode&&(d.fencedCodeBlockDefaultMode="text/plain"),void 0===d.xml&&(d.xml=!0),void 0===d.tokenTypeOverrides&&(d.tokenTypeOverrides={});var e,p={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(e in p)p.hasOwnProperty(e)&&d.tokenTypeOverrides[e]&&(p[e]=d.tokenTypeOverrides[e]);var m=/^([*\-_])(?:\s*\1){2,}\s*$/,g=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,y=d.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,x=/^ {0,3}(?:\={1,}|-{2,})\s*$/,n=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,w=/^\s*\[[^\]]+?\]:.*$/,k=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function C(e,t,n){return(t.f=t.inline=n)(e,t)}function S(e,t,n){return(t.f=t.block=n)(e,t)}function i(e){var t,n;return e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f!=L||(n=!(n=r)?"xml"==(t=vt.innerMode(h,e.htmlState)).mode.name&&null===t.state.tagStart&&!t.state.context&&t.state.tokenize.isInText:n)&&(e.f=T,e.block=o,e.htmlState=null),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function o(e,t){var n=e.column()===t.indentation,i=!(c=t.prevLine.stream)||!/\S/.test(c.string),r=t.indentedCode,o=t.prevLine.hr,a=!1!==t.list,s=(t.listStack[t.listStack.length-1]||0)+3;t.indentedCode=!1;var l=t.indentation;if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,a)){for(t.list=null;l<t.listStack[t.listStack.length-1];)t.listStack.pop(),t.listStack.length?t.indentation=t.listStack[t.listStack.length-1]:t.list=!1;!1!==t.list&&(t.indentationDiff=l-t.listStack[t.listStack.length-1])}var u=!(i||o||t.prevLine.header||a&&r||t.prevLine.fencedCodeEnd),c=(!1===t.list||o||i)&&t.indentation<=s&&e.match(m),o=null;if(4<=t.indentationDiff&&(r||t.prevLine.fencedCodeEnd||t.prevLine.header||i))return e.skipToEnd(),t.indentedCode=!0,p.code;if(e.eatSpace())return null;if(n&&t.indentation<=s&&(o=e.match(y))&&o[1].length<=6)return t.quote=0,t.header=o[1].length,t.thisLine.header=!0,d.highlightFormatting&&(t.formatting="header"),t.f=t.inline,M(t);if(t.indentation<=s&&e.eat(">"))return t.quote=n?1:t.quote+1,d.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),M(t);if(!c&&!t.setext&&n&&t.indentation<=s&&(o=e.match(g))){i=o[1]?"ol":"ul";return t.indentation=l+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,d.taskLists&&e.match(v,!1)&&(t.taskList=!0),t.f=t.inline,d.highlightFormatting&&(t.formatting=["list","list-"+i]),M(t)}return n&&t.indentation<=s&&(o=e.match(b,!0))?(t.quote=0,t.fencedEndRE=new RegExp(o[1]+"+ *$"),t.localMode=d.fencedCodeBlockHighlighting&&(n=o[2]||d.fencedCodeBlockDefaultMode,!vt.findModeByName||(s=vt.findModeByName(n))&&(n=s.mime||s.mimes[0]),"null"==(n=vt.getMode(f,n)).name?null:n),t.localMode&&(t.localState=vt.startState(t.localMode)),t.f=t.block=E,d.highlightFormatting&&(t.formatting="code-block"),t.code=-1,M(t)):t.setext||!(u&&a||t.quote||!1!==t.list||t.code||c||w.test(e.string))&&(o=e.lookAhead(1))&&(o=o.match(x))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),d.highlightFormatting&&(t.formatting="header")):(t.header="="==o[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,M(t)):c?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,p.hr):"["===e.peek()?C(e,t,O):C(e,t,t.inline)}function L(e,t){var n,i=h.token(e,t.htmlState);return r||("xml"==(n=vt.innerMode(h,t.htmlState)).mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText||t.md_inside&&-1<e.current().indexOf(">"))&&(t.f=T,t.block=o,t.htmlState=null),i}function E(e,t){var n,i=t.listStack[t.listStack.length-1]||0,r=t.indentation<i;return t.fencedEndRE&&t.indentation<=i+3&&(r||e.match(t.fencedEndRE))?(d.highlightFormatting&&(t.formatting="code-block"),r||(n=M(t)),t.localMode=t.localState=null,t.block=o,t.f=T,t.fencedEndRE=null,t.code=0,t.thisLine.fencedCodeEnd=!0,r?S(e,t,t.block):n):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),p.code)}function M(e){var t,n=[];if(e.formatting){n.push(p.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var i=0;i<e.formatting.length;i++)n.push(p.formatting+"-"+e.formatting[i]),"header"===e.formatting[i]&&n.push(p.formatting+"-"+e.formatting[i]+"-"+e.header),"quote"===e.formatting[i]&&(!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=e.quote?n.push(p.formatting+"-"+e.formatting[i]+"-"+e.quote):n.push("error"))}return e.taskOpen?n.push("meta"):e.taskClosed?n.push("property"):(e.linkHref?n.push(p.linkHref,"url"):(e.strong&&n.push(p.strong),e.em&&n.push(p.em),e.strikethrough&&n.push(p.strikethrough),e.emoji&&n.push(p.emoji),e.linkText&&n.push(p.linkText),e.code&&n.push(p.code),e.image&&n.push(p.image),e.imageAltText&&n.push(p.imageAltText,"link"),e.imageMarker&&n.push(p.imageMarker)),e.header&&n.push(p.header,p.header+"-"+e.header),e.quote&&(n.push(p.quote),!d.maxBlockquoteDepth||d.maxBlockquoteDepth>=e.quote?n.push(p.quote+"-"+e.quote):n.push(p.quote+"-"+d.maxBlockquoteDepth)),!1!==e.list&&((t=(e.listStack.length-1)%3)?1==t?n.push(p.list2):n.push(p.list3):n.push(p.list1)),e.trailingSpaceNewLine?n.push("trailing-space-new-line"):e.trailingSpace&&n.push("trailing-space-"+(e.trailingSpace%2?"a":"b"))),n.length?n.join(" "):null}function t(e,t){if(e.match(n,!0))return M(t)}function T(e,t){var n=t.text(e,t);if(void 0!==n)return n;if(t.list)return t.list=null,M(t);if(t.taskList)return" "===e.match(v,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,d.highlightFormatting&&(t.formatting="task"),t.taskList=!1,M(t);if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))return d.highlightFormatting&&(t.formatting="header"),M(t);var i=e.next();if(t.linkTitle){t.linkTitle=!1;n=((n="("===i?")":i)+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");if(e.match(new RegExp("^\\s*(?:[^"+n+"\\\\]+|\\\\\\\\|\\\\.)"+n),!0))return p.linkHref}if("`"===i){var r=t.formatting;d.highlightFormatting&&(t.formatting="code"),e.eatWhile("`");var o=e.current().length;if(0!=t.code||t.quote&&1!=o){if(o!=t.code)return t.formatting=r,M(t);var a=M(t);return t.code=0,a}return t.code=o,M(t)}if(t.code)return M(t);if("\\"===i&&(e.next(),d.highlightFormatting)){var s=M(t),l=p.formatting+"-escape";return s?s+" "+l:l}if("!"===i&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.imageMarker=!0,t.image=!0,d.highlightFormatting&&(t.formatting="image"),M(t);if("["===i&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return t.imageMarker=!1,t.imageAltText=!0,d.highlightFormatting&&(t.formatting="image"),M(t);if("]"===i&&t.imageAltText){d.highlightFormatting&&(t.formatting="image");s=M(t);return t.imageAltText=!1,t.image=!1,t.inline=t.f=A,s}if("["===i&&!t.image)return t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,d.highlightFormatting&&(t.formatting="link")),M(t);if("]"===i&&t.linkText){d.highlightFormatting&&(t.formatting="link");s=M(t);return t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?A:T,s}if("<"===i&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,d.highlightFormatting&&(t.formatting="link"),(s=M(t))?s+=" ":s="",s+p.linkInline;if("<"===i&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,d.highlightFormatting&&(t.formatting="link"),(s=M(t))?s+=" ":s="",s+p.linkEmail;if(d.xml&&"<"===i&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var u=e.string.indexOf(">",e.pos);return-1!=u&&(f=e.string.substring(e.start,u),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(f)&&(t.md_inside=!0)),e.backUp(1),t.htmlState=vt.startState(h),S(e,t,L)}if(d.xml&&"<"===i&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===i||"_"===i){for(var c=1,r=1==e.pos?" ":e.string.charAt(e.pos-2);c<3&&e.eat(i);)c++;var o=e.peek()||" ",l=!/\s/.test(o)&&(!k.test(o)||/\s/.test(r)||k.test(r)),s=!/\s/.test(r)&&(!k.test(r)||/\s/.test(o)||k.test(o)),u=null,f=null;if(c%2&&(t.em||!l||"*"!==i&&s&&!k.test(r)?t.em!=i||!s||"*"!==i&&l&&!k.test(o)||(u=!1):u=!0),1<c&&(t.strong||!l||"*"!==i&&s&&!k.test(r)?t.strong!=i||!s||"*"!==i&&l&&!k.test(o)||(f=!1):f=!0),null!=f||null!=u){d.highlightFormatting&&(t.formatting=null==u?"strong":null==f?"em":"strong em"),!0===u&&(t.em=i),!0===f&&(t.strong=i);a=M(t);return!1===u&&(t.em=!1),!1===f&&(t.strong=!1),a}}else if(" "===i&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return M(t);e.backUp(1)}if(d.strikethrough)if("~"===i&&e.eatWhile(i)){if(t.strikethrough){d.highlightFormatting&&(t.formatting="strikethrough");a=M(t);return t.strikethrough=!1,a}if(e.match(/^[^\s]/,!1))return t.strikethrough=!0,d.highlightFormatting&&(t.formatting="strikethrough"),M(t)}else if(" "===i&&e.match("~~",!0)){if(" "===e.peek())return M(t);e.backUp(2)}if(d.emoji&&":"===i&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){t.emoji=!0,d.highlightFormatting&&(t.formatting="emoji");a=M(t);return t.emoji=!1,a}return" "===i&&(e.match(/^ +$/,!1)?t.trailingSpace++:t.trailingSpace&&(t.trailingSpaceNewLine=!0)),M(t)}function D(e,t){if(">"!==e.next())return e.match(/^[^>]+/,!0),p.linkInline;t.f=t.inline=T,d.highlightFormatting&&(t.formatting="link");t=M(t);return t?t+=" ":t="",t+p.linkInline}function A(e,t){if(e.eatSpace())return null;var n,e=e.next();return"("===e||"["===e?(t.f=t.inline=(n="("===e?")":"]",function(e,t){if(e.next()!==n)return e.match(a[n]),t.linkHref=!0,M(t);t.f=t.inline=T,d.highlightFormatting&&(t.formatting="link-string");e=M(t);return t.linkHref=!1,e}),d.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,M(t)):"error"}var a={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function O(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=s,e.next(),d.highlightFormatting&&(t.formatting="link"),t.linkText=!0,M(t)):C(e,t,T)}function s(e,t){if(e.match("]:",!0)){t.f=t.inline=l,d.highlightFormatting&&(t.formatting="link");var n=M(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),p.linkText}function l(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),t.f=t.inline=T,p.linkHref+" url")}var u={startState:function(){return{f:o,prevLine:{stream:null},thisLine:{stream:null},block:o,htmlState:null,indentation:0,inline:T,text:t,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&vt.copyState(h,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?vt.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return i(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=L)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length;if(t.indentation=n,t.indentationDiff=null,0<n)return null}}return t.f(e,t)},innerMode:function(e){return e.block==L?{state:e.htmlState,mode:h}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:u}},indent:function(e,t,n){return e.block==L&&h.indent?h.indent(e.htmlState,t,n):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,t,n):vt.Pass},blankLine:i,getType:M,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return u},"xml"),vt.defineMIME("text/markdown","markdown"),vt.defineMIME("text/x-markdown","markdown"),xt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,bt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,wt=/[*+-]\s/,(yt=k.exports).commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return yt.Pass;for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){var r=t[i].head,o=e.getStateAfter(r.line),a=yt.innerMode(e.getMode(),o);if("markdown"!==a.mode.name)return void e.execCommand("newlineAndIndent");var s,l,u=!1!==(o=a.state).list,c=0!==o.quote,f=e.getLine(r.line),a=xt.exec(f),o=/^\s*$/.test(f.slice(0,r.ch));if(!t[i].empty()||!u&&!c||!a||o)return void e.execCommand("newlineAndIndent");bt.test(f)?(s=c&&/>\s*$/.test(f),l=!/>\s*$/.test(f),(s||l)&&e.replaceRange("",{line:r.line,ch:0},{line:r.line,ch:r.ch+1}),n[i]="\n"):(f=a[1],s=a[5],a=(l=!(wt.test(a[2])||0<=a[2].indexOf(">")))?parseInt(a[3],10)+1+a[4]:a[2].replace("x"," "),n[i]="\n"+f+a+s,l&&function(e,t){var n=t.line,i=0,r=0,o=xt.exec(e.getLine(n)),a=o[1];do{var s=n+(i+=1),l=e.getLine(s),u=xt.exec(l);if(u){var c=u[1],f=parseInt(o[3],10)+i-r,d=parseInt(u[3],10),h=d;if(a!==c||isNaN(d)){if(a.length>c.length)return;if(a.length<c.length&&1===i)return;r+=1}else f===d&&(h=d+1),d<f&&(h=1+f),e.replaceRange(l.replace(xt,c+h+u[4]+u[5]),{line:s,ch:0},{line:s,ch:l.length})}}while(u)}(e,r))}e.replaceSelections(n)};var Et,Mt=function(){$$("input[data-enable]").forEach(function(e){e.addEventListener("change",function(){for(var e,t=this.getAttribute("data-enable").split(","),n=0;n<t.length;n++)e=$('input[name="'+t[n]+'"]'),this.checked?e.removeAttribute("disabled"):e.setAttribute("disabled","")})}),$$(".input-reset").forEach(function(e){e.addEventListener("click",function(){var e=document.getElementById(this.getAttribute("data-reset"));e.value="",x.triggerEvent(e,"change")})}),$$(".input-date").forEach(function(e){dt(e,Formwork.config.DateInput)}),$$(".input-image").forEach(function(i){i.addEventListener("click",function(){gt.show("imagesModal",null,function(e){var t,n=$(".image-picker-thumbnail.selected",e);n&&n.classList.remove("selected"),i.value&&(t=$('.image-picker-thumbnail[data-filename="'+i.value+'"]',e))&&t.classList.add("selected"),$(".image-picker-confirm",e).setAttribute("data-target",i.id)})})}),$$(".image-picker").forEach(function(e){!function(e){var t,n,i,r=$$("option",e),o=$(".image-picker-confirm",e.parentNode),a=$("[data-command=upload]",e.parentNode);if(e.style.display="none",0<r.length){for((t=document.createElement("div")).className="image-picker-thumbnails",i=0;i<r.length;i++)(n=document.createElement("div")).className="image-picker-thumbnail",n.style.backgroundImage="url("+r[i].value+")",n.setAttribute("data-uri",r[i].value),n.setAttribute("data-filename",r[i].text),n.addEventListener("click",s),n.addEventListener("dblclick",l),t.appendChild(n);e.parentNode.insertBefore(t,e),$(".image-picker-empty-state").style.display="none"}function s(){var e=document.getElementById($(".image-picker-confirm").getAttribute("data-target"));e&&(e.value=this.getAttribute("data-filename")),$$(".image-picker-thumbnail").forEach(function(e){e.classList.remove("selected")}),this.classList.add("selected")}function l(){this.click(),$(".image-picker-confirm").click()}o.addEventListener("click",function(){var e=$(".image-picker-thumbnail.selected"),t=document.getElementById(this.getAttribute("data-target"));e&&t&&(t.value=e.getAttribute("data-filename"))}),a.addEventListener("click",function(){document.getElementById(this.getAttribute("data-upload-target")).click()})}(e)}),$$(".editor-textarea").forEach(function(e){kt(e)}),$$("input[type=file]").forEach(function(e){Ct(e)}),$$("input[data-field=tags]").forEach(function(e){Lt(e)}),$$("input[data-field=duration]").forEach(function(e){ht(e,Formwork.config.DurationInput)}),$$("input[type=range]").forEach(function(e){function t(){$('output[for="'+this.id+'"]').innerHTML=this.value}(e=e).addEventListener("change",t),e.addEventListener("input",t)}),$$(".input-array").forEach(function(e){ft(e)}),$$("[data-form]").forEach(function(e){St(e)})},Tt=function(){var e=$("[data-command=expand-all-pages]"),t=$("[data-command=collapse-all-pages]"),n=$("[data-command=reorder-pages]"),i=$("[data-command=change-slug]"),r=$(".page-search"),o=document.getElementById("newPageModal"),a=document.getElementById("slugModal");function s(){var i,e=this.value;0===e.length?($$(".pages-children").forEach(function(e){e.style.display=e.getAttribute("data-display")}),$$(".pages-item, .page-children-toggle").forEach(function(e){e.style.display=""}),$$(".page-details").forEach(function(e){e.style.paddingLeft=""}),$$(".page-title a").forEach(function(e){e.innerHTML=e.textContent})):(i=new RegExp(x.makeDiacriticsRegExp(x.escapeRegExp(e)),"gi"),$$(".pages-children").forEach(function(e){e.style.display="block"}),$$(".page-children-toggle").forEach(function(e){e.style.display="none"}),$$(".page-details").forEach(function(e){e.style.paddingLeft="0"}),$$(".page-title a").forEach(function(e){var t=e.closest(".pages-item"),n=e.textContent;null!==n.match(i)?(e.innerHTML=n.replace(i,"<mark>$&</mark>"),t.style.display=""):t.style.display="none"}))}function l(){this.value=x.validateSlug(this.value)}$$(".pages-list").forEach(function(e){var t,n,i;"true"===e.getAttribute("data-sortable-children")&&(n=[],n=(i=qe.create(t=e,{handle:".sort-handle",filter:"[data-sortable=false]",forceFallback:!0,onClone:function(e){e.item.closest(".pages-list").classList.add("dragging"),$$(".pages-children",e.item).forEach(function(e){e.style.display="none"}),$$(".page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed"),e.style.opacity="0.5"})},onMove:function(e){if("false"===e.related.getAttribute("data-sortable"))return!1;$$(".pages-children",e.related).forEach(function(e){e.style.display="none"})},onEnd:function(e){e.item.closest(".pages-list").classList.remove("dragging"),$$(".page-children-toggle").forEach(function(e){e.style.opacity=""}),e.newIndex!==e.oldIndex&&(i.option("disabled",!0),e={"csrf-token":$("meta[name=csrf-token]").getAttribute("content"),parent:t.getAttribute("data-parent"),from:e.oldIndex,to:e.newIndex},f({method:"POST",url:Formwork.config.baseUri+"pages/reorder/",data:e},function(e){e.status&&new c(e.message,e.status,{icon:"check-cricle"}).show(),e.status&&"error"!==e.status||i.sort(n),i.option("disabled",!1),n=i.toArray()}))}})).toArray())}),$$(".page-details").forEach(function(e){var t=$(".page-children-toggle",e);t&&e.addEventListener("click",function(){t.click()})}),$$(".page-details a").forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation()})}),$$(".page-children-toggle").forEach(function(e){e.addEventListener("click",function(e){var t,n;n=(t=this).closest("li"),$$(".pages-list",n).forEach(function(e){e.parentNode===n&&x.toggleElement(e)}),t.classList.toggle("toggle-expanded"),t.classList.toggle("toggle-collapsed"),e.stopPropagation()})}),e&&e.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="block"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-collapsed"),e.classList.add("toggle-expanded")}),this.blur()}),t&&t.addEventListener("click",function(){$$(".pages-children").forEach(function(e){e.style.display="none"}),$$(".pages-list .page-children-toggle").forEach(function(e){e.classList.remove("toggle-expanded"),e.classList.add("toggle-collapsed")}),this.blur()}),n&&n.addEventListener("click",function(){this.classList.toggle("active"),$$(".pages-list .sort-handle").forEach(function(e){x.toggleElement(e,"inline-block")}),this.blur()}),r&&(r.addEventListener("focus",function(){$$(".pages-children").forEach(function(e){e.setAttribute("data-display",getComputedStyle(e).display)})}),r.addEventListener("keyup",x.debounce(s,100)),r.addEventListener("search",s),document.addEventListener("keydown",function(e){(e.ctrlKey||e.metaKey)&&70===e.which&&document.activeElement!==r&&(r.focus(),e.preventDefault())})),o&&($("#page-title",o).addEventListener("keyup",function(){$("#page-slug",o).value=x.slug(this.value)}),$("#page-slug",o).addEventListener("keyup",l),$("#page-slug",o).addEventListener("blur",l),$("#page-parent",o).addEventListener("change",function(){var e=this.options[this.selectedIndex],t=$("#page-template",o),n=e.getAttribute("data-allowed-templates"),i=0;if(null!==n)for(n=n.split(", "),t.setAttribute("data-previous-value",t.value),t.value=n[0],i=0;i<t.options.length;i++)-1===n.indexOf(t.options[i].value)&&t.options[i].setAttribute("disabled","");else for(t.hasAttribute("data-previous-value")&&(t.value=t.getAttribute("data-previous-value"),t.removeAttribute("data-previous-value")),i=0;i<t.options.length;i++)t.options[i].disabled=!1})),a&&i&&(i.addEventListener("click",function(){gt.show("slugModal",null,function(e){var t=document.getElementById("slug").value,e=$("#page-slug",e);e.value=t,e.setAttribute("placeholder",t)})}),$("#page-slug",a).addEventListener("keydown",function(e){13===e.which&&$("[data-command=continue]",a).click()}),$("#page-slug",a).addEventListener("keyup",l),$("#page-slug",a).addEventListener("blur",l),$("[data-command=generate-slug]",a).addEventListener("click",function(){var e=x.slug(document.getElementById("title").value);$("#page-slug",a).value=e,$("#page-slug",a).focus()}),$("[data-command=continue]",a).addEventListener("click",function(){var e,t=$("#page-slug",a).value.replace(/^-+|-+$/,"");0<t.length&&(e=$(".page-slug-change").innerHTML,$$("#page-slug, #slug").forEach(function(e){e.value=t}),$("#page-slug",a).value=t,document.getElementById("slug").value=t,$(".page-slug-change").innerHTML=e.replace(/\/[a-z0-9-]+\/$/,"/"+t+"/")),gt.hide("slugModal")}))},Dt=function(){$$("[title]",document.body).forEach(function(e){e.setAttribute("data-tooltip",e.getAttribute("title")),e.removeAttribute("title")}),$$("[data-tooltip]").forEach(function(e){e.addEventListener("mouseover",function(){new r(this.getAttribute("data-tooltip"),{referenceElement:this,position:"bottom",offset:{x:0,y:4}}).show()}),"button"!==e.tagName.toLowerCase()&&!e.classList.contains("button")||e.addEventListener("focus",function(){new r(this.getAttribute("data-tooltip"),{referenceElement:this,position:"bottom",offset:{x:0,y:4},delay:0}).show()})}),$$('[data-overflow-tooltip="true"]').forEach(function(e){e.addEventListener("mouseover",function(){this.offsetWidth<this.scrollWidth&&new r(this.textContent.trim(),{referenceElement:this,position:"bottom",offset:{x:0,y:4}}).show()})})},At=function(){var t,n,i,r,o,a;document.getElementById("updater-component")&&(t=$(".update-status"),n=$(".spinner"),i=$(".current-version"),r=$(".current-version-name"),o=$(".new-version"),a=$(".new-version-name"),setTimeout(function(){var e={"csrf-token":$("meta[name=csrf-token]").getAttribute("content")};f({method:"POST",url:Formwork.config.baseUri+"updates/check/",data:e},function(e){t.innerHTML=e.message,"success"===e.status?!1===e.data.uptodate?(e=e.data.release.name,n.classList.add("spinner-info"),u.inject("info",n),a.innerHTML=e,o.style.display="block"):(n.classList.add("spinner-success"),u.inject("check",n),i.style.display="block"):(n.classList.add("spinner-error"),u.inject("exclamation",n))})},1e3),$("[data-command=install-updates]").addEventListener("click",function(){o.style.display="none",n.classList.remove("spinner-info"),t.innerHTML=t.getAttribute("data-installing-text"),f({method:"POST",url:Formwork.config.baseUri+"updates/update/",data:{"csrf-token":$("meta[name=csrf-token]").getAttribute("content")}},function(e){new c(e.message,e.status,{icon:"check-circle"}).show(),t.innerHTML=e.data.status,"success"===e.status?(n.classList.add("spinner-success"),u.inject("check",n),r.innerHTML=a.innerHTML,i.style.display="block"):(n.classList.add("spinner-error"),u.inject("exclamation",n))})}))},k=Et={config:{},init:function(){function e(){var e=x.getCookies(),t="formwork_preferred_color_scheme",n=t in e?e[t]:null,e=null;window.matchMedia("(prefers-color-scheme: light)").matches?e="light":window.matchMedia("(prefers-color-scheme: dark)").matches&&(e="dark"),e!==n&&x.setCookie(t,e,{"max-age":2592e3,path:Et.config.baseUri,samesite:"strict"})}gt.init(),Mt(),s(),Dt(),a(),Tt(),At(),$(".toggle-navigation")&&$(".toggle-navigation").addEventListener("click",function(){$(".sidebar").classList.toggle("show")}),$$("[data-chart-data]").forEach(function(e){var t=JSON.parse(e.getAttribute("data-chart-data"));new i.Line(e,t,{showArea:!0,fullWidth:!0,scaleMinSpace:20,divisor:5,chartPadding:20,lineSmooth:!1,low:0,axisX:{showGrid:!1,labelOffset:{x:0,y:10}},axisY:{onlyInteger:!0,offset:15,labelOffset:{x:0,y:5}}}).container.addEventListener("mouseover",function(e){var t,n;"ct-point"===e.target.getAttribute("class")&&(t={x:0,y:-8},-1!==navigator.userAgent.indexOf("Firefox")&&(n=parseFloat(getComputedStyle(e.target)["stroke-width"]),t.x+=n/2,t.y+=n/2),new r(e.target.getAttribute("ct:value"),{referenceElement:e.target,offset:t}).show())})}),$$("meta[name=notification]").forEach(function(e){var t=JSON.parse(e.getAttribute("content"))[0];new c(t.text,t.type,{interval:t.interval,icon:t.icon}).show(),e.parentNode.removeChild(e)}),$("[data-command=save]")&&document.addEventListener("keydown",function(e){e.altKey||!e.ctrlKey&&!e.metaKey||83===e.which&&($("[data-command=save]").click(),e.preventDefault())}),window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e)},initGlobals:function(e){e.$=function(e,t){return(t=void 0===t?document:t).querySelector(e)},e.$$=function(e,t){return(t=void 0===t?document:t).querySelectorAll(e)},"forEach"in e.NodeList.prototype||(e.NodeList.prototype.forEach=e.Array.prototype.forEach),"matches"in e.Element.prototype||(e.Element.prototype.matches=e.Element.prototype.msMatchesSelector||e.Element.prototype.webkitMatchesSelector),"closest"in e.Element.prototype||(e.Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null}),"requestSubmit"in e.HTMLFormElement.prototype||(e.HTMLFormElement.prototype.requestSubmit=function(e){function t(e,t,n){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",n)}e?(e instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"!==e.type&&t(TypeError,"The specified element is not a submit button"),e.form!==this&&t(DOMException,"The specified element is not owned by this form element","NotFoundError"),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))})}};return document.addEventListener("DOMContentLoaded",function(){Et.init()}),Et.initGlobals(window),k}();