You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simplemde-markdown-editor/dist/simplemde.min.js

28 lines
537 KiB
JavaScript

/**
* simplemde v1.11.2
* Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT
*/
7 years ago
<<<<<<< HEAD
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimpleMDE=e()}}(function(){var e;return function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,l,s=e.length;a=r(e),l=new f(3*s/4-a),i=a>0?s-4:s;var c=0;for(t=0,n=0;t<i;t+=4,n+=3)o=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],l[c++]=o>>16&255,l[c++]=o>>8&255,l[c++]=255&o;return 2===a?(o=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,l[c++]=255&o):1===a&&(o=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,l[c++]=o>>8&255,l[c++]=255&o),l}function a(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function l(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(a(r));return i.join("")}function s(e){for(var t,n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a<s;a+=16383)o.push(l(e,a,a+16383>s?s:a+16383));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=s;for(var c=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d<p;++d)c[d]=h[d],u[h.charCodeAt(d)]=d;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){"use strict";function r(e){if(e>X)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return s(e)}return o(e,t,n)}function o(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return e instanceof ArrayBuffer?f(e,t,n):"string"==typeof e?c(e,t):h(e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function l(e,t,n){return a(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}function s(e){return a(e),r(e<0?0:0|d(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(e,t),o=r(n),a=o.write(e,t);return a!==n&&(o=o.slice(0,a)),o}function u(e){for(var t=e.length<0?0:0|d(e.length),n=r(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),r.__proto__=i.prototype,r}function h(e){if(i.isBuffer(e)){var t=0|d(e.length),n=r(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}if(e){if(ArrayBuffer.isView(e)||"length"in e)return"number"!=typeof e.length||$(e.length)?r(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(e){if(e>=X)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+X.toString(16)+" bytes");return 0|e}function p(e){retu
o.lineSpace=i("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var a=i("div",[o.lineSpace],"CodeMirror-lines");o.mover=r("div",[a],null,"position: relative"),o.sizer=r("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=r("div",null,null,"position: absolute; height: "+wa+"px; width: 1px;"),o.gutters=r("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=r("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=r("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),Zo&&Jo<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Qo||Vo&&sa||(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,n.init(o)}function M(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 r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function N(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function A(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function E(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function O(e){if(null==e.parent)return null;for(var t=e.parent,n=h(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function I(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return n+a}function D(e,t){return t>=e.first&&t<e.first+e.size}function H(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function W(e,t,n){if(void 0===n&&(n=null),!(this instanceof W))return new W(e,t,n);this.line=e,this.ch=t,this.sticky=n}function B(e,t){return e.line-t.line||e.ch-t.ch}function P(e,t){return e.sticky==t.sticky&&0==B(e,t)}function R(e){return W(e.line,e.ch)}function F(e,t){return B(e,t)<0?t:e}function z(e,t){return B(e,t)<0?e:t}function _(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function j(e,t){if(t.line<e.first)return W(e.first,0);var n=e.first+e.size-1;return t.line>n?W(n,M(e,n).text.length):q(t,M(e,t.line).text.length)}function q(e,t){var n=e.ch;return null==n||n>t?W(e.line,t):n<0?W(e.line,0):e}function U(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=j(e,t[r]);return n}function G(){Aa=!0}function $(){Ea=!0}function V(e,t,n){this.marker=e,this.from=t,this.to=n}function K(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function X(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Y(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Z(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new V(a,o.from,s?null:o.to))}}return r}function J(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r
;r||(r="local");var l=ye(t);if("local"==r?l+=Ft(e.display):l-=e.display.viewOffset,"page"==r||"window"==r){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==r?0:ln());var c=s.left+("window"==r?0:an());n.left+=c,n.right+=c}return n.top+=l,n.bottom+=l,n}function cn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=an(),i-=ln();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function un(e,t,n,r,i){return r||(r=M(e.doc,t.line)),sn(e,r,Kt(e,r,t.ch,i),n)}function fn(e,t,n,r,i,o){function a(t,a){var l=Zt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,sn(e,r,l,n)}function l(e,t,n){var r=s[t],i=r.level%2!=0;return a(n?e-1:e,i!=n)}r=r||M(e.doc,t.line),i||(i=Yt(e,r));var s=Ce(r,e.doc.direction),c=t.ch,u=t.sticky;if(c>=r.text.length?(c=r.text.length,u="before"):c<=0&&(c=0,u="after"),!s)return a("before"==u?c-1:c,"before"==u);var f=ke(s,c,u),h=Oa,d=l(c,f,"before"==u);return null!=h&&(d.other=l(c,h,"before"!=u)),d}function hn(e,t){var n=0;t=j(e.doc,t),e.options.lineWrapping||(n=xn(e.display)*t.ch);var r=M(e.doc,t.line),i=ye(r)+Ft(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function dn(e,t,n,r,i){var o=W(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function pn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return dn(r.first,0,null,!0,-1);var i=I(r,n),o=r.first+r.size-1;if(i>o)return dn(r.first+r.size-1,M(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=M(r,i);;){var l=vn(e,a,i,t,n),s=ce(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=O(a=c.to.line)}}function mn(e,t,n,r){var i=function(r){return sn(e,t,Zt(e,n,r),"line")},o=t.text.length,a=L(function(e){return i(e-1).bottom<=r},o,0);return o=L(function(e){return i(e).top>r},a,o),{begin:a,end:o}}function gn(e,t,n,r){return mn(e,t,n,sn(e,t,Zt(e,n,r),"line").top)}function vn(e,t,n,r,i){i-=ye(t);var o,a=0,l=t.text.length,s=Yt(e,t);if(Ce(t,e.doc.direction)){if(e.options.lineWrapping){var c;c=mn(e,t,s,i),a=c.begin,l=c.end}o=new W(n,a);var u,f,h=fn(e,o,"line",t,s).left,d=h<r?1:-1,p=h-r;do{if(u=p,f=o,null==(o=Me(e,t,o,d))||o.ch<a||l<=("before"==o.sticky?o.ch-1:o.ch)){o=f;break}p=fn(e,o,"line",t,s).left-r}while(d<0!=p<0&&Math.abs(p)<=Math.abs(u));if(Math.abs(p)>Math.abs(u)){if(p<0==u<0)throw new Error("Broke out of infinite loop in coordsCharInner");o=f}}else{var m=L(function(n){var o=sn(e,t,Zt(e,s,n),"line");return o.top>i?(l=Math.min(n,l),!0):!(o.bottom<=i)&&(o.left>r||!(o.right<r)&&r-o.left<o.right-r)},a,l);m=S(t.text,m,1),o=new W(n,m,m==l?"before":"after")}var g=fn(e,o,"line",t,s);return(i<g.top||g.bottom<i)&&(o.outside=!0),o.xRel=r<g.left?-1:r>g.right?1:0,o}function yn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ga){Ga=r("pre");for(var i=0;i<49;++i)Ga.appendChild(document.createTextNode("x")),Ga.appendChild(r("br"));Ga.appendChild(document.createTextNode("x"))}n(e.measure,Ga);var o=Ga.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function xn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=r("span","xxxxxxxxxx"),i=r("pre",[t]);n(e.measure,i);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function bn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:wn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function wn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function kn(e){var t=yn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xn(e.display)-3);return function(i){if(ge(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function Cn(e){var t=e.doc,n=kn(e);t.iter(
;return r}function ri(e,t){var n=ni(e,t),r=Q(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function ii(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?il.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&h(t,Number(u[1]))>-1&&(m(l)[f]=c[f],delete c[f])}}}return r}function oi(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=B(n,i)<0;o!=B(r,i)<0?(i=n,n=r):o!=B(n,r)<0&&(n=r)}return new ol(i,n)}return new ol(r||n,n)}function ai(e,t,n,r){hi(e,new il([oi(e,e.sel.primary(),t,n)],0),r)}function li(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=oi(e,e.sel.ranges[i],t[i],null);hi(e,Or(r,e.sel.primIndex),n)}function si(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,hi(e,Or(i,e.sel.primIndex),r)}function ci(e,t,n,r){hi(e,Ir(t,n),r)}function ui(e,t,n){var r={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var r=0;r<t.length;r++)n.ranges[r]=new ol(j(e,t[r].anchor),j(e,t[r].head))},origin:n&&n.origin};return Ee(e,"beforeSelectionChange",e,r),e.cm&&Ee(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Or(r.ranges,r.ranges.length-1):t}function fi(e,t,n){var r=e.history.done,i=m(r);i&&i.ranges?(r[r.length-1]=t,di(e,t,n)):hi(e,t,n)}function hi(e,t,n){di(e,t,n),Jr(e,e.sel,e.cm?e.cm.curOp.id:0/0,n)}function di(e,t,n){(De(e,"beforeSelectionChange")||e.cm&&De(e.cm,"beforeSelectionChange"))&&(t=ui(e,t,n)),pi(e,gi(e,t,n&&n.bias||(B(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),n&&n.scroll===!1||!e.cm||er(e.cm)}function pi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ie(e.cm)),Ct(e,"cursorActivity",e))}function mi(e){pi(e,gi(e,e.sel,null,!1),Ca)}function gi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=yi(e,a.anchor,l&&l.anchor,n,r),c=yi(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new ol(s,c))}return i?Or(i,t.primIndex):t}function vi(e,t,n,r,i){var o=M(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Ee(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var c=s.find(r<0?1:-1),u=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(c=xi(e,c,-r,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=B(c,n))&&(r<0?u<0:u>0))return vi(e,c,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=xi(e,f,r,f.line==t.line?o:null)),f?vi(e,f,t,r,i):null}}return t}function yi(e,t,n,r,i){var o=r||1,a=vi(e,t,n,o,i)||!i&&vi(e,t,n,o,!0)||vi(e,t,n,-o,i)||!i&&vi(e,t,n,-o,!0);return a||(e.cantEdit=!0,W(e.first,0))}function xi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?j(e,W(t.line-1)):null:n>0&&t.ch==(r||M(e,t.line)).text.length?t.line<e.first+e.size-1?W(t.line+1,0):null:new W(t.line,t.ch+n)}function bi(e){e.setSelection(W(e.firstLine(),0),W(e.lastLine()),Ca)}function wi(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=j(e,t)),n&&(r.to=j(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),Ee(e,"beforeChange",e,r),e.cm&&Ee(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ki(e,t,n){if(e.cm){if(!e.cm.curOp)return fr(e.cm,ki)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(De(e,"beforeChange")||e.cm&&De(e.cm,"beforeChange"))||(t=wi(e,t,!0))){var r=Aa&&!n&&te(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ci(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Ci(e,t)}}function
for(var g=c.previousSibling,v=n;g;g=g.previousSibling){if(h=r(g,g.firstChild,-1))return zo(W(h.line,h.ch+v),a);v+=g.textContent.length}}function Uo(e,t){function n(){e.value=s.getValue()}if(t=t?u(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=a();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}var i;if(e.form&&(Ha(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(Ae(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=To(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s}var Go=navigator.userAgent,$o=navigator.platform,Vo=/gecko\/\d/i.test(Go),Ko=/MSIE \d/.test(Go),Xo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Go),Yo=/Edge\/(\d+)/.exec(Go),Zo=Ko||Xo||Yo,Jo=Zo&&(Ko?document.documentMode||6:+(Yo||Xo)[1]),Qo=!Yo&&/WebKit\//.test(Go),ea=Qo&&/Qt\/\d+\.\d+/.test(Go),ta=!Yo&&/Chrome\//.test(Go),na=/Opera\//.test(Go),ra=/Apple Computer/.test(navigator.vendor),ia=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Go),oa=/PhantomJS/.test(Go),aa=!Yo&&/AppleWebKit/.test(Go)&&/Mobile\/\w+/.test(Go),la=/Android/.test(Go),sa=aa||la||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Go),ca=aa||/Mac/.test($o),ua=/\bCrOS\b/.test(Go),fa=/win/i.test($o),ha=na&&Go.match(/Version\/(\d*\.\d*)/);ha&&(ha=Number(ha[1])),ha&&ha>=15&&(na=!1,Qo=!0);var da,pa=ca&&(ea||na&&(null==ha||ha<12.11)),ma=Vo||Zo&&Jo>=9,ga=function(t,n){var r=t.className,i=e(n).exec(r);if(i){var o=r.slice(i.index+i[0].length);t.className=r.slice(0,i.index)+(o?i[1]+o:"")}};da=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var va=function(e){e.select()};aa?va=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Zo&&(va=function(e){try{e.select()}catch(e){}});var ya=function(){this.id=null};ya.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var xa,ba,wa=30,ka={toString:function(){return"CodeMirror.Pass"}},Ca={scroll:!1},Sa={origin:"*mouse"},La={origin:"+move"},Ta=[""],Ma=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Na=/[\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\u
from:e.coordsChar({left:0,top:n},"div"),to:t.from()}})},delWrappedLineRight:function(e){return eo(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(W(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(W(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return to(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ro(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return no(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},La)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},La)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ro(e,t.head):r},La)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=f(e.getLine(o.line),o.ch,r);t.push(p(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=M(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new W(i.line,i.ch-1)),i.ch>0)i=new W(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),W(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=M(e.doc,i.line-1).text;a&&(i=new W(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),W(i.line-1,a.length-1),i,"+transpose"))}n.push(new ol(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(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 r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);er(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}},Sl=new ya,Ll=null,Tl={toString:function(){return"CodeMirror.Init"}},Ml={},Nl={};To.defaults=Ml,To.optionHandlers=Nl;var Al=[];To.defineInitHook=function(e){return Al.push(e)};var El=null,Ol=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.last
}return e.match(/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:r},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in n)a[l]=n[l];return a.name="markdown",e.overlayMode(e.getMode(t,a),o)},"markdown"),e.defineMIME("text/x-gfm","gfm")})},{"../../addon/mode/overlay":8,"../../lib/codemirror":10,"../markdown/markdown":12}],12:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror"),t("../xml/xml"),t("../meta")):"function"==typeof e&&e.amd?e(["../../lib/codemirror","../xml/xml","../meta"],i):i(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,n){function r(n){if(e.findModeByName){var r=e.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=e.getMode(t,n);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e,t,n){return t.f=t.block=n,n(e,t)}function a(e){return!e||!/\S/.test(e.string)}function l(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==c&&(e.f=d,e.block=s),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function s(t,o){var l=t.sol(),s=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,s&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var h=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||a(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,k.code):null;if(t.eatSpace())return null;if((h=t.match(M))&&h[1].length<=6)return o.header=h[1].length,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,f(o);if(!(a(o.prevLine)||o.quote||s||c)&&(h=t.match(N)))return o.header="="==h[0].charAt(0)?1:2,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,f(o);if(t.eat(">"))return o.quote=l?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),f(o);if("["===t.peek())return i(t,o,v);if(t.match(S,!0))return o.hr=!0,k.hr;if(h=t.match(L)){var d=h[1]?"ol":"ul";for(o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),n.taskLists&&t.match(T,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+d]),f(o)}return n.fencedCodeBlocks&&(h=t.match(E,!0))?(o.fencedChars=h[1],o.localMode=r(h[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=u,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,f(o)):i(t,o,o.inline)}function c(t,n){var r=b.token(t,n.htmlState);if(!w){var i=e.innerMode(b,n.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||n.md_inside&&t.current().indexOf(">")>-1)&&(n.f=d,n.block=s,n.htmlState=null)}return r}function u(e,t){if(t.fencedChars&&e.match(t.fenced
this.tokens.links={},this.options=e||h.defaults,this.rules=d.normal,this.options.gfm&&(this.options.tables?this.rules=d.tables:this.rules=d.gfm)}function i(e,t){if(this.options=t||h.defaults,this.links=e,this.rules=p.normal,this.renderer=this.options.renderer||new o,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=p.breaks:this.rules=p.gfm:this.options.pedantic&&(this.rules=p.pedantic)}function o(e){this.options=e||{}}function a(e){this.tokens=[],this.token=null,this.options=e||h.defaults,this.options.renderer=this.options.renderer||new o,this.renderer=this.options.renderer,this.renderer.options=this.options}function l(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function s(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function c(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function u(){}function f(e){for(var t,n,r=1;r<arguments.length;r++){t=arguments[r];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function h(e,n,r){if(r||"function"==typeof n){r||(r=n,n=null),n=f({},h.defaults,n||{});var i,o,s=n.highlight,c=0;try{i=t.lex(e,n)}catch(e){return r(e)}o=i.length;var u=function(e){if(e)return n.highlight=s,r(e);var t;try{t=a.parse(i,n)}catch(t){e=t}return n.highlight=s,e?r(e):r(null,t)};if(!s||s.length<3)return u();if(delete n.highlight,!o)return u();for(;c<i.length;c++)!function(e){"code"!==e.type?--o||u():s(e.text,e.lang,function(t,n){return t?u(t):null==n||n===e.text?--o||u():(e.text=n,e.escaped=!0,void(--o||u()))})}(i[c])}else try{return n&&(n=f({},h.defaults,n)),a.parse(t.lex(e,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(n||h.defaults).silent)return"<p>An error occured:</p><pre>"+l(e.message+"",!0)+"</pre>";throw e}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=c(d.item,"gm")(/bull/g,d.bullet)(),d.list=c(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=c(d.blockquote)("def",d.def)(),d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",d.html=c(d.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,d._tag)(),d.paragraph=c(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=f({},d),d.gfm=f({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=c(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=f({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=d,t.lex=function(e,n){return new t(n).lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n")
7 years ago
;/editor-preview-active-side/.test(a.className)&&E(e)}function I(e,t,n,r){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){var i,o=n[0],a=n[1],l=e.getCursor("start"),s=e.getCursor("end");r&&(a=a.replace("#url#",r)),t?(i=e.getLine(l.line),o=i.slice(0,l.ch),a=i.slice(l.ch),e.replaceRange(o+a,{line:l.line,ch:0})):(i=e.getSelection(),e.replaceSelection(o+i+a),l.ch+=o.length,l!==s&&(s.ch+=o.length)),e.setSelection(l,s),e.focus()}}function D(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var r=e.getCursor("start"),i=e.getCursor("end"),o=r.line;o<=i.line;o++)!function(r){var i=e.getLine(r),o=i.search(/[^#]/);i=void 0!==t?o<=0?"bigger"==t?"###### "+i:"# "+i:6==o&&"smaller"==t?i.substr(7):1==o&&"bigger"==t?i.substr(2):"bigger"==t?i.substr(1):"#"+i:1==n?o<=0?"# "+i:o==n?i.substr(o+1):"# "+i.substr(o+1):2==n?o<=0?"## "+i:o==n?i.substr(o+1):"## "+i.substr(o+1):o<=0?"### "+i:o==n?i.substr(o+1):"### "+i.substr(o+1),e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(o);e.focus()}}function H(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n=l(e),r=e.getCursor("start"),i=e.getCursor("end"),o={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},s=r.line;s<=i.line;s++)!function(r){var i=e.getLine(r);i=n[t]?i.replace(o[t],"$1"):a[t]+i,e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(s);e.focus()}}function W(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r=void 0===r?n:r;var i,o=e.codemirror,a=l(o),s=n,c=r,u=o.getCursor("start"),f=o.getCursor("end");a[t]?(i=o.getLine(u.line),s=i.slice(0,u.ch),c=i.slice(u.ch),"bold"==t?(s=s.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),c=c.replace(/(\*\*|__)/,"")):"italic"==t?(s=s.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),c=c.replace(/(\*|_)/,"")):"strikethrough"==t&&(s=s.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),c=c.replace(/(\*\*|~~)/,"")),o.replaceRange(s+c,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==f&&(f.ch-=2)):"italic"==t&&(u.ch-=1,u!==f&&(f.ch-=1))):(i=o.getSelection(),"bold"==t?(i=i.split("**").join(""),i=i.split("__").join("")):"italic"==t?(i=i.split("*").join(""),i=i.split("_").join("")):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(s+i+c),u.ch+=n.length,f.ch=u.ch+i.length),o.setSelection(u,f),o.focus()}}function B(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=e.getLine(i),t=t.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}function P(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=P(e[n]||{},t[n]):e[n]=t[n]);return e}function R(e){for(var t=1;t<arguments.length;t++)e=P(e,arguments[t]);return e}function F(e){var t=e.match(/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g),n=0;if(null===t)return n;for(var r=0;r<t.length;r++)t[r].charCodeAt(0)>=19968?n+=t[r].length:n+=1;return n}function z(e){e=e||{},e.parent=this;var t=!0;if(e.autoDownloadFontAwesome===!1&&(t=!1),e.autoDownloadFontAwesome!==!0)for(var n=document.styleSheets,r=0;r<n.length;r++)n[r].href&&n[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")>-1&&(t=!1);if(t){var i=document.createElement("link");i.rel="stylesheet",i.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(i)}if(e.element)this.element=e.element;else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.");if(void 0===e.toolbar){e.toolbar=[];for(var o in Z)Z.hasOwnProperty(o)&&(o.indexOf("separator-")!=-1&&e.toolbar.push("|"),(Z[o].default===!0||e.showI
=======
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimpleMDE=e()}}(function(){var e;return function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,a,l,s=e.length;a=r(e),l=new f(3*s/4-a),i=a>0?s-4:s;var u=0;for(t=0,n=0;t<i;t+=4,n+=3)o=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],l[u++]=o>>16&255,l[u++]=o>>8&255,l[u++]=255&o;return 2===a?(o=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,l[u++]=255&o):1===a&&(o=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,l[u++]=o>>8&255,l[u++]=255&o),l}function a(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function l(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(a(r));return i.join("")}function s(e){for(var t,n=e.length,r=n%3,i="",o=[],a=16383,s=0,c=n-r;s<c;s+=a)o.push(l(e,s,s+a>c?c:s+a));return 1===r?(t=e[n-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=s;for(var u=[],c=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=h.length;d<p;++d)u[d]=h[d],c[h.charCodeAt(d)]=d;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=a.prototype):(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}return l(this,e,t,n)}function l(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?d(e,t,n,r):"string"==typeof t?f(e,t,n):p(e,t)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function u(e,t,n,r){return s(t),t<=0?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}function c(e,t){if(s(t),e=o(e,t<0?0:0|m(t)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(t,n);e=o(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function h(e,t){var n=t.length<0?0:0|m(t.length);e=o(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function d(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8A
n=new y),t&&u(t,n),n}function b(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Da.test(e))}function w(e,t){return t?!!(t.source.indexOf("\\w")>-1&&b(e))||t.test(e):b(e)}function k(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function S(e){return e.charCodeAt(0)>=768&&Ha.test(e)}function C(e,t,n){var i=this;this.input=n,i.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=r("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=r("div",null,"CodeMirror-code"),i.selectionDiv=r("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=r("div",null,"CodeMirror-cursors"),i.measure=r("div",null,"CodeMirror-measure"),i.lineMeasure=r("div",null,"CodeMirror-measure"),i.lineSpace=r("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none"),i.mover=r("div",[r("div",[i.lineSpace],"CodeMirror-lines")],null,"position: relative"),i.sizer=r("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=r("div",null,null,"position: absolute; height: "+Na+"px; width: 1px;"),i.gutters=r("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=r("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=r("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),la&&sa<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),ua||ia&&va||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,n.init(i)}function L(e,t){if(t-=e.first,t<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 r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function T(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function M(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function A(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function N(e){if(null==e.parent)return null;for(var t=e.parent,n=h(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function E(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return n+a}function O(e,t){return t>=e.first&&t<e.first+e.size}function I(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t){return this instanceof P?(this.line=e,void(this.ch=t)):new P(e,t)}function R(e,t){return e.line-t.line||e.ch-t.ch}function D(e){return P(e.line,e.ch)}function H(e,t){return R(e,t)<0?t:e}function W(e,t){return R(e,t)<0?e:t}function B(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _(e,t){if(t.line<e.first)return P(e.first,0);var n=e.first+e.size-1;return t.line>n?P(n,L(e,n).text.length):F(t,L(e,t.line).text.length)}function F(e,t){var n=e.ch;return null==n||n>t?P(e.line,t):n<0?P(e.line,0):e}function z(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=_(e,t[r]);return n}function j(){Wa=!0}function U(){Ba=!0}function q(e,t,n){this.marker=e,this.from=t,this.to=n}function G(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}
n}function cn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=ln(),i-=sn();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function fn(e,t,n,r,i){return r||(r=L(e.doc,t.line)),un(e,r,Kt(e,r,t.ch,i),n)}function hn(e,t,n,r,i,o){function a(t,a){var l=Jt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,un(e,r,l,n)}function l(e,t){var n=s[t],r=n.level%2;return e==ye(n)&&t&&n.level<s[t-1].level?(n=s[--t],e=xe(n)-(n.level%2?0:1),r=!0):e==xe(n)&&t<s.length-1&&n.level<s[t+1].level&&(n=s[++t],e=ye(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||L(e.doc,t.line),i||(i=Zt(e,r));var s=Me(r),u=t.ch;if(!s)return a(u);var c=Se(s,u),f=l(u,c);return null!=_a&&(f.other=l(u,_a)),f}function dn(e,t){var n=0;t=_(e.doc,t),e.options.lineWrapping||(n=yn(e.display)*t.ch);var r=L(e.doc,t.line),i=pe(r)+Ft(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function pn(e,t,n,r){var i=P(e,t);return i.xRel=r,n&&(i.outside=!0),i}function mn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return pn(r.first,0,!0,-1);var i=E(r,n),o=r.first+r.size-1;if(i>o)return pn(r.first+r.size-1,L(r,o).text.length,!0,1);t<0&&(t=0);for(var a=L(r,i);;){var l=gn(e,a,i,t,n),s=ae(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=N(a=u.to.line)}}function gn(e,t,n,r,i){function o(r){var i=hn(e,P(n,r),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-pe(t),l=!1,s=2*e.display.wrapper.clientWidth,u=Zt(e,t),c=Me(t),f=t.text.length,h=be(t),d=we(t),p=o(h),m=l,g=o(d),v=l;if(r>g)return pn(n,d,v,1);for(;;){if(c?d==h||d==Le(t,h,1):d-h<=1){var y=r<p||r-p<=g-r?h:d,x=y==h?m:v,b=r-(y==h?p:g);if(v&&!c&&!/\s/.test(t.text.charAt(y))&&b>0&&y<t.text.length&&u.view.measure.heights.length>1){var w=Jt(e,u,y,"right");a<=w.bottom&&a>=w.top&&Math.abs(r-w.right)<b&&(x=!1,y++,b=r-w.right)}for(;S(t.text.charAt(y));)++y;var k=pn(n,y,x,b<-1?-1:b>1?1:0);return k}var C=Math.ceil(f/2),L=h+C;if(c){L=h;for(var T=0;T<C;++T)L=Le(t,L,1)}var M=o(L);M>r?(d=L,g=M,(v=l)&&(g+=1e3),f=C):(h=L,p=M,m=l,f-=C)}}function vn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ja){Ja=r("pre");for(var i=0;i<49;++i)Ja.appendChild(document.createTextNode("x")),Ja.appendChild(r("br"));Ja.appendChild(document.createTextNode("x"))}n(e.measure,Ja);var o=Ja.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function yn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=r("span","xxxxxxxxxx"),i=r("pre",[t]);n(e.measure,i);var o=t.getBoundingClientRect(),a=(o.right-o.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:bn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function bn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function wn(e){var t=vn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/yn(e.display)-3);return function(i){if(he(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function kn(e){var t=e.doc,n=wn(e);t.iter(function(e){var t=n(e);t!=e.height&&A(e,t)})}function Sn(e,t,n,r){var i=e.display;if(!n&&"true"==_e(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(e){return null}var s,u=mn(e,o,a);if(r&&1==u.xRel&&(s=L(e.doc,u.line).text).length==u.ch){var f=c(s,s.length,e.options.tabSize)-s.length;u=P(u.line,Math.max(0,Math.round((o-jt(e.display).left)/yn(e.display))-f))}return u}function Cn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,
return r}function oi(e,t){var n=ii(e,t),r=X(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function ai(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Pr.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c=void 0;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&h(t,Number(c[1]))>-1&&(m(l)[f]=u[f],delete u[f])}}}return r}function li(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var o=R(n,i)<0;o!=R(r,i)<0?(i=n,n=r):o!=R(n,r)<0&&(n=r)}return new Rr(i,n)}return new Rr(r||n,n)}function si(e,t,n,r){pi(e,new Pr([li(e,e.sel.primary(),t,n)],0),r)}function ui(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=li(e,e.sel.ranges[i],t[i],null);var o=Dr(r,e.sel.primIndex);pi(e,o,n)}function ci(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,pi(e,Dr(i,e.sel.primIndex),r)}function fi(e,t,n,r){pi(e,Hr(t,n),r)}function hi(e,t,n){var r={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var r=0;r<t.length;r++)n.ranges[r]=new Rr(_(e,t[r].anchor),_(e,t[r].head))},origin:n&&n.origin};return Ee(e,"beforeSelectionChange",e,r),e.cm&&Ee(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Dr(r.ranges,r.ranges.length-1):t}function di(e,t,n){var r=e.history.done,i=m(r);i&&i.ranges?(r[r.length-1]=t,mi(e,t,n)):pi(e,t,n)}function pi(e,t,n){mi(e,t,n),ei(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function mi(e,t,n){(Pe(e,"beforeSelectionChange")||e.cm&&Pe(e.cm,"beforeSelectionChange"))&&(t=hi(e,t,n));var r=n&&n.bias||(R(t.primary().head,e.sel.primary().head)<0?-1:1);gi(e,yi(e,t,r,!0)),n&&n.scroll===!1||!e.cm||tr(e.cm)}function gi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ie(e.cm)),Ct(e,"cursorActivity",e))}function vi(e){gi(e,yi(e,e.sel,null,!1),Oa)}function yi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=bi(e,a.anchor,l&&l.anchor,n,r),u=bi(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Rr(s,u))}return i?Dr(i,t.primIndex):t}function xi(e,t,n,r,i){var o=L(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(Ee(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var u=s.find(r<0?1:-1),c=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(u=wi(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=R(u,n))&&(r<0?c<0:c>0))return xi(e,u,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=wi(e,f,r,f.line==t.line?o:null)),f?xi(e,f,t,r,i):null}}return t}function bi(e,t,n,r,i){var o=r||1,a=xi(e,t,n,o,i)||!i&&xi(e,t,n,o,!0)||xi(e,t,n,-o,i)||!i&&xi(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,P(e.first,0))}function wi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?_(e,P(t.line-1)):null:n>0&&t.ch==(r||L(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+n)}function ki(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),Oa)}function Si(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=_(e,t)),n&&(r.to=_(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),Ee(e,"beforeChange",e,r),e.cm&&Ee(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ci(e,t,n){if(e.cm){if(!e.cm.curOp)return hr(e.cm,Ci)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Pe(e,"beforeChange")||e.cm&&Pe(e.cm,"beforeChange"))||(t=Si(e,t,!0))){var r=Wa&&!n&&J(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Li(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Li(
return ua?e.style.width="1000px":e.setAttribute("wrap","off"),ga&&(e.style.border="1px solid black"),jo(e),t}function qo(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&hr(this,t[e])(this,n,i))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](ao(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:dr(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");v(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,mr(this)}),removeOverlay:dr(function(e){for(var t=this,n=this.state.overlays,r=0;r<n.length;++r){var i=n[r].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return n.splice(r,1),t.state.modeGen++,void mr(t)}}),indentLine:dr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),O(this.doc,e)&&Ho(this,e,t,n)}),indentSelection:dr(function(e){for(var t=this,n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var o=n[i];if(o.empty())o.head.line>r&&(Ho(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&tr(t));else{var a=o.from(),l=o.to(),s=Math.max(r,a.line);r=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1;for(var u=s;u<r;++u)Ho(t,u,e);var c=t.doc.sel.ranges;0==a.ch&&n.length==c.length&&c[i].from().ch>0&&ci(t.doc,i,new Rr(a,c[i].to()),Oa)}}}),getTokenAt:function(e,t){return it(this,e,t)},getLineTokens:function(e,t){return it(this,P(e),t,!0)},getTokenTypeAt:function(e){e=_(this.doc,e);var t,n=Qe(this,L(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=this,i=[];if(!n.hasOwnProperty(t))return i;var o=n[t],a=this.getModeAt(e);if("string"==typeof a[t])o[a[t]]&&i.push(o[a[t]]);else if(a[t])for(var l=0;l<a[t].length;l++){var s=o[a[t][l]];s&&i.push(s)}else a.helperType&&o[a.helperType]?i.push(o[a.helperType]):o[a.name]&&i.push(o[a.name]);for(var u=0;u<o._global.length;u++){var c=o._global[u];c.pred(a,r)&&h(i,c.val)==-1&&i.push(c.val)}return i},getStateAfter:function(e,t){var n=this.doc;return e=B(n,null==e?n.first+n.size-1:e),et(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?_(this.doc,e):e?r.from():r.to(),hn(this,n,t||"page")},charCoords:function(e,t){return fn(this,_(this.doc,e),t||"page")},coordsChar:function(e,t){return e=cn(this,e,t||"page"),mn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=cn(this,{top:e,left:0},t||"page").top,E(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=L(this.doc,e)}else r=e;return un(this,r,{top:0,left:0},t||"page",n).top+(i?this.doc.height-pe(r):0)},defaultTextHeight:function(){return vn(this.display)},defaultCharWidth:function(){return yn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=hn(this,_(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.off
},clipPos:function(e){return _(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||e===!1?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pr(function(e,t,n){fi(this,_(this,"number"==typeof e?P(e,t||0):e),null,n)}),setSelection:pr(function(e,t,n){fi(this,_(this,e),_(this,t||e),n)}),extendSelection:pr(function(e,t,n){si(this,_(this,e),t&&_(this,t),n)}),extendSelections:pr(function(e,t){ui(this,z(this,e),t)}),extendSelectionsBy:pr(function(e,t){var n=g(this.sel.ranges,e);ui(this,z(this,n),t)}),setSelections:pr(function(e,t,n){var r=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new Rr(_(r,e[o].anchor),_(r,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),pi(this,Dr(i,t),n)}}),addSelection:pr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Rr(_(this,e),_(this,t||e))),pi(this,Dr(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this,r=this.sel.ranges,i=0;i<r.length;i++){var o=T(n,r[i].from(),r[i].to());t=t?t.concat(o):o}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,n=[],r=this.sel.ranges,i=0;i<r.length;i++){var o=T(t,r[i].from(),r[i].to());e!==!1&&(o=o.join(e||t.lineSeparator())),n[i]=o}return n},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:pr(function(e,t,n){for(var r=this,i=[],o=this.sel,a=0;a<o.ranges.length;a++){var l=o.ranges[a];i[a]={from:l.from(),to:l.to(),text:r.splitLines(e[a]),origin:n}}for(var s=t&&"end"!=t&&zr(this,i,t),u=i.length-1;u>=0;u--)Ci(r,i[u]);s?di(this,s):this.cm&&tr(this.cm)}),undo:pr(function(){Ti(this,"undo")}),redo:pr(function(){Ti(this,"redo")}),undoSelection:pr(function(){Ti(this,"undo",!0)}),redoSelection:pr(function(){Ti(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,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new Vr(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ai(this.history.done),undone:ai(this.history.undone)}},setHistory:function(e){var t=this.history=new Vr(this.history.maxGeneration);t.done=ai(e.done.slice(0),null,!0),t.undone=ai(e.undone.slice(0),null,!0)},setGutterMarker:pr(function(e,t,n){return Ri(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&k(r)&&(e.gutterMarkers=null),!0})}),clearGutter:pr(function(e){var t=this,n=this.first;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Ri(t,r,"gutter",function(){return r.gutterMarkers[e]=null,k(r.gutterMarkers)&&(r.gutterMarkers=null),!0}),++n})}),lineInfo:function(e){var t;if("number"==typeof e){if(!O(this,e))return null;if(t=e,e=L(this,e),!e)return null}else if(t=N(e),null==t)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:pr(function(t,n,r){return Ri(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(t[i]){if(e(r).test(t[i]))return!1;t[i]+=" "+r}else t[i]=r;return!0})}),removeLineClass:pr(function(t,n,r){return Ri(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",o=t[i];if(!o)return!1;if(null==r)t[i]=null;else{var a=o.match(e(r));if(!a)return!1;var l=a.index+a[0].length;t[i]=o.slice(0,a.index)+(a.index&&l!=o.lengt
o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),n.taskLists&&t.match(M,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+d]),h(o)}return n.fencedCodeBlocks&&(f=t.match(O,!0))?(o.fencedChars=f[1],o.localMode=r(f[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=c,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,h(o)):i(t,o,o.inline)}function u(t,n){var r=w.token(t,n.htmlState);if(!k){var i=e.innerMode(w,n.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||n.md_inside&&t.current().indexOf(">")>-1)&&(n.f=p,n.block=s,n.htmlState=null)}return r}function c(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),S.code)}function f(e,t){e.match(t.fencedChars),t.block=s,t.f=p,t.fencedChars=null,n.highlightFormatting&&(t.formatting="code-block"),t.code=1;var r=h(t);return t.code=0,r}function h(e){var t=[];if(e.formatting){t.push(S.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r<e.formatting.length;r++)t.push(S.formatting+"-"+e.formatting[r]),"header"===e.formatting[r]&&t.push(S.formatting+"-"+e.formatting[r]+"-"+e.header),"quote"===e.formatting[r]&&(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(S.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(S.linkHref,"url"):(e.strong&&t.push(S.strong),e.em&&t.push(S.em),e.strikethrough&&t.push(S.strikethrough),e.linkText&&t.push(S.linkText),e.code&&t.push(S.code),e.image&&t.push(S.image),e.imageAltText&&t.push(S.imageAltText,"link"),e.imageMarker&&t.push(S.imageMarker)),e.header&&t.push(S.header,S.header+"-"+e.header),e.quote&&(t.push(S.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(S.quote+"-"+e.quote):t.push(S.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(S.list2):t.push(S.list3):t.push(S.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){if(e.match(E,!0))return h(t)}function p(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,h(r);if(r.taskList){var a="x"!==t.match(M,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,h(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),h(r);var l=t.sol(),s=t.next();if(r.linkTitle){r.linkTitle=!1;var c=s;"("===s&&(c=")"),c=(c+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+c+"\\\\]+|\\\\\\\\|\\\\.)"+c;if(t.match(new RegExp(f),!0))return S.linkHref}if("`"===s){var d=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var p=t.current().length;if(0==r.code)return r.code=p,h(r);if(p==r.code){var v=h(r);return r.code=0,v}return r.formatting=d,h(r)}if(r.code)return h(r);if("\\"===s&&(t.next(),n.highlightFormatting)){var y=h(r),x=S.formatting+"-escape";return y?y+" "+x:x}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,n.highlightFormatting&&(r.formatting="image"),h(r);if("["===s&&r.imageMarker)return r.imageMarker=!1,r.imageAltText=!0,n.highlightFormatting&&(r.formatting="image"),h(r);if("]"===s&&r.imageAltText){n.highlightFormatting&&(r.formatting="image");var y=h(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=g,y}if("["===s&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!r.image)return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),h(r);if("]"===s&&r.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){n.highlightFormatting&&(r.formatting="link");var y=h(r);return r.linkText=!1,r.inline=r.f=g,y}if("<"===s&&t.match(/^(https?
d.normal=f({},d),d.gfm=f({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=u(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=f({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=d,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,o,a,l,s,u,c,f,e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),s={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},c=0;c<s.align.length;c++)/^ *-+: *$/.test(s.align[c])?s.align[c]="right":/^ *:-+: *$/.test(s.align[c])?s.align[c]="center":/^ *:-+ *$/.test(s.align[c])?s.align[c]="left":s.align[c]=null;for(c=0;c<s.cells.length;c++)s.cells[c]=s.cells[c].split(/ *\| */);this.tokens.push(s)}else if(o=this.rules.lheading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(o=this.rules.hr.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,t,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),r=!1,f=o.length,c=0;c<f;c++)s=o[c],u=s.length,s=s.replace(/^ *([*+-]|\d+\.) +/,""),~s.indexOf("\n ")&&(u-=s.length,s=this.options.pedantic?s.replace(/^ {1,4}/gm,""):s.replace(new RegExp("^ {1,"+u+"}","gm"),"")),this.options.smartLists&&c!==f-1&&(l=d.bullet.exec(o[c+1])[0],a===l||a.length>1&&l.length>1||(e=o.slice(c+1).join("\n")+e,c=f-1)),i=r||/\n\n(?!\s*$)/.test(s),c!==f-1&&(r="\n"===s.charAt(s.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(s,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),s={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c<s.align.length;c++)/^ *-+: *$/.test(s.align[c])?s.align[c]="right":/^ *:-+: *$/.test(s.align[c])?s.align[c]="center":/^ *:-+ *$/.test(s.align[c])?s.align[c]="left":s.align[c]=null;for(c=0;c<s.cells.length;c++)s.cells[c]=s.cells[c].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(s)}else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.
7 years ago
}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=H({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=H({},X,e.insertTexts||{}),e.promptTexts=Z,e.blockStyles=H({},J,e.blockStyles||{}),e.shortcuts=H({},G,e.shortcuts||{}),e.minHeight=e.minHeight||"300px",void 0!=e.autosave&&void 0!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&this.options.autosave.foundSavedValue===!0||this.value(e.initialValue)}function _(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var F=e("codemirror");e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js");var z=e("codemirror-spell-checker"),j=e("marked"),U=/Mac/.test(navigator.platform),q={toggleBold:u,toggleItalic:c,drawLink:k,toggleHeadingSmaller:p,toggleHeadingBigger:m,drawImage:S,toggleBlockquote:d,toggleOrderedList:b,toggleUnorderedList:x,toggleCodeBlock:h,togglePreview:N,toggleStrikethrough:f,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:C,drawHorizontalRule:L,undo:T,redo:M,toggleSideBySide:A,toggleFullScreen:s},G={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Y=function(e){for(var t in q)if(q[t]===e)return t;return null},$=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.use
>>>>>>> b117a697026dd96c26829874e6d99f53d26cad62