From 8bf1aaa5bb1e26da0b752479428ace80bb6d6381 Mon Sep 17 00:00:00 2001 From: Giuseppe Criscione <18699708+giuscris@users.noreply.github.com> Date: Thu, 27 Oct 2022 21:07:29 +0200 Subject: [PATCH] Migrate to terser --- admin/assets/js/app.min.js | 2 +- admin/package.json | 6 +- admin/rollup.config.js | 3 +- admin/yarn.lock | 124 +++++++++++++++++++++++++++++++++---- 4 files changed, 119 insertions(+), 16 deletions(-) diff --git a/admin/assets/js/app.min.js b/admin/assets/js/app.min.js index 46892e61..ca2a9407 100644 --- a/admin/assets/js/app.min.js +++ b/admin/assets/js/app.min.js @@ -1 +1 @@ -var Formwork=function(){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={exports:{}},n=(Z=i,$t=function(){var p,u,f,m,r,o,a,s,l,n,h,c,d,g,v,y,x,b,w,k,C,e={version:"0.11.4"},t=(p=e,u=(t=this||i).window,f=t.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":">",'"':""","'":"'"},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){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=n)s.step=1;else if(i&&t=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(1e3e.x;return t&&"explode"===n||!t&&"implode"===n?"start":t&&"implode"===n||!t&&"explode"===n?"end":"middle"}return S.Svg=S.Class.extend({constructor:function(e,t,n,i,r){e instanceof Element?this._node=e:(this._node=L.createElementNS(S.namespaces.svg,e),"svg"===e&&this.attr({"xmlns:ct":S.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(S.namespaces[t[0]],e,n[e])):this._node.setAttribute(e,n[e]))}.bind(this)),this)},elem:function(e,t,n,i){return new S.Svg(e,t,n,this,i)},parent:function(){return this._node.parentNode instanceof SVGElement?new S.Svg(this._node.parentNode):null},root:function(){for(var e=this._node;"svg"!==e.nodeName;)e=e.parentNode;return new S.Svg(e)},querySelector:function(e){return(e=this._node.querySelector(e))?new S.Svg(e):null},querySelectorAll:function(e){return(e=this._node.querySelectorAll(e)).length?new S.Svg.List(e):null},getNode:function(){return this._node},foreignObject:function(e,t,n,i){"string"==typeof e&&((r=L.createElement("div")).innerHTML=e,e=r.firstChild),e.setAttribute("xmlns",S.namespaces.xmlns);var r=this.elem("foreignObject",t,n,i);return r._node.appendChild(e),r},text:function(e){return this._node.appendChild(L.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:S.Svg.Easing[t.easing],delete t.easing),t.begin=S.ensureUnit(t.begin,"ms"),t.dur=S.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=S.quantity(t.begin||0).value,t.begin="indefinite"),n=this.elem("animate",S.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}}),S.Svg.isSupported=function(e){return L.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+e,"1.1")},S.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]},S.Svg.List=S.Class.extend({constructor:function(e){var i=this;this.svgElements=[];for(var t=0;t":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","¡":"","£":"","¤":"","¥":"","¦":"","§":"","«":"","°":"","»":"","‘":"","’":"","“":"","”":"","\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[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)&&ee(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 te,ne=/\s+/g;function N(e,t,n){var i;e&&t&&(e.classList?e.classList[n?"add":"remove"](t):(i=(" "+e.className+" ").replace(ne," ").replace(" "+t+" "," "),e.className=(i+(n?" "+t:"")).replace(ne," ")))}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")?t:"-webkit-"+t]=n+("string"==typeof n?"":"px")}}function ie(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 re(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r=n.left-i&&r<=n.right+i,n=o>=n.top-i&&o<=n.bottom+i,t&&n?a=e:void 0});var t=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[H]._onDragOver(i)}}var r,o,a}function ke(e){R&&R.parentNode[H]._isOutsideThisEl(e.target)}var R,j,_,Y,U,Ce,b,r,Se,q,Le,X,Ee,G,Me,c,Te,De,Ae,Oe,Ne,Fe,Ie,Pe,d,He=!1,$e=!1,ze=[],Be=!1,We=!1,Re=[],je=!1,_e=[],Ye="undefined"!=typeof document,Ue=M,qe=S||x?"cssFloat":"float",Xe=Ye&&!Z&&!M&&"draggable"in document.createElement("div"),Ge=function(){var e;if(Ye)return!x&&((e=document.createElement("x")).style.cssText="pointer-events:auto","auto"===e.style.pointerEvents)}();Ye&&!Z&&document.addEventListener("click",function(e){if($e)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),$e=!1},!0);function V(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=a({},t),e[H]=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 ye(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!==V.supportPointer&&"PointerEvent"in window&&!E,emptyInsertThreshold:5};for(n in ge.initializePlugins(this,e,r),r)n in t||(t[n]=r[n]);for(i in xe(t),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!t.forceFallback&&Xe,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?l(e,"pointerdown",this._onTapStart):(l(e,"mousedown",this._onTapStart),l(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(l(e,"dragover",this),l(e,"dragenter",this)),ze.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),a(this,he())}function Ve(e,t,n,i,r,o,a,s){var l,u,c=e[H],d=c.options.onMove;return!window.CustomEvent||x||S?(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||I(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),u=d?d.call(c,l,a):u}function Ke(e){e.draggable=!1}function Qe(){je=!1}function Ze(e){return setTimeout(e,0)}function Je(e){return clearTimeout(e)}V.prototype={constructor:V,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Fe=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,R):this.options.direction},_onTapStart:function(t){if(t.cancelable){for(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,c=i,d=(_e.length=0,c.getElementsByTagName("input")),f=d.length;f--;){var h=d[f];h.checked&&_e.push(h)}if(!R&&!(/mousedown|pointerdown/.test(o)&&0!==t.button||e.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!E||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=O(s,e.draggable,i,!1))&&s.animated||Ce===s)){if(Se=P(s),Le=P(s,e.draggable),"function"==typeof u){if(u.call(this,t,s,this))return B({sortable:n,rootEl:l,name:"filter",targetEl:s,toEl:i,fromEl:i}),z("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 B({sortable:n,rootEl:e,name:"filter",targetEl:s,fromEl:i,toEl:i}),z("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&&!R&&n.parentNode===o&&(i=I(n),Y=o,j=(R=n).parentNode,U=R.nextSibling,Ce=n,Ee=a.group,Me={target:V.dragged=R,clientX:(t||e).clientX,clientY:(t||e).clientY},Ae=Me.clientX-i.left,Oe=Me.clientY-i.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,R.style["will-change"]="all",o=function(){z("delayEnded",r,{evt:e}),V.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!L&&r.nativeDraggable&&(R.draggable=!0),r._triggerDragStart(e,t),B({sortable:r,name:"choose",originalEvent:e}),N(R,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){re(R,e.trim(),Ke)}),l(s,"dragover",W),l(s,"mousemove",W),l(s,"touchmove",W),l(s,"mouseup",r._onDrop),l(s,"touchend",r._onDrop),l(s,"touchcancel",r._onDrop),L&&this.nativeDraggable&&(this.options.touchStartThreshold=4,R.draggable=!0),z("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(S||x)?o():V.eventCanceled?this._onDrop():(l(s,"mouseup",r._disableDelayedDrag),l(s,"touchend",r._disableDelayedDrag),l(s,"touchcancel",r._disableDelayedDrag),l(s,"mousemove",r._delayedDragTouchMoveHandler),l(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&l(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,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(){R&&Ke(R),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;o(e,"mouseup",this._disableDelayedDrag),o(e,"touchend",this._disableDelayedDrag),o(e,"touchcancel",this._disableDelayedDrag),o(e,"mousemove",this._delayedDragTouchMoveHandler),o(e,"touchmove",this._delayedDragTouchMoveHandler),o(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?l(document,"pointermove",this._onTouchMove):l(document,t?"touchmove":"mousemove",this._onTouchMove):(l(R,"dragend",this),l(Y,"dragstart",this._onDragStart));try{document.selection?Ze(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){var n;He=!1,Y&&R?(z("dragStarted",this,{evt:t}),this.nativeDraggable&&l(document,"dragover",ke),n=this.options,e||N(R,n.dragClass,!1),N(R,n.ghostClass,!0),V.active=this,e&&this._appendGhost(),B({sortable:this,name:"start",originalEvent:t})):this._nulling()},_emulateDragOver:function(){if(c){this._lastX=c.clientX,this._lastY=c.clientY,be();for(var e=document.elementFromPoint(c.clientX,c.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(c.clientX,c.clientY))!==t;)t=e;if(R.parentNode[H]._isOutsideThisEl(e),t)do{if(t[H])if(t[H]._onDragOver({clientX:c.clientX,clientY:c.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}while(t=(e=t).parentNode);we()}},_onTouchMove:function(e){if(Me){var t=this.options,n=t.fallbackTolerance,t=t.fallbackOffset,i=e.touches?e.touches[0]:e,r=_&&ie(_,!0),o=_&&r&&r.a,a=_&&r&&r.d,s=Ue&&d&&le(d),o=(i.clientX-Me.clientX+t.x)/(o||1)+(s?s[0]-Re[0]:0)/(o||1),t=(i.clientY-Me.clientY+t.y)/(a||1)+(s?s[1]-Re[1]:0)/(a||1);if(!V.active&&!He){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))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)&&!e.animated){if(e===R)return T(!1);if((s=e&&a===n.target?e:s)&&(v=I(s)),!1!==Ve(Y,a,R,i,s,v,n,!!s))return M(),e&&e.nextSibling?a.insertBefore(R,e.nextSibling):a.appendChild(R),j=a,D(),T(!0)}else if(e&&function(e,t,n){n=I(ae(n.el,0,n.options,!0));return t?e.clientXk.getMaxSafeInteger();)this.value=this.value.slice(0,-1);g(),m(),v()}),r.addEventListener("blur",function(){m();var e,t=p(c.value*d[l.unit]);for(e in f)Object.prototype.hasOwnProperty.call(f,e)&&(f[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(e,s),e.appendChild(c)}dt.prototype={startIndex:null,dragStart:function(e){e=e.oldDraggableIndex;this.startIndex=e},onSpill:function(e){var t=e.dragEl,e=e.putSortable,n=(this.sortable.captureAnimationState(),e&&e.captureAnimationState(),ae(this.sortable.el,this.startIndex,this.options));n?this.sortable.el.insertBefore(t,n):this.sortable.el.appendChild(t),this.sortable.animateAll(),e&&e.animateAll()},drop:ut},a(dt,{pluginName:"revertOnSpill"}),ft.prototype={onSpill:function(e){var t=e.dragEl,e=e.putSortable||this.sortable;e.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),e.animateAll()},drop:ut},a(ft,{pluginName:"removeOnSpill"}),V.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?l(document,"dragover",this._handleAutoScroll):this.options.supportPointer?l(document,"pointermove",this._handleFallbackAutoScroll):e.touches?l(document,"touchmove",this._handleFallbackAutoScroll):l(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){e=e.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?o(document,"dragover",this._handleAutoScroll):(o(document,"pointermove",this._handleFallbackAutoScroll),o(document,"touchmove",this._handleFallbackAutoScroll),o(document,"mousemove",this._handleFallbackAutoScroll)),lt(),st(),clearTimeout(te),te=void 0},nulling:function(){rt=tt=et=at=ot=nt=it=null,K.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);rt=t,n||this.options.forceAutoScrollFallback||S||x||E?(ct(t,this.options,e,n),i=D(e,!0),!at||ot&&o===nt&&a===it||(ot&<(),ot=setInterval(function(){var e=D(document.elementFromPoint(o,a),!0);e!==i&&(i=e,st()),ct(t,r.options,e,n)},10),nt=o,it=a)):this.options.bubbleScroll&&D(e,!0)!==T()?ct(t,this.options,D(e,!1),!1):st()}},a(e,{pluginName:"scroll",initializeByDefault:!0})}),V.mount(ft,dt);var mt,gt,vt={exports:{}},yt=vt.exports=function(){var e=navigator.userAgent,a=navigator.platform,z=/gecko\/\d/i.test(e),s=/MSIE \d/.test(e),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),B=/Edge\/(\d+)/.exec(e),S=s||c||B,w=S&&(s?document.documentMode||6:+(B||c)[1]),g=!B&&/WebKit\//.test(e),W=g&&/Qt\/\d+\.\d+/.test(e),R=!B&&/Chrome\/(\d+)/.exec(e),j=R&&+R[1],_=/Opera\//.test(e),Y=/Apple Computer/.test(navigator.vendor),q=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),X=/PhantomJS/.test(e),G=Y&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),V=/Android/.test(e),K=G||V||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),v=G||/Mac/.test(a),Q=/\bCrOS\b/.test(e),Z=/win/i.test(a),J=_&&e.match(/Version\/(\d*\.\d*)/);if(J)J=Number(J[1]);if(J&&J>=15){_=false;g=true}var ee=v&&(W||_&&(J==null||J<12.11)),te=z||S&&w>=9;function ne(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ie=function(e,t){var n=e.className;var i=ne(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:"")}},re;function oe(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function o(e,t){return oe(e).appendChild(t)}function k(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)return a+(t-o);a+=s-o;a+=n-a%n;o=s+1}}var me=function(){this.id=null;this.f=null;this.time=0;this.handler=he(this.onTimeout,this)};function m(e,t){for(var n=0;n=t)return i+Math.min(a,t-r);r+=o-i;r+=n-r%n;i=o+1;if(r>=t)return i}}var ke=[""];function Ce(e){while(ke.length<=e)ke.push(U(ke)+" ");return ke[e]}function U(e){return e[e.length-1]}function Se(e,t){var n=[];for(var i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Ae(e,t){if(!t)return De(e);if(t.source.indexOf("\\w")>-1&&De(e))return true;return t.test(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return false;return true}var Ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Fe(e){return e.charCodeAt(0)>=768&&Ne.test(e)}function Ie(e,t,n){while((n<0?t>0:tn?-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 He(e,t,n,i){if(!e)return i(t,n,"ltr",0);var r=false;for(var o=0;ot||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 $e=null;function ze(e,t,n){var i;$e=null;for(var r=0;rt)return r;if(o.to==t)if(o.from!=o.to&&n=="before")i=r;else $e=r;if(o.from==t)if(o.from!=o.to&&n!="before")i=r;else $e=r}return i!=null?i:$e}var Be=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-1)i[t]=r.slice(0,o).concat(r.slice(o+1))}}}function p(e,t){var n=je(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2);for(var r=0;r0}function Ye(e){e.prototype.on=function(e,t){E(this,e,t)};e.prototype.off=function(e,t){M(this,e,t)}}function T(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false}function Ue(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true}function qe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function Xe(e){T(e);Ue(e)}function Ge(e){return e.target||e.srcElement}function Ve(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(v&&e.ctrlKey&&t==1)t=3;return t}var Ke=function(){if(S&&w<9)return false;var e=k("div");return"draggable"in e||"dragDrop"in e}(),Qe,Ze;function Je(e){if(Qe==null){var t=k("span","​");o(e,k("span",[t,document.createTextNode("x")]));if(e.firstChild.offsetHeight!=0)Qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(S&&w<8)}var n=Qe?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");n.setAttribute("cm-text","");return n}function et(e){if(Ze!=null)return Ze;var t=o(e,document.createTextNode("AخA"));var n=re(t,0,1).getBoundingClientRect();var i=re(t,1,2).getBoundingClientRect();oe(e);if(!n||n.left==n.right)return false;return Ze=i.right-n.right<3}var tt="\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/)},nt=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},it=function(){var e=k("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}(),rt=null;function ot(e){if(rt!=null)return rt;var t=o(e,k("span","x"));var n=t.getBoundingClientRect();var i=re(t,0,1).getBoundingClientRect();return rt=Math.abs(n.left-i.left)>1}var at={},st={};function lt(e,t){if(arguments.length>2)t.dependencies=Array.prototype.slice.call(arguments,2);at[e]=t}function ut(e,t){st[e]=t}function ct(e){if(typeof e=="string"&&st.hasOwnProperty(e))e=st[e];else if(e&&typeof e.name=="string"&&st.hasOwnProperty(e.name)){var t=st[e.name];if(typeof t=="string")t={name:t};e=Me(t,e);e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ct("application/xml");else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ct("application/json");if(typeof e=="string")return{name:e};else return e||{name:"null"}}function dt(e,t){t=ct(t);var n=at[t.name];if(!n)return dt(e,"text/plain");var i=n(e,t);if(ft.hasOwnProperty(t.name)){var r=ft[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 ft={};function ht(e,t){var n=ft.hasOwnProperty(e)?ft[e]:ft[e]={};pe(t,n)}function pt(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 mt(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 gt(e,t,n){return e.startState?e.startState(t,n):true}var x=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 O(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=e.first&&tn)return N(n,O(e,n).text.length);return Tt(t,O(e,t.line).text.length)}function Tt(e,t){var n=e.ch;if(n==null||n>t)return N(e.line,t);else if(n<0)return N(e.line,0);else return e}function Dt(e,t){var n=[];for(var i=0;i=this.string.length},x.prototype.sol=function(){return this.pos==this.lineStart},x.prototype.peek=function(){return this.string.charAt(this.pos)||undefined},x.prototype.next=function(){if(this.post},x.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},x.prototype.skipToEnd=function(){this.pos=this.string.length},x.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}},x.prototype.backUp=function(e){this.pos-=e},x.prototype.column=function(){if(this.lastColumnPos0)return null;if(o&&t!==false)this.pos+=o[0].length;return o}},x.prototype.current=function(){return this.string.slice(this.start,this.pos)},x.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},x.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},x.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var At=function(e,t){this.state=e;this.lookAhead=t},Ot=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 Nt(t,n,i,e){var l=[t.state.modeGen],r={};Rt(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;Rt(t,n.text,o.mode,i,function(e,t){var n=a;while(se)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(;ne.options.maxHighlightLength&&pt(e.doc.mode,i.state);var o=Nt(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 It(n,i,e){var t=n.doc,r=n.display;if(!t.mode.startState)return new Ot(t,true,i);var o=jt(n,i,e);var a=o>t.first&&O(t,o-1).stateAfter;var s=a?Ot.fromSaved(t,a,o):new Ot(t,gt(t.mode),o);t.iter(o,i,function(e){Pt(n,e.text,s);var t=s.line;e.stateAfter=t==i-1||t%5==0||t>=r.viewFrom&&tt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Ot.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);if(t!=null&&e>this.maxLookAhead)this.maxLookAhead=e;return t},Ot.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}},Ot.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0)this.maxLookAhead--},Ot.fromSaved=function(e,t,n){if(t instanceof At)return new Ot(e,pt(e.mode,t.state),n,t.lookAhead);else return new Ot(e,pt(e.mode,t),n)},Ot.prototype.save=function(e){var t=e!==false?pt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new At(t,this.maxLookAhead):t};var zt=function(e,t,n){this.start=e.start;this.end=e.pos;this.string=e.current();this.type=t||null;this.state=n};function Bt(e,t,n,i){var r=e.doc,o=r.mode,a;t=A(r,t);var s=O(r,t.line),l=It(e,t.line,n);var u=new x(s.text,e.options.tabSize,l),c;if(i)c=[];while((i||u.pose.options.maxHighlightLength){s=false;if(a)Pt(e,t,i,c.pos);c.pos=t.length;d=null}else d=Wt($t(n,c,i.state,f),o);if(f){var h=f[0].name;if(h)d="m-"+(d?h+" "+d:h)}if(!s||u!=d){while(la;--s){if(s<=o.first)return o.first;var l=O(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof At?u.lookAhead:0)<=o.modeFrontier))return s;var c=L(l.text,null,e.options.tabSize);if(r==null||i>c){r=s-1;i=c}}return r}function _t(e,t){e.modeFrontier=Math.min(e.modeFrontier,t);if(e.highlightFrontiern;i--){var r=O(e,i).stateAfter;if(r&&(!(r instanceof At)||i+r.lookAhead=t:o.to>t);(i||(i=[])).push(new Gt(a,o.from,l?null:o.to))}}return i}function Jt(e,t,n){var i;if(e)for(var r=0;r=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.from0&&s)for(var b=0;b0)continue;var c=[l,1],d=D(u.from,s.from),f=D(u.to,s.to);if(d<0||!a.inclusiveLeft&&!d)c.push({from:u.from,to:s.from});if(f>0||!a.inclusiveRight&&!f)c.push({from:s.to,to:u.to});r.splice.apply(r,c);l+=c.length-3}}return r}function rn(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!i||ln(i,o.marker)<0))i=o.marker}return i}function hn(e,t,n,i,r){var o=O(e,t);var a=Ut&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||c<=0&&d>=0)continue;if(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?D(u.to,n)>=0:D(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?D(u.from,i)<=0:D(u.from,i)<0))return true}}function pn(e){var t;while(t=cn(e))e=t.find(-1,true).line;return e}function mn(e){var t;while(t=dn(e))e=t.find(1,true).line;return e}function gn(e){var t,n;while(t=dn(e)){e=t.find(1,true).line;(n||(n=[])).push(e)}return n}function vn(e,t){var n=O(e,t),i=pn(n);if(n==i)return t;return C(i)}function yn(e,t){if(t>e.lastLine())return t;var n=O(e,t),i;if(!xn(e,n))return t;while(i=dn(n))n=i.find(1,true).line;return C(n)+1}function xn(e,t){var n=Ut&&t.markedSpans;if(n)for(var i=void 0,r=0;rn.maxLineLength){n.maxLineLength=t;n.maxLine=e}})}var Sn=function(e,t,n){this.text=e;on(this,t);this.height=n?n(this):1};function Ln(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;rn(e);on(e,n);var r=i?i(e):1;if(r!=e.height)xt(e,r)}function En(e){e.parent=null;rn(e)}Sn.prototype.lineNo=function(){return C(this)},Ye(Sn);var Mn={},Tn={};function Dn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Tn:Mn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function An(e,t){var n=ae("span",null,null,g?"padding-right: .1px":null);var i={pre:ae("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=Nn;if(et(e.display.measure)&&(a=We(o,e.doc.direction)))i.addToken=In(i.addToken,a);i.map=[];var s=t!=e.display.externalMeasured&&C(o);Hn(o,i,Ft(e,o,s));if(o.styleClasses){if(o.styleClasses.bgClass)i.bgClass=ue(o.styleClasses.bgClass,i.bgClass||"");if(o.styleClasses.textClass)i.textClass=ue(o.styleClasses.textClass,i.textClass||"")}if(i.map.length==0)i.map.push(0,0,i.content.appendChild(Je(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(g){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"}p(e,"renderLine",e,t.line,i.pre);if(i.pre.className)i.textClass=ue(i.pre.className,i.textClass||"");return i}function On(e){var t=k("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);t.setAttribute("aria-label",t.title);return t}function Nn(e,t,n,i,r,o,a){if(!t)return;var s=e.splitSpaces?Fn(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 d=0;while(true){l.lastIndex=d;var f=l.exec(t);var h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));if(S&&w<9)c.appendChild(k("span",[p]));else c.appendChild(p);e.map.push(e.pos,e.pos+h,p);e.col+=h;e.pos+=h}if(!f)break;d+=h+1;var m=void 0;if(f[0]=="\t"){var g=e.cm.options.tabSize,v=g-e.col%g;m=c.appendChild(k("span",Ce(v),"cm-tab"));m.setAttribute("role","presentation");m.setAttribute("cm-text","\t");e.col+=v}else if(f[0]=="\r"||f[0]=="\n"){m=c.appendChild(k("span",f[0]=="\r"?"␍":"␤","cm-invalidchar"));m.setAttribute("cm-text",f[0]);e.col+=1}else{m=e.cm.options.specialCharPlaceholder(f[0]);m.setAttribute("cm-text",f[0]);if(S&&w<9)c.appendChild(k("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=k("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 Fn(e,t){if(e.length>1&&!/ /.test(e))return e;var n=t,i="";for(var r=0;rs&&u.from<=s)break}if(u.to>=l)return d(e,t,n,i,r,o,a);d(e,t.slice(0,u.to-s),n,i,null,o,a);i=null;t=t.slice(u.to-s);s=u.to}}}function Pn(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 Hn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(!i){for(var a=1;al||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)f=(f?f+";":"")+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||ln(v.marker,C)<0))v=k}else if(k.from>l&&h>k.from)h=k.from}if(b)for(var L=0;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,d?d+p:p,g,l+D.length==h?m:"",f,y)}if(T>=M){c=c.slice(M-l);l=M;break}l=T;g=""}c=r.slice(o,o=n[u++]);d=Dn(n[u++],t.cm.options)}}}function $n(e,t,n){this.line=t;this.rest=gn(t);this.size=this.rest?C(U(this.rest))-n+1:1;this.node=this.text=null;this.hidden=xn(e,t)}function zn(e,t,n){var i=[],r;for(var o=t;o2)o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function fi(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var i=0;in)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:true}}}function hi(e,t){t=pn(t);var n=C(t);var i=e.display.externalMeasured=new $n(e.doc,t,n);i.lineN=n;var r=i.built=An(e,i);i.text=r.pre;o(e.display.lineMeasure,r.pre);return i}function pi(e,t,n,i){return vi(e,gi(e,t),n,i)}function mi(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt){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=0;r--)if((n=e[r]).left!=n.right)break;return n}function ki(e,t,n,i){var r=bi(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&&Fe(t.line.text.charAt(r.coverStart+a)))--a;while(r.coverStart+s0)l=i="right";var d;if(e.options.lineWrapping&&(d=o.getClientRects()).length>1)u=d[i=="right"?d.length-1:0];else u=o.getBoundingClientRect()}if(S&&w<9&&!a&&(!u||!u.left&&!u.right)){var f=o.parentNode.getClientRects()[0];if(f)u={left:f.left,right:f.left+Yi(e.display),top:f.top,bottom:f.bottom};else u=yi}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=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 d=ze(u,t,n);var f=$e;var h=c(t,d,n=="before");if(f!=null)h.other=c(t,f,n!="before");return h}function Ii(e,t){var n=0;t=A(e.doc,t);if(!e.options.lineWrapping)n=Yi(e.display)*t.ch;var i=O(e.doc,t.line);var r=wn(i)+oi(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Pi(e,t,n,i,r){var o=N(e,t,n);o.xRel=r;if(i)o.outside=i;return o}function Hi(e,t,n){var i=e.doc;n+=e.display.viewOffset;if(n<0)return Pi(i.first,0,null,-1,-1);var r=bt(i,n),o=i.first+i.size-1;if(r>o)return Pi(i.first+i.size-1,O(i,o).text.length,null,1,1);if(t<0)t=0;var a=O(i,r);for(;;){var s=Wi(e,a,r,t,n);var l=fn(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=O(i,r=u.line)}}function $i(t,e,n,i){i-=Di(e);var r=e.text.length;var o=Pe(function(e){return vi(t,n,e-1).bottom<=i},r,0);r=Pe(function(e){return vi(t,n,e).top>i},o,r);return{begin:o,end:r}}function zi(e,t,n,i){if(!n)n=gi(e,t);var r=Ai(e,t,vi(e,n,i),"line").top;return $i(e,t,n,r)}function Bi(e,t,n,i){return e.bottom<=n?false:e.top>n?true:(i?e.left:e.right)>t}function Wi(n,e,t,i,r){r-=wn(e);var o=gi(n,e);var a=Di(e);var s=0,l=e.text.length,u=true;var c=We(e,n.doc.direction);if(c){var d=(n.options.lineWrapping?ji:Ri)(n,e,t,o,c,i,r);u=d.level!=1;s=u?d.from:d.to-1;l=u?d.to:d.from-1}var f=null,h=null;var p=Pe(function(e){var t=vi(n,o,e);t.top+=a;t.bottom+=a;if(!Bi(t,i,r,false))return false;if(t.top<=r&&t.left<=i){f=e;h=t}return true},s,l);var m,g,v=false;if(h){var y=i-h.left=b.bottom?1:0}p=Ie(e.text,p,1);return Pi(t,p,g,v,i-m)}function Ri(i,r,o,a,s,l,u){var e=Pe(function(e){var t=s[e],n=t.level!=1;return Bi(Fi(i,N(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=Fi(i,N(o,n?t.from:t.to,n?"after":"before"),"line",r,a);if(Bi(c,l,u,true)&&c.top>u)t=s[e-1]}return t}function ji(e,t,n,i,r,o,a){var s=$i(e,t,i,a);var l=s.begin;var u=s.end;if(/\s/.test(t.text.charAt(u-1)))u--;var c=null,d=null;for(var f=0;f=u||h.to<=l)continue;var p=h.level!=1;var m=vi(e,i,p?Math.min(u,h.to)-1:Math.max(l,h.from)).right;var g=mg){c=h;d=g}}if(!c)c=r[r.length-1];if(c.fromu)c={from:c.from,to:u,level:c.level};return c}function _i(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(xi==null){xi=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t){xi.appendChild(document.createTextNode("x"));xi.appendChild(k("br"))}xi.appendChild(document.createTextNode("x"))}o(e.measure,xi);var n=xi.offsetHeight/50;if(n>3)e.cachedTextHeight=n;oe(e.measure);return n||1}function Yi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx");var n=k("pre",[t],"CodeMirror-line-like");o(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;if(r>2)e.cachedCharWidth=r;return r||10}function Ui(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:qi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function qi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Xi(i){var r=_i(i.display),o=i.options.lineWrapping;var a=o&&Math.max(5,i.display.scroller.clientWidth/Yi(i.display)-3);return function(e){if(xn(i.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n0&&(u=O(e.doc,l.line).text).length==l.ch){var c=L(u,u.length,e.options.tabSize)-u.length;l=N(l.line,Math.max(0,Math.round((o-si(e.display).left)/Yi(e.display))-c))}return l}function Ki(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;it))r.updateLineNumbers=t;e.curOp.viewChanged=true;if(t>=r.viewTo){if(Ut&&vn(e.doc,t)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=Ji(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=Ji(e,t,t,-1);if(a){r.view=r.view.slice(0,a.index);r.viewTo=a.lineN}else Zi(e)}else{var s=Ji(e,t,t,-1);var l=Ji(e,n,n+i,1);if(s&&l){r.view=r.view.slice(0,s.index).concat(zn(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=r.lineN&&t=i.viewTo)return;var o=i.view[Ki(e,t)];if(o.node==null)return;var a=o.changes||(o.changes=[]);if(m(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 Ji(e,t,n,i){var r=Ki(e,t),o,a=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:r,lineN:n};var s=e.display.viewFrom;for(var l=0;l0){if(r==a.length-1)return null;o=s+a[r].size-t;r++}else o=s-t;t+=o;n+=o}while(vn(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 er(e,t,n){var i=e.display,r=i.view;if(r.length==0||t>=i.viewTo||n<=i.viewFrom){i.view=zn(e,t,n);i.viewFrom=t}else{if(i.viewFrom>t)i.view=zn(e,t,i.viewFrom).concat(i.view);else if(i.viewFromn)i.view=i.view.slice(0,Ki(e,n))}i.viewTo=n}function tr(e){var t=e.display.view,n=0;for(var i=0;i=e.display.viewTo||l.to().line0?a:e.defaultCharWidth())+"px"}if(i.other){var s=n.appendChild(k("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="";s.style.left=i.other.left+"px";s.style.top=i.other.top+"px";s.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function or(e,t){return e.top-t.top||e.left-t.left}function ar(s,e,t){var n=s.display,i=s.doc;var r=document.createDocumentFragment();var o=si(s.display),M=o.left;var T=Math.max(n.sizerWidth,ui(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(k("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=O(i,n);var w=a.text.length;var k,C;function S(e,t){return Ni(s,N(n,e),"div",a,t)}function L(e,t,n){var i=zi(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=We(a,i.direction);He(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 d=(D?s:l)&&u;var f=(D?l:s)&&c;var h=d?M:(r?o:a).left;var p=f?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.bottom0)t.blinker=setInterval(function(){if(!e.hasFocus())dr(e);t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate);else if(e.options.cursorBlinkRate<0)t.cursorDiv.style.visibility="hidden"}function lr(e){if(!e.hasFocus()){e.display.input.focus();if(!e.state.focused)cr(e)}}function ur(e){e.state.delayingBlurEvent=true;setTimeout(function(){if(e.state.delayingBlurEvent){e.state.delayingBlurEvent=false;if(e.state.focused)dr(e)}},100)}function cr(e,t){if(e.state.delayingBlurEvent&&!e.state.draggingText)e.state.delayingBlurEvent=false;if(e.options.readOnly=="nocursor")return;if(!e.state.focused){p(e,"focus",e,t);e.state.focused=true;le(e.display.wrapper,"CodeMirror-focused");if(!e.curOp&&e.display.selForContextMenu!=e.doc.sel){e.display.input.reset();if(g)setTimeout(function(){return e.display.input.reset(true)},20)}e.display.input.receivedFocus()}sr(e)}function dr(e,t){if(e.state.delayingBlurEvent)return;if(e.state.focused){p(e,"blur",e,t);e.state.focused=false;ie(e.display.wrapper,"CodeMirror-focused")}clearInterval(e.display.blinker);setTimeout(function(){if(!e.state.focused)e.display.shift=false},150)}function fr(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.005||h<-.005){if(re.display.sizerWidth){var m=Math.ceil(c/Yi(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 hr(e){if(e.widgets)for(var t=0;t=a){o=bt(t,wn(O(t,l))-e.wrapper.clientHeight);a=l}}return{from:o,to:Math.max(a,o+1)}}function mr(e,t){if(h(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;var o=n.wrapper.ownerDocument;if(t.top+i.top<0)r=true;else if(t.bottom+i.top>(o.defaultView.innerHeight||o.documentElement.clientHeight))r=false;if(r!=null&&!X){var a=k("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-oi(e.display))+"px;\n height: "+(t.bottom-t.top+li(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a);a.scrollIntoView(r);e.display.lineSpace.removeChild(a)}}function gr(e,t,n,i){if(i==null)i=0;var r;if(!e.options.lineWrapping&&t==n){n=t.sticky=="before"?N(t.line,t.ch+1,"before"):t;t=t.ch?N(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t}for(var o=0;o<5;o++){var a=false;var s=Fi(e,t);var l=!n||n==t?s:Fi(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=yr(e,r);var c=e.doc.scrollTop,d=e.doc.scrollLeft;if(u.scrollTop!=null){Lr(e,u.scrollTop);if(Math.abs(e.doc.scrollTop-c)>1)a=true}if(u.scrollLeft!=null){Mr(e,u.scrollLeft);if(Math.abs(e.doc.scrollLeft-d)>1)a=true}if(!a)break}return r}function vr(e,t){var n=yr(e,t);if(n.scrollTop!=null)Lr(e,n.scrollTop);if(n.scrollLeft!=null)Mr(e,n.scrollLeft)}function yr(e,t){var n=e.display,i=_i(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=ci(e),a={};if(t.bottom-t.top>o)t.bottom=t.top+o;var s=e.doc.height+ai(n);var l=t.tops-i;if(t.topr+o){var c=Math.min(t.top,(u?s:t.bottom)-o);if(c!=r)a.scrollTop=c}var d=e.options.fixedGutter?0:n.gutters.offsetWidth;var f=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-d;var h=ui(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.lefth+f-3)a.scrollLeft=t.right+(p?0:10)-h;return a}function xr(e,t){if(t==null)return;Cr(e);e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function br(e){Cr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function wr(e,t,n){if(t!=null||n!=null)Cr(e);if(t!=null)e.curOp.scrollLeft=t;if(n!=null)e.curOp.scrollTop=n}function kr(e,t){Cr(e);e.curOp.scrollToPos=t}function Cr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Ii(e,t.from),i=Ii(e,t.to);Sr(e,n,i,t.margin)}}function Sr(e,t,n,i){var r=yr(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});wr(e,r.scrollLeft,r.scrollTop)}function Lr(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;if(!z)Zr(e,{top:t});Er(e,t,true);if(z)Zr(e);Yr(e,100)}function Er(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 Mr(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;no(e);if(e.display.scroller.scrollLeft!=t)e.display.scroller.scrollLeft=t;e.display.scrollbars.setScrollLeft(t)}function Tr(e){var t=e.display,n=t.gutters.offsetWidth;var i=Math.round(e.doc.height+ai(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+li(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Dr=function(e,t,n){this.cm=n;var i=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var r=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1;e(i);e(r);E(i,"scroll",function(){if(i.clientHeight)t(i.scrollTop,"vertical")});E(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"},Ar=(Dr.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.scrollTop=0;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}},Dr.prototype.setScrollLeft=function(e){if(this.horiz.scrollLeft!=e)this.horiz.scrollLeft=e;if(this.disableHoriz)this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Dr.prototype.setScrollTop=function(e){if(this.vert.scrollTop!=e)this.vert.scrollTop=e;if(this.disableVert)this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Dr.prototype.zeroWidthHack=function(){var e=v&&!q?"12px":"18px";this.horiz.style.height=this.vert.style.width=e;this.horiz.style.visibility=this.vert.style.visibility="hidden";this.disableHoriz=new me;this.disableVert=new me},Dr.prototype.enableZeroWidthBar=function(n,i,r){n.style.visibility="";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.visibility="hidden";else i.set(1e3,o)}i.set(1e3,o)},Dr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz);e.removeChild(this.vert)},function(){});function Or(e,t){if(!t)t=Tr(e);var n=e.display.barWidth,i=e.display.barHeight;Nr(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)fr(e);Nr(e,Tr(e));n=e.display.barWidth;i=e.display.barHeight}}function Nr(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=""}Ar.prototype.update=function(){return{bottom:0,right:0}},Ar.prototype.setScrollLeft=function(){},Ar.prototype.setScrollTop=function(){},Ar.prototype.clear=function(){};var Fr={native:Dr,null:Ar};function Ir(n){if(n.display.scrollbars){n.display.scrollbars.clear();if(n.display.scrollbars.addClass)ie(n.display.wrapper,n.display.scrollbars.addClass)}n.display.scrollbars=new Fr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller);E(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")Mr(n,e);else Lr(n,e)},n);if(n.display.scrollbars.addClass)le(n.display.wrapper,n.display.scrollbars.addClass)}var Pr=0;function Hr(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:++Pr,markArrays:null};Wn(e.curOp)}function $r(e){var t=e.curOp;if(t)jn(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping;e.update=e.mustUpdate&&new qr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Wr(e){e.updatedDisplay=e.mustUpdate&&Kr(e.cm,e.update)}function Rr(e){var t=e.cm,n=t.display;if(e.updatedDisplay)fr(t);e.barMeasure=Tr(t);if(n.maxLineChanged&&!t.options.lineWrapping){e.adjustWidthTo=pi(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+li(t)+t.display.barWidth);e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ui(t))}if(e.updatedDisplay||e.selectionChanged)e.preparedSelection=n.input.prepareSelection()}function jr(e){var t=e.cm;if(e.adjustWidthTo!=null){t.display.sizer.style.minWidth=e.adjustWidthTo+"px";if(e.maxScrollLeft=l.display.viewTo)return;var c=+new Date+l.options.workTime;var d=It(l,u.highlightFrontier);var f=[];u.iter(d.line,Math.min(u.first+u.size,l.display.viewTo+500),function(e){if(d.line>=l.display.viewFrom){var t=e.styles;var n=e.text.length>l.options.maxHighlightLength?pt(u.mode,d.state):null;var i=Nt(l,e,d,true);if(n)d.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&&sc){Yr(l,l.options.workDelay);return true}});u.highlightFrontier=d.line;u.modeFrontier=Math.max(u.modeFrontier,d.line);if(f.length)I(l,function(){for(var e=0;e=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&tr(e)==0)return false;if(io(e)){Zi(e);t.dims=Ui(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.viewFroma&&n.viewTo-a<20)a=Math.min(r,n.viewTo);if(Ut){o=vn(e.doc,o);a=yn(e.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;er(e,o,a);n.viewOffset=wn(O(e.doc,n.viewFrom));e.display.mover.style.top=n.viewOffset+"px";var l=tr(e);if(!s&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return false;var u=Gr(e);if(l>4)n.lineDiv.style.display="none";Jr(e,n.updateLineNumbers,t.dims);if(l>4)n.lineDiv.style.display="";n.renderedView=n.view;Vr(u);oe(n.cursorDiv);oe(n.selectionDiv);n.gutters.style.height=n.sizer.style.minHeight=0;if(s){n.lastWrapHeight=t.wrapperHeight;n.lastWrapWidth=t.wrapperWidth;Yr(e,400)}n.updateLineNumbers=null;return true}function Qr(e,t){var n=t.viewport;for(var i=true;;i=false){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(n&&n.top!=null)n={top:Math.min(e.doc.height+ai(e.display)-ci(e),n.top)};t.visible=pr(e.display,e.doc,n);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else if(i)t.visible=pr(e.display,e.doc,n);if(!Kr(e,t))break;fr(e);var r=Tr(e);nr(e);Or(e,r);to(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 Zr(e,t){var n=new qr(e,t);if(Kr(e,n)){fr(e);Qr(e,n);var i=Tr(e);nr(e);Or(e,i);to(e,i);n.finish()}}function Jr(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(g&&v&&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-1)h=false;Un(n,d,u,t)}if(h){oe(d.lineNumber);d.lineNumber.appendChild(document.createTextNode(kt(n.options,u)))}a=d.node.nextSibling}u+=d.size}while(a)a=s(a)}function eo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px";b(e,"gutterChanged",e)}function to(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+li(e)+"px"}function no(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var i=qi(t)-t.scroller.scrollLeft+e.doc.scrollLeft;var r=t.gutters.offsetWidth,o=i+"px";for(var a=0;a=105)r.wrapper.style.clipPath="inset(0px)";r.wrapper.setAttribute("translate","no");if(S&&w<8){r.gutters.style.zIndex=-1;r.scroller.style.paddingRight=0}if(!g&&!(z&&K))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=ro(i.gutters,i.lineNumbers);oo(r);n.init(r)}qr.prototype.signal=function(e,t){if(y(e,t))this.events.push(arguments)},qr.prototype.finish=function(){for(var e=0;es.clientWidth;var u=s.scrollHeight>s.clientHeight;if(!(i&&l||r&&u))return;if(r&&v&&g)e:for(var c=t.target,d=a.view;c!=s;c=c.parentNode)for(var f=0;f=0&&D(e,i.to())<=0)return n}return-1},function(e,t){this.anchor=e;this.head=t});function po(e,t,n){var i=e&&e.options.selectionsMayTouch;var r=t[n];t.sort(function(e,t){return D(e.from(),t.from())});n=m(t,r);for(var o=1;o0:l>=0){var u=Et(s.from(),a.from()),c=Lt(s.to(),a.to());var d=s.empty()?a.from()==a.head:s.from()==s.head;if(o<=n)--n;t.splice(--o,2,new H(d?c:u,d?u:c))}}return new f(t,n)}function mo(e,t){return new f([new H(e,t||e)],0)}function go(e){if(!e.text)return e.to;return N(e.from.line+e.text.length-1,U(e.text).length+(e.text.length==1?e.from.ch:0))}function vo(e,t){if(D(e,t.from)<0)return e;if(D(e,t.to)<=0)return go(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+=go(t).ch-t.to.ch;return N(n,i)}function yo(e,t){var n=[];for(var i=0;i1)e.remove(s.line+1,p-1);e.insert(s.line+1,v)}b(e,"change",e,i)}function Lo(e,a,s){function l(e,t,n){if(e.linked)for(var i=0;i1&&!e.done[e.done.length-2].ranges){e.done.pop();return U(e.done)}}function Fo(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=No(r,r.lastOp==i))){s=U(a.changes);if(D(t.from,t.to)==0&&D(t.from,s.to)==0)s.to=go(t);else a.changes.push(Ao(e,t))}else{var l=U(r.done);if(!l||!l.ranges)Ho(e.sel,r.done);a={changes:[Ao(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)p(e,"historyAdded")}function Io(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 Po(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||Io(e,o,U(r.done),t)))r.done[r.done.length-1]=t;else Ho(t,r.done);r.lastSelTime=+new Date;r.lastSelOrigin=o;r.lastSelOp=n;if(i&&i.clearRedo!==false)Oo(r.undone)}function Ho(e,t){var n=U(t);if(!(n&&n.ranges&&n.equals(e)))t.push(e)}function $o(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 zo(e){if(!e)return null;var t;for(var n=0;n-1){U(s)[d]=u[d];delete u[d]}}}return i}function jo(e,t,n,i){if(i){var r=e.anchor;if(n){var o=D(t,r)<0;if(o!=D(n,r)<0){r=t;t=n}else if(o!=D(t,n)<0)t=n}return new H(r,t)}else return new H(n||t,t)}function _o(e,t,n,i,r){if(r==null)r=e.cm&&(e.cm.display.shift||e.extend);$(e,new f([jo(e.sel.primary(),t,n,r)],0),i)}function Yo(e,t,n){var i=[];var r=e.cm&&(e.cm.display.shift||e.extend);for(var o=0;o=t.ch:s.to>t.ch))){if(r){p(l,"beforeCursorEnter");if(l.explicitlyCleared)if(!o.markedSpans)break;else{--a;continue}}if(!l.atomic)continue;if(n){var d=l.find(i<0?1:-1),f=void 0;if(i<0?c:u)d=ta(e,d,-i,d&&d.line==t.line?o:null);if(d&&d.line==t.line&&(f=D(d,n))&&(i<0?f<0:f>0))return Jo(e,d,t,i,r)}var h=l.find(i<0?-1:1);if(i<0?u:c)h=ta(e,h,i,h.line==t.line?o:null);return h?Jo(e,h,t,i,r):null}}return t}function ea(e,t,n,i,r){var o=i||1;var a=Jo(e,t,n,o,r)||!r&&Jo(e,t,n,o,true)||Jo(e,t,n,-o,r)||!r&&Jo(e,t,n,-o,true);if(!a){e.cantEdit=true;return N(e.first,0)}return a}function ta(e,t,n,i){if(n<0&&t.ch==0)if(t.line>e.first)return A(e,N(t.line-1));else return null;else if(n>0&&t.ch==(i||O(e,t.line)).text.length)if(t.line=0;--r)oa(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else oa(e,t)}function oa(e,n){if(n.text.length==1&&n.text[0]==""&&D(n.from,n.to)==0)return;var t=yo(e,n);Fo(e,n,t,e.cm?e.cm.curOp.id:NaN);la(e,n,t,en(e,n));var i=[];Lo(e,function(e,t){if(!t&&m(i,e.history)==-1){ha(e.history,n);i.push(e.history)}la(e,n,null,en(e,n))})}function aa(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=0;--h){var p=f(h);if(p)return p.v}}function sa(e,t){if(t==0)return;e.first+=t;e.sel=new f(Se(e.sel.ranges,function(e){return new H(N(e.anchor.line+t,e.anchor.ch),N(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){F(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())return;if(t.from.lineo)t={from:t.from,to:N(o,O(e,o).text.length),text:[t.text[0]],origin:t.origin};t.removed=vt(e,t.from,t.to);if(!n)n=yo(e,t);if(e.cm)ua(e.cm,t,i);else So(e,t,i);Vo(e,n,ye);if(e.cantEdit&&ea(e,N(e.firstLine(),0)))e.cantEdit=false}function ua(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=C(pn(O(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)_e(e);So(i,t,n,Xi(e));if(!e.options.lineWrapping){i.iter(l,o.line+t.text.length,function(e){var t=kn(e);if(t>r.maxLineLength){r.maxLine=e;r.maxLineLength=t;r.maxLineChanged=true;s=false}});if(s)e.curOp.updateMaxLine=true}_t(i,o.line);Yr(e,400);var u=t.text.length-(a.line-o.line)-1;if(t.full)F(e);else if(o.line==a.line&&t.text.length==1&&!Co(e.doc,t))Qi(e,o.line,"text");else F(e,o.line,a.line+1,u);var c=y(e,"changes"),d=y(e,"change");if(d||c){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};if(d)b(e,"change",e,f);if(c)(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function ca(e,t,n,i,r){var o;if(!i)i=n;if(D(i,n)<0)o=[i,n],n=o[0],i=o[1];if(typeof t=="string")t=e.splitLines(t);ra(e,{from:n,to:i,text:t,origin:r})}function da(e,t,n,i){if(n1||!(this.children[0]instanceof ma))){var s=[];this.collapse(s);this.children=[new ma(s)];this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){var a=r.lines.length%25+25;for(var s=a;s10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i0||a==0&&o.clearWhenEmpty!==false)return o;if(o.replacedWith){o.collapsed=true;o.widgetNode=ae("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(hn(t,n.line,n,i,o)||n.line!=i.line&&hn(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Xt()}if(o.addToHistory)Fo(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&&pn(e)==l.display.maxLine)u=true;if(o.collapsed&&s!=n.line)xt(e,0);Qt(e,new Gt(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(xn(t,e))xt(e,0)});if(o.clearOnEnter)E(o,"beforeCursorEnter",function(){return o.clear()});if(o.readOnly){qt();if(t.history.done.length||t.history.undone.length)t.clearHistory()}if(o.collapsed){o.id=++ba;o.atomic=true}if(l){if(u)l.curOp.updateMaxLine=true;if(o.collapsed)F(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++)Qi(l,c,"text");if(o.atomic)Qo(l.doc);b(l,"markerAdded",l,o)}return o}wa.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t)Hr(e);if(y(this,"clear")){var n=this.find();if(n)b(this,"clear",n.from,n.to)}var i=null,r=null;for(var o=0;oe.display.maxLineLength){e.display.maxLine=u;e.display.maxLineLength=c;e.display.maxLineChanged=true}}if(i!=null&&e&&this.collapsed)F(e,i,r+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(e)Qo(e.doc)}if(e)b(e,"markerCleared",e,this,i,r);if(t)$r(e);if(this.parent)this.parent.clear()},wa.prototype.find=function(e,t){if(e==null&&this.type=="bookmark")e=1;var n,i;for(var r=0;r=0;l--)ra(this,i[l]);if(s)Go(this,s);else if(this.cm)br(this.cm)}),undo:n(function(){aa(this,"undo")}),redo:n(function(){aa(this,"redo")}),undoSelection:n(function(){aa(this,"undo",true)}),redoSelection:n(function(){aa(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.ch))t.push(r.marker.parent||r.marker)}return t},findMarks:function(r,o,a){r=A(this,r);o=A(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=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;nn){i=n;return true}n-=t;++r});return A(this,N(r,i))},indexFromPos:function(e){e=A(this,e);var t=e.ch;if(e.linet)t=e.from;if(e.to!=null&&e.to-1){i.state.draggingText(e);setTimeout(function(){return i.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var d;if(i.state.draggingText&&!i.state.draggingText.copy)d=i.listSelections();Vo(i.doc,mo(t,t));if(d)for(var f=0;f=0;e--)ca(t.doc,"",i[e].from,i[e].to,"+delete");br(t)})}function Za(e,t,n){var i=Ie(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ja(e,t,n){var i=Za(e,t.ch,n);return i==null?null:new N(t.line,i,n<0?"after":"before")}function es(e,t,n,i,r){if(e){if(t.doc.direction=="rtl")r=-r;var o=We(n,t.doc.direction);if(o){var a=r<0?U(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=gi(t,n);u=r<0?n.text.length-1:0;var d=vi(t,c,u).top;u=Pe(function(e){return vi(t,c,e).top==d},r<0==(a.level==1)?a.from:a.to-1,u);if(l=="before")u=Za(n,u,1)}else u=r<0?a.to:a.from;return new N(i,u,l)}}return new N(i,r<0?n.text.length:0,r<0?"before":"after")}function ts(t,n,s,e){var l=We(n,t.doc.direction);if(!l)return Ja(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=ze(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=r.from&&f>=c.begin:f<=r.to&&f<=c.end)){var h=d?"before":"after";return new N(s.line,f,h)}}var p=function(e,t,n){var i=function(e,t){return t?new N(s.line,u(e,1),"before"):new N(s.line,e,"after")};for(;e>=0&&e0==(r.level!=1);var a=o?n.begin:u(n.end,-1);if(r.from<=a&&a0?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"]=v?_a.macDefault:_a.pcDefault;var ns={selectAll:na,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(n){return Qa(n,function(e){if(e.empty()){var t=O(n.doc,e.head.line).text.length;if(e.head.ch==t&&e.head.line0){i=new N(i.line,i.ch+1);a.replaceRange(r.charAt(i.ch-1)+r.charAt(i.ch-2),N(i.line,i.ch-2),i,"+transpose")}else if(i.line>a.doc.first){var o=O(a.doc,i.line-1).text;if(o){i=new N(i.line,1);a.replaceRange(r.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),N(i.line-1,o.length-1),i,"+transpose")}}}t.push(new H(i,i))}a.setSelections(t)})},newlineAndIndent:function(i){return I(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-1&&(D((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(D(a.to(),t)>0||t.xRel<0))Ms(e,i,t,r);else Ds(e,i,t,r)}function Ms(t,n,i,r){var o=t.display,a=false;var s=P(t,function(e){if(g)o.scroller.draggable=false;t.state.draggingText=false;if(t.state.delayingBlurEvent)if(t.hasFocus())t.state.delayingBlurEvent=false;else ur(t);M(o.wrapper.ownerDocument,"mouseup",s);M(o.wrapper.ownerDocument,"mousemove",l);M(o.scroller,"dragstart",u);M(o.scroller,"drop",s);if(!a){T(e);if(!r.addNew)_o(t.doc,i,null,null,r.extend);if(g&&!Y||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(g)o.scroller.draggable=true;t.state.draggingText=s;s.copy=!r.moveOnDrag;E(o.wrapper.ownerDocument,"mouseup",s);E(o.wrapper.ownerDocument,"mousemove",l);E(o.scroller,"dragstart",u);E(o.scroller,"drop",s);t.state.delayingBlurEvent=true;setTimeout(function(){return o.input.focus()},20);if(o.scroller.dragDrop)o.scroller.dragDrop()}function Ts(e,t,n){if(n=="char")return new H(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new H(N(t.line,0),A(e.doc,N(t.line+1,0)));var i=n(e,t);return new H(i.from,i.to)}function Ds(g,e,v,y){if(S)ur(g);var o=g.display,x=g.doc;T(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 H(v,v)}else{b=x.sel.primary();w=x.sel.primIndex}if(y.unit=="rectangle"){if(!y.addNew)b=new H(v,v);v=Vi(g,e,true,true);w=-1}else{var n=Ts(g,v,y.unit);if(y.extend)b=jo(b,n.anchor,n.head,y.extend);else b=n}if(!y.addNew){w=0;$(x,new f([b],0),xe);k=x.sel}else if(w==-1){w=t.length;$(x,po(g,t.concat([b]),w),{scroll:false,origin:"*mouse"})}else if(t.length>1&&t[w].empty()&&y.unit=="char"&&!y.extend){$(x,po(g,t.slice(0,w).concat(t.slice(w+1)),0),{scroll:false,origin:"*mouse"});k=x.sel}else Uo(x,w,b,xe);var C=v;function a(e){if(D(C,e)==0)return;C=e;if(y.unit=="rectangle"){var t=[],n=g.options.tabSize;var i=L(O(x,v.line).text,v.ch,n);var r=L(O(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=O(x,s).text,c=we(u,o,n);if(o==a)t.push(new H(N(s,c),N(s,c)));else if(u.length>c)t.push(new H(N(s,c),N(s,we(u,a,n))))}if(!t.length)t.push(new H(v,v));$(x,po(g,k.ranges.slice(0,w).concat(t),w),{origin:"*mouse",scroll:false});g.scrollIntoView(e)}else{var d=b;var f=Ts(g,e,y.unit);var h=d.anchor,p;if(D(f.anchor,h)>0){p=f.head;h=Et(d.from(),f.anchor)}else{p=f.anchor;h=Lt(d.to(),f.head)}var m=k.ranges.slice(0);m[w]=As(g,new H(A(x,h),p));$(x,po(g,m,w),xe)}}var s=o.wrapper.getBoundingClientRect();var l=0;function u(e){var t=++l;var n=Vi(g,e,true,y.unit=="rectangle");if(!n)return;if(D(n,C)!=0){g.curOp.focus=d(de(g));a(n);var i=pr(o,x);if(n.line>=i.to||n.lines.bottom?20:0;if(r)setTimeout(P(g,function(){if(l!=t)return;o.scroller.scrollTop+=r;u(e)}),50)}}function i(e){g.state.selectingText=false;l=Infinity;if(e){T(e);o.input.focus()}M(o.wrapper.ownerDocument,"mousemove",r);M(o.wrapper.ownerDocument,"mouseup",c);x.history.lastSelOrigin=null}var r=P(g,function(e){if(e.buttons===0||!Ve(e))i(e);else u(e)});var c=P(g,i);g.state.selectingText=c;E(o.wrapper.ownerDocument,"mousemove",r);E(o.wrapper.ownerDocument,"mouseup",c)}function As(e,t){var n=t.anchor;var i=t.head;var r=O(e.doc,n.line);if(D(n,i)==0&&n.sticky==i.sticky)return t;var o=We(r);if(!o)return t;var a=ze(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=ze(o,i.ch,i.sticky);var d=c-a||(i.ch-n.ch)*(s.level==1?-1:1);if(c==l-1||c==l)u=d<0;else u=d>0}var f=o[l+(u?-1:0)];var h=u==(f.level==1);var p=h?f.from:f.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new H(new N(n.line,p,m),i)}function Os(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)T(t);var a=e.display;var s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!y(e,n))return qe(t);o-=s.top-a.viewOffset;for(var l=0;l=r){var c=bt(e.doc,o);var d=e.display.gutterSpecs[l];p(e,n,e,c,d.className,t);return qe(t)}}}function Ns(e,t){return Os(e,t,"gutterClick",true)}function Fs(e,t){if(ri(e.display,t)||Is(e,t))return;if(h(e,t,"contextmenu"))return;if(!te)e.display.input.onContextMenu(t)}function Is(e,t){if(!y(e,"gutterContextMenu"))return false;return Os(e,t,"gutterContextMenu",false)}function Ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");Ei(e)}xs.prototype.compare=function(e,t,n){return this.time+ys>e&&D(t,this.pos)==0&&n==this.button};var Hs={toString:function(){return"CodeMirror.Init"}},$s={},zs={};function Bs(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!=Hs)i(e,t,n)}:i}r.defineOption=e;r.Init=Hs;e("value","",function(e,t){return e.setValue(t)},true);e("mode",null,function(e,t){e.doc.modeOption=t;wo(e)},true);e("indentUnit",2,wo,true);e("indentWithTabs",false);e("smartIndent",true);e("tabSize",4,function(e){ko(e);Ei(e);F(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(N(o,n))}o++});for(var t=r.length-1;t>=0;t--)ca(e.doc,i,r[t],N(r[t].line,r[t].ch+i.length))});e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");if(n!=Hs)e.refresh()});e("specialCharPlaceholder",On,function(e){return e.refresh()},true);e("electricChars",true);e("inputStyle",K?"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",!Z);e("wholeLineUpdateBefore",true);e("theme","default",function(e){Ps(e);ao(e)},true);e("keyMap","default",function(e,t,n){var i=Ka(t);var r=n!=Hs&&Ka(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,Rs,true);e("gutters",[],function(e,t){e.display.gutterSpecs=ro(t,e.options.lineNumbers);ao(e)},true);e("fixedGutter",true,function(e,t){e.display.gutters.style.left=t?qi(e.display)+"px":"0";e.refresh()},true);e("coverGutterNextToScrollbar",false,function(e){return Or(e)},true);e("scrollbarStyle","native",function(e){Ir(e);Or(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=ro(e.options.gutters,t);ao(e)},true);e("firstLineNumber",1,ao,true);e("lineNumberFormatter",function(e){return e},ao,true);e("showCursorWhenSelecting",false,nr,true);e("resetSelectionOnContextMenu",true);e("lineWiseCopyCut",true);e("pasteLinesPerSelection",true);e("selectionsMayTouch",false);e("readOnly",false,function(e,t){if(t=="nocursor"){dr(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,Ws);e("allowDropFileTypes",null);e("cursorBlinkRate",530);e("cursorScrollMargin",0);e("cursorHeight",1,nr,true);e("singleCursorHeightPerLine",true,nr,true);e("workTime",100);e("workDelay",100);e("flattenSpans",true,ko,true);e("addModeClass",false,ko,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,ko,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 Ws(e,t,n){var i=n&&n!=Hs;if(!t!=!i){var r=e.display.dragFunctions;var o=t?E:M;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 Rs(e){if(e.options.lineWrapping){le(e.display.wrapper,"CodeMirror-wrap");e.display.sizer.style.minWidth="";e.display.sizerWidth=null}else{ie(e.display.wrapper,"CodeMirror-wrap");Cn(e)}Gi(e);F(e);Ei(e);setTimeout(function(){return Or(e)},100)}function u(e,t){var n=this;if(!(this instanceof u))return new u(e,t);this.options=t=t?pe(t):{};pe($s,t,false);var i=t.value;if(typeof i=="string")i=new l(i,t.mode,null,t.lineSeparator,t.direction);else if(t.mode)i.modeOption=t.mode;this.doc=i;var r=new u.inputStyles[t.inputStyle](this);var o=this.display=new so(e,i,r,t);o.wrapper.CodeMirror=this;Ps(this);if(t.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";Ir(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 me,keySeq:null,specialChars:null};if(t.autofocus&&!K)o.input.focus();if(S&&w<11)setTimeout(function(){return n.display.input.reset(true)},20);js(this);Ha();Hr(this);this.curOp.forceUpdate=true;Eo(this,i);if(t.autofocus&&!K||this.hasFocus())setTimeout(function(){if(n.hasFocus()&&!n.state.focused)cr(n)},20);else dr(this);for(var a in zs)if(zs.hasOwnProperty(a))zs[a](this,t[a],Hs);io(this);if(t.finishInit)t.finishInit(this);for(var s=0;s<_s.length;++s)_s[s](this);$r(this);if(g&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility")o.lineDiv.style.textRendering="auto"}function js(r){var o=r.display;E(o.scroller,"mousedown",P(r,Cs));if(S&&w<11)E(o.scroller,"dblclick",P(r,function(e){if(h(r,e))return;var t=Vi(r,e);if(!t||Ns(r,e)||ri(r.display,e))return;T(e);var n=r.findWordAt(t);_o(r.doc,n.anchor,n.head)}));else E(o.scroller,"dblclick",function(e){return h(r,e)||T(e)});E(o.scroller,"contextmenu",function(e){return Fs(r,e)});E(o.input.getField(),"contextmenu",function(e){if(!o.scroller.contains(e.target))Fs(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}E(o.scroller,"touchstart",function(e){if(!h(r,e)&&!s(e)&&!Ns(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}}});E(o.scroller,"touchmove",function(){if(o.activeTouch)o.activeTouch.moved=true});E(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!ri(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 H(n,n);else if(!t.prev.prev||l(t,t.prev.prev))i=r.findWordAt(n);else i=new H(N(n.line,0),A(r.doc,N(n.line+1,0)));r.setSelection(i.anchor,i.head);r.focus();T(e)}a()});E(o.scroller,"touchcancel",a);E(o.scroller,"scroll",function(){if(o.scroller.clientHeight){Lr(r,o.scroller.scrollTop);Mr(r,o.scroller.scrollLeft,true);p(r,"scroll",r)}});E(o.scroller,"mousewheel",function(e){return ho(r,e)});E(o.scroller,"DOMMouseScroll",function(e){return ho(r,e)});E(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0});o.dragFunctions={enter:function(e){if(!h(r,e))Xe(e)},over:function(e){if(!h(r,e)){Na(r,e);Xe(e)}},start:function(e){return Oa(r,e)},drop:P(r,Aa),leave:function(e){if(!h(r,e))Fa(r)}};var e=o.input.getField();E(e,"keyup",function(e){return gs.call(r,e)});E(e,"keydown",P(r,ps));E(e,"keypress",P(r,vs));E(e,"focus",function(e){return cr(r,e)});E(e,"blur",function(e){return dr(r,e)})}u.defaults=$s,u.optionHandlers=zs;var _s=[];function Ys(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=It(e,t).state;var a=e.options.tabSize;var s=O(r,t),l=L(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==ve||c>150){if(!i)return;n="prev"}}if(n=="prev")if(t>r.first)c=L(O(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 d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h){f+=a;d+="\t"}if(fa;var l=tt(t),u=null;if(s&&i.ranges.length>1)if(Us&&Us.text.join("\n")==t){if(i.ranges.length%Us.text.length==0){u=[];for(var c=0;c=0;f--){var h=i.ranges[f];var p=h.from(),m=h.to();if(h.empty())if(n&&n>0)p=N(p.line,p.ch-n);else if(e.state.overwrite&&!s)m=N(m.line,Math.min(O(o,m.line).text.length,m.ch+U(l).length));else if(s&&Us&&Us.lineWise&&Us.text.join("\n")==l.join("\n"))p=m=N(p.line,0);var g={from:p,to:m,text:u?u[f%u.length]:l,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};ra(e.doc,g);b(e,"inputRead",e,g)}if(t&&!s)Vs(e,t);br(e);if(e.curOp.updateInput<2)e.curOp.updateInput=d;e.curOp.typing=true;e.state.pasteIncoming=e.state.cutIncoming=-1}function Gs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n){e.preventDefault();if(!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus())I(t,function(){return Xs(t,n,0,null,"paste")});return true}}function Vs(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-1){a=Ys(e,r.head.line,"smart");break}}else if(o.electricInput)if(o.electricInput.test(O(e.doc,r.head.line).text.slice(0,r.head.ch)))a=Ys(e,r.head.line,"smart");if(a)b(e,"electricInput",e,r.head.line)}}function Ks(e){var t=[],n=[];for(var i=0;i0)Uo(this.doc,i,new H(o,u[i].to()),ye)}else if(r.head.line>n){Ys(this,r.head.line,e,true);n=r.head.line;if(i==this.doc.sel.primIndex)br(this)}}}),getTokenAt:function(e,t){return Bt(this,e,t)},getLineTokens:function(e,t){return Bt(this,N(e),t,true)},getTokenTypeAt:function(e){e=A(this.doc,e);var t=Ft(this,O(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]o){e=o;i=true}r=O(this.doc,e)}else r=e;return Ai(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-wn(r):0)},defaultTextHeight:function(){return _i(this.display)},defaultCharWidth:function(){return Yi(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=Fi(this,A(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)vr(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:t(ps),triggerOnKeyPress:t(vs),triggerOnKeyUp:gs,triggerOnMouseDown:t(Cs),execCommand:function(e){if(ns.hasOwnProperty(e))return ns[e].call(null,this)},triggerElectric:t(function(e){Vs(this,e)}),findPosH:function(e,t,n,i){var r=1;if(t<0){r=-1;t=-t}var o=A(this.doc,e);for(var a=0;a0&&s(n.charAt(i-1)))--i;while(r.5||this.options.lineWrapping)Gi(this);p(this,"refresh",this)}),swapDoc:t(function(e){var t=this.doc;t.cm=null;if(this.state.selectingText)this.state.selectingText();Eo(this,e);Ei(this);this.display.input.reset();wr(this,e.scrollLeft,e.scrollTop);this.curOp.forceScroll=true;b(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}};Ye(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 el(r,o,a,s,l){var e=o;var t=a;var u=O(r,o.line);var c=l&&r.direction=="rtl"?-a:a;function d(){var e=o.line+c;if(e=r.first+r.size)return false;o=new N(e,o.ch,o.sticky);return u=O(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 N(o.line,Math.max(0,Math.min(u.text.length,o.ch+a*(i?2:1))),-a)}}else if(l)t=ts(r.cm,u,o,a);else t=Ja(u,o,a);if(t==null)if(!e&&d())o=es(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,f=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=Ae(m,h)?"w":f&&m=="\n"?"n":!f||/\s/.test(m)?null:"p";if(f&&!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=ea(r,o,e,t,true);if(Ct(e,v))v.hitSide=true;return v}function tl(e,t,n,i){var r=e.doc,o=t.left,a;if(i=="page"){var s=Math.min(e.display.wrapper.clientHeight,fe(e).innerHeight||r(e).documentElement.clientHeight);var l=Math.max(s-.5*_i(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=Hi(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 i=function(e){this.cm=e;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new me;this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};function nl(e,t){var n=mi(e,t.line);if(!n||n.hidden)return null;var i=O(e.doc,t.line);var r=fi(n,i,t.line);var o=We(i,e.doc.direction),a="left";if(o){var s=ze(o,t.ch);a=s%2?"right":"left"}var l=bi(r.map,t.ch,a);l.offset=l.collapse=="right"?l.end:l.start;return l}function il(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return true;return false}function rl(e,t){if(t)e.bad=true;return e}function ol(s,e,t,l,u){var n="",c=false,d=s.doc.lineSeparator(),f=false;function h(t){return function(e){return e.id==t}}function p(){if(c){n+=d;if(f)n+=d;c=f=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(N(l,0),N(u+1,0),h(+n));if(r.length&&(i=r[0].find(0)))m(vt(s.doc,i.from,i.to).join(d));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=t.display.viewTo||r.line=t.display.viewFrom&&nl(t,i)||{node:s[0].measure.map[2],offset:0};var u=r.linee.firstLine())i=N(i.line-1,O(e.doc,i.line-1).length);if(r.ch==O(e.doc,r.line).text.length&&r.linet.viewTo-1)return false;var o,a,s;if(i.line==t.viewFrom||(o=Ki(e,i.line))==0){a=C(t.view[0].line);s=t.view[0].node}else{a=C(t.view[o].line);s=t.view[o-1].node.nextSibling}var l=Ki(e,r.line);var u,c;if(l==t.view.length-1){u=t.viewTo-1;c=t.lineDiv.lastChild}else{u=C(t.view[l+1].line)-1;c=t.view[l+1].node.previousSibling}if(!s)return false;var d=e.doc.splitLines(ol(e,s,c,a,u));var f=vt(e.doc,N(a,0),N(u,O(e.doc,u).text.length));while(d.length>1&&f.length>1)if(U(d)==U(f)){d.pop();f.pop();u--}else if(d[0]==f[0]){d.shift();f.shift();a++}else break;var h=0,p=0;var m=d[0],g=f[0],v=Math.min(m.length,g.length);while(hi.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1)){h--;p++}d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,"");d[0]=d[0].slice(h).replace(/\u200b+$/,"");var w=N(a,h);var k=N(u,f.length?U(f).length-p:0);if(d.length>1||d[0]||D(w,k)){ca(e.doc,d,w,k,"+input");return true}},i.prototype.ensurePolled=function(){this.forceCompositionEnd()},i.prototype.reset=function(){this.forceCompositionEnd()},i.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()},i.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)},i.prototype.updateFromDOM=function(){var e=this;if(this.cm.isReadOnly()||!this.pollContent())I(this.cm,function(){return F(e.cm)})},i.prototype.setUneditable=function(e){e.contentEditable="false"},i.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault();if(!this.cm.isReadOnly())P(this.cm,Xs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},i.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},i.prototype.onContextMenu=function(){},i.prototype.resetPosition=function(){},i.prototype.needsContentAttribute=true;var r=function(e){this.cm=e;this.prevInput="";this.pollingFast=false;this.polling=new me;this.hasSelection=false;this.composing=null;this.resetting=false};function ll(t,n){n=n?pe(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=d(t.ownerDocument);n.autofocus=e==t||t.getAttribute("autofocus")!=null&&e==document.body}function i(){t.value=s.getValue()}var r;if(t.form){E(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){M(t.form,"submit",i);if(!n.leaveSubmitMethodAlone&&typeof t.form.submit=="function")t.form.submit=r}}};t.style.display="none";var s=u(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s}function ul(e){e.off=M;e.on=E;e.wheelEventPixels=fo;e.Doc=l;e.splitLines=tt;e.countColumn=L;e.findColumn=we;e.isWordChar=De;e.Pass=ve;e.signal=p;e.Line=Sn;e.changeEnd=go;e.scrollbarModel=Fr;e.Pos=N;e.cmpPos=D;e.modes=at;e.mimeModes=st;e.resolveMode=ct;e.getMode=dt;e.modeExtensions=ft;e.extendMode=ht;e.copyState=pt;e.startState=gt;e.innerMode=mt;e.commands=ns;e.keyMap=_a;e.keyName=Va;e.isModifierKey=Xa;e.lookupKey=qa;e.normalizeKeyMap=Ua;e.StringStream=x;e.SharedTextMarker=Ca;e.TextMarker=wa;e.LineWidget=va;e.e_preventDefault=T;e.e_stopPropagation=Ue;e.e_stop=Xe;e.addClass=le;e.contains=se;e.rmClass=ie;e.keyNames=Ba}r.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(G)o.style.width="0px";E(o,"input",function(){if(S&&w>=9&&e.hasSelection)e.hasSelection=null;i.poll()});E(o,"paste",function(e){if(h(r,e)||Gs(e,r))return;r.state.pasteIncoming=+new Date;i.fastPoll()});function t(e){if(h(r,e))return;if(r.somethingSelected())qs({lineWise:false,text:r.getSelections()});else if(!r.options.lineWiseCopyCut)return;else{var t=Ks(r);qs({lineWise:true,text:t.text});if(e.type=="cut")r.setSelections(t.ranges,null,ye);else{i.prevInput="";o.value=t.text.join("\n");ce(o)}}if(e.type=="cut")r.state.cutIncoming=+new Date}E(o,"cut",t);E(o,"copy",t);E(n.scroller,"paste",function(e){if(ri(n,e)||h(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)});E(n.lineSpace,"selectstart",function(e){if(!ri(n,e))T(e)});E(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"})}});E(o,"compositionend",function(){if(i.composing){i.poll();i.composing.range.clear();i.composing=null}})},r.prototype.createField=function(e){this.wrapper=Zs();this.textarea=this.wrapper.firstChild},r.prototype.screenReaderLabelChanged=function(e){if(e)this.textarea.setAttribute("aria-label",e);else this.textarea.removeAttribute("aria-label")},r.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc;var i=ir(e);if(e.options.moveInputWithCursor){var r=Fi(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},r.prototype.showSelection=function(e){var t=this.cm,n=t.display;o(n.cursorDiv,e.cursors);o(n.selectionDiv,e.selection);if(e.teTop!=null){this.wrapper.style.top=e.teTop+"px";this.wrapper.style.left=e.teLeft+"px"}},r.prototype.reset=function(e){if(this.contextMenuPending||this.composing&&e)return;var t=this.cm;this.resetting=true;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n;if(t.state.focused)ce(this.textarea);if(S&&w>=9)this.hasSelection=n}else if(!e){this.prevInput=this.textarea.value="";if(S&&w>=9)this.hasSelection=null}this.resetting=false},r.prototype.getField=function(){return this.textarea},r.prototype.supportsTouch=function(){return false},r.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!K||d(this.textarea.ownerDocument)!=this.textarea))try{this.textarea.focus()}catch(e){}},r.prototype.blur=function(){this.textarea.blur()},r.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},r.prototype.receivedFocus=function(){this.slowPoll()},r.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()})},r.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)},r.prototype.poll=function(){var e=this;var t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||nt(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||v&&/[\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(a1e3||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},r.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll())this.pollingFast=false},r.prototype.onKeyPress=function(){if(S&&w>=9)this.hasSelection=null;this.fastPoll()},r.prototype.onContextMenu=function(e){var n=this,i=n.cm,r=i.display,o=n.textarea;if(n.contextMenuPending)n.contextMenuPending();var t=Vi(i,e),a=r.scroller.scrollTop;if(!t||_)return;var s=i.options.resetSelectionOnContextMenu;if(s&&i.doc.sel.contains(t)==-1)P(i,$)(i.doc,mo(t),ye);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 d;if(g)d=o.ownerDocument.defaultView.scrollY;r.input.focus();if(g)o.ownerDocument.defaultView.scrollTo(null,d);r.input.reset();if(!i.somethingSelected())o.value=n.prevInput=" ";n.contextMenuPending=h;r.selForContextMenu=i.doc.sel;clearTimeout(r.detectingSelectAll);function f(){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)f();var e=0,t=function(){if(r.selForContextMenu==i.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&n.prevInput=="​")P(i,na)(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)f();if(te){Xe(e);var p=function(){M(window,"mouseup",p);setTimeout(h,20)};E(window,"mouseup",p)}else setTimeout(h,50)},r.prototype.readOnlyChanged=function(e){if(!e)this.reset();this.textarea.disabled=e=="nocursor";this.textarea.readOnly=!!e},r.prototype.setUneditable=function(){},r.prototype.needsContentAttribute=false,Bs(u),Js(u);var cl="iter insert remove copy getEditor constructor".split(" "),dl;for(dl in l.prototype)if(l.prototype.hasOwnProperty(dl)&&m(cl,dl)<0)u.prototype[dl]=function(e){return function(){return e.apply(this.doc,arguments)}}(l.prototype[dl]);return Ye(l),u.inputStyles={textarea:r,contenteditable:i},u.defineMode=function(e){if(!u.defaults.mode&&e!="null")u.defaults.mode=e;lt.apply(this,arguments)},u.defineMIME=ut,u.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),u.defineMIME("text/plain","null"),u.defineExtension=function(e,t){u.prototype[e]=t},u.defineDocExtension=function(e,t){l.prototype[e]=t},u.fromTextArea=ll,ul(u),u.version="5.65.9",u}(),xt=mt={init:function(){$$("[data-modal]").forEach(function(e){e.addEventListener("click",function(){var e=this.getAttribute("data-modal"),t=this.getAttribute("data-modal-action");t?mt.show(e,t):mt.show(e)})}),$$(".modal [data-dismiss]").forEach(function(e){e.addEventListener("click",function(){this.hasAttribute("data-validate")&&!mt.validate(this.getAttribute("data-dismiss"))||mt.hide(this.getAttribute("data-dismiss"))})}),$$(".modal").forEach(function(e){e.addEventListener("click",function(e){e.target===this&&mt.hide()})}),document.addEventListener("keyup",function(e){27===e.which&&mt.hide()}),window.addEventListener("focus",function(){var e=$(".modal.show");e&&k.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):k.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){if(""===e.value)return e.classList("input-invalid"),e.focus(),$(".modal-error",n).style.display="block",t=!1;t=!0}),t}},bt={};function wt(){var S,L,E;return gt||(E={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!(L={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}),allowMissing:!(gt=1),allowMissingTagName:!1,caseFold:!1},(S=vt.exports).defineMode("xml",function(e,t){var n,a,o,s=e.indentUnit,l={},i=t.htmlMode?L:E;for(n in i)l[n]=i[n];for(n in t)l[n]=t[n];function u(t,n){function e(e){return(n.tokenize=e)(t,n)}var i=t.next();return"<"==i?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(r("atom","]]>")):null:t.match("--")?e(r("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function i(r){return function(e,t){for(var n;null!=(n=e.next());){if("<"==n)return t.tokenize=i(r+1),t.tokenize(e,t);if(">"==n){if(1!=r)return t.tokenize=i(r-1),t.tokenize(e,t);t.tokenize=u;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=r("meta","?>"),"meta"):(a=t.eat("/")?"closeTag":"openTag",n.tokenize=c,"tag bracket"):"&"==i?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function c(e,t){var n,i,r=e.next();return">"==r||"/"==r&&e.eat(">")?(t.tokenize=u,a=">"==r?"endTag":"selfcloseTag","tag bracket"):"="==r?(a="equals",null):"<"==r?(t.tokenize=u,t.state=m,t.tagName=t.tagStart=null,(n=t.tokenize(e,t))?n+" tag error":"tag error"):/[\'\"]/.test(r)?(t.tokenize=(i=r,o.isInAttribute=!0,o),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");function o(e,t){for(;!e.eol();)if(e.next()==i){t.tokenize=c;break}return"string"}}function r(n,i){return function(e,t){for(;!e.eol();){if(e.match(i)){t.tokenize=u;break}e.next()}return n}}function d(e){return e&&e.toLowerCase()}function f(e,t,n){this.prev=e.context,this.tagName=t||"",this.indent=e.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function h(e){e.context&&(e.context=e.context.prev)}function p(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!l.contextGrabbers.hasOwnProperty(d(n))||!l.contextGrabbers[d(n)].hasOwnProperty(d(t)))return;h(e)}}function m(e,t,n){return"openTag"==e?(n.tagStart=t.column(),g):"closeTag"==e?v:m}function g(e,t,n){return"word"==e?(n.tagName=t.current(),o="tag",b):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,0,n)):(o="error",g)}function v(e,t,n){var i;return"word"==e?(i=t.current(),n.context&&n.context.tagName!=i&&l.implicitlyClosed.hasOwnProperty(d(n.context.tagName))&&h(n),n.context&&n.context.tagName==i||!1===l.matchClosing?(o="tag",y):(o="tag error",x)):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",y(e,0,n)):(o="error",x)}function y(e,t,n){return"endTag"!=e?(o="error",y):(h(n),m)}function x(e,t,n){return o="error",y(e,0,n)}function b(e,t,n){var i,r;return"word"==e?(o="attribute",w):"endTag"==e||"selfcloseTag"==e?(i=n.tagName,r=n.tagStart,n.tagName=n.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(d(i))?p(n,i):(p(n,i),n.context=new f(n,i,r==n.indented)),m):(o="error",b)}function w(e,t,n){return"equals"==e?k:(l.allowMissing||(o="error"),b(e,0,n))}function k(e,t,n){return"string"==e?C:"word"==e&&l.allowUnquoted?(o="string",b):(o="error",b(e,0,n))}function C(e,t,n){return"string"==e?C:b(e,0,n)}return u.isInText=!0,{startState:function(e){var t={tokenize:u,state:m,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;a=null;var n=t.tokenize(e,t);return n=(n||a)&&"comment"!=n&&(o=null,t.state=t.state(a||n,e,t),o)?"error"==o?n+" error":o:n},indent:function(e,t,n){var i=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+s;if(i&&i.noIndent)return S.Pass;if(e.tokenize!=c&&e.tokenize!=u)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=b)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],n=e.context;n;n=n.prev)t.push(n.tagName);return t.reverse()}}}),S.defineMIME("text/xml","xml"),S.defineMIME("application/xml","xml"),S.mimeModes.hasOwnProperty("text/html"))||S.defineMIME("text/html",{name:"xml",htmlMode:!0}),bt}var kt,Q,Ct,St,Lt,Et;if(Q=vt.exports,wt(),!kt){kt=1;var s=vt.exports;s.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 Mt=0;Mt ","")}),$("[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(){xt.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;i()||(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()}),r(),o.on("changes",k.debounce(function(){e.value=o.getValue(),r(),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(i,e){var r=function(e){var t,n=[];for(t=0;t` "'(~:]+/,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;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&&(r||"xml"==(t=Q.innerMode(d,e.htmlState)).mode.name&&null===t.state.tagStart&&!t.state.context&&t.state.tokenize.isInText)&&(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=!(i=t.prevLine.stream)||!/\S/.test(i.string),r=t.indentedCode,o=t.prevLine.hr,a=!1!==t.list,s=(t.listStack[t.listStack.length-1]||0)+3,l=(t.indentedCode=!1,t.indentation);if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,a)){for(t.list=null;l")?(t.quote=n?1:t.quote+1,h.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),M(t)):!o&&!t.setext&&n&&t.indentation<=s&&(d=e.match(g))?(r=d[1]?"ol":"ul",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,h.taskLists&&e.match(v,!1)&&(t.taskList=!0),t.f=t.inline,h.highlightFormatting&&(t.formatting=["list","list-"+r]),M(t)):n&&t.indentation<=s&&(d=e.match(b,!0))?(t.quote=0,t.fencedEndRE=new RegExp(d[1]+"+ *$"),t.localMode=h.fencedCodeBlockHighlighting&&(i=d[2]||h.fencedCodeBlockDefaultMode,Q.findModeByName&&(u=Q.findModeByName(i))&&(i=u.mime||u.mimes[0]),"null"==(u=Q.getMode(f,i)).name?null:u),t.localMode&&(t.localState=Q.startState(t.localMode)),t.f=t.block=E,h.highlightFormatting&&(t.formatting="code-block"),t.code=-1,M(t)):t.setext||!(c&&a||t.quote||!1!==t.list||t.code||o||w.test(e.string))&&(d=(d=e.lookAhead(1))&&d.match(x))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),h.highlightFormatting&&(t.formatting="header")):(t.header="="==d[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,M(t)):o?(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=d.token(e,t.htmlState);return!r&&("xml"==(n=Q.innerMode(d,t.htmlState)).mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText||t.md_inside&&-1"))&&(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=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),!h.maxBlockquoteDepth||h.maxBlockquoteDepth>=e.quote?n.push(p.quote+"-"+e.quote):n.push(p.quote+"-"+h.maxBlockquoteDepth)),!1!==e.list&&(t=(e.listStack.length-1)%3,n.push(t?1==t?p.list2:p.list3: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)t.list=null;else if(t.taskList)" "===e.match(v,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,h.highlightFormatting&&(t.formatting="task"),t.taskList=!1;else if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))h.highlightFormatting&&(t.formatting="header");else{var i=e.next();if(t.linkTitle){t.linkTitle=!1;var n=((n="("===i?")":i)+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");if(e.match(new RegExp("^\\s*(?:[^"+n+"\\\\]+|\\\\\\\\|\\\\.)"+n),!0))return p.linkHref}if("`"===i)return n=t.formatting,h.highlightFormatting&&(t.formatting="code"),e.eatWhile("`"),s=e.current().length,0!=t.code||t.quote&&1!=s?s==t.code?(a=M(t),t.code=0,a):(t.formatting=n,M(t)):(t.code=s,M(t));if(!t.code){if("\\"===i)if(e.next(),h.highlightFormatting)return o=M(t),n=p.formatting+"-escape",o?o+" "+n:n;if("!"===i&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))t.imageMarker=!0,t.image=!0,h.highlightFormatting&&(t.formatting="image");else if("["===i&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))t.imageMarker=!1,t.imageAltText=!0,h.highlightFormatting&&(t.formatting="image");else{if("]"===i&&t.imageAltText)return h.highlightFormatting&&(t.formatting="image"),o=M(t),t.imageAltText=!1,t.image=!1,t.inline=t.f=A,o;if("["!==i||t.image){if("]"===i&&t.linkText)return h.highlightFormatting&&(t.formatting="link"),o=M(t),t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?A:T,o;if("<"===i&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,h.highlightFormatting&&(t.formatting="link"),(o=M(t))?o+=" ":o="",o+p.linkInline;if("<"===i&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,h.highlightFormatting&&(t.formatting="link"),(o=M(t))?o+=" ":o="",o+p.linkEmail;if(h.xml&&"<"===i&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1))return-1!=(s=e.string.indexOf(">",e.pos))&&(n=e.string.substring(e.start,s),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(n))&&(t.md_inside=!0),e.backUp(1),t.htmlState=Q.startState(d),S(e,t,L);if(h.xml&&"<"===i&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===i||"_"===i){for(var r=1,o=1==e.pos?" ":e.string.charAt(e.pos-2);r<3&&e.eat(i);)r++;var a,s=e.peek()||" ",n=!/\s/.test(s)&&(!k.test(s)||/\s/.test(o)||k.test(o)),l=!/\s/.test(o)&&(!k.test(o)||/\s/.test(s)||k.test(s)),u=null,c=null;if(r%2&&(t.em||!n||"*"!==i&&l&&!k.test(o)?t.em!=i||!l||"*"!==i&&n&&!k.test(s)||(u=!1):u=!0),1"===e.next()?(t.f=t.inline=T,h.highlightFormatting&&(t.formatting="link"),(t=M(t))?t+=" ":t="",t+p.linkInline):(e.match(/^[^>]+/,!0),p.linkInline)}function A(e,t){var i;return e.eatSpace()?null:"("===(e=e.next())||"["===e?(t.f=t.inline=(i="("===e?")":"]",function(e,t){var n;return e.next()===i?(t.f=t.inline=T,h.highlightFormatting&&(t.formatting="link-string"),n=M(t),t.linkHref=!1,n):(e.match(a[i]),t.linkHref=!0,M(t))}),h.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(),h.highlightFormatting&&(t.formatting="link"),t.linkText=!0,M(t)):C(e,t,T)}function s(e,t){var n;return e.match("]:",!0)?(t.f=t.inline=l,h.highlightFormatting&&(t.formatting="link"),n=M(t),t.linkText=!1,n):(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&&Q.copyState(d,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?Q.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[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,Lt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Et=/[*+-]\s/,(Ct=vt.exports).commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return Ct.Pass;for(var t=e.listSelections(),n=[],i=0;i\s*$/.test(s),u=!/>\s*$/.test(s),(a||u)&&e.replaceRange("",{line:r.line,ch:0},{line:r.line,ch:r.ch+1}),n[i]="\n"):(o=l[1],s=l[5],u=(a=!(Et.test(l[2])||0<=l[2].indexOf(">")))?parseInt(l[3],10)+1+l[4]:l[2].replace("x"," "),n[i]="\n"+o+u+s,a&&function(e,t){var n=t.line,i=0,r=0,o=St.exec(e.getLine(n)),a=o[1];do{var s=n+(i+=1),l=e.getLine(s),u=St.exec(l);if(u){var c=u[1],d=parseInt(o[3],10)+i-r,f=parseInt(u[3],10),h=f;if(a!==c||isNaN(f)){if(a.length>c.length)return;if(a.length'+(s+" "+e))+""+"",c=0;c<7;c++)u=(u+='')+f.labels.weekdays.short[p.mod(c+f.weekStarts,7)]+"";for(u+="",c=0;c<6;c++){for(i=0;i<7;i++)u=r<=a&&(0':'')+r++:1===r?(u+='')+(p.daysInMonth(p.mod(t-1,12),e)-l+i+1):u+''+(r++-a),u+="";u+=""}u+="",$(".calendar-table",m).innerHTML=u,$$(".calendar-day",m).forEach(function(e){e.addEventListener("mousedown",function(e){e.stopPropagation(),e.preventDefault()}),e.addEventListener("click",function(){var e=d(),t=new Date(h.year,h.month,parseInt(this.textContent));e.setAttribute("data-date",t),e.value=p.formatDateTime(t),e.blur()})})}function t(){var e,t,n,i,r,o;(a=d())&&"block"===m.style.display&&(t=(e=a.getBoundingClientRect()).top+window.pageYOffset,e=e.left+window.pageXOffset,m.style.top=t+a.offsetHeight+"px",m.style.left=e+a.offsetLeft+"px",e=(t=m.getBoundingClientRect()).top+window.pageYOffset,t=t.left+window.pageXOffset,n=k.outerWidth(m),i=k.outerHeight(m),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,rp.daysInMonth(this.month,this.year)&&this.lastDay()},nextMonth:function(){this.month=p.mod(this.month+1,12),0===this.month&&this.nextYear(),this.day>p.daysInMonth(this.month,this.year)&&this.lastDay()},prevWeek:function(){this.day-=7,this.day<1&&(this.prevMonth(),this.day+=p.daysInMonth(this.month,this.year))},nextWeek:function(){this.day+=7,this.day>p.daysInMonth(this.month,this.year)&&(this.day-=p.daysInMonth(this.month,this.year),this.nextMonth())},prevDay:function(){this.day--,this.day<1&&(this.prevMonth(),this.lastDay())},nextDay:function(){this.day++,this.day>p.daysInMonth(this.month,this.year)&&(this.nextMonth(),this.day=1)},nextHour:function(){this.hours=p.mod(this.hours+1,24),0===this.hours&&this.nextDay()},prevHour:function(){this.hours=p.mod(this.hours-1,24),23===this.hours&&this.prevDay()},nextMinute:function(){this.minutes=p.mod(this.minutes+1,60),0===this.minutes&&this.nextHour()},prevMinute:function(){this.minutes=p.mod(this.minutes-1,60),59===this.minutes&&this.prevHour()},nextSecond:function(){this.seconds=p.mod(this.seconds+1,60),0===this.seconds&&this.nextMinute()},prevSecond:function(){this.seconds=p.mod(this.seconds-1,60),59===this.minutes&&this.prevMinute()}},p={_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=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
',!0===f.time&&(m.innerHTML+='
:
',u.inject("chevron-down",$(".prevHour",m)),u.inject("chevron-up",$(".nextHour",m)),u.inject("chevron-down",$(".prevMinute",m)),u.inject("chevron-up",$(".nextMinute",m)),k.longClick($(".nextHour",m),function(e){h.nextHour(),i(a),e.preventDefault()},750,250),k.longClick($(".prevHour",m),function(e){h.prevHour(),i(a),e.preventDefault()},750,250),k.longClick($(".nextMinute",m),function(e){h.nextMinute(),i(a),e.preventDefault()},750,250),k.longClick($(".prevMinute",m),function(e){h.prevMinute(),i(a),e.preventDefault()},750,250));return document.body.appendChild(m),u.inject("calendar-clock",$(".currentMonth",m)),u.inject("chevron-left",$(".prevMonth",m)),u.inject("chevron-right",$(".nextMonth",m)),$(".currentMonth",m).addEventListener("mousedown",function(e){var t=d(),n=new Date;h.setDate(n),i(t),t.blur(),e.preventDefault()}),k.longClick($(".prevMonth",m),function(e){h.prevMonth(),i(a),e.preventDefault()},750,500),k.longClick($(".nextMonth",m),function(e){h.nextMonth(),i(a),e.preventDefault()},750,500),window.addEventListener("mousedown",function(e){"none"!==m.style.display&&e.target.closest(".calendar")&&e.preventDefault()}),window.addEventListener("resize",k.throttle(t,100)),m}(),e=a.value,a.readOnly=!0,a.size=f.format.length,p.isValidDate(e)&&(e=new Date(e),a.setAttribute("data-date",e),a.value=p.formatDateTime(e)),a.addEventListener("change",function(){""===this.value?this.setAttribute("data-date",""):this.value=p.formatDateTime(this.getAttribute("data-date"))}),a.addEventListener("keydown",function(e){var t=this.getAttribute("data-date");switch(h.setDate(p.isValidDate(t)?new Date(t):new Date),e.which){case 13:$(".calendar-day.selected",m).click(),m.style.display="none";break;case 8:this.value="",this.blur(),m.style.display="none";break;case 27:this.blur(),m.style.display="none";break;case 37:e.ctrlKey||e.metaKey?e.shiftKey?h.prevYear():h.prevMonth():h.prevDay(),i(this);break;case 38:h.prevWeek(),i(this);break;case 39:e.ctrlKey||e.metaKey?e.shiftKey?h.nextYear():h.nextMonth():h.nextDay(),i(this);break;case 40:h.nextWeek(),i(this);break;case 48:(e.ctrlKey||e.metaKey)&&h.setDate(new Date),i(this);break;default:return}e.stopPropagation(),e.preventDefault()}),a.addEventListener("focus",function(){var e=p.isValidDate(this.getAttribute("data-date"))?new Date(this.getAttribute("data-date")):new Date;h.setDate(e),r(h.year,h.month,h.day),n(h.hours,h.minutes),m.style.display="block",t()}),a.addEventListener("blur",function(){m.style.display="none"})}),$$(".input-image").forEach(function(n){n.addEventListener("click",function(){xt.show("imagesModal",null,function(e){var t=$(".image-picker-thumbnail.selected",e);t&&t.classList.remove("selected"),n.value&&(t=$('.image-picker-thumbnail[data-filename="'+n.value+'"]',e))&&t.classList.add("selected"),$(".image-picker-confirm",e).setAttribute("data-target",n.id)})})}),$$(".image-picker").forEach(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$&"),t.style.display=""):t.style.display="none"}))}function l(){this.value=k.validateSlug(this.value)}$$(".pages-list").forEach(function(e){var t,n,i;"true"===e.getAttribute("data-sortable-children")&&(t=e,n=[],n=(i=V.create(t,{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},m({method:"POST",url:Formwork.config.baseUri+"pages/reorder/",data:e},function(e){e.status&&new p(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&&k.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){k.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",k.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=k.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.serialize=function(e){return null==e?e:("number"==typeof e?e=""+e:"object"==typeof e&&(e=JSON.stringify({data:e})),Object.keys(t.escapingMap).reduce((function(e,n){return t.replaceAll(e,n,t.escapingMap[n])}),e))},t.deserialize=function(e){if("string"!=typeof e)return e;e=Object.keys(t.escapingMap).reduce((function(e,n){return t.replaceAll(e,t.escapingMap[n],n)}),e);try{e=void 0!==(e=JSON.parse(e)).data?e.data:e}catch(e){}return e},t.createSvg=function(e,n,i,r){var o;return n=n||"100%",i=i||"100%",Array.prototype.slice.call(e.querySelectorAll("svg")).filter((function(e){return e.getAttributeNS(t.namespaces.xmlns,"ct")})).forEach((function(t){e.removeChild(t)})),(o=new t.Svg("svg").attr({width:n,height:i}).addClass(r))._node.style.width=n,o._node.style.height=i,e.appendChild(o._node),o},t.normalizeData=function(e,n,i){var r,o={raw:e,normalized:{}};return o.normalized.series=t.getDataArray({series:e.series||[]},n,i),r=o.normalized.series.every((function(e){return e instanceof Array}))?Math.max.apply(null,o.normalized.series.map((function(e){return e.length}))):o.normalized.series.length,o.normalized.labels=(e.labels||[]).slice(),Array.prototype.push.apply(o.normalized.labels,t.times(Math.max(0,r-o.normalized.labels.length)).map((function(){return""}))),n&&t.reverseData(o.normalized),o},t.safeHasProperty=function(e,t){return null!==e&&"object"==typeof e&&e.hasOwnProperty(t)},t.isDataHoleValue=function(e){return null==e||"number"==typeof e&&isNaN(e)},t.reverseData=function(e){e.labels.reverse(),e.series.reverse();for(var t=0;tr.high&&(r.high=s),a&&s0||(r.high=1),r.low=0)),r},t.isNumeric=function(e){return null!==e&&isFinite(e)},t.isFalseyButZero=function(e){return!e&&0!==e},t.getNumberOrUndefined=function(e){return t.isNumeric(e)?+e:void 0},t.isMultiValue=function(e){return"object"==typeof e&&("x"in e||"y"in e)},t.getMultiValue=function(e,n){return t.isMultiValue(e)?t.getNumberOrUndefined(e[n||"y"]):t.getNumberOrUndefined(e)},t.rho=function(e){if(1===e)return e;function t(e,n){return e%n==0?n:t(n,e%n)}function n(e){return e*e+1}var i,r=2,o=2;if(e%2==0)return 2;do{r=n(r)%e,o=n(n(o))%e,i=t(Math.abs(r-o),e)}while(1===i);return i},t.getBounds=function(e,n,i,r){var o,a,s,l=0,u={high:n.high,low:n.low};u.valueRange=u.high-u.low,u.oom=t.orderOfMagnitude(u.valueRange),u.step=Math.pow(10,u.oom),u.min=Math.floor(u.low/u.step)*u.step,u.max=Math.ceil(u.high/u.step)*u.step,u.range=u.max-u.min,u.numberOfSteps=Math.round(u.range/u.step);var c=t.projectLength(e,u.step,u)=i)u.step=1;else if(r&&d=i)u.step=d;else for(;;){if(c&&t.projectLength(e,u.step,u)<=i)u.step*=2;else{if(c||!(t.projectLength(e,u.step/2,u)>=i))break;if(u.step/=2,r&&u.step%1!=0){u.step*=2;break}}if(l++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var h=2221e-19;function f(e,t){return e===(e+=t)&&(e*=1+(t>0?h:-h)),e}for(u.step=Math.max(u.step,h),a=u.min,s=u.max;a+u.step<=u.low;)a=f(a,u.step);for(;s-u.step>=u.high;)s=f(s,-u.step);u.min=a,u.max=s,u.range=u.max-u.min;var p=[];for(o=u.min;o<=u.max;o=f(o,u.step)){var m=t.roundWithPrecision(o);m!==p[p.length-1]&&p.push(m)}return u.values=p,u},t.polarToCartesian=function(e,t,n,i){var r=(i-90)*Math.PI/180;return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}},t.createChartRect=function(e,n,i){var r=!(!n.axisX&&!n.axisY),o=r?n.axisY.offset:0,a=r?n.axisX.offset:0,s=e.width()||t.quantity(n.width).value||0,l=e.height()||t.quantity(n.height).value||0,u=t.normalizePadding(n.chartPadding,i);s=Math.max(s,o+u.left+u.right),l=Math.max(l,a+u.top+u.bottom);var c={padding:u,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return r?("start"===n.axisX.position?(c.y2=u.top+a,c.y1=Math.max(l-u.bottom,c.y2+1)):(c.y2=u.top,c.y1=Math.max(l-u.bottom-a,c.y2+1)),"start"===n.axisY.position?(c.x1=u.left+o,c.x2=Math.max(s-u.right,c.x1+1)):(c.x1=u.left,c.x2=Math.max(s-u.right-o,c.x1+1))):(c.x1=u.left,c.x2=Math.max(s-u.right,c.x1+1),c.y2=u.top,c.y1=Math.max(l-u.bottom,c.y2+1)),c},t.createGrid=function(e,n,i,r,o,a,s,l){var u={};u[i.units.pos+"1"]=e,u[i.units.pos+"2"]=e,u[i.counterUnits.pos+"1"]=r,u[i.counterUnits.pos+"2"]=r+o;var c=a.elem("line",u,s.join(" "));l.emit("draw",t.extend({type:"grid",axis:i,index:n,group:a,element:c},u))},t.createGridBackground=function(e,t,n,i){var r=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:r})},t.createLabel=function(e,n,r,o,a,s,l,u,c,d,h){var f,p={};if(p[a.units.pos]=e+l[a.units.pos],p[a.counterUnits.pos]=l[a.counterUnits.pos],p[a.units.len]=n,p[a.counterUnits.len]=Math.max(0,s-10),d){var m=i.createElement("span");m.className=c.join(" "),m.setAttribute("xmlns",t.namespaces.xhtml),m.innerText=o[r],m.style[a.units.len]=Math.round(p[a.units.len])+"px",m.style[a.counterUnits.len]=Math.round(p[a.counterUnits.len])+"px",f=u.foreignObject(m,t.extend({style:"overflow: visible;"},p))}else f=u.elem("text",p,c.join(" ")).text(o[r]);h.emit("draw",t.extend({type:"label",axis:a,index:r,group:u,element:f,text:o[r]},p))},t.getSeriesOption=function(e,t,n){if(e.name&&t.series&&t.series[e.name]){var i=t.series[e.name];return i.hasOwnProperty(n)?i[n]:t[n]}return t[n]},t.optionsProvider=function(e,i,r){var o,a,s=t.extend({},e),l=[];function u(e){var l=o;if(o=t.extend({},s),i)for(a=0;a=2&&e[a]<=e[a-2]&&(o=!0),o&&(r.push({pathCoordinates:[],valueData:[]}),o=!1),r[r.length-1].pathCoordinates.push(e[a],e[a+1]),r[r.length-1].valueData.push(n[a/2]));return r}}(this||i,e),function(e,t){t.Interpolation={},t.Interpolation.none=function(e){return e=t.extend({},{fillHoles:!1},e),function(n,i){for(var r=new t.Svg.Path,o=!0,a=0;a1){var l=[];return s.forEach((function(e){l.push(r(e.pathCoordinates,e.valueData))})),t.Svg.Path.join(l)}if(o=s[0].pathCoordinates,a=s[0].valueData,o.length<=4)return t.Interpolation.none()(o,a);for(var u=(new t.Svg.Path).move(o[0],o[1],!1,a[0]),c=0,d=o.length;d-2>c;c+=2){var h=[{x:+o[c-2],y:+o[c-1]},{x:+o[c],y:+o[c+1]},{x:+o[c+2],y:+o[c+3]},{x:+o[c+4],y:+o[c+5]}];d-4===c?h[3]=h[2]:c||(h[0]={x:+o[c],y:+o[c+1]}),u.curve(n*(-h[0].x+6*h[1].x+h[2].x)/6+i*h[2].x,n*(-h[0].y+6*h[1].y+h[2].y)/6+i*h[2].y,n*(h[1].x+6*h[2].x-h[3].x)/6+i*h[2].x,n*(h[1].y+6*h[2].y-h[3].y)/6+i*h[2].y,h[2].x,h[2].y,!1,a[(c+2)/2])}return u}return t.Interpolation.none()([])}},t.Interpolation.monotoneCubic=function(e){return e=t.extend({},{fillHoles:!1},e),function n(i,r){var o=t.splitIntoSegments(i,r,{fillHoles:e.fillHoles,increasingX:!0});if(o.length){if(o.length>1){var a=[];return o.forEach((function(e){a.push(n(e.pathCoordinates,e.valueData))})),t.Svg.Path.join(a)}if(i=o[0].pathCoordinates,r=o[0].valueData,i.length<=4)return t.Interpolation.none()(i,r);var s,l,u=[],c=[],d=i.length/2,h=[],f=[],p=[],m=[];for(s=0;s0!=f[s]>0?h[s]=0:(h[s]=3*(m[s-1]+m[s])/((2*m[s]+m[s-1])/f[s-1]+(m[s]+2*m[s-1])/f[s]),isFinite(h[s])||(h[s]=0));for(l=(new t.Svg.Path).move(u[0],c[0],!1,r[0]),s=0;s1})).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,g).line(t.x,t.y).position(e.pathElements.length+1).line(n.x,g)})).forEach(function(t){var s=l.elem("path",{d:t.stringify()},e.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:i.normalized.series[a],path:t.clone(),series:n,seriesIndex:a,axisX:r,axisY:o,chartRect:u,index:a,group:l,element:s})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:o.bounds,chartRect:u,axisX:r,axisY:o,svg:this.svg,options:e})}})}(this||i,e),function(e,t){e.window,e.document;var n={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:t.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:t.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"}};t.Bar=t.Base.extend({constructor:function(e,i,r,o){t.Bar.super.constructor.call(this,e,i,n,t.extend({},n,r),o)},createChart:function(e){var i,r;e.distributeSeries?(i=t.normalizeData(this.data,e.reverseData,e.horizontalBars?"x":"y")).normalized.series=i.normalized.series.map((function(e){return[e]})):i=t.normalizeData(this.data,e.reverseData,e.horizontalBars?"x":"y"),this.svg=t.createSvg(this.container,e.width,e.height,e.classNames.chart+(e.horizontalBars?" "+e.classNames.horizontalBars:""));var o=this.svg.elem("g").addClass(e.classNames.gridGroup),a=this.svg.elem("g"),s=this.svg.elem("g").addClass(e.classNames.labelGroup);if(e.stackBars&&0!==i.normalized.series.length){var l=t.serialMap(i.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})}));r=t.getHighLow([l],e,e.horizontalBars?"x":"y")}else r=t.getHighLow(i.normalized.series,e,e.horizontalBars?"x":"y");r.high=+e.high||(0===e.high?0:r.high),r.low=+e.low||(0===e.low?0:r.low);var u,c,d,h,f,p=t.createChartRect(this.svg,e,n.padding);c=e.distributeSeries&&e.stackBars?i.normalized.labels.slice(0,1):i.normalized.labels,e.horizontalBars?(u=h=void 0===e.axisX.type?new t.AutoScaleAxis(t.Axis.units.x,i.normalized.series,p,t.extend({},e.axisX,{highLow:r,referenceValue:0})):e.axisX.type.call(t,t.Axis.units.x,i.normalized.series,p,t.extend({},e.axisX,{highLow:r,referenceValue:0})),d=f=void 0===e.axisY.type?new t.StepAxis(t.Axis.units.y,i.normalized.series,p,{ticks:c}):e.axisY.type.call(t,t.Axis.units.y,i.normalized.series,p,e.axisY)):(d=h=void 0===e.axisX.type?new t.StepAxis(t.Axis.units.x,i.normalized.series,p,{ticks:c}):e.axisX.type.call(t,t.Axis.units.x,i.normalized.series,p,e.axisX),u=f=void 0===e.axisY.type?new t.AutoScaleAxis(t.Axis.units.y,i.normalized.series,p,t.extend({},e.axisY,{highLow:r,referenceValue:0})):e.axisY.type.call(t,t.Axis.units.y,i.normalized.series,p,t.extend({},e.axisY,{highLow:r,referenceValue:0})));var m=e.horizontalBars?p.x1+u.projectValue(0):p.y1-u.projectValue(0),g=[];d.createGridAndLabels(o,s,this.supportsForeignObject,e,this.eventEmitter),u.createGridAndLabels(o,s,this.supportsForeignObject,e,this.eventEmitter),e.showGridBackground&&t.createGridBackground(o,p,e.classNames.gridBackground,this.eventEmitter),i.raw.series.forEach(function(n,r){var o,s,l=r-(i.raw.series.length-1)/2;o=e.distributeSeries&&!e.stackBars?d.axisLength/i.normalized.series.length/2:e.distributeSeries&&e.stackBars?d.axisLength/2:d.axisLength/i.normalized.series[r].length/2,(s=a.elem("g")).attr({"ct:series-name":n.name,"ct:meta":t.serialize(n.meta)}),s.addClass([e.classNames.series,n.className||e.classNames.series+"-"+t.alphaNumerate(r)].join(" ")),i.normalized.series[r].forEach(function(a,c){var v,y,x,b;if(b=e.distributeSeries&&!e.stackBars?r:e.distributeSeries&&e.stackBars?0:c,v=e.horizontalBars?{x:p.x1+u.projectValue(a&&a.x?a.x:0,c,i.normalized.series[r]),y:p.y1-d.projectValue(a&&a.y?a.y:0,b,i.normalized.series[r])}:{x:p.x1+d.projectValue(a&&a.x?a.x:0,b,i.normalized.series[r]),y:p.y1-u.projectValue(a&&a.y?a.y:0,c,i.normalized.series[r])},d instanceof t.StepAxis&&(d.options.stretch||(v[d.units.pos]+=o*(e.horizontalBars?-1:1)),v[d.units.pos]+=e.stackBars||e.distributeSeries?0:l*e.seriesBarDistance*(e.horizontalBars?-1:1)),x=g[c]||m,g[c]=x-(m-v[d.counterUnits.pos]),void 0!==a){var w={};w[d.units.pos+"1"]=v[d.units.pos],w[d.units.pos+"2"]=v[d.units.pos],!e.stackBars||"accumulate"!==e.stackMode&&e.stackMode?(w[d.counterUnits.pos+"1"]=m,w[d.counterUnits.pos+"2"]=v[d.counterUnits.pos]):(w[d.counterUnits.pos+"1"]=x,w[d.counterUnits.pos+"2"]=g[c]),w.x1=Math.min(Math.max(w.x1,p.x1),p.x2),w.x2=Math.min(Math.max(w.x2,p.x1),p.x2),w.y1=Math.min(Math.max(w.y1,p.y2),p.y1),w.y2=Math.min(Math.max(w.y2,p.y2),p.y1);var k=t.getMetaData(n,c);y=s.elem("line",w,e.classNames.bar).attr({"ct:value":[a.x,a.y].filter(t.isNumeric).join(","),"ct:meta":t.serialize(k)}),this.eventEmitter.emit("draw",t.extend({type:"bar",value:a,index:c,meta:k,series:n,seriesIndex:r,axisX:h,axisY:f,chartRect:p,group:s,element:y},w))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:u.bounds,chartRect:p,axisX:h,axisY:f,svg:this.svg,options:e})}})}(this||i,e),function(e,t){e.window,e.document;var n={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:t.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1};function i(e,t,n){var i=t.x>e.x;return i&&"explode"===n||!i&&"implode"===n?"start":i&&"implode"===n||!i&&"explode"===n?"end":"middle"}t.Pie=t.Base.extend({constructor:function(e,i,r,o){t.Pie.super.constructor.call(this,e,i,n,t.extend({},n,r),o)},createChart:function(e){var r,o,a,s,l,u=t.normalizeData(this.data),c=[],d=e.startAngle;this.svg=t.createSvg(this.container,e.width,e.height,e.donut?e.classNames.chartDonut:e.classNames.chartPie),o=t.createChartRect(this.svg,e,n.padding),a=Math.min(o.width()/2,o.height()/2),l=e.total||u.normalized.series.reduce((function(e,t){return e+t}),0);var h=t.quantity(e.donutWidth);"%"===h.unit&&(h.value*=a/100),a-=e.donut&&!e.donutSolid?h.value/2:0,s="outside"===e.labelPosition||e.donut&&!e.donutSolid?a:"center"===e.labelPosition?0:e.donutSolid?a-h.value/2:a/2,s+=e.labelOffset;var f={x:o.x1+o.width()/2,y:o.y2+o.height()/2},p=1===u.raw.series.filter((function(e){return e.hasOwnProperty("value")?0!==e.value:0!==e})).length;u.raw.series.forEach(function(e,t){c[t]=this.svg.elem("g",null,null)}.bind(this)),e.showLabel&&(r=this.svg.elem("g",null,null)),u.raw.series.forEach(function(n,o){if(0!==u.normalized.series[o]||!e.ignoreEmptyValues){c[o].attr({"ct:series-name":n.name}),c[o].addClass([e.classNames.series,n.className||e.classNames.series+"-"+t.alphaNumerate(o)].join(" "));var m=l>0?d+u.normalized.series[o]/l*360:0,g=Math.max(0,d-(0===o||p?0:.2));m-g>=359.99&&(m=g+359.99);var v,y,x,b=t.polarToCartesian(f.x,f.y,a,g),w=t.polarToCartesian(f.x,f.y,a,m),k=new t.Svg.Path(!e.donut||e.donutSolid).move(w.x,w.y).arc(a,a,0,m-d>180,0,b.x,b.y);e.donut?e.donutSolid&&(x=a-h.value,v=t.polarToCartesian(f.x,f.y,x,d-(0===o||p?0:.2)),y=t.polarToCartesian(f.x,f.y,x,m),k.line(v.x,v.y),k.arc(x,x,0,m-d>180,1,y.x,y.y)):k.line(f.x,f.y);var C=e.classNames.slicePie;e.donut&&(C=e.classNames.sliceDonut,e.donutSolid&&(C=e.classNames.sliceDonutSolid));var S=c[o].elem("path",{d:k.stringify()},C);if(S.attr({"ct:value":u.normalized.series[o],"ct:meta":t.serialize(n.meta)}),e.donut&&!e.donutSolid&&(S._node.style.strokeWidth=h.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:u.normalized.series[o],totalDataSum:l,index:o,meta:n.meta,series:n,group:c[o],element:S,path:k.clone(),center:f,radius:a,startAngle:d,endAngle:m}),e.showLabel){var L,E;L=1===u.raw.series.length?{x:f.x,y:f.y}:t.polarToCartesian(f.x,f.y,s,d+(m-d)/2),E=u.normalized.labels&&!t.isFalseyButZero(u.normalized.labels[o])?u.normalized.labels[o]:u.normalized.series[o];var M=e.labelInterpolationFnc(E,o);if(M||0===M){var T=r.elem("text",{dx:L.x,dy:L.y,"text-anchor":i(f,L,e.labelDirection)},e.classNames.label).text(""+M);this.eventEmitter.emit("draw",{type:"label",index:o,group:r,element:T,text:""+M,x:L.x,y:L.y})}}d=m}}.bind(this)),this.eventEmitter.emit("created",{chartRect:o,svg:this.svg,options:e})},determineAnchorPosition:i})}(this||i,e),e},(e=r).exports?e.exports=n():t.Chartist=n();var o=r.exports,a={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(e,t){var n,i,r,o=0,a=null;return function(){var s,l=Date.now();return 0===o&&(o=l),n=this,i=arguments,(s=o+t-l)<=0||s>t?(a&&(clearTimeout(a),a=null),o=l,r=e.apply(n,i)):a||(a=setTimeout((function(){o=Date.now(),r=e.apply(n,i),a=null}),s)),r}},outerWidth:function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft)+parseInt(n.marginRight)},outerHeight:function(e){var t=e.offsetHeight,n=getComputedStyle(e);return t+=parseInt(n.marginTop)+parseInt(n.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=0;i--)t.options[i].selected&&r.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.options[i].value));else("checkbox"!==t.type&&"radio"!==t.type||t.checked)&&r.push(encodeURIComponent(t.name)+"="+encodeURIComponent(t.value));return r.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,t,n,i){var r;function o(){clearTimeout(r)}e.addEventListener("mousedown",(function(e){var a=this;1!==e.which?o():(t.call(a,e),r=setTimeout((function(){r=setInterval(t.bind(a,e),i)}),n))})),e.addEventListener("mouseout",o),window.addEventListener("mouseup",o)},firstFocusableElement:function(e){return void 0===e&&(e=document.body),e.querySelector("button, .button, input:not([type=hidden]), select, textarea")||e},getCookies:function(){var e,t,n=[],i=document.cookie.split(";");for(t=0;t0?o.insertBefore(i,o.childNodes[0]):o.appendChild(i),r=setTimeout(l,a),i.addEventListener("click",l),i.addEventListener("mouseenter",(function(){clearTimeout(r)})),i.addEventListener("mouseleave",(function(){r=setTimeout(l,n.mouseleaveDelay)}))}function l(){i.classList.add("fadeout"),setTimeout((function(){i&&i.parentNode&&o.removeChild(i),o&&o.childNodes.length<1&&(o.parentNode&&document.body.removeChild(o),o=null)}),n.fadeOutDelay)}return n=a.extendObject({},{interval:5e3,icon:null,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3},n),{show:function(){null!==n.icon?u.pass(n.icon,(function(r){s(e,t,n.interval),i.insertAdjacentHTML("afterBegin",r)})):s(e,t,n.interval)},remove:l}}function d(e,t){var n,i,r,o=new XMLHttpRequest;return o.open(e.method,e.url,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send(a.serializeObject(e.data)),"function"==typeof t&&(n=function(){i=JSON.parse(this.response),r=i.code||this.status,400===parseInt(r)?location.reload():t(i,o)},o.onload=n,o.onerror=n),o}var h=function(){var e=$("[data-command=clear-cache]"),t=$("[data-command=make-backup]");e&&e.addEventListener("click",(function(){d({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 e=this;e.setAttribute("disabled",""),d({method:"POST",url:Formwork.config.baseUri+"backup/make/",data:{"csrf-token":$("meta[name=csrf-token]").getAttribute("content")}},(function(t){new c(t.message,t.status,{icon:"check-circle"}).show(),setTimeout((function(){"success"===t.status&&a.triggerDownload(t.data.uri,$("meta[name=csrf-token]").getAttribute("content")),e.removeAttribute("disabled")}),1e3)}))}))},f=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 p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function m(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function b(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var w=b(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),k=b(/Edge/i),C=b(/firefox/i),S=b(/safari/i)&&!b(/chrome/i)&&!b(/android/i),L=b(/iP(ad|od|hone)/i),E=b(/chrome/i)&&b(/android/i),M={capture:!1,passive:!1};function T(e,t,n){e.addEventListener(t,n,!w&&M)}function D(e,t,n){e.removeEventListener(t,n,!w&&M)}function A(e,t){if(t){if(">"===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!1}return!1}}function O(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function N(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&A(e,t):A(e,t))||i&&e===n)return e;if(e===n)break}while(e=O(e))}return null}var F,I=/\s+/g;function P(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(I," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(I," ")}}function H(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];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function z(e,t){var n="";if("string"==typeof e)n=e;else do{var i=H(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function B(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r=o:r<=o))return i;if(i===W())break;i=X(i,!1)}return!1}function _(e,t,n,i){for(var r=0,o=0,a=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},i=n.evt,r=x(n,ie);ne.pluginEvent.bind(Ke)(e,t,m({dragEl:ae,parentEl:se,ghostEl:le,rootEl:ue,nextEl:ce,lastDownEl:de,cloneEl:he,cloneHidden:fe,dragStarted:Ee,putSortable:xe,activeSortable:Ke.active,originalEvent:i,oldIndex:pe,oldDraggableIndex:ge,newIndex:me,newDraggableIndex:ve,hideGhostForTarget:qe,unhideGhostForTarget:Xe,cloneNowHidden:function(){fe=!0},cloneNowShown:function(){fe=!1},dispatchSortableEvent:function(e){oe({sortable:t,name:e,originalEvent:i})}},r))};function oe(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,d=e.newDraggableIndex,h=e.originalEvent,f=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Z]){var g,v=t.options,y="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||w||k?(g=document.createEvent("Event")).initEvent(i,!0,!0):g=new CustomEvent(i,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=r||n,g.clone=o,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=h,g.pullMode=f?f.lastPutMode:void 0;var x=m(m({},p),ne.getEventProperties(i,t));for(var b in x)g[b]=x[b];n&&n.dispatchEvent(g),v[y]&&v[y].call(t,g)}}(m({putSortable:xe,cloneEl:he,targetEl:ae,rootEl:ue,oldIndex:pe,oldDraggableIndex:ge,newIndex:me,newDraggableIndex:ve},e))}var ae,se,le,ue,ce,de,he,fe,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=L,Re=k||w?"cssFloat":"float",je=Be&&!E&&!L&&"draggable"in document.createElement("div"),_e=function(){if(Be){if(w)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ye=function(e,t){var n=H(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=_(e,0,t),o=_(e,1,t),a=r&&H(r),s=o&&H(o),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+R(r).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+R(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){var c="left"===a.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=i&&"none"===n[Re]||o&&"none"===n[Re]&&l+u>i)?"vertical":"horizontal"},Ue=function(e){function t(e,n){return function(i,r,o,a){var s=i.options.group.name&&r.options.group.name&&i.options.group.name===r.options.group.name;if(null==e&&(n||s))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(i,r,o,a),n)(i,r,o,a);var l=(n?i:r).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},i=e.group;i&&"object"==g(i)||(i={name:i}),n.name=i.name,n.checkPull=t(i.pull,!0),n.checkPut=t(i.put),n.revertClone=i.revertClone,e.group=n},qe=function(){!_e&&le&&H(le,"display","none")},Xe=function(){!_e&&le&&H(le,"display","")};Be&&!E&&document.addEventListener("click",(function(e){if(Ne)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ne=!1,!1}),!0);var Ge=function(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[Z].options.emptyInsertThreshold;if(t&&!Y(e)){var n=R(e),i=r>=n.left-t&&r<=n.right+t,s=o>=n.top-t&&o<=n.bottom+t;return i&&s?a=e:void 0}})),a);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[Z]._onDragOver(n)}}var r,o,a},Ve=function(e){ae&&ae.parentNode[Z]._isOutsideThisEl(e.target)};function Ke(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=y({},t),e[Z]=this;var n={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 Ye(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!==Ke.supportPointer&&"PointerEvent"in window&&!S,emptyInsertThreshold:5};for(var i in ne.initializePlugins(this,e,n),n)!(i in t)&&(t[i]=n[i]);for(var r in Ue(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&je,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?T(e,"pointerdown",this._onTapStart):(T(e,"mousedown",this._onTapStart),T(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(T(e,"dragover",this),T(e,"dragenter",this)),Fe.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),y(this,J())}function Qe(e,t,n,i,r,o,a,s){var l,u,c=e[Z],d=c.options.onMove;return!window.CustomEvent||w||k?(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||R(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function Ze(e){e.draggable=!1}function Je(){$e=!1}function et(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;n--;)i+=t.charCodeAt(n);return i.toString(36)}function tt(e){return setTimeout(e,0)}function nt(e){return clearTimeout(e)}Ke.prototype={constructor:Ke,_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(e){if(e.cancelable){var t=this,n=this.el,i=this.options,r=i.preventOnFilter,o=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=i.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)}}(n),!ae&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!S||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=N(s,i.draggable,n,!1))&&s.animated||de===s)){if(pe=U(s),ge=U(s,i.draggable),"function"==typeof u){if(u.call(this,e,s,this))return oe({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),re("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(i){if(i=N(l,i.trim(),n,!1))return oe({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:n,toEl:n}),re("filter",t,{evt:e}),!0}))))return void(r&&e.cancelable&&e.preventDefault());i.handle&&!N(l,i.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var i,r=this,o=r.el,a=r.options,s=o.ownerDocument;if(n&&!ae&&n.parentNode===o){var l=R(n);if(ue=o,se=(ae=n).parentNode,ce=ae.nextSibling,de=n,ye=a.group,Ke.dragged=ae,be={target:ae,clientX:(t||e).clientX,clientY:(t||e).clientY},Se=be.clientX-l.left,Le=be.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ae.style["will-change"]="all",i=function(){re("delayEnded",r,{evt:e}),Ke.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!C&&r.nativeDraggable&&(ae.draggable=!0),r._triggerDragStart(e,t),oe({sortable:r,name:"choose",originalEvent:e}),P(ae,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){B(ae,e.trim(),Ze)})),T(s,"dragover",Ge),T(s,"mousemove",Ge),T(s,"touchmove",Ge),T(s,"mouseup",r._onDrop),T(s,"touchend",r._onDrop),T(s,"touchcancel",r._onDrop),C&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ae.draggable=!0),re("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(k||w))i();else{if(Ke.eventCanceled)return void this._onDrop();T(s,"mouseup",r._disableDelayedDrag),T(s,"touchend",r._disableDelayedDrag),T(s,"touchcancel",r._disableDelayedDrag),T(s,"mousemove",r._delayedDragTouchMoveHandler),T(s,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&T(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ae&&Ze(ae),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;D(e,"mouseup",this._disableDelayedDrag),D(e,"touchend",this._disableDelayedDrag),D(e,"touchcancel",this._disableDelayedDrag),D(e,"mousemove",this._delayedDragTouchMoveHandler),D(e,"touchmove",this._delayedDragTouchMoveHandler),D(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?T(document,"pointermove",this._onTouchMove):T(document,t?"touchmove":"mousemove",this._onTouchMove):(T(ae,"dragend",this),T(ue,"dragstart",this._onDragStart));try{document.selection?tt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Oe=!1,ue&&ae){re("dragStarted",this,{evt:t}),this.nativeDraggable&&T(document,"dragover",Ve);var n=this.options;!e&&P(ae,n.dragClass,!1),P(ae,n.ghostClass,!0),Ke.active=this,e&&this._appendGhost(),oe({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(we){this._lastX=we.clientX,this._lastY=we.clientY,qe();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[Z]._isOutsideThisEl(e),t)do{if(t[Z]){if(t[Z]._onDragOver({clientX:we.clientX,clientY:we.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Xe()}},_onTouchMove:function(e){if(be){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=le&&z(le,!0),a=le&&o&&o.a,s=le&&o&&o.d,l=We&&Ae&&q(Ae),u=(r.clientX-be.clientX+i.x)/(a||1)+(l?l[0]-He[0]:0)/(a||1),c=(r.clientY-be.clientY+i.y)/(s||1)+(l?l[1]-He[1]:0)/(s||1);if(!Ke.active&&!Oe){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))i.right+r||e.clientX<=i.right&&e.clientY>i.bottom&&e.clientX>=i.left:e.clientX>i.right&&e.clientY>i.top||e.clientX<=i.right&&e.clientY>i.bottom+r}(e,r,this)&&!g.animated){if(g===ae)return F(!1);if(g&&o===e.target&&(a=g),a&&(n=R(a)),!1!==Qe(ue,o,ae,t,a,n,e,!!a))return O(),g&&g.nextSibling?o.insertBefore(ae,g.nextSibling):o.appendChild(ae),se=o,I(),F(!0)}else if(g&&function(e,t,n){var i=R(_(n.el,0,n.options,!0)),r=10;return t?e.clientXc+u*o/2:ld-De)return-Te}else if(l>c+u*(1-r)/2&&ld-u*o/2))return l>c+u/2?1:-1;return 0}(e,a,n,r,k?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Pe,Me===a),0!==y){var E=U(ae);do{E-=y,b=se.children[E]}while(b&&("none"===H(b,"display")||b===le))}if(0===y||b===a)return F(!1);Me=a,Te=y;var M=a.nextElementSibling,T=!1,D=Qe(ue,o,ae,t,a,n,e,T=1===y);if(!1!==D)return 1!==D&&-1!==D||(T=1===D),$e=!0,setTimeout(Je,30),O(),T&&!M?o.appendChild(ae):a.parentNode.insertBefore(ae,T?M:a),S&&K(S,0,L-S.scrollTop),se=ae.parentNode,void 0===x||Pe||(De=Math.abs(x-R(a)[C])),I(),F(!0)}if(o.contains(ae))return F(!1)}return!1}function A(s,l){re(s,f,m({evt:e,isOwner:c,axis:r?"vertical":"horizontal",revert:i,dragRect:t,targetRect:n,canSort:d,fromSortable:h,target:a,completed:F,onMove:function(n,i){return Qe(ue,o,ae,t,n,R(n),e,i)},changed:I},l))}function O(){A("dragOverAnimationCapture"),f.captureAnimationState(),f!==h&&h.captureAnimationState()}function F(t){return A("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(f),f!==h&&(P(ae,xe?xe.options.ghostClass:u.options.ghostClass,!1),P(ae,s.ghostClass,!0)),xe!==f&&f!==Ke.active?xe=f:f===Ke.active&&xe&&(xe=null),h===f&&(f._ignoreWhileAnimating=a),f.animateAll((function(){A("dragOverAnimationComplete"),f._ignoreWhileAnimating=null})),f!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(a===ae&&!ae.animated||a===o&&!a.animated)&&(Me=null),s.dragoverBubble||e.rootEl||a===document||(ae.parentNode[Z]._isOutsideThisEl(e.target),!t&&Ge(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function I(){me=U(ae),ve=U(ae,s.draggable),oe({sortable:f,name:"change",toEl:o,newIndex:me,newDraggableIndex:ve,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){D(document,"mousemove",this._onTouchMove),D(document,"touchmove",this._onTouchMove),D(document,"pointermove",this._onTouchMove),D(document,"dragover",Ge),D(document,"mousemove",Ge),D(document,"touchmove",Ge)},_offUpEvents:function(){var e=this.el.ownerDocument;D(e,"mouseup",this._onDrop),D(e,"touchend",this._onDrop),D(e,"pointerup",this._onDrop),D(e,"touchcancel",this._onDrop),D(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;me=U(ae),ve=U(ae,n.draggable),re("drop",this,{evt:e}),se=ae&&ae.parentNode,me=U(ae),ve=U(ae,n.draggable),Ke.eventCanceled||(Oe=!1,Pe=!1,Ie=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),nt(this.cloneId),nt(this._dragStartId),this.nativeDraggable&&(D(document,"drop",this),D(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),S&&H(document.body,"user-select",""),H(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)&&he&&he.parentNode&&he.parentNode.removeChild(he),ae&&(this.nativeDraggable&&D(ae,"dragend",this),Ze(ae),ae.style["will-change"]="",Ee&&!Oe&&P(ae,xe?xe.options.ghostClass:this.options.ghostClass,!1),P(ae,this.options.chosenClass,!1),oe({sortable:this,name:"unchoose",toEl:se,newIndex:null,newDraggableIndex:null,originalEvent:e}),ue!==se?(me>=0&&(oe({rootEl:se,name:"add",toEl:se,fromEl:ue,originalEvent:e}),oe({sortable:this,name:"remove",toEl:se,originalEvent:e}),oe({rootEl:se,name:"sort",toEl:se,fromEl:ue,originalEvent:e}),oe({sortable:this,name:"sort",toEl:se,originalEvent:e})),xe&&xe.save()):me!==pe&&me>=0&&(oe({sortable:this,name:"update",toEl:se,originalEvent:e}),oe({sortable:this,name:"sort",toEl:se,originalEvent:e})),Ke.active&&(null!=me&&-1!==me||(me=pe,ve=ge),oe({sortable:this,name:"end",toEl:se,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){re("nulling",this),ue=ae=se=le=ce=he=de=fe=be=we=Ee=me=ve=pe=ge=Me=Te=xe=ye=Ke.dragged=Ke.ghost=Ke.clone=Ke.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;i1?e.parentNode.removeChild(e):o(e)}function o(e){var i,r;t&&((i=$(".input-array-key",e)).value="",i.removeAttribute("value")),(r=$(".input-array-value",e)).value="",r.removeAttribute("value"),r.name=n+"[]"}function a(e){var t=$(".input-array-key",e);$(".input-array-value",e).name=n+"["+t.value.trim()+"]"}function s(e){var n,o,s=$(".input-array-add",e),l=$(".input-array-remove",e);s.addEventListener("click",i.bind(s,e)),l.addEventListener("click",r.bind(l,e)),t&&(n=$(".input-array-key",e),o=$(".input-array-value",e),n.addEventListener("keyup",a.bind(n,e)),o.addEventListener("keyup",a.bind(o,e)))}$$(".input-array-row",e).forEach((function(e){s(e)})),Ke.create(e,{handle:".sort-handle",forceFallback:!0})}function yt(e,t){var n,i,r={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1},o={},s={};function l(e,n){var i,o={};for(i in e=a.toSafeInteger(e),void 0===n&&(n=t.intervals),r)Object.prototype.hasOwnProperty.call(r,i)&&-1!==n.indexOf(i)&&(o[i]=Math.floor(e/r[i]),e-=o[i]*r[i]);return o}function u(){var e={},n=0,s=0,l=0;for(l in o)Object.prototype.hasOwnProperty.call(o,l)&&(e[l]=o[l].value);n=function(e){var t,n=0;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(r,t)&&(n+=e[t]*r[t]);return a.toSafeInteger(n)}(e),i.step&&(s=i.step*r[t.unit],n=Math.floor(n/s)*s),i.min&&(n=Math.max(n,i.min)),i.max&&(n=Math.min(n,i.max)),i.value=Math.round(n/r[t.unit])}function c(){var e,n=l(i.value*r[t.unit]);for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(o[e].value=n[e])}function d(){var e;for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(o[e].style.width=Math.max(3,o[e].value.length+2)+"ch")}function h(){var e;for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(s[e].innerHTML=t.labels[e][1===parseInt(o[e].value)?0:1])}function f(i,r){var l,f,p,m,g;for((n=document.createElement("div")).className="input-duration",g=0;g1&&(p.step=r[f]),e.disabled&&(p.disabled=!0),o[f]=p,p.addEventListener("input",(function(){for(;"0"===this.value.charAt(0)&&this.value.length>1&&!this.value.charAt(1).match(/[.,]/);)this.value=this.value.slice(1);for(;this.value>a.getMaxSafeInteger();)this.value=this.value.slice(0,-1);d(),u(),h()})),p.addEventListener("blur",(function(){u(),c(),d(),h()})),p.addEventListener("focus",(function(){n.classList.add("focused")})),p.addEventListener("blur",(function(){n.classList.remove("focused")})),l.addEventListener("mousedown",(function(e){var t=$("input",this);t&&e.target!==t&&(t.focus(),e.preventDefault())})),(m=document.createElement("label")).innerHTML=t.labels[f][1===parseInt(p.value)?0:1],s[f]=m,l.appendChild(p),l.appendChild(m),n.appendChild(l);return n.addEventListener("mousedown",(function(e){e.target===this&&(p.focus(),e.preventDefault())})),n}t=a.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"]}},t),function(){var n,o,a;(i=document.createElement("input")).className="input-duration-hidden",i.name=e.name,i.id=e.id,i.type="text",i.value=e.value,i.readOnly=!0,i.hidden=!0,e.min&&(i.min=e.min);e.max&&(i.max=e.max);e.step&&(i.step=e.step);e.required&&(i.required=!0);e.disabled&&(i.disabled=!0);e.hasAttribute("data-intervals")&&(t.intervals=e.getAttribute("data-intervals").split(", "));e.hasAttribute("data-unit")&&(t.unit=e.getAttribute("data-unit"));o=e.value*r[t.unit],a=e.step*r[t.unit],n=f(l(o||0),l(a||1)),e.parentNode.replaceChild(n,e),n.appendChild(i)}()}mt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var i=_(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:pt},y(mt,{pluginName:"revertOnSpill"}),gt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:pt},y(gt,{pluginName:"removeOnSpill"}),Ke.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){var t=e.originalEvent;this.sortable.nativeDraggable?T(document,"dragover",this._handleAutoScroll):this.options.supportPointer?T(document,"pointermove",this._handleFallbackAutoScroll):t.touches?T(document,"touchmove",this._handleFallbackAutoScroll):T(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?D(document,"dragover",this._handleAutoScroll):(D(document,"pointermove",this._handleFallbackAutoScroll),D(document,"touchmove",this._handleFallbackAutoScroll),D(document,"mousemove",this._handleFallbackAutoScroll)),ht(),dt(),clearTimeout(F),F=void 0},nulling:function(){st=rt=it=ct=lt=ot=at=null,ut.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,i=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,o=document.elementFromPoint(i,r);if(st=e,t||this.options.forceAutoScrollFallback||k||w||S){ft(e,this.options,o,t);var a=X(o,!0);!ct||lt&&i===ot&&r===at||(lt&&ht(),lt=setInterval((function(){var o=X(document.elementFromPoint(i,r),!0);o!==a&&(a=o,dt()),ft(e,n.options,o,t)}),10),ot=i,at=r)}else{if(!this.options.bubbleScroll||X(o,!0)===W())return void dt();ft(e,this.options,X(o,!1),!1)}}},y(e,{pluginName:"scroll",initializeByDefault:!0})}),Ke.mount(gt,mt);var xt,bt={exports:{}};function wt(){return xt||(xt=1,function(e,t){e.exports=function(){var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=i||r||o,s=a&&(i?document.documentMode||6:+(o||r)[1]),l=!o&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\/(\d+)/.exec(e),d=c&&+c[1],h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),m=/PhantomJS/.test(e),g=f&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),v=/Android/.test(e),y=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),x=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),k=h&&e.match(/Version\/(\d*\.\d*)/);k&&(k=Number(k[1])),k&&k>=15&&(h=!1,l=!0);var C=x&&(u||h&&(null==k||k<12.11)),S=n||a&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E,M=function(e,t){var n=e.className,i=L(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:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function D(e,t){return T(e).appendChild(t)}function A(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}g?H=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(H=function(e){try{e.select()}catch(e){}});var j=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};function _(e,t){for(var n=0;n=t)return i+Math.min(a,t-r);if(r+=o-i,i=o+1,(r+=n-r%n)>=t)return i}}var K=[""];function Q(e){for(;K.length<=e;)K.push(Z(K)+" ");return K[e]}function Z(e){return e[e.length-1]}function J(e,t){for(var n=[],i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||ie.test(e))}function oe(e,t){return t?!!(t.source.indexOf("\\w")>-1&&re(e))||t.test(e):re(e)}function ae(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var se=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function le(e){return e.charCodeAt(0)>=768&&se.test(e)}function ue(e,t,n){for(;(n<0?t>0:tn?-1:1;;){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;e(o)?n=o:t=o+i}}function de(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var r=!1,o=0;ot||t==n&&a.to==t)&&(i(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),r=!0)}r||i(t,n,"ltr")}var he=null;function fe(e,t,n){var i;he=null;for(var r=0;rt)return r;o.to==t&&(o.from!=o.to&&"before"==n?i=r:he=r),o.from==t&&(o.from!=o.to&&"before"!=n?i=r:he=r)}return null!=i?i:he}var pe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!i.test(e))return!1;for(var c=e.length,d=[],h=0;h-1&&(i[t]=r.slice(0,o).concat(r.slice(o+1)))}}}function be(e,t){var n=ye(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Se(e){e.prototype.on=function(e,t){ve(this,e,t)},e.prototype.off=function(e,t){xe(this,e,t)}}function Le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ee(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Me(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Te(e){Le(e),Ee(e)}function De(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),x&&e.ctrlKey&&1==t&&(t=3),t}var Oe,Ne,Fe=function(){if(a&&s<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Ie(e){if(null==Oe){var t=A("span","​");D(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Oe=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&s<8))}var n=Oe?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Pe(e){if(null!=Ne)return Ne;var t=D(e,document.createTextNode("AخA")),n=E(t,0,1).getBoundingClientRect(),i=E(t,1,2).getBoundingClientRect();return T(e),!(!n||n.left==n.right)&&(Ne=i.right-n.right<3)}var He,$e=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf("\n",t);-1==r&&(r=e.length);var o=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ze=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be="oncopy"in(He=A("div"))||(He.setAttribute("oncopy","return;"),"function"==typeof He.oncopy),We=null;function Re(e){if(null!=We)return We;var t=D(e,A("span","x")),n=t.getBoundingClientRect(),i=E(t,0,1).getBoundingClientRect();return We=Math.abs(n.left-i.left)>1}var je={},_e={};function Ye(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),je[e]=t}function Ue(e,t){_e[e]=t}function qe(e){if("string"==typeof e&&_e.hasOwnProperty(e))e=_e[e];else if(e&&"string"==typeof e.name&&_e.hasOwnProperty(e.name)){var t=_e[e.name];"string"==typeof t&&(t={name:t}),(e=ne(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return qe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return qe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Xe(e,t){t=qe(t);var n=je[t.name];if(!n)return Xe(e,"text/plain");var i=n(e,t);if(Ge.hasOwnProperty(t.name)){var r=Ge[t.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)i[a]=t.modeProps[a];return i}var Ge={};function Ve(e,t){W(t,Ge.hasOwnProperty(e)?Ge[e]:Ge[e]={})}function Ke(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Qe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ze(e,t,n){return!e.startState||e.startState(t,n)}var Je=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 et(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t=e.first&&tn?lt(n,et(e,n).text.length):gt(t,et(e,t.line).text.length)}function gt(e,t){var n=e.ch;return null==n||n>t?lt(e.line,t):n<0?lt(e.line,0):e}function vt(e,t){for(var n=[],i=0;i=this.string.length},Je.prototype.sol=function(){return this.pos==this.lineStart},Je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Je.prototype.next=function(){if(this.post},Je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Je.prototype.skipToEnd=function(){this.pos=this.string.length},Je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Je.prototype.backUp=function(e){this.pos-=e},Je.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},Je.prototype.current=function(){return this.string.slice(this.start,this.pos)},Je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Je.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var yt=function(e,t){this.state=e,this.lookAhead=t},xt=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 bt(e,t,n,i){var r=[e.state.modeGen],o={};Dt(e,t.text,e.doc.mode,n,(function(e,t){return r.push(e,t)}),o,i);for(var a=n.state,s=function(i){n.baseTokens=r;var s=e.state.overlays[i],l=1,u=0;n.state=!0,Dt(e,t.text,s.mode,n,(function(e,t){for(var n=l;ue&&r.splice(l,1,e,r[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(s.opaque)r.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;ne.options.maxHighlightLength&&Ke(e.doc.mode,i.state),o=bt(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function kt(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new xt(i,!0,t);var o=At(e,t,n),a=o>i.first&&et(i,o-1).stateAfter,s=a?xt.fromSaved(i,a,o):new xt(i,Ze(i.mode),o);return i.iter(o,t,(function(n){Ct(e,n.text,s);var i=s.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&it.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}xt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},xt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},xt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xt.fromSaved=function(e,t,n){return t instanceof yt?new xt(e,Ke(e.mode,t.state),n,t.lookAhead):new xt(e,Ke(e.mode,t),n)},xt.prototype.save=function(e){var t=!1!==e?Ke(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new yt(t,this.maxLookAhead):t};var Et=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Mt(e,t,n,i){var r,o,a=e.doc,s=a.mode,l=et(a,(t=mt(a,t)).line),u=kt(e,t.line,n),c=new Je(l.text,e.options.tabSize,u);for(i&&(o=[]);(i||c.pose.options.maxHighlightLength?(s=!1,a&&Ct(e,t,i,d.pos),d.pos=t.length,l=null):l=Tt(Lt(n,d,i.state,h),o),h){var f=h[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||c!=l){for(;ua;--s){if(s<=o.first)return o.first;var l=et(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof yt?u.lookAhead:0)<=o.modeFrontier))return s;var c=R(l.text,null,e.options.tabSize);(null==r||i>c)&&(r=s-1,i=c)}return r}function Ot(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;i--){var r=et(e,i).stateAfter;if(r&&(!(r instanceof yt)||i+r.lookAhead=t:o.to>t);(i||(i=[])).push(new Ht(a,o.from,s?null:o.to))}}return i}function Rt(e,t,n){var i;if(e)for(var r=0;r=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var x=0;x0)){var c=[l,1],d=ut(u.from,s.from),h=ut(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),r.splice.apply(r,c),l+=c.length-3}}return r}function Ut(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!n||Vt(n,o.marker)<0)&&(n=o.marker)}return n}function en(e,t,n,i,r){var o=et(e,t),a=Ft&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ut(u.to,n)>=0:ut(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ut(u.from,i)<=0:ut(u.from,i)<0)))return!0}}}function tn(e){for(var t;t=Qt(e);)e=t.find(-1,!0).line;return e}function nn(e){for(var t;t=Zt(e);)e=t.find(1,!0).line;return e}function rn(e){for(var t,n;t=Zt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function on(e,t){var n=et(e,t),i=tn(n);return n==i?t:rt(i)}function an(e,t){if(t>e.lastLine())return t;var n,i=et(e,t);if(!sn(e,i))return t;for(;n=Zt(i);)i=n.find(1,!0).line;return rt(i)+1}function sn(e,t){var n=Ft&&t.markedSpans;if(n)for(var i=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var hn=function(e,t,n){this.text=e,qt(this,t),this.height=n?n(this):1};function fn(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Ut(e),qt(e,n);var r=i?i(e):1;r!=e.height&&it(e,r)}function pn(e){e.parent=null,Ut(e)}hn.prototype.lineNo=function(){return rt(this)},Se(hn);var mn={},gn={};function vn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?gn:mn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function yn(e,t){var n=O("span",null,null,l?"padding-right: .1px":null),i={pre:O("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,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=bn,Pe(e.display.measure)&&(a=me(o,e.doc.direction))&&(i.addToken=kn(i.addToken,a)),i.map=[],Sn(o,i,wt(e,o,t!=e.display.externalMeasured&&rt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=P(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=P(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Ie(e.display.measure))),0==r?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var s=i.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=P(i.pre.className,i.textClass||"")),i}function xn(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function bn(e,t,n,i,r,o,l){if(t){var u,c=e.splitSpaces?wn(t,e.trailingSpace):t,d=e.cm.state.specialChars,h=!1;if(d.test(t)){u=document.createDocumentFragment();for(var f=0;;){d.lastIndex=f;var p=d.exec(t),m=p?p.index-f:t.length-f;if(m){var g=document.createTextNode(c.slice(f,f+m));a&&s<9?u.appendChild(A("span",[g])):u.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!p)break;f+=m+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,x=y-e.col%y;(v=u.appendChild(A("span",Q(x),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=x}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(A("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&s<9?u.appendChild(A("span",[v])):u.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),a&&s<9&&(h=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||i||r||h||o||l){var b=n||"";i&&(b+=i),r&&(b+=r);var w=A("span",[u],b,o);if(l)for(var k in l)l.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&w.setAttribute(k,l[k]);return e.content.appendChild(w)}e.content.appendChild(u)}}function wn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;ru&&d.from<=u);h++);if(d.to>=c)return e(n,i,r,o,a,s,l);e(n,i.slice(0,d.to-u),r,o,null,s,l),o=null,i=i.slice(d.to-u),u=d.to}}}function Cn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function Sn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(i)for(var a,s,l,u,c,d,h,f=r.length,p=0,m=1,g="",v=0;;){if(v==p){l=u=c=s="",h=null,d=null,v=1/0;for(var y=[],x=void 0,b=0;bp||k.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),k.className&&(l+=" "+k.className),k.css&&(s=(s?s+";":"")+k.css),k.startStyle&&w.from==p&&(c+=" "+k.startStyle),k.endStyle&&w.to==v&&(x||(x=[])).push(k.endStyle,w.to),k.title&&((h||(h={})).title=k.title),k.attributes)for(var C in k.attributes)(h||(h={}))[C]=k.attributes[C];k.collapsed&&(!d||Vt(d.marker,k)<0)&&(d=w)}else w.from>p&&v>w.from&&(v=w.from)}if(x)for(var S=0;S=f)break;for(var E=Math.min(f,v);;){if(g){var M=p+g.length;if(!d){var T=M>E?g.slice(0,E-p):g;t.addToken(t,T,a?a+l:l,c,p+T.length==v?u:"",s,h)}if(M>=E){g=g.slice(E-p),p=E;break}p=M,c=""}g=r.slice(o,o=n[m++]),a=vn(n[m++],t.cm.options)}}else for(var D=1;D2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function ti(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var i=0;in)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}}function ni(e,t){var n=rt(t=tn(t)),i=e.display.externalMeasured=new Ln(e.doc,t,n);i.lineN=n;var r=i.built=yn(e,i);return i.text=r.pre,D(e.display.lineMeasure,r.pre),i}function ii(e,t,n,i){return ai(e,oi(e,t),n,i)}function ri(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(r=(o=l-s)-1,t>=l&&(a="right")),null!=r){if(i=e[u+2],s==l&&n==(i.insertLeft?"left":"right")&&(a=n),"left"==n&&0==r)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[2+(u-=3)],a="left";if("right"==n&&r==l-s)for(;u=0&&(n=e[r]).left==n.right;r--);return n}function di(e,t,n,i){var r,o=ui(t.map,n,i),l=o.node,u=o.start,c=o.end,d=o.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;u&&le(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c0&&(d=i="right"),r=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==i?f.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!u&&(!r||!r.left&&!r.right)){var p=l.parentNode.getClientRects()[0];r=p?{left:p.left,right:p.left+Fi(e.display),top:p.top,bottom:p.bottom}:li}for(var m=r.top-t.rect.top,g=r.bottom-t.rect.top,v=(m+g)/2,y=t.view.measure.heights,x=0;x=i.text.length?(l=i.text.length,u="before"):l<=0&&(l=0,u="after"),!s)return a("before"==u?l-1:l,"before"==u);function c(e,t,n){return a(n?e-1:e,1==s[t].level!=n)}var d=fe(s,l,u),h=he,f=c(l,d,"before"==u);return null!=h&&(f.other=c(l,h,"before"!=u)),f}function Ci(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=Fi(e.display)*t.ch);var i=et(e.doc,t.line),r=un(i)+Gn(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Si(e,t,n,i,r){var o=lt(e,t,n);return o.xRel=r,i&&(o.outside=i),o}function Li(e,t,n){var i=e.doc;if((n+=e.display.viewOffset)<0)return Si(i.first,0,null,-1,-1);var r=ot(i,n),o=i.first+i.size-1;if(r>o)return Si(i.first+i.size-1,et(i,o).text.length,null,1,1);t<0&&(t=0);for(var a=et(i,r);;){var s=Di(e,a,r,t,n),l=Jt(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=et(i,r=u.line)}}function Ei(e,t,n,i){i-=yi(t);var r=t.text.length,o=ce((function(t){return ai(e,n,t-1).bottom<=i}),r,0);return{begin:o,end:r=ce((function(t){return ai(e,n,t).top>i}),o,r)}}function Mi(e,t,n,i){return n||(n=oi(e,t)),Ei(e,t,n,xi(e,t,ai(e,n,i),"line").top)}function Ti(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function Di(e,t,n,i,r){r-=un(t);var o=oi(e,t),a=yi(t),s=0,l=t.text.length,u=!0,c=me(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?Oi:Ai)(e,t,n,o,c,i,r);s=(u=1!=d.level)?d.from:d.to-1,l=u?d.to:d.from-1}var h,f,p=null,m=null,g=ce((function(t){var n=ai(e,o,t);return n.top+=a,n.bottom+=a,!!Ti(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=t,m=n),!0)}),s,l),v=!1;if(m){var y=i-m.left=b.bottom?1:0}return Si(n,g=ue(t.text,g,1),f,v,i-h)}function Ai(e,t,n,i,r,o,a){var s=ce((function(s){var l=r[s],u=1!=l.level;return Ti(ki(e,lt(n,u?l.to:l.from,u?"before":"after"),"line",t,i),o,a,!0)}),0,r.length-1),l=r[s];if(s>0){var u=1!=l.level,c=ki(e,lt(n,u?l.from:l.to,u?"after":"before"),"line",t,i);Ti(c,o,a,!0)&&c.top>a&&(l=r[s-1])}return l}function Oi(e,t,n,i,r,o,a){var s=Ei(e,t,i,a),l=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,d=null,h=0;h=u||f.to<=l)){var p=ai(e,i,1!=f.level?Math.min(u,f.to)-1:Math.max(l,f.from)).right,m=pm)&&(c=f,d=m)}}return c||(c=r[r.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function Ni(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==si){si=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)si.appendChild(document.createTextNode("x")),si.appendChild(A("br"));si.appendChild(document.createTextNode("x"))}D(e.measure,si);var n=si.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),T(e.measure),n||1}function Fi(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),n=A("pre",[t],"CodeMirror-line-like");D(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function Ii(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,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:Pi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function Pi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Hi(e){var t=Ni(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Fi(e.display)-3);return function(r){if(sn(e.doc,r))return 0;var o=0;if(r.widgets)for(var a=0;a0&&(l=et(e.doc,u.line).text).length==u.ch){var c=R(l,l.length,e.options.tabSize)-l.length;u=lt(u.line,Math.max(0,Math.round((o-Kn(e.display).left)/Fi(e.display))-c))}return u}function Bi(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,i=0;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Ft&&on(e.doc,t)r.viewFrom?ji(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)ji(e);else if(t<=r.viewFrom){var o=_i(e,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):ji(e)}else if(n>=r.viewTo){var a=_i(e,t,t,-1);a?(r.view=r.view.slice(0,a.index),r.viewTo=a.lineN):ji(e)}else{var s=_i(e,t,t,-1),l=_i(e,n,n+i,1);s&&l?(r.view=r.view.slice(0,s.index).concat(En(e,s.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):ji(e)}var u=r.externalMeasured;u&&(n=r.lineN&&t=i.viewTo)){var o=i.view[Bi(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==_(a,n)&&a.push(n)}}}function ji(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function _i(e,t,n,i){var r,o=Bi(e,t),a=e.display.view;if(!Ft||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,l=0;l0){if(o==a.length-1)return null;r=s+a[o].size-t,o++}else r=s-t;t+=r,n+=r}for(;on(e.doc,n)!=n;){if(o==(i<0?0:a.length-1))return null;n+=i*a[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function Yi(e,t,n){var i=e.display;0==i.view.length||t>=i.viewTo||n<=i.viewFrom?(i.view=En(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=En(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,Bi(e,n)))),i.viewTo=n}function Ui(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||l.to().line0?a:e.defaultCharWidth())+"px"}if(i.other){var s=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=i.other.left+"px",s.style.top=i.other.top+"px",s.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Vi(e,t){return e.top-t.top||e.left-t.left}function Ki(e,t,n){var i=e.display,r=e.doc,o=document.createDocumentFragment(),a=Kn(e.display),s=a.left,l=Math.max(i.sizerWidth,Zn(e)-i.sizer.offsetLeft)-a.right,u="ltr"==r.direction;function c(e,t,n,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?l-e:n)+"px;\n height: "+(i-t)+"px"))}function d(t,n,i){var o,a,d=et(r,t),h=d.text.length;function f(n,i){return wi(e,lt(t,n),"div",d,i)}function p(t,n,i){var r=Mi(e,d,null,t),o="ltr"==n==("after"==i)?"left":"right";return f("after"==i?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1),o)[o]}var m=me(d,r.direction);return de(m,n||0,null==i?h:i,(function(e,t,r,d){var g="ltr"==r,v=f(e,g?"left":"right"),y=f(t-1,g?"right":"left"),x=null==n&&0==e,b=null==i&&t==h,w=0==d,k=!m||d==m.length-1;if(y.top-v.top<=3){var C=(u?b:x)&&k,S=(u?x:b)&&w?s:(g?v:y).left,L=C?l:(g?y:v).right;c(S,v.top,L-S,v.bottom)}else{var E,M,T,D;g?(E=u&&x&&w?s:v.left,M=u?l:p(e,r,"before"),T=u?s:p(t,r,"after"),D=u&&b&&k?l:y.right):(E=u?p(e,r,"before"):s,M=!u&&x&&w?l:v.right,T=!u&&b&&k?s:y.left,D=u?p(t,r,"after"):l),c(E,v.top,M-E,v.bottom),v.bottom0?t.blinker=setInterval((function(){e.hasFocus()||tr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Zi(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||er(e))}function Ji(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&tr(e))}),100)}function er(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),Qi(e))}function tr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,M(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function nr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=Math.max(0,t.scroller.getBoundingClientRect().top),r=t.lineDiv.getBoundingClientRect().top,o=0,l=0;l.005||m<-.005)&&(re.display.sizerWidth){var v=Math.ceil(h/Fi(e.display));v>e.display.maxLineLength&&(e.display.maxLineLength=v,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function ir(e){if(e.widgets)for(var t=0;t=a&&(o=ot(t,un(et(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function or(e,t){if(!we(e,"scrollCursorIntoView")){var n=e.display,i=n.sizer.getBoundingClientRect(),r=null,o=n.wrapper.ownerDocument;if(t.top+i.top<0?r=!0:t.bottom+i.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(r=!1),null!=r&&!m){var a=A("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Gn(e.display))+"px;\n height: "+(t.bottom-t.top+Qn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(r),e.display.lineSpace.removeChild(a)}}}function ar(e,t,n,i){var r;null==i&&(i=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?lt(t.line,t.ch+1,"before"):t,t=t.ch?lt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,s=ki(e,t),l=n&&n!=t?ki(e,n):s,u=lr(e,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}),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=u.scrollTop&&(mr(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(vr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return r}function sr(e,t){var n=lr(e,t);null!=n.scrollTop&&mr(e,n.scrollTop),null!=n.scrollLeft&&vr(e,n.scrollLeft)}function lr(e,t){var n=e.display,i=Ni(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Jn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Vn(n),l=t.tops-i;if(t.topr+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=r&&(a.scrollTop=c)}var d=e.options.fixedGutter?0:n.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-d,f=Zn(e)-n.gutters.offsetWidth,p=t.right-t.left>f;return p&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.leftf+h-3&&(a.scrollLeft=t.right+(p?0:10)-f),a}function ur(e,t){null!=t&&(fr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function cr(e){fr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function dr(e,t,n){null==t&&null==n||fr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function hr(e,t){fr(e),e.curOp.scrollToPos=t}function fr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,pr(e,Ci(e,t.from),Ci(e,t.to),t.margin))}function pr(e,t,n,i){var r=lr(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});dr(e,r.scrollLeft,r.scrollTop)}function mr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||qr(e,{top:t}),gr(e,t,!0),n&&qr(e),zr(e,100))}function gr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function vr(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,Kr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function yr(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+Vn(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+Qn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var i=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),ve(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),ve(r,"scroll",(function(){r.clientWidth&&t(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,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.scrollTop=0,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";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=x&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new j,this.disableVert=new j},xr.prototype.enableZeroWidthBar=function(e,t,n){function i(){var r=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=e?e.style.visibility="hidden":t.set(1e3,i)}e.style.visibility="",t.set(1e3,i)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var br=function(){};function wr(e,t){t||(t=yr(e));var n=e.display.barWidth,i=e.display.barHeight;kr(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&nr(e),kr(e,yr(e)),n=e.display.barWidth,i=e.display.barHeight}function kr(e,t){var n=e.display,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",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",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"):n.gutterFiller.style.display=""}br.prototype.update=function(){return{bottom:0,right:0}},br.prototype.setScrollLeft=function(){},br.prototype.setScrollTop=function(){},br.prototype.clear=function(){};var Cr={native:xr,null:br};function Sr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Cr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ve(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?vr(e,t):mr(e,t)}),e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Lr=0;function Er(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Lr,markArrays:null},Tn(e.curOp)}function Mr(e){var t=e.curOp;t&&An(t,(function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Wr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ar(e){e.updatedDisplay=e.mustUpdate&&Yr(e.cm,e.update)}function Or(e){var t=e.cm,n=t.display;e.updatedDisplay&&nr(t),e.barMeasure=yr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ii(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+Qn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Zn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Nr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,i=kt(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(i.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?Ke(t.mode,i.state):null,l=bt(e,o,i,!0);s&&(i.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!d&&hn)return zr(e,e.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&Ir(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ui(e))return!1;Qr(e)&&(ji(e),t.dims=Ii(e));var r=i.first+i.size,o=Math.max(t.visible.from-e.options.viewportMargin,i.first),a=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(r,n.viewTo)),Ft&&(o=on(e.doc,o),a=an(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Yi(e,o,a),n.viewOffset=un(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=Ui(e);if(!s&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=jr(e);return l>4&&(n.lineDiv.style.display="none"),Xr(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,_r(u),T(n.cursorDiv),T(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,zr(e,400)),n.updateLineNumbers=null,!0}function Ur(e,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Zn(e))i&&(t.visible=rr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Vn(e.display)-Jn(e),n.top)}),t.visible=rr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Yr(e,t))break;nr(e);var r=yr(e);qi(e),wr(e,r),Vr(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function qr(e,t){var n=new Wr(e,t);if(Yr(e,n)){nr(e),Ur(e,n);var i=yr(e);qi(e),wr(e,i),Vr(e,i),n.finish()}}function Xr(e,t,n){var i=e.display,r=e.options.lineNumbers,o=i.lineDiv,a=o.firstChild;function s(t){var n=t.nextSibling;return l&&x&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=i.view,c=i.viewFrom,d=0;d-1&&(f=!1),In(e,h,c,n)),f&&(T(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(st(e.options,c)))),a=h.node.nextSibling}else{var p=jn(e,h,c,n);o.insertBefore(p,a)}c+=h.size}for(;a;)a=s(a)}function Gr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Nn(e,"gutterChanged",e)}function Vr(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+Qn(e)+"px"}function Kr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=Pi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,o=i+"px",a=0;a=105&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),a&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),l||n&&y||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Zr(r.gutters,r.lineNumbers),Jr(o),i.init(o)}Wr.prototype.signal=function(e,t){Ce(e,t)&&this.events.push(arguments)},Wr.prototype.finish=function(){for(var e=0;eu.clientWidth,p=u.scrollHeight>u.clientHeight;if(r&&f||o&&p){if(o&&x&&l)e:for(var m=t.target,g=s.view;m!=u;m=m.parentNode)for(var v=0;v=0&&ut(e,i.to())<=0)return n}return-1};var lo=function(e,t){this.anchor=e,this.head=t};function uo(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort((function(e,t){return ut(e.from(),t.from())})),n=_(t,r);for(var o=1;o0:l>=0){var u=ft(s.from(),a.from()),c=ht(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,t.splice(--o,2,new lo(d?c:u,d?u:c))}}return new so(t,n)}function co(e,t){return new so([new lo(e,t||e)],0)}function ho(e){return e.text?lt(e.from.line+e.text.length-1,Z(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function fo(e,t){if(ut(e,t.from)<0)return e;if(ut(e,t.to)<=0)return ho(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=ho(t).ch-t.to.ch),lt(n,i)}function po(e,t){for(var n=[],i=0;i1&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}Nn(e,"change",e,t)}function wo(e,t,n){function i(e,r,o){if(e.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Z(e.done)):void 0}function Do(e,t,n,i){var r=e.history;r.undone.length=0;var o,a,s=+new Date;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&r.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=To(r,r.lastOp==i)))a=Z(o.changes),0==ut(t.from,t.to)&&0==ut(t.from,a.to)?a.to=ho(t):o.changes.push(Eo(e,t));else{var l=Z(r.done);for(l&&l.ranges||No(e.sel,r.done),o={changes:[Eo(e,t)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,a||be(e,"historyAdded")}function Ao(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 Oo(e,t,n,i){var r=e.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||Ao(e,o,Z(r.done),t))?r.done[r.done.length-1]=t:No(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&!1!==i.clearRedo&&Mo(r.undone)}function No(e,t){var n=Z(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fo(e,t,n,i){var r=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),(function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Io(e){if(!e)return null;for(var t,n=0;n-1&&(Z(s)[d]=u[d],delete u[d])}}}return i}function zo(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ut(t,r)<0;o!=ut(n,r)<0?(r=t,t=n):o!=ut(t,n)<0&&(t=n)}return new lo(r,t)}return new lo(n||t,t)}function Bo(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),Uo(e,new so([zo(e.sel.primary(),t,n,r)],0),i)}function Wo(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(r&&(be(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var d=l.find(i<0?1:-1),h=void 0;if((i<0?c:u)&&(d=Zo(e,d,-i,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(h=ut(d,n))&&(i<0?h<0:h>0))return Ko(e,d,t,i,r)}var f=l.find(i<0?-1:1);return(i<0?u:c)&&(f=Zo(e,f,i,f.line==t.line?o:null)),f?Ko(e,f,t,i,r):null}}return t}function Qo(e,t,n,i,r){var o=i||1,a=Ko(e,t,n,o,r)||!r&&Ko(e,t,n,o,!0)||Ko(e,t,n,-o,r)||!r&&Ko(e,t,n,-o,!0);return a||(e.cantEdit=!0,lt(e.first,0))}function Zo(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?mt(e,lt(t.line-1)):null:n>0&&t.ch==(i||et(e,t.line)).text.length?t.line=0;--r)na(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else na(e,t)}}function na(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ut(t.from,t.to)){var n=po(e,t);Do(e,t,n,e.cm?e.cm.curOp.id:NaN),oa(e,t,n,jt(e,t));var i=[];wo(e,(function(e,n){n||-1!=_(i,e.history)||(ca(e.history,t),i.push(e.history)),oa(e,t,null,jt(e,t))}))}}function ia(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,o=e.history,a=e.sel,s="undo"==t?o.done:o.undone,l="undo"==t?o.undone:o.done,u=0;u=0;--f){var p=h(f);if(p)return p.v}}}}function ra(e,t){if(0!=t&&(e.first+=t,e.sel=new so(J(e.sel.ranges,(function(e){return new lo(lt(e.anchor.line+t,e.anchor.ch),lt(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){Wi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())){if(t.from.lineo&&(t={from:t.from,to:lt(o,et(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=tt(e,t.from,t.to),n||(n=po(e,t)),e.cm?aa(e.cm,t,i):bo(e,t,i),qo(e,n,q),e.cantEdit&&Qo(e,lt(e.firstLine(),0))&&(e.cantEdit=!1)}}function aa(e,t,n){var i=e.doc,r=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=rt(tn(et(i,o.line))),i.iter(l,a.line+1,(function(e){if(e==r.maxLine)return s=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&ke(e),bo(i,t,n,Hi(e)),e.options.lineWrapping||(i.iter(l,o.line+t.text.length,(function(e){var t=cn(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,s=!1)})),s&&(e.curOp.updateMaxLine=!0)),Ot(i,o.line),zr(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Wi(e):o.line!=a.line||1!=t.text.length||xo(e.doc,t)?Wi(e,o.line,a.line+1,u):Ri(e,o.line,"text");var c=Ce(e,"changes"),d=Ce(e,"change");if(d||c){var h={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&Nn(e,"change",e,h),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function sa(e,t,n,i,r){var o;i||(i=n),ut(i,n)<0&&(n=(o=[i,n])[0],i=o[1]),"string"==typeof t&&(t=e.splitLines(t)),ta(e,{from:n,to:i,text:t,origin:r})}function la(e,t,n,i){n1||!(this.children[0]instanceof ha))){var s=[];this.collapse(s),this.children=[new ha(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=r.lines.length%25+25,s=a;s10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;i0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(en(e,t.line,t,n,o)||t.line!=n.line&&en(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pt()}o.addToHistory&&Do(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,n.line+1,(function(i){u&&o.collapsed&&!u.options.lineWrapping&&tn(i)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&it(i,0),Bt(i,new Ht(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){sn(e,t)&&it(t,0)})),o.clearOnEnter&&ve(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(It(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++va,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Wi(u,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Ri(u,c,"text");o.atomic&&Go(u.doc),Nn(u,"markerAdded",u,o)}return o}ya.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Er(e),Ce(this,"clear")){var n=this.find();n&&Nn(this,"clear",n.from,n.to)}for(var i=null,r=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&Wi(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Nn(e,"markerCleared",e,this,i,r),t&&Mr(e),this.parent&&this.parent.clear()}},ya.prototype.find=function(e,t){var n,i;null==e&&"bookmark"==this.type&&(e=1);for(var r=0;r=0;l--)ta(this,i[l]);s?Yo(this,s):this.cm&&cr(this.cm)})),undo:$r((function(){ia(this,"undo")})),redo:$r((function(){ia(this,"redo")})),undoSelection:$r((function(){ia(this,"undo",!0)})),redoSelection:$r((function(){ia(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=mt(this,e),t=mt(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&r!=e.line||null!=l.from&&r==t.line&&l.from>=t.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r})),i},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var i=0;ie)return t=e,!0;e-=o,++n})),mt(this,lt(n,t))},indexFromPos:function(e){var t=(e=mt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var d=e.dataTransfer.getData("Text");if(d){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),qo(t.doc,co(n,n)),h)for(var f=0;f=0;t--)sa(e.doc,"",i[t].from,i[t].to,"+delete");cr(e)}))}function Ka(e,t,n){var i=ue(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Qa(e,t,n){var i=Ka(e,t.ch,n);return null==i?null:new lt(t.line,i,n<0?"after":"before")}function Za(e,t,n,i,r){if(e){"rtl"==t.doc.direction&&(r=-r);var o=me(n,t.doc.direction);if(o){var a,s=r<0?Z(o):o[0],l=r<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=oi(t,n);a=r<0?n.text.length-1:0;var c=ai(t,u,a).top;a=ce((function(e){return ai(t,u,e).top==c}),r<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=Ka(n,a,1))}else a=r<0?s.to:s.from;return new lt(i,a,l)}}return new lt(i,r<0?n.text.length:0,r<0?"before":"after")}function Ja(e,t,n,i){var r=me(t,e.doc.direction);if(!r)return Qa(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=fe(r,n.ch,n.sticky),a=r[o];if("ltr"==e.doc.direction&&a.level%2==0&&(i>0?a.to>n.ch:a.from=a.from&&h>=c.begin)){var f=d?"before":"after";return new lt(n.line,h,f)}}var p=function(e,t,i){for(var o=function(e,t){return t?new lt(n.line,l(e,1),"before"):new lt(n.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?i.begin:l(i.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==g||i>0&&g==t.text.length||!(m=p(i>0?0:r.length-1,i,u(g)))?null:m}Ra.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"},Ra.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"},Ra.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"},Ra.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"]},Ra.default=x?Ra.macDefault:Ra.pcDefault;var es={selectAll:Jo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(e){return Va(e,(function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)r=new lt(r.line,r.ch+1),e.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),lt(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var a=et(e.doc,r.line-1).text;a&&(r=new lt(r.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),lt(r.line-1,a.length-1),r,"+transpose"))}n.push(new lo(r,r))}e.setSelections(n)}))},newlineAndIndent:function(e){return Ir(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i-1&&(ut((r=s.ranges[r]).from(),t)<0||t.xRel>0)&&(ut(r.to(),t)>0||t.xRel<0)?Ls(e,i,t,o):Ms(e,i,t,o)}function Ls(e,t,n,i){var r=e.display,o=!1,u=Pr(e,(function(t){l&&(r.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ji(e)),xe(r.wrapper.ownerDocument,"mouseup",u),xe(r.wrapper.ownerDocument,"mousemove",c),xe(r.scroller,"dragstart",d),xe(r.scroller,"drop",u),o||(Le(t),i.addNew||Bo(e.doc,n,null,null,i.extend),l&&!f||a&&9==s?setTimeout((function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()}),20):r.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};l&&(r.scroller.draggable=!0),e.state.draggingText=u,u.copy=!i.moveOnDrag,ve(r.wrapper.ownerDocument,"mouseup",u),ve(r.wrapper.ownerDocument,"mousemove",c),ve(r.scroller,"dragstart",d),ve(r.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return r.input.focus()}),20),r.scroller.dragDrop&&r.scroller.dragDrop()}function Es(e,t,n){if("char"==n)return new lo(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new lo(lt(t.line,0),mt(e.doc,lt(t.line+1,0)));var i=n(e,t);return new lo(i.from,i.to)}function Ms(e,t,n,i){a&&Ji(e);var r=e.display,o=e.doc;Le(t);var s,l,u=o.sel,c=u.ranges;if(i.addNew&&!i.extend?(l=o.sel.contains(n),s=l>-1?c[l]:new lo(n,n)):(s=o.sel.primary(),l=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(s=new lo(n,n)),n=zi(e,t,!0,!0),l=-1;else{var d=Es(e,n,i.unit);s=i.extend?zo(s,d.anchor,d.head,i.extend):d}i.addNew?-1==l?(l=c.length,Uo(o,uo(e,c.concat([s]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==i.unit&&!i.extend?(Uo(o,uo(e,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Ro(o,l,s,X):(l=0,Uo(o,new so([s],0),X),u=o.sel);var h=n;function f(t){if(0!=ut(h,t))if(h=t,"rectangle"==i.unit){for(var r=[],a=e.options.tabSize,c=R(et(o,n.line).text,n.ch,a),d=R(et(o,t.line).text,t.ch,a),f=Math.min(c,d),p=Math.max(c,d),m=Math.min(n.line,t.line),g=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=g;m++){var v=et(o,m).text,y=V(v,f,a);f==p?r.push(new lo(lt(m,y),lt(m,y))):v.length>y&&r.push(new lo(lt(m,y),lt(m,V(v,p,a))))}r.length||r.push(new lo(n,n)),Uo(o,uo(e,u.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,b=s,w=Es(e,t,i.unit),k=b.anchor;ut(w.anchor,k)>0?(x=w.head,k=ft(b.from(),w.anchor)):(x=w.anchor,k=ht(b.to(),w.head));var C=u.ranges.slice(0);C[l]=Ts(e,new lo(mt(o,k),x)),Uo(o,uo(e,C,l),X)}}var p=r.wrapper.getBoundingClientRect(),m=0;function g(t){var n=++m,a=zi(e,t,!0,"rectangle"==i.unit);if(a)if(0!=ut(a,h)){e.curOp.focus=F($(e)),f(a);var s=rr(r,o);(a.line>=s.to||a.linep.bottom?20:0;l&&setTimeout(Pr(e,(function(){m==n&&(r.scroller.scrollTop+=l,g(t))})),50)}}function v(t){e.state.selectingText=!1,m=1/0,t&&(Le(t),r.input.focus()),xe(r.wrapper.ownerDocument,"mousemove",y),xe(r.wrapper.ownerDocument,"mouseup",x),o.history.lastSelOrigin=null}var y=Pr(e,(function(e){0!==e.buttons&&Ae(e)?g(e):v(e)})),x=Pr(e,v);e.state.selectingText=x,ve(r.wrapper.ownerDocument,"mousemove",y),ve(r.wrapper.ownerDocument,"mouseup",x)}function Ts(e,t){var n=t.anchor,i=t.head,r=et(e.doc,n.line);if(0==ut(n,i)&&n.sticky==i.sticky)return t;var o=me(r);if(!o)return t;var a=fe(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var l,u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=fe(o,i.ch,i.sticky),d=c-a||(i.ch-n.ch)*(1==s.level?-1:1);l=c==u-1||c==u?d<0:d>0}var h=o[u+(l?-1:0)],f=l==(1==h.level),p=f?h.from:h.to,m=f?"after":"before";return n.ch==p&&n.sticky==m?t:new lo(new lt(n.line,p,m),i)}function Ds(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!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&Le(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ce(e,n))return Me(t);o-=s.top-a.viewOffset;for(var l=0;l=r)return be(e,n,e,ot(e.doc,o),e.display.gutterSpecs[l].className,t),Me(t)}}function As(e,t){return Ds(e,t,"gutterClick",!0)}function Os(e,t){Xn(e.display,t)||Ns(e,t)||we(e,t,"contextmenu")||S||e.display.input.onContextMenu(t)}function Ns(e,t){return!!Ce(e,"gutterContextMenu")&&Ds(e,t,"gutterContextMenu",!1)}function Fs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),mi(e)}xs.prototype.compare=function(e,t,n){return this.time+ys>e&&0==ut(t,this.pos)&&n==this.button};var Is={toString:function(){return"CodeMirror.Init"}},Ps={},Hs={};function $s(e){var t=e.optionHandlers;function n(n,i,r,o){e.defaults[n]=i,r&&(t[n]=o?function(e,t,n){n!=Is&&r(e,t,n)}:r)}e.defineOption=n,e.Init=Is,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,vo(e)}),!0),n("indentUnit",2,vo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){yo(e),mi(e),Wi(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter((function(e){for(var r=0;;){var o=e.text.indexOf(t,r);if(-1==o)break;r=o+t.length,n.push(lt(i,o))}i++}));for(var r=n.length-1;r>=0;r--)sa(e.doc,t,n[r],lt(n[r].line,n[r].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Is&&e.refresh()})),n("specialCharPlaceholder",xn,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",y?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){Fs(e),eo(e)}),!0),n("keyMap","default",(function(e,t,n){var i=Ga(t),r=n!=Is&&Ga(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Bs,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=Zr(t,e.options.lineNumbers),eo(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?Pi(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return wr(e)}),!0),n("scrollbarStyle","native",(function(e){Sr(e),wr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=Zr(e.options.gutters,t),eo(e)}),!0),n("firstLineNumber",1,eo,!0),n("lineNumberFormatter",(function(e){return e}),eo,!0),n("showCursorWhenSelecting",!1,qi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(tr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,zs),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,qi,!0),n("singleCursorHeightPerLine",!0,qi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,yo,!0),n("addModeClass",!1,yo,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,yo,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}function zs(e,t,n){if(!t!=!(n&&n!=Is)){var i=e.display.dragFunctions,r=t?ve:xe;r(e.display.scroller,"dragstart",i.start),r(e.display.scroller,"dragenter",i.enter),r(e.display.scroller,"dragover",i.over),r(e.display.scroller,"dragleave",i.leave),r(e.display.scroller,"drop",i.drop)}}function Bs(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(M(e.display.wrapper,"CodeMirror-wrap"),dn(e)),$i(e),Wi(e),mi(e),setTimeout((function(){return wr(e)}),100)}function Ws(e,t){var n=this;if(!(this instanceof Ws))return new Ws(e,t);this.options=t=t?W(t):{},W(Ps,t,!1);var i=t.value;"string"==typeof i?i=new Ea(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new Ws.inputStyles[t.inputStyle](this),o=this.display=new to(e,i,r,t);for(var u in o.wrapper.CodeMirror=this,Fs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Sr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new j,keySeq:null,specialChars:null},t.autofocus&&!y&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Rs(this),Ia(),Er(this),this.curOp.forceUpdate=!0,ko(this,i),t.autofocus&&!y||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&er(n)}),20):tr(this),Hs)Hs.hasOwnProperty(u)&&Hs[u](this,t[u],Is);Qr(this),t.finishInit&&t.finishInit(this);for(var c=0;c400}ve(t.scroller,"touchstart",(function(r){if(!we(e,r)&&!o(r)&&!As(e,r)){t.input.ensurePolled(),clearTimeout(n);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-i.end<=300?i:null},1==r.touches.length&&(t.activeTouch.left=r.touches[0].pageX,t.activeTouch.top=r.touches[0].pageY)}})),ve(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),ve(t.scroller,"touchend",(function(n){var i=t.activeTouch;if(i&&!Xn(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!i.prev||l(i,i.prev)?new lo(a,a):!i.prev.prev||l(i,i.prev.prev)?e.findWordAt(a):new lo(lt(a.line,0),mt(e.doc,lt(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Le(n)}r()})),ve(t.scroller,"touchcancel",r),ve(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(mr(e,t.scroller.scrollTop),vr(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))})),ve(t.scroller,"mousewheel",(function(t){return ao(e,t)})),ve(t.scroller,"DOMMouseScroll",(function(t){return ao(e,t)})),ve(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){we(e,t)||Te(t)},over:function(t){we(e,t)||(Aa(e,t),Te(t))},start:function(t){return Da(e,t)},drop:Pr(e,Ta),leave:function(t){we(e,t)||Oa(e)}};var u=t.input.getField();ve(u,"keyup",(function(t){return ps.call(e,t)})),ve(u,"keydown",Pr(e,hs)),ve(u,"keypress",Pr(e,ms)),ve(u,"focus",(function(t){return er(e,t)})),ve(u,"blur",(function(t){return tr(e,t)}))}Ws.defaults=Ps,Ws.optionHandlers=Hs;var js=[];function _s(e,t,n,i){var r,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=kt(e,t).state:n="prev");var a=e.options.tabSize,s=et(o,t),l=R(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(i||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(r,s.text.slice(c.length),s.text))==U||u>150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?R(et(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(u/a);f;--f)h+=a,d+="\t";if(ha,l=$e(t),u=null;if(s&&i.ranges.length>1)if(Ys&&Ys.text.join("\n")==t){if(i.ranges.length%Ys.text.length==0){u=[];for(var c=0;c=0;h--){var f=i.ranges[h],p=f.from(),m=f.to();f.empty()&&(n&&n>0?p=lt(p.line,p.ch-n):e.state.overwrite&&!s?m=lt(m.line,Math.min(et(o,m.line).text.length,m.ch+Z(l).length)):s&&Ys&&Ys.lineWise&&Ys.text.join("\n")==l.join("\n")&&(p=m=lt(p.line,0)));var g={from:p,to:m,text:u?u[h%u.length]:l,origin:r||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};ta(e.doc,g),Nn(e,"inputRead",e,g)}t&&!s&&Gs(e,t),cr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Xs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||Ir(t,(function(){return qs(t,n,0,null,"paste")})),!0}function Gs(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,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)){var o=e.getModeAt(r.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=_s(e,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(et(e.doc,r.head.line).text.slice(0,r.head.ch))&&(a=_s(e,r.head.line,"smart"));a&&Nn(e,"electricInput",e,r.head.line)}}}function Vs(e){for(var t=[],n=[],i=0;in&&(_s(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex&&cr(this));else{var o=r.from(),a=r.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l0&&Ro(this.doc,i,new lo(o,u[i].to()),q)}}})),getTokenAt:function(e,t){return Mt(this,e,t)},getLineTokens:function(e,t){return Mt(this,lt(e),t,!0)},getTokenTypeAt:function(e){e=mt(this.doc,e);var t,n=wt(this,et(this.doc,e.line)),i=0,r=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=i+r>>1;if((a?n[2*a-1]:0)>=o)r=a;else{if(!(n[2*a+1]o&&(e=o,r=!0),i=et(this.doc,e)}else i=e;return xi(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-un(i):0)},defaultTextHeight:function(){return Ni(this.display)},defaultCharWidth:function(){return Fi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display,a=(e=ki(this,mt(this.doc,e))).bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==i)a=e.top;else if("above"==i||"near"==i){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==r?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&sr(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Hr(hs),triggerOnKeyPress:Hr(ms),triggerOnKeyUp:ps,triggerOnMouseDown:Hr(ws),execCommand:function(e){if(es.hasOwnProperty(e))return es[e].call(null,this)},triggerElectric:Hr((function(e){Gs(this,e)})),findPosH:function(e,t,n,i){var r=1;t<0&&(r=-1,t=-t);for(var o=mt(this.doc,e),a=0;a0&&a(t.charAt(n-1));)--n;for(;i.5||this.options.lineWrapping)&&$i(this),be(this,"refresh",this)})),swapDoc:Hr((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,e),mi(this),this.display.input.reset(),dr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Nn(this,"swapDoc",this,t),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}},Se(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,o){e.registerHelper(t,i,o),n[t]._global.push({pred:r,val:o})}}function Js(e,t,n,i,r){var o=t,a=n,s=et(e,t.line),l=r&&"rtl"==e.direction?-n:n;function u(){var n=t.line+l;return!(n=e.first+e.size)&&(t=new lt(n,t.ch,t.sticky),s=et(e,n))}function c(o){var a;if("codepoint"==i){var c=s.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(c))a=null;else{var d=n>0?c>=55296&&c<56320:c>=56320&&c<57343;a=new lt(t.line,Math.max(0,Math.min(s.text.length,t.ch+n*(d?2:1))),-n)}}else a=r?Ja(e.cm,s,t,n):Qa(s,t,n);if(null==a){if(o||!u())return!1;t=Za(r,e.cm,s,t.line,l)}else t=a;return!0}if("char"==i||"codepoint"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var d=null,h="group"==i,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(n<0)||c(!p);p=!1){var m=s.text.charAt(t.ch)||"\n",g=oe(m,f)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||p||g||(g="s"),d&&d!=g){n<0&&(n=1,c(),t.sticky="after");break}if(g&&(d=g),n>0&&!c(!p))break}var v=Qo(e,t,o,a,!0);return ct(o,v)&&(v.hitSide=!0),v}function el(e,t,n,i){var r,o,a=e.doc,s=t.left;if("page"==i){var l=Math.min(e.display.wrapper.clientHeight,z(e).innerHeight||a(e).documentElement.clientHeight),u=Math.max(l-.5*Ni(e.display),3);r=(n>0?t.bottom:t.top)+n*u}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(;(o=Li(e,s,r)).outside;){if(n<0?r<=0:r>=a.height){o.hitSide=!0;break}r+=5*n}return o}var tl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new j,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function nl(e,t){var n=ri(e,t.line);if(!n||n.hidden)return null;var i=et(e.doc,t.line),r=ti(n,i,t.line),o=me(i,e.doc.direction),a="left";o&&(a=fe(o,t.ch)%2?"right":"left");var s=ui(r.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function il(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function rl(e,t){return t&&(e.bad=!0),e}function ol(e,t,n,i,r){var o="",a=!1,s=e.doc.lineSeparator(),l=!1;function u(e){return function(t){return t.id==e}}function c(){a&&(o+=s,l&&(o+=s),a=l=!1)}function d(e){e&&(c(),o+=e)}function h(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void d(n);var o,f=t.getAttribute("cm-marker");if(f){var p=e.findMarks(lt(i,0),lt(r+1,0),u(+f));return void(p.length&&(o=p[0].find(0))&&d(tt(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&c();for(var g=0;g=t.display.viewTo||o.line=t.display.viewFrom&&nl(t,r)||{node:l[0].measure.map[2],offset:0},c=o.linei.firstLine()&&(a=lt(a.line-1,et(i.doc,a.line-1).length)),s.ch==et(i.doc,s.line).text.length&&s.liner.viewTo-1)return!1;a.line==r.viewFrom||0==(e=Bi(i,a.line))?(t=rt(r.view[0].line),n=r.view[0].node):(t=rt(r.view[e].line),n=r.view[e-1].node.nextSibling);var l,u,c=Bi(i,s.line);if(c==r.view.length-1?(l=r.viewTo-1,u=r.lineDiv.lastChild):(l=rt(r.view[c+1].line)-1,u=r.view[c+1].node.previousSibling),!n)return!1;for(var d=i.doc.splitLines(ol(i,n,u,t,l)),h=tt(i.doc,lt(t,0),lt(l,et(i.doc,l).text.length));d.length>1&&h.length>1;)if(Z(d)==Z(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),t++}for(var f=0,p=0,m=d[0],g=h[0],v=Math.min(m.length,g.length);fa.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1);)f--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(f).replace(/\u200b+$/,"");var w=lt(t,f),k=lt(l,h.length?Z(h).length-p:0);return d.length>1||d[0]||ut(w,k)?(sa(i.doc,d,w,k,"+input"),!0):void 0},tl.prototype.ensurePolled=function(){this.forceCompositionEnd()},tl.prototype.reset=function(){this.forceCompositionEnd()},tl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},tl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},tl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Ir(this.cm,(function(){return Wi(e.cm)}))},tl.prototype.setUneditable=function(e){e.contentEditable="false"},tl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Pr(this.cm,qs)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},tl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},tl.prototype.onContextMenu=function(){},tl.prototype.resetPosition=function(){},tl.prototype.needsContentAttribute=!0;var ll=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new j,this.hasSelection=!1,this.composing=null,this.resetting=!1};function ul(e,t){if((t=t?W(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F(e.ownerDocument);t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function i(){e.value=s.getValue()}var r;if(e.form&&(ve(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var o=e.form;r=o.submit;try{var a=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,i(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(xe(e.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=r))}},e.style.display="none";var s=Ws((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return s}function cl(e){e.off=xe,e.on=ve,e.wheelEventPixels=oo,e.Doc=Ea,e.splitLines=$e,e.countColumn=R,e.findColumn=V,e.isWordChar=re,e.Pass=U,e.signal=be,e.Line=hn,e.changeEnd=ho,e.scrollbarModel=Cr,e.Pos=lt,e.cmpPos=ut,e.modes=je,e.mimeModes=_e,e.resolveMode=qe,e.getMode=Xe,e.modeExtensions=Ge,e.extendMode=Ve,e.copyState=Ke,e.startState=Ze,e.innerMode=Qe,e.commands=es,e.keyMap=Ra,e.keyName=Xa,e.isModifierKey=Ua,e.lookupKey=Ya,e.normalizeKeyMap=_a,e.StringStream=Je,e.SharedTextMarker=ba,e.TextMarker=ya,e.LineWidget=pa,e.e_preventDefault=Le,e.e_stopPropagation=Ee,e.e_stop=Te,e.addClass=I,e.contains=N,e.rmClass=M,e.keyNames=$a}ll.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;function o(e){if(!we(i,e)){if(i.somethingSelected())Us({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Vs(i);Us({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(n.prevInput="",r.value=t.text.join("\n"),H(r))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(r.style.width="0px"),ve(r,"input",(function(){a&&s>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),ve(r,"paste",(function(e){we(i,e)||Xs(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),ve(r,"cut",o),ve(r,"copy",o),ve(e.scroller,"paste",(function(t){if(!Xn(e,t)&&!we(i,t)){if(!r.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,r.dispatchEvent(o)}})),ve(e.lineSpace,"selectstart",(function(t){Xn(e,t)||Le(t)})),ve(r,"compositionstart",(function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}})),ve(r,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},ll.prototype.createField=function(e){this.wrapper=Qs(),this.textarea=this.wrapper.firstChild},ll.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ll.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=Xi(e);if(e.options.moveInputWithCursor){var r=ki(e,n.sel.primary().head,"div"),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},ll.prototype.showSelection=function(e){var t=this.cm.display;D(t.cursorDiv,e.cursors),D(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ll.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&H(this.textarea),a&&s>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null));this.resetting=!1}},ll.prototype.getField=function(){return this.textarea},ll.prototype.supportsTouch=function(){return!1},ll.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||F(this.textarea.ownerDocument)!=this.textarea))try{this.textarea.focus()}catch(e){}},ll.prototype.blur=function(){this.textarea.blur()},ll.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ll.prototype.receivedFocus=function(){this.slowPoll()},ll.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},ll.prototype.fastPoll=function(){var e=!1,t=this;function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},ll.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||ze(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===r||x&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(i.length,r.length);l1e3||r.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ll.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ll.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},ll.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=zi(n,e),u=i.scroller.scrollTop;if(o&&!h){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&Pr(n,Uo)(n.doc,co(o),q);var c,d=r.style.cssText,f=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=r.ownerDocument.defaultView.scrollY),i.input.focus(),l&&r.ownerDocument.defaultView.scrollTo(null,c),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=v,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),a&&s>=9&&g(),S){Te(e);var m=function(){xe(window,"mouseup",m),setTimeout(v,20)};ve(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=r.selectionStart){var e=n.somethingSelected(),o="​"+(e?r.value:"");r.value="⇚",r.value=o,t.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=o.length,i.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,r.style.cssText=d,a&&s<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=r.selectionStart)){(!a||a&&s<9)&&g();var e=0,o=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==t.prevInput?Pr(n,Jo)(n):e++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},ll.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},ll.prototype.setUneditable=function(){},ll.prototype.needsContentAttribute=!1,$s(Ws),Zs(Ws);var dl="iter insert remove copy getEditor constructor".split(" ");for(var hl in Ea.prototype)Ea.prototype.hasOwnProperty(hl)&&_(dl,hl)<0&&(Ws.prototype[hl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ea.prototype[hl]));return Se(Ea),Ws.inputStyles={textarea:ll,contenteditable:tl},Ws.defineMode=function(e){Ws.defaults.mode||"null"==e||(Ws.defaults.mode=e),Ye.apply(this,arguments)},Ws.defineMIME=Ue,Ws.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ws.defineMIME("text/plain","null"),Ws.defineExtension=function(e,t){Ws.prototype[e]=t},Ws.defineDocExtension=function(e,t){Ea.prototype[e]=t},Ws.fromTextArea=ul,cl(Ws),Ws.version="5.65.9",Ws}()}(bt)),bt.exports}var kt,Ct,St=wt(),Lt=kt={init:function(){$$("[data-modal]").forEach((function(e){e.addEventListener("click",(function(){var e=this.getAttribute("data-modal"),t=this.getAttribute("data-modal-action");t?kt.show(e,t):kt.show(e)}))})),$$(".modal [data-dismiss]").forEach((function(e){e.addEventListener("click",(function(){this.hasAttribute("data-validate")&&!kt.validate(this.getAttribute("data-dismiss"))||kt.hide(this.getAttribute("data-dismiss"))}))})),$$(".modal").forEach((function(e){e.addEventListener("click",(function(e){e.target===this&&kt.hide()}))})),document.addEventListener("keyup",(function(e){27===e.which&&kt.hide()})),window.addEventListener("focus",(function(){var e=$(".modal.show");e&&a.firstFocusableElement(e).focus()}))},show:function(e,t,n){var i=document.getElementById(e);i&&(i.classList.add("show"),t&&$("form",i).setAttribute("action",t),document.activeElement.blur(),$("[autofocus]",i)?$("[autofocus]",i).focus():a.firstFocusableElement(i).focus(),"function"==typeof n&&n(i),$$(".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){if(""===e.value)return e.classList("input-invalid"),e.focus(),$(".modal-error",n).style.display="block",t=!1,!1;t=!0})),t}},Et={};function Mt(){return Ct||(Ct=1,e=wt(),t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1},e.defineMode("xml",(function(i,r){var o,a,s=i.indentUnit,l={},u=r.htmlMode?t:n;for(var c in u)l[c]=u[c];for(var c in r)l[c]=r[c];function d(e,t){function n(n){return t.tokenize=n,n(e,t)}var i=e.next();return"<"==i?e.eat("!")?e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(m(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta"):(o=e.eat("/")?"closeTag":"openTag",t.tokenize=h,"tag bracket"):"&"==i?(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error":(e.eatWhile(/[^&<]/),null)}function h(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=d,o=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return o="equals",null;if("<"==n){t.tokenize=d,t.state=b,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=f(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=h;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,i){for(;!n.eol();){if(n.match(t)){i.tokenize=d;break}n.next()}return e}}function m(e){return function(t,n){for(var i;null!=(i=t.next());){if("<"==i)return n.tokenize=m(e+1),n.tokenize(t,n);if(">"==i){if(1==e){n.tokenize=d;break}return n.tokenize=m(e-1),n.tokenize(t,n)}}return"meta"}}function g(e){return e&&e.toLowerCase()}function v(e,t,n){this.prev=e.context,this.tagName=t||"",this.indent=e.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function y(e){e.context&&(e.context=e.context.prev)}function x(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!l.contextGrabbers.hasOwnProperty(g(n))||!l.contextGrabbers[g(n)].hasOwnProperty(g(t)))return;y(e)}}function b(e,t,n){return"openTag"==e?(n.tagStart=t.column(),w):"closeTag"==e?k:b}function w(e,t,n){return"word"==e?(n.tagName=t.current(),a="tag",L):l.allowMissingTagName&&"endTag"==e?(a="tag bracket",L(e,t,n)):(a="error",w)}function k(e,t,n){if("word"==e){var i=t.current();return n.context&&n.context.tagName!=i&&l.implicitlyClosed.hasOwnProperty(g(n.context.tagName))&&y(n),n.context&&n.context.tagName==i||!1===l.matchClosing?(a="tag",C):(a="tag error",S)}return l.allowMissingTagName&&"endTag"==e?(a="tag bracket",C(e,t,n)):(a="error",S)}function C(e,t,n){return"endTag"!=e?(a="error",C):(y(n),b)}function S(e,t,n){return a="error",C(e,t,n)}function L(e,t,n){if("word"==e)return a="attribute",E;if("endTag"==e||"selfcloseTag"==e){var i=n.tagName,r=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(g(i))?x(n,i):(x(n,i),n.context=new v(n,i,r==n.indented)),b}return a="error",L}function E(e,t,n){return"equals"==e?M:(l.allowMissing||(a="error"),L(e,t,n))}function M(e,t,n){return"string"==e?T:"word"==e&&l.allowUnquoted?(a="string",L):(a="error",L(e,t,n))}function T(e,t,n){return"string"==e?T:L(e,t,n)}return d.isInText=!0,{startState:function(e){var t={tokenize:d,state:b,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;o=null;var n=t.tokenize(e,t);return(n||o)&&"comment"!=n&&(a=null,t.state=t.state(o||n,e,t),a&&(n="error"==a?n+" error":a)),n},indent:function(t,n,i){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+s;if(r&&r.noIndent)return e.Pass;if(t.tokenize!=h&&t.tokenize!=d)return i?i.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+s*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==M&&(e.state=L)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],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:!0})),Et;var e,t,n}var Tt,Dt;function At(e){var t,n,i,r,o,s={addKeyCodes:[32]},l=[];function u(){i.value=l.join(", "),c()}function c(){r.length>0&&(0===l.length?(n.placeholder=r,n.size=r.length):(n.placeholder="",n.size=1))}function d(e){var t=document.createElement("span"),i=document.createElement("i");t.className="tag",t.innerHTML=e,t.style.marginRight=".25rem",n.parentNode.insertBefore(t,n),i.className="tag-remove",i.setAttribute("role","button"),i.addEventListener("mousedown",(function(n){f(e),t.parentNode.removeChild(t),n.preventDefault()})),t.appendChild(i)}function h(e){!function(e){return-1===l.indexOf(e)&&(!o||null!==$('[data-value="'+e+'"]',o))}(e)?c():(l.push(e),d(e),u()),n.value="",o&&p()}function f(e){var t=l.indexOf(e);t>-1&&(l.splice(t,1),u()),o&&p()}function p(){var e=0;$$(".dropdown-item",o).forEach((function(t){"none"!==getComputedStyle(t).display&&e++,-1===l.indexOf(t.getAttribute("data-value"))?t.style.display="block":t.style.display="none",t.classList.remove("selected")})),o.style.display=e>0?"block":"none"}function m(){var e=$(".dropdown-item.selected",o);"none"!==getComputedStyle(e).display&&(n.value=e.getAttribute("data-value"))}function g(e){var t=$(".dropdown-item.selected",o);t&&t.classList.remove("selected"),e&&(e.classList.add("selected"),function(e){var t=o.scrollTop,n=o.clientHeight,i=t+n,r=getComputedStyle(o),a=parseInt(r.paddingTop),s=parseInt(r.paddingBottom),l=e.offsetTop,u=l+e.clientHeight;li&&(o.scrollTop=u-n+s)}(e))}function v(){var e,t=$$(".dropdown-item",o);for(e=0;e=0;e--)if("none"!==getComputedStyle(t[e]).display)return void g(t[e])}()}(),e.preventDefault());break;case 40:"none"!==getComputedStyle(o).display&&(!function(){var e,t=$(".dropdown-item.selected",o);if(t){for(e=t.nextSibling;e&&"none"===e.style.display;)e=e.nextSibling;if(e)return g(e)}v()}(),e.preventDefault());break;default:s.addKeyCodes.indexOf(e.which)>-1&&(m(),e.preventDefault())}})),n.addEventListener("keyup",a.debounce((function(e){var t=n.value.trim();switch(e.which){case 27:o.style.display="none";break;case 38:case 40:return!0;default:o.style.display="block",function(e){var t=0;o.style.display="block",$$(".dropdown-item",o).forEach((function(n){var i=n.textContent,r=new RegExp(a.makeDiacriticsRegExp(a.escapeRegExp(e)),"i");null!==i.match(r)&&"none"!==n.style.display?(n.style.display="block",t++):n.style.display="none"})),o.style.display=t>0?"block":"none"}(t),t.length>0&&v()}}),100))}}(),n.addEventListener("focus",(function(){t.classList.add("focused")})),n.addEventListener("blur",(function(){var e=n.value.trim();""!==e&&h(e),t.classList.remove("focused")})),n.addEventListener("keydown",(function(){var e=n.value.trim();switch(event.which){case 8:""===e?(f(l[l.length-1]),n.previousSibling&&n.parentNode.removeChild(n.previousSibling),event.preventDefault()):n.size=Math.max(n.value.length,n.placeholder.length,1);break;case 13:case 188:""!==e&&h(e),event.preventDefault();break;case 27:n.value="",c(),n.blur(),event.preventDefault();break;default:if(""!==e&&s.addKeyCodes.indexOf(event.which)>-1){h(e),event.preventDefault();break}e.length>0&&(n.size=n.value.length+2)}}))}Dt=wt(),Mt(),Tt||(Tt=1,function(e){e.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 t=0;t-1&&t.substring(r+1,t.length);if(o)return e.findModeByExtension(o)},e.findModeByName=function(t){t=t.toLowerCase();for(var n=0;n` "'(~:]+/,f=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,m=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,g=" ";function v(e,t,n){return t.f=t.inline=n,n(e,t)}function y(e,t,n){return t.f=t.block=n,n(e,t)}function x(e){return!e||!/\S/.test(e.string)}function b(e){if(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==k){var t=i;if(!t){var r=Dt.innerMode(n,e.htmlState);t="xml"==r.mode.name&&null===r.state.tagStart&&!r.state.context&&r.state.tokenize.isInText}t&&(e.f=E,e.block=w,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function w(e,n){var i=e.column()===n.indentation,a=x(n.prevLine.stream),h=n.indentedCode,m=n.prevLine.hr,g=!1!==n.list,y=(n.listStack[n.listStack.length-1]||0)+3;n.indentedCode=!1;var b=n.indentation;if(null===n.indentationDiff&&(n.indentationDiff=n.indentation,g)){for(n.list=null;b=4&&(h||n.prevLine.fencedCodeEnd||n.prevLine.header||a))return e.skipToEnd(),n.indentedCode=!0,o.code;if(e.eatSpace())return null;if(i&&n.indentation<=y&&(L=e.match(c))&&L[1].length<=6)return n.quote=0,n.header=L[1].length,n.thisLine.header=!0,t.highlightFormatting&&(n.formatting="header"),n.f=n.inline,S(n);if(n.indentation<=y&&e.eat(">"))return n.quote=i?1:n.quote+1,t.highlightFormatting&&(n.formatting="quote"),e.eatSpace(),S(n);if(!k&&!n.setext&&i&&n.indentation<=y&&(L=e.match(l))){var E=L[1]?"ol":"ul";return n.indentation=b+e.current().length,n.list=!0,n.quote=0,n.listStack.push(n.indentation),n.em=!1,n.strong=!1,n.code=!1,n.strikethrough=!1,t.taskLists&&e.match(u,!1)&&(n.taskList=!0),n.f=n.inline,t.highlightFormatting&&(n.formatting=["list","list-"+E]),S(n)}return i&&n.indentation<=y&&(L=e.match(f,!0))?(n.quote=0,n.fencedEndRE=new RegExp(L[1]+"+ *$"),n.localMode=t.fencedCodeBlockHighlighting&&r(L[2]||t.fencedCodeBlockDefaultMode),n.localMode&&(n.localState=Dt.startState(n.localMode)),n.f=n.block=C,t.highlightFormatting&&(n.formatting="code-block"),n.code=-1,S(n)):n.setext||!(w&&g||n.quote||!1!==n.list||n.code||k||p.test(e.string))&&(L=e.lookAhead(1))&&(L=L.match(d))?(n.setext?(n.header=n.setext,n.setext=0,e.skipToEnd(),t.highlightFormatting&&(n.formatting="header")):(n.header="="==L[0].charAt(0)?1:2,n.setext=n.header),n.thisLine.header=!0,n.f=n.inline,S(n)):k?(e.skipToEnd(),n.hr=!0,n.thisLine.hr=!0,o.hr):"["===e.peek()?v(e,n,O):v(e,n,n.inline)}function k(e,t){var r=n.token(e,t.htmlState);if(!i){var o=Dt.innerMode(n,t.htmlState);("xml"==o.mode.name&&null===o.state.tagStart&&!o.state.context&&o.state.tokenize.isInText||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=E,t.block=w,t.htmlState=null)}return r}function C(e,n){var i,r=n.listStack[n.listStack.length-1]||0,a=n.indentation=e.quote?n.push(o.formatting+"-"+e.formatting[i]+"-"+e.quote):n.push("error"))}if(e.taskOpen)return n.push("meta"),n.length?n.join(" "):null;if(e.taskClosed)return n.push("property"),n.length?n.join(" "):null;if(e.linkHref?n.push(o.linkHref,"url"):(e.strong&&n.push(o.strong),e.em&&n.push(o.em),e.strikethrough&&n.push(o.strikethrough),e.emoji&&n.push(o.emoji),e.linkText&&n.push(o.linkText),e.code&&n.push(o.code),e.image&&n.push(o.image),e.imageAltText&&n.push(o.imageAltText,"link"),e.imageMarker&&n.push(o.imageMarker)),e.header&&n.push(o.header,o.header+"-"+e.header),e.quote&&(n.push(o.quote),!t.maxBlockquoteDepth||t.maxBlockquoteDepth>=e.quote?n.push(o.quote+"-"+e.quote):n.push(o.quote+"-"+t.maxBlockquoteDepth)),!1!==e.list){var r=(e.listStack.length-1)%3;r?1===r?n.push(o.list2):n.push(o.list3):n.push(o.list1)}return 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 L(e,t){if(e.match(h,!0))return S(t)}function E(e,i){var r=i.text(e,i);if(void 0!==r)return r;if(i.list)return i.list=null,S(i);if(i.taskList)return" "===e.match(u,!0)[1]?i.taskOpen=!0:i.taskClosed=!0,t.highlightFormatting&&(i.formatting="task"),i.taskList=!1,S(i);if(i.taskOpen=!1,i.taskClosed=!1,i.header&&e.match(/^#+$/,!0))return t.highlightFormatting&&(i.formatting="header"),S(i);var a=e.next();if(i.linkTitle){i.linkTitle=!1;var s=a;"("===a&&(s=")");var l="^\\s*(?:[^"+(s=(s+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+s;if(e.match(new RegExp(l),!0))return o.linkHref}if("`"===a){var c=i.formatting;t.highlightFormatting&&(i.formatting="code"),e.eatWhile("`");var d=e.current().length;if(0!=i.code||i.quote&&1!=d){if(d==i.code){var h=S(i);return i.code=0,h}return i.formatting=c,S(i)}return i.code=d,S(i)}if(i.code)return S(i);if("\\"===a&&(e.next(),t.highlightFormatting)){var f=S(i),p=o.formatting+"-escape";return f?f+" "+p:p}if("!"===a&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return i.imageMarker=!0,i.image=!0,t.highlightFormatting&&(i.formatting="image"),S(i);if("["===a&&i.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return i.imageMarker=!1,i.imageAltText=!0,t.highlightFormatting&&(i.formatting="image"),S(i);if("]"===a&&i.imageAltText){t.highlightFormatting&&(i.formatting="image");var f=S(i);return i.imageAltText=!1,i.image=!1,i.inline=i.f=T,f}if("["===a&&!i.image)return i.linkText&&e.match(/^.*?\]/)||(i.linkText=!0,t.highlightFormatting&&(i.formatting="link")),S(i);if("]"===a&&i.linkText){t.highlightFormatting&&(i.formatting="link");var f=S(i);return i.linkText=!1,i.inline=i.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?T:E,f}if("<"===a&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=M,t.highlightFormatting&&(i.formatting="link"),(f=S(i))?f+=" ":f="",f+o.linkInline;if("<"===a&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=M,t.highlightFormatting&&(i.formatting="link"),(f=S(i))?f+=" ":f="",f+o.linkEmail;if(t.xml&&"<"===a&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var g=e.string.indexOf(">",e.pos);if(-1!=g){var v=e.string.substring(e.start,g);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(v)&&(i.md_inside=!0)}return e.backUp(1),i.htmlState=Dt.startState(n),y(e,i,k)}if(t.xml&&"<"===a&&e.match(/^\/\w*?>/))return i.md_inside=!1,"tag";if("*"===a||"_"===a){for(var x=1,b=1==e.pos?" ":e.string.charAt(e.pos-2);x<3&&e.eat(a);)x++;var w=e.peek()||" ",C=!/\s/.test(w)&&(!m.test(w)||/\s/.test(b)||m.test(b)),L=!/\s/.test(b)&&(!m.test(b)||/\s/.test(w)||m.test(w)),D=null,A=null;if(x%2&&(i.em||!C||"*"!==a&&L&&!m.test(b)?i.em!=a||!L||"*"!==a&&C&&!m.test(w)||(D=!1):D=!0),x>1&&(i.strong||!C||"*"!==a&&L&&!m.test(b)?i.strong!=a||!L||"*"!==a&&C&&!m.test(w)||(A=!1):A=!0),null!=A||null!=D)return t.highlightFormatting&&(i.formatting=null==D?"strong":null==A?"em":"strong em"),!0===D&&(i.em=a),!0===A&&(i.strong=a),h=S(i),!1===D&&(i.em=!1),!1===A&&(i.strong=!1),h}else if(" "===a&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return S(i);e.backUp(1)}if(t.strikethrough)if("~"===a&&e.eatWhile(a)){if(i.strikethrough)return t.highlightFormatting&&(i.formatting="strikethrough"),h=S(i),i.strikethrough=!1,h;if(e.match(/^[^\s]/,!1))return i.strikethrough=!0,t.highlightFormatting&&(i.formatting="strikethrough"),S(i)}else if(" "===a&&e.match("~~",!0)){if(" "===e.peek())return S(i);e.backUp(2)}if(t.emoji&&":"===a&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){i.emoji=!0,t.highlightFormatting&&(i.formatting="emoji");var O=S(i);return i.emoji=!1,O}return" "===a&&(e.match(/^ +$/,!1)?i.trailingSpace++:i.trailingSpace&&(i.trailingSpaceNewLine=!0)),S(i)}function M(e,n){if(">"===e.next()){n.f=n.inline=E,t.highlightFormatting&&(n.formatting="link");var i=S(n);return i?i+=" ":i="",i+o.linkInline}return e.match(/^[^>]+/,!0),o.linkInline}function T(e,n){if(e.eatSpace())return null;var i=e.next();return"("===i||"["===i?(n.f=n.inline=A("("===i?")":"]"),t.highlightFormatting&&(n.formatting="link-string"),n.linkHref=!0,S(n)):"error"}var D={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function A(e){return function(n,i){if(n.next()===e){i.f=i.inline=E,t.highlightFormatting&&(i.formatting="link-string");var r=S(i);return i.linkHref=!1,r}return n.match(D[e]),i.linkHref=!0,S(i)}}function O(e,n){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(n.f=N,e.next(),t.highlightFormatting&&(n.formatting="link"),n.linkText=!0,S(n)):v(e,n,E)}function N(e,n){if(e.match("]:",!0)){n.f=n.inline=F,t.highlightFormatting&&(n.formatting="link");var i=S(n);return n.linkText=!1,i}return e.match(/^([^\]\\]|\\.)+/,!0),o.linkText}function F(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=E,o.linkHref+" url")}var I={startState:function(){return{f:w,prevLine:{stream:null},thisLine:{stream:null},block:w,htmlState:null,indentation:0,inline:E,text:L,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&&Dt.copyState(n,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?Dt.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 b(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!=k)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g,g).length;if(t.indentation=n,t.indentationDiff=null,n>0)return null}}return t.f(e,t)},innerMode:function(e){return e.block==k?{state:e.htmlState,mode:n}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:I}},indent:function(e,t,i){return e.block==k&&n.indent?n.indent(e.htmlState,t,i):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,t,i):Dt.Pass},blankLine:b,getType:S,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return I}),"xml"),Dt.defineMIME("text/markdown","markdown"),Dt.defineMIME("text/x-markdown","markdown"),function(e){var t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,i=/[*+-]\s/;function r(e,n){var i=n.line,r=0,o=0,a=t.exec(e.getLine(i)),s=a[1];do{var l=i+(r+=1),u=e.getLine(l),c=t.exec(u);if(c){var d=c[1],h=parseInt(a[3],10)+r-o,f=parseInt(c[3],10),p=f;if(s!==d||isNaN(f)){if(s.length>d.length)return;if(s.lengthf&&(p=h+1),e.replaceRange(u.replace(t,d+p+c[4]+c[5]),{line:l,ch:0},{line:l,ch:u.length})}}while(c)}e.commands.newlineAndIndentContinueMarkdownList=function(o){if(o.getOption("disableInput"))return e.Pass;for(var a=o.listSelections(),s=[],l=0;l\s*$/.test(p),y=!/>\s*$/.test(p);(v||y)&&o.replaceRange("",{line:u.line,ch:0},{line:u.line,ch:u.ch+1}),s[l]="\n"}else{var x=m[1],b=m[5],w=!(i.test(m[2])||m[2].indexOf(">")>=0),k=w?parseInt(m[3],10)+1+m[4]:m[2].replace("x"," ");s[l]="\n"+x+k+b,w&&r(o,u)}}o.replaceSelections(s)}}(wt());var Ot,Nt=function(){$$("input[data-enable]").forEach((function(e){e.addEventListener("change",(function(){var e,t,n=this.getAttribute("data-enable").split(",");for(e=0;e',m+=f+" "+e,m+="",m+="",s=0;s<7;s++)m+='',m+=t.labels.weekdays.short[i.mod(s+t.weekStarts,7)],m+="";for(m+="",s=0;s<6;s++){for(u=0;u<7;u++)c<=h&&(s>0||u>=p)?(m+=c===a?'':'',m+=c++):1===c?(m+='',m+=i.daysInMonth(i.mod(o-1,12),e)-p+u+1):(m+='',m+=c++-h),m+="";m+=""}m+="",$(".calendar-table",r).innerHTML=m,$$(".calendar-day",r).forEach((function(e){e.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()})),e.addEventListener("click",(function(){var e=l(),t=new Date(n.year,n.month,parseInt(this.textContent));e.setAttribute("data-date",t),e.value=i.formatDateTime(t),e.blur()}))}))}function h(){var t,n,i,o,s,u,c,d,h,f;(e=l())&&"block"===r.style.display&&(n=(t=e.getBoundingClientRect()).top+window.pageYOffset,i=t.left+window.pageXOffset,r.style.top=n+e.offsetHeight+"px",r.style.left=i+e.offsetLeft+"px",s=(o=r.getBoundingClientRect()).top+window.pageYOffset,u=o.left+window.pageXOffset,c=a.outerWidth(r),d=a.outerHeight(r),h=document.documentElement.clientWidth,f=document.documentElement.clientHeight,u+c>h&&(r.style.left=h-c+"px"),(si.daysInMonth(this.month,this.year)&&this.lastDay()},nextMonth:function(){this.month=i.mod(this.month+1,12),0===this.month&&this.nextYear(),this.day>i.daysInMonth(this.month,this.year)&&this.lastDay()},prevWeek:function(){this.day-=7,this.day<1&&(this.prevMonth(),this.day+=i.daysInMonth(this.month,this.year))},nextWeek:function(){this.day+=7,this.day>i.daysInMonth(this.month,this.year)&&(this.day-=i.daysInMonth(this.month,this.year),this.nextMonth())},prevDay:function(){this.day--,this.day<1&&(this.prevMonth(),this.lastDay())},nextDay:function(){this.day++,this.day>i.daysInMonth(this.month,this.year)&&(this.nextMonth(),this.day=1)},nextHour:function(){this.hours=i.mod(this.hours+1,24),0===this.hours&&this.nextDay()},prevHour:function(){this.hours=i.mod(this.hours-1,24),23===this.hours&&this.prevDay()},nextMinute:function(){this.minutes=i.mod(this.minutes+1,60),0===this.minutes&&this.nextHour()},prevMinute:function(){this.minutes=i.mod(this.minutes-1,60),59===this.minutes&&this.prevHour()},nextSecond:function(){this.seconds=i.mod(this.seconds+1,60),0===this.seconds&&this.nextMinute()},prevSecond:function(){this.seconds=i.mod(this.seconds-1,60),59===this.minutes&&this.prevMinute()}},i={_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=i.getTime()?t+1:e.getTime()>=n.getTime()?t:t-1},weekOfYear:function(e){var t=this.weekNumberingYear(e),n=this.weekStart(new Date(t,0,4),1),i=this.weekStart(e,1);return Math.round((i.getTime()-n.getTime())/6048e5)+1},has12HourFormat:function(e){var t=e.match(/\[([^\]]*)\]|H{1,2}/);return null!==t&&"H"===t[0][0]},formatDateTime:function(e,n){var r=this;function o(e){var t=e>0?"-":"+",n=Math.floor(Math.abs(e)/60),r=Math.abs(e)%60;return[t+i.pad(n,2),i.pad(r,2)]}return void 0===n&&(n=t.format),n.replace(/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g,(function(n,i){switch(n){case"YY":return e.getFullYear().toString().substr(-2);case"YYYY":return e.getFullYear();case"M":return e.getMonth()+1;case"MM":return r.pad(e.getMonth()+1,2);case"MMM":return t.labels.months.short[e.getMonth()];case"MMMM":return t.labels.months.long[e.getMonth()];case"D":return e.getDate();case"DD":return r.pad(e.getDate(),2);case"DDD":return t.labels.weekdays.short[r.mod(e.getDay()+t.weekStarts,7)];case"DDDD":return t.labels.weekdays.long[r.mod(e.getDay()+t.weekStarts,7)];case"W":return r.weekOfYear(e);case"WW":return r.pad(r.weekOfYear(e),2);case"RR":return r.weekNumberingYear(e).toString().substr(-2);case"RRRR":return r.weekNumberingYear(e);case"H":return r.mod(e.getHours(),12)||12;case"HH":return r.pad(r.mod(e.getHours(),12)||12,2);case"h":return e.getHours();case"hh":return r.pad(e.getHours(),2);case"m":return e.getMinutes();case"mm":return r.pad(e.getMinutes(),2);case"s":return e.getSeconds();case"ss":return r.pad(e.getSeconds(),2);case"uuu":return r.pad(e.getMilliseconds(),3);case"A":return e.getHours()<12?"AM":"PM";case"a":return e.getHours()<12?"am":"pm";case"Z":return o(e.getTimezoneOffset()).join(":");case"z":return o(e.getTimezoneOffset()).join("");default:return i||n}}))}},r=$(".calendar")?$(".calendar"):((r=document.createElement("div")).className="calendar",r.innerHTML='
',!0===t.time&&(r.innerHTML+='
:
',u.inject("chevron-down",$(".prevHour",r)),u.inject("chevron-up",$(".nextHour",r)),u.inject("chevron-down",$(".prevMinute",r)),u.inject("chevron-up",$(".nextMinute",r)),a.longClick($(".nextHour",r),(function(t){n.nextHour(),s(e),t.preventDefault()}),750,250),a.longClick($(".prevHour",r),(function(t){n.prevHour(),s(e),t.preventDefault()}),750,250),a.longClick($(".nextMinute",r),(function(t){n.nextMinute(),s(e),t.preventDefault()}),750,250),a.longClick($(".prevMinute",r),(function(t){n.prevMinute(),s(e),t.preventDefault()}),750,250)),document.body.appendChild(r),u.inject("calendar-clock",$(".currentMonth",r)),u.inject("chevron-left",$(".prevMonth",r)),u.inject("chevron-right",$(".nextMonth",r)),$(".currentMonth",r).addEventListener("mousedown",(function(e){var t=l(),i=new Date;n.setDate(i),s(t),t.blur(),e.preventDefault()})),a.longClick($(".prevMonth",r),(function(t){n.prevMonth(),s(e),t.preventDefault()}),750,500),a.longClick($(".nextMonth",r),(function(t){n.nextMonth(),s(e),t.preventDefault()}),750,500),window.addEventListener("mousedown",(function(e){"none"!==r.style.display&&e.target.closest(".calendar")&&e.preventDefault()})),window.addEventListener("resize",a.throttle(h,100)),r),f=e.value,e.readOnly=!0,e.size=t.format.length,i.isValidDate(f)&&(f=new Date(f),e.setAttribute("data-date",f),e.value=i.formatDateTime(f)),e.addEventListener("change",(function(){""===this.value?this.setAttribute("data-date",""):this.value=i.formatDateTime(this.getAttribute("data-date"))})),e.addEventListener("keydown",(function(e){var t=this.getAttribute("data-date");switch(n.setDate(i.isValidDate(t)?new Date(t):new Date),e.which){case 13:$(".calendar-day.selected",r).click(),r.style.display="none";break;case 8:this.value="",this.blur(),r.style.display="none";break;case 27:this.blur(),r.style.display="none";break;case 37:e.ctrlKey||e.metaKey?e.shiftKey?n.prevYear():n.prevMonth():n.prevDay(),s(this);break;case 38:n.prevWeek(),s(this);break;case 39:e.ctrlKey||e.metaKey?e.shiftKey?n.nextYear():n.nextMonth():n.nextDay(),s(this);break;case 40:n.nextWeek(),s(this);break;case 48:(e.ctrlKey||e.metaKey)&&n.setDate(new Date),s(this);break;default:return}e.stopPropagation(),e.preventDefault()})),e.addEventListener("focus",(function(){var e=i.isValidDate(this.getAttribute("data-date"))?new Date(this.getAttribute("data-date")):new Date;n.setDate(e),d(n.year,n.month,n.day),c(n.hours,n.minutes),r.style.display="block",h()})),e.addEventListener("blur",(function(){r.style.display="none"}));var f}(e,Formwork.config.DateInput)})),$$(".input-image").forEach((function(e){e.addEventListener("click",(function(){Lt.show("imagesModal",null,(function(t){var n,i=$(".image-picker-thumbnail.selected",t);i&&i.classList.remove("selected"),e.value&&(n=$('.image-picker-thumbnail[data-filename="'+e.value+'"]',t))&&n.classList.add("selected"),$(".image-picker-confirm",t).setAttribute("data-target",e.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",r.length>0){for((t=document.createElement("div")).className="image-picker-thumbnails",i=0;i ","")})),$("[data-command=link]",n).addEventListener("click",(function(){var e=t.getSelection();/^(https?:\/\/|mailto:)/i.test(e)?c("[","]("+e+")",!0):""!==e?c("["+e+"](http://",")",!0):c("[","](http://)")})),$("[data-command=image]",n).addEventListener("click",(function(){Lt.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?c(u()+"![","]("+t+")"):c(u()+"![](",")"),this.removeEventListener("click",e)}))}))})),$("[data-command=summary]",n).addEventListener("click",(function(){var e;o()||(c((void 0===(e=l())||"\n"===e?"":"\n")+"\n===\n\n",""),this.setAttribute("disabled",""))})),$("[data-command=undo]",n).addEventListener("click",(function(){t.undo(),t.focus()})),$("[data-command=redo]",n).addEventListener("click",(function(){t.redo(),t.focus()})),s(),t.on("changes",a.debounce((function(){e.value=t.getValue(),s(),t.historySize().undo<1?$("[data-command=undo]").setAttribute("disabled",""):$("[data-command=undo]").removeAttribute("disabled"),t.historySize().redo<1?$("[data-command=redo]").setAttribute("disabled",""):$("[data-command=redo]").removeAttribute("disabled")}),500)),t.on("beforeSelectionChange",(function(e,t){var n=function(e){var t,n=[];for(t=0;t0?n.innerHTML=this.files[0].name:n.innerHTML=this.getAttribute("data-label")}function o(e){e.preventDefault()}function s(e){this.classList.add("drag"),e.preventDefault()}e.setAttribute("data-label",$('label[for="'+e.id+'"] span').innerHTML),e.addEventListener("change",r),e.addEventListener("input",r),e.form.addEventListener("submit",(function(){e.files.length>0&&(n.innerHTML+=' '),i=!0})),t.addEventListener("drag",o),t.addEventListener("dragstart",o),t.addEventListener("dragend",o),t.addEventListener("dragover",s),t.addEventListener("dragenter",s),t.addEventListener("dragleave",(function(e){this.classList.remove("drag"),e.preventDefault()})),t.addEventListener("drop",(function(t){t.preventDefault(),i||(e.files=t.dataTransfer.files,a.triggerEvent(e,"change"))})),t.addEventListener("click",(function(e){i&&e.preventDefault()}))}(e)})),$$("input[data-field=tags]").forEach((function(e){At(e)})),$$("input[data-field=duration]").forEach((function(e){yt(e,Formwork.config.DurationInput)})),$$("input[type=range]").forEach((function(e){!function(e){function t(){$('output[for="'+this.id+'"]').innerHTML=this.value}e.addEventListener("change",t),e.addEventListener("input",t)}(e)})),$$(".input-array").forEach((function(e){vt(e)})),$$("[data-form]").forEach((function(e){!function(e){var t=a.serializeForm(e);function n(e){r()&&(e.preventDefault(),e.returnValue="")}function i(){window.removeEventListener("beforeunload",n)}function r(n){var i,r;if(void 0===n&&(n=!0),i=$$("input[type=file]",e),!0===n&&i.length>0)for(r=0;r0)return!0;return a.serializeForm(e)!==t}window.addEventListener("beforeunload",n),e.addEventListener("submit",i),$$('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach((function(e){e.addEventListener("click",(function(t){r()&&(t.preventDefault(),Lt.show("changesModal",null,(function(t){$("[data-command=continue]",t).setAttribute("data-href",e.href)})))}))})),$$("input[type=file][data-auto-upload]",e).forEach((function(t){t.addEventListener("change",(function(){r(!1)||e.requestSubmit($("[type=submit]",e))}))})),o=document.getElementById("changesModal"),s=document.getElementById("deletePageModal"),l=document.getElementById("deleteUserModal"),o&&$("[data-command=continue]",o).addEventListener("click",(function(){i(),window.location.href=this.getAttribute("data-href")})),s&&$("[data-command=delete]",s).addEventListener("click",i),l&&$("[data-command=delete]",l).addEventListener("click",i);var o,s,l}(e)}))},Ft=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"),s=document.getElementById("slugModal");function l(){var e,t=this.value;0===t.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}))):(e=new RegExp(a.makeDiacriticsRegExp(a.escapeRegExp(t)),"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(t){var n=t.closest(".pages-item"),i=t.textContent;null!==i.match(e)?(t.innerHTML=i.replace(e,"$&"),n.style.display=""):n.style.display="none"})))}function u(){this.value=a.validateSlug(this.value)}$$(".pages-list").forEach((function(e){"true"===e.getAttribute("data-sortable-children")&&function(e){var t=[],n=Ke.create(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(i){var r;i.item.closest(".pages-list").classList.remove("dragging"),$$(".page-children-toggle").forEach((function(e){e.style.opacity=""})),i.newIndex!==i.oldIndex&&(n.option("disabled",!0),r={"csrf-token":$("meta[name=csrf-token]").getAttribute("content"),parent:e.getAttribute("data-parent"),from:i.oldIndex,to:i.newIndex},d({method:"POST",url:Formwork.config.baseUri+"pages/reorder/",data:r},(function(e){e.status&&new c(e.message,e.status,{icon:"check-cricle"}).show(),e.status&&"error"!==e.status||n.sort(t),n.option("disabled",!1),t=n.toArray()})))}});t=n.toArray()}(e)})),$$(".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&&a.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){a.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",a.debounce(l,100)),r.addEventListener("search",l),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=a.slug(this.value)})),$("#page-slug",o).addEventListener("keyup",u),$("#page-slug",o).addEventListener("blur",u),$("#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;i0&&(e=$(".page-slug-change").innerHTML,$$("#page-slug, #slug").forEach((function(e){e.value=t})),$("#page-slug",s).value=t,document.getElementById("slug").value=t,$(".page-slug-change").innerHTML=e.replace(/\/[a-z0-9-]+\/$/,"/"+t+"/")),Lt.hide("slugModal")})))},It=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 s(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 s(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