From 2d98e6b3233ccb074bd0464d6f0260cf4d3b870b Mon Sep 17 00:00:00 2001 From: Nivanka Fonseka Date: Thu, 2 Nov 2017 10:24:17 +0530 Subject: [PATCH 1/2] added a short code parse for the editor previews --- client/dist/bundle.min.js | 23 +-- .../MarkdownEditorField.js | 34 +++-- .../ShortCodeParser/ShortcodeParser.js | 136 ++++++++++++++++++ client/src/entwine/Markdown_ssmedia.js | 3 +- package-lock.json | 4 +- package.json | 3 +- src/db/MarkdownText.php | 6 +- src/forms/MarkdownEditorConfig.php | 45 +++++- 8 files changed, 223 insertions(+), 31 deletions(-) create mode 100644 client/src/components/ShortCodeParser/ShortcodeParser.js diff --git a/client/dist/bundle.min.js b/client/dist/bundle.min.js index 37fc967..3f33aa3 100644 --- a/client/dist/bundle.min.js +++ b/client/dist/bundle.min.js @@ -1,5 +1,5 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";n(1),n(7),n(8)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertEmbedModal.default);o.default.entwine("ss",function(e){e("#insert-md-embed-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this.setData({}),this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=function(){return t._handleCreate.apply(t,arguments)},o=function(){return t._handleLoadingError.apply(t,arguments)},a=window.ss.store,l=window.ss.apolloClient,d=this.getOriginalAttributes();u.default.render(s.default.createElement(c.ApolloProvider,{store:a,client:l},s.default.createElement(p,{show:e,onCreate:i,onInsert:r,onHide:n,onLoadingError:o,fileAttributes:d,bodyClassName:"modal__dialog modal__dialog--scrollable",className:"insert-embed-react__dialog-wrapper"})),this[0])},_handleLoadingError:function(){this.setData({}),this.open()},_handleInsert:function(e){var t=this.getData();this.setData(Object.assign({Url:t.Url},e)),this.insertRemote(),this.close()},_handleCreate:function(e){this.setData(Object.assign({},this.getData(),e)),this.open()},getOriginalAttributes:function(){var e=this.getData();return e},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var n=e.split(" ");return t.find(function(e){return n.indexOf(e)>-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertMediaModal.default);o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.width+" height="+t.height+'] "'+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("
").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),y.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else g.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=v.markdownConfigs.readToolbarConfigs(t.dataset.config);d.default.render(u.default.createElement(y,{textarea:t,toolbar:n}),this[0])}})}),t.default={MarkdownEditorField:y}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like
,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
"],c=[3,"","
"],d=[1,'',""],p={"*":[1,"?

"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertMediaModal.default);o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.InsertWidth+" height="+t.InsertHeight+" url='"+t.url+"'] \""+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("

").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'});var w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=x.markdownConfigs,n}return a(t,e),s(t,[{key:"handleChange",value:function(e){this.props.textarea.value=e}},{key:"previewRender",value:function(e){var t=b.parse(e);return this.parent.markdown(t)}},{key:"render",value:function(){return u.default.createElement("div",{className:"editor-container"},u.default.createElement(f.default,{value:this.props.textarea.value,onChange:this.handleChange.bind(this),options:{spellChecker:!0,dragDrop:!1,keyMap:"sublime",toolbar:this.props.toolbar,previewRender:this.previewRender}}))}}],[{key:"addCustomAction",value:function(e,t){x.markdownConfigs[e]=t}},{key:"registerShortCodes",value:function(e,t){}}]),t}(u.default.Component);window.MarkdownEditorField=w,m.default.entwine("ss",function(e){w.addCustomAction("ssEmbed",function(t){if(window.InsertMediaModal){var n=e("#insert-md-embed-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),w.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else y.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=JSON.parse(t.dataset.config),r=x.markdownConfigs.readToolbarConfigs(n.toolbar);d.default.render(u.default.createElement(w,{textarea:t,toolbar:r}),this[0])}})}),t.default={MarkdownEditorField:w}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
"],c=[3,"","
"],d=[1,'',""],p={"*":[1,"?

"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o * @license MIT */ -"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()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return D(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function x(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,l=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}var u;if(i){var c=-1;for(u=n;us&&(n=s-l),u=n;u>=0;u--){for(var d=!0,p=0;pi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var l,u,c,d;switch(s){case 1:o<128&&(a=o);break;case 2:l=e[i+1],128===(192&l)&&(d=(31&o)<<6|63&l,d>127&&(a=d));break;case 3:l=e[i+1],u=e[i+2],128===(192&l)&&128===(192&u)&&(d=(15&o)<<12|(63&l)<<6|63&u,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=e[i+1],u=e[i+2],c=e[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(d=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,d>65535&&d<1114112&&(a=d))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return L(r)}function L(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function B(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function F(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function W(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,i){return i||W(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return i||W(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function V(e){if(e=j(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function K(e){return Q.toByteArray(V(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e){return e!==e}var Q=n(11),Z=n(12),J=n(13);t.Buffer=a,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),t.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return u(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,l=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),d=0;di)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return C(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return N(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;P(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function r(e){return 3*e.length/4-n(e)}function i(e){var t,r,i,o,a,s=e.length;o=n(e),a=new c(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function a(e,t,n){for(var r,i=[],a=t;ac?c:u+s));return 1===r?(t=e[n-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),o.push(i),o.join("")}t.byteLength=r,t.toByteArray=i,t.fromByteArray=s;for(var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=d.length;p>1,c=-7,d=n?i-1:0,p=n?-1:1,f=e[t+d];for(d+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(f?-1:1)*(1/0);a+=Math.pow(2,r),o-=u}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),t+=a+d>=1?p/l:p*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=h,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";function r(e){return e=j?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function i(e,t,n){e=e||{};var r=document.createElement("a");return t=void 0==t||t,e.title&&t&&(r.title=a(e.title,e.action,n),j&&(r.title=r.title.replace("Ctrl","⌘"),r.title=r.title.replace("Alt","⌥"))),r.tabIndex=-1,r.className=e.className,r}function o(){var e=document.createElement("i");return e.className="separator",e.innerHTML="|",e}function a(e,t,n){var i,o=e;return t&&(i=Y(t),n[i]&&(o+=" ("+r(n[i])+")")),o}function s(e,t){t=t||e.getCursor("start");var n=e.getTokenAt(t);if(!n.type)return{};for(var r,i,o=n.type.split(" "),a={},s=0;s=0&&(f=u.getLineHandle(o),!t(f));o--);var v,y,b,x,w=u.getTokenAt({line:o,ch:1}),C=n(w).fencedChars;t(u.getLineHandle(c.line))?(v="",y=c.line):t(u.getLineHandle(c.line-1))?(v="",y=c.line-1):(v=C+"\n",y=c.line),t(u.getLineHandle(d.line))?(b="",x=d.line,0===d.ch&&(x+=1)):0!==d.ch&&t(u.getLineHandle(d.line+1))?(b="",x=d.line+1):(b=C+"\n",x=d.line+1),0===d.ch&&(x-=1),u.operation(function(){u.replaceRange(b,{line:x,ch:0},{line:x+(b?0:1),ch:0}),u.replaceRange(v,{line:y,ch:0},{line:y+(v?0:1),ch:0})}),u.setSelection({line:y+(v?1:0),ch:0},{line:x+(v?1:-1),ch:0}),u.focus()}else{var k=c.line;if(t(u.getLineHandle(c.line))&&("fenced"===r(u,c.line+1)?(o=c.line,k=c.line+1):(a=c.line,k=c.line-1)),void 0===o)for(o=k;o>=0&&(f=u.getLineHandle(o),!t(f));o--);if(void 0===a)for(s=u.lineCount(),a=k;a=0;o--)if(f=u.getLineHandle(o),!f.text.match(/^\s*$/)&&"indented"!==r(u,o,f)){o+=1;break}for(s=u.lineCount(),a=c.line;a\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},l=r.line;l<=i.line;l++)!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})}(l);e.focus()}}function A(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r="undefined"==typeof r?n:r;var i,o=e.codemirror,a=s(o),l=n,u=r,c=o.getCursor("start"),d=o.getCursor("end");a[t]?(i=o.getLine(c.line),l=i.slice(0,c.ch),u=i.slice(c.ch),"bold"==t?(l=l.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),u=u.replace(/(\*\*|__)/,"")):"italic"==t?(l=l.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),u=u.replace(/(\*|_)/,"")):"strikethrough"==t&&(l=l.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),u=u.replace(/(\*\*|~~)/,"")),o.replaceRange(l+u,{line:c.line,ch:0},{line:c.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(c.ch-=2,c!==d&&(d.ch-=2)):"italic"==t&&(c.ch-=1,c!==d&&(d.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(l+i+u),c.ch+=n.length,d.ch=c.ch+i.length),o.setSelection(c,d),o.focus()}}function I(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 R(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]=R(e[n]||{},t[n]):e[n]=t[n]);return e}function P(e){for(var t=1;t=19968?n[i].length:1;return r}function F(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-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 $)$.hasOwnProperty(o)&&(o.indexOf("separator-")!=-1&&e.toolbar.push("|"),($[o].default===!0||e.showIcons&&e.showIcons.constructor===Array&&e.showIcons.indexOf(o)!=-1)&&e.toolbar.push(o))}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=P({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=P({},X,e.insertTexts||{}),e.promptTexts=Q,e.blockStyles=P({},Z,e.blockStyles||{}),e.shortcuts=P({},q,e.shortcuts||{}),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 W(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var H=n(15);n(16),n(17),n(18),n(19),n(22),n(23),n(24),n(25),n(20);var U=n(26),V=n(29),j=/Mac/.test(navigator.platform),z={toggleBold:u,toggleItalic:c,drawLink:C,toggleHeadingSmaller:h,toggleHeadingBigger:m,drawImage:k,toggleBlockquote:f,toggleOrderedList:x,toggleUnorderedList:b,toggleCodeBlock:p,togglePreview:M,toggleStrikethrough:d,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:S,drawHorizontalRule:E,undo:N,redo:T,toggleSideBySide:_,toggleFullScreen:l},q={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 z)if(z[t]===e)return t;return null},G=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.userAgent||navigator.vendor||window.opera),e},K="",$={bold:{name:"bold",action:u,className:"fa fa-bold",title:"Bold",default:!0},italic:{name:"italic",action:c,className:"fa fa-italic",title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:d,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:h,className:"fa fa-header",title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:h,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:p,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:f,className:"fa fa-quote-left",title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:b,className:"fa fa-list-ul",title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:x,className:"fa fa-list-ol",title:"Numbered List",default:!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:C,className:"fa fa-link",title:"Create Link",default:!0},image:{name:"image",action:k,className:"fa fa-picture-o",title:"Insert Image",default:!0},table:{name:"table",action:S,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:E,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:M,className:"fa fa-eye no-disable",title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:_,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:l,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:N,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:T,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Q={link:"URL for the link:",image:"URL of the image:"},Z={bold:"**",code:"```",italic:"*"};F.prototype.markdown=function(e){if(V){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),V.setOptions(t),V(e)}},F.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==z[o]&&!function(e){i[r(t.shortcuts[e])]=function(){z[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&l(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&l(n)},!1);var a,s;if(t.spellChecker!==!1?(a="spell-checker",s=t.parsingConfig,s.name="gfm",s.gitHubSpice=!1,U({codeMirrorInstance:H})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=H.fromTextArea(e,{mode:a,backdrop:s,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0==t.styleSelectedText||t.styleSelectedText}),t.forceSync===!0){var u=this.codemirror;u.on("change",function(){u.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var c=this.codemirror;setTimeout(function(){c.refresh()}.bind(c),0)}},F.prototype.autosave=function(){if(W()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=i<10?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},F.prototype.clearAutosavedValue=function(){if(W()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},F.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},F.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t0;--t)e.removeChild(e.firstChild);return e}function n(e,n){return t(e).appendChild(n)}function r(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.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}}function p(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function h(e){for(;Va.length<=e;)Va.push(m(Va)+" ");return Va[e]}function m(e){return e[e.length-1]}function g(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||ja.test(e))}function w(e,t){return t?!!(t.source.indexOf("\\w")>-1&&x(e))||t.test(e):x(e)}function C(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return e.charCodeAt(0)>=768&&za.test(e)}function S(e,t,n){for(;(n<0?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=e.first&&tn?R(n,T(e,n).text.length):j(t,T(e,t.line).text.length)}function j(e,t){var n=e.ch;return null==n||n>t?R(e.line,t):n<0?R(e.line,0):e}function z(e,t){for(var n=[],r=0;r=t:o.to>t);(r||(r=[])).push(new G(a,o.from,l?null:o.to))}}return r}function Z(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var w=0;w0)){var c=[l,1],d=P(u.from,s.from),f=P(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}function ne(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?P(u.to,n)>=0:P(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?P(u.from,r)<=0:P(u.from,r)<0)))return!0}}}function de(e){for(var t;t=le(e);)e=t.find(-1,!0).line;return e}function pe(e){for(var t;t=ue(e);)e=t.find(1,!0).line;return e}function fe(e){for(var t,n;t=ue(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function he(e,t){var n=T(e,t),r=de(n);return n==r?t:D(r)}function me(e,t){if(t>e.lastLine())return t;var n,r=T(e,t);if(!ge(e,r))return t;for(;n=ue(r);)r=n.find(1,!0).line;return D(r)+1}function ge(e,t){var n=Ya&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function we(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function Ce(e,t,n){var r;Ga=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Ga=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Ga=i)}return null!=r?r:Ga}function ke(e,t){var n=e.order;return null==n&&(n=e.order=Ka(e.text,t)),n}function Se(e,t,n){var r=S(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ee(e,t,n){var r=Se(e,t.ch,n);return null==r?null:new R(t.line,r,n<0?"after":"before")}function Ne(e,t,n,r,i){if(e){var o=ke(n,t.doc.direction);if(o){var a,s=i<0?m(o):o[0],l=i<0==(1==s.level),u=l?"after":"before";if(s.level>0){var c=Qt(t,n);a=i<0?n.text.length-1:0;var d=Zt(t,c,a).top;a=E(function(e){return Zt(t,c,e).top==d},i<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=Se(n,a,1))}else a=i<0?s.to:s.from;return new R(r,a,u)}}return new R(r,i<0?n.text.length:0,i<0?"before":"after")}function Te(e,t,n,r){var i=ke(t,e.doc.direction);if(!i)return Ee(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Ce(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&p>=c.begin)){var f=d?"before":"after";return new R(n.line,p,f)}}var h=function(e,t,r){for(var o=function(e,t){return t?new R(n.line,l(e,1),"before"):new R(n.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==g||r>0&&g==t.text.length||!(m=h(r>0?0:i.length-1,r,u(g)))?null:m}function _e(e,t){return e._handlers&&e._handlers[t]||$a}function Me(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=p(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Le(e,t){var n=_e(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Ie(e){e.prototype.on=function(e,t){Xa(this,e,t)},e.prototype.off=function(e,t){Me(this,e,t)}}function Re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Pe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Be(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Fe(e){Re(e),Pe(e)}function We(e){return e.target||e.srcElement}function He(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Ea&&e.ctrlKey&&1==t&&(t=3),t}function Ue(e){if(null==Ra){var t=r("span","​");n(e,r("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ra=t.offsetWidth<=1&&t.offsetHeight>2&&!(fa&&ha<8))}var i=Ra?r("span","​"):r("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Ve(e){if(null!=Pa)return Pa;var r=n(e,document.createTextNode("AخA")),i=Ma(r,0,1).getBoundingClientRect(),o=Ma(r,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(Pa=o.right-i.right<3)}function je(e){if(null!=ts)return ts;var t=n(e,r("span","x")),i=t.getBoundingClientRect(),o=Ma(t,0,1).getBoundingClientRect();return ts=Math.abs(i.left-o.left)>1}function ze(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ns[e]=t}function qe(e,t){rs[e]=t}function Ye(e){if("string"==typeof e&&rs.hasOwnProperty(e))e=rs[e];else if(e&&"string"==typeof e.name&&rs.hasOwnProperty(e.name)){var t=rs[e.name];"string"==typeof t&&(t={name:t}),e=b(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ye("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ye("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ge(e,t){t=Ye(t);var n=ns[t.name];if(!n)return Ge(e,"text/plain");var r=n(e,t);if(is.hasOwnProperty(t.name)){var i=is[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}function Ke(e,t){var n=is.hasOwnProperty(e)?is[e]:is[e]={};c(t,n)}function $e(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Xe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),n&&n.mode!=e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Qe(e,t,n){return!e.startState||e.startState(t,n)}function Ze(e,t,n,r){var i=[e.state.modeGen],o={};at(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,s=function(r){var a=e.state.overlays[r],s=1,l=0;n.state=!0,at(e,t.text,a.mode,n,function(e,t){for(var n=s;le&&i.splice(s,1,e,i[s+1],r),s+=2,l=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&$e(e.doc.mode,r.state),o=Ze(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),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 et(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ss(r,!0,t);var o=st(e,t,n),a=o>r.first&&T(r,o-1).stateAfter,s=a?ss.fromSaved(r,a,o):new ss(r,Qe(r.mode),o);return r.iter(o,t,function(n){tt(e,n.text,s);var r=s.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function it(e,t,n,r){var i,o=e.doc,a=o.mode;t=V(o,t);var s,l=T(o,t.line),u=et(e,t.line,n),c=new os(l.text,e.options.tabSize,u);for(r&&(s=[]);(r||c.pose.options.maxHighlightLength?(s=!1,a&&tt(e,t,r,d.pos),d.pos=t.length,l=null):l=ot(rt(n,d,r.state,p),o),p){var f=p[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=T(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof as?u.lookAhead:0)<=o.modeFrontier))return s;var c=d(l.text,null,e.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function lt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=T(e,r).stateAfter;if(i&&(!(i instanceof as)||r+i.lookAhead1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&d.from<=u));p++);if(d.to>=c)return e(n,r,i,o,a,s,l);e(n,r.slice(0,d.to-u),i,o,null,s,l),o=null,r=r.slice(d.to-u),u=d.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function yt(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,u,c,d,p,f=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=u=c=d=s="",p=null,v=1/0;for(var y=[],b=void 0,x=0;xh||C.collapsed&&w.to==h&&w.from==h)?(null!=w.to&&w.to!=h&&v>w.to&&(v=w.to,u=""),C.className&&(l+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&w.from==h&&(c+=" "+C.startStyle),C.endStyle&&w.to==v&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!d&&(d=C.title),C.collapsed&&(!p||ae(p.marker,C)<0)&&(p=w)):w.from>h&&v>w.from&&(v=w.from)}if(b)for(var k=0;k=f)break;for(var E=Math.min(f,v);;){if(g){var N=h+g.length;if(!p){var T=N>E?g.slice(0,E-h):g;t.addToken(t,T,a?a+l:l,c,h+T.length==v?u:"",d,s)}if(N>=E){g=g.slice(E-h),h=E;break}h=N,c=""}g=i.slice(o,o=n[m++]),a=dt(n[m++],t.cm.options)}}else for(var _=1;_2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Gt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Kt(e,t){t=de(t);var r=D(t),i=e.display.externalMeasured=new bt(e.doc,t,r);i.lineN=r;var o=i.built=pt(e,i);return i.text=o.pre,n(e.display.lineMeasure,o.pre),i}function $t(e,t,n,r){return Zt(e,Qt(e,t),n,r)}function Xt(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=l-s,i=o-1,t>=l&&(a="right")),null!=i){if(r=e[u+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if("right"==n&&i==l-s)for(;u=0&&(n=e[i]).left==n.right;i--);return n}function tn(e,t,n,r){var i,o=Jt(t.map,n,r),a=o.node,s=o.start,l=o.end,u=o.collapse;if(3==a.nodeType){for(var c=0;c<4;c++){for(;s&&k(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l0&&(u=r="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==r?d.length-1:0]:a.getBoundingClientRect()}if(fa&&ha<9&&!s&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+xn(e.display),top:p.top,bottom:p.bottom}:ms}for(var f=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(f+h)/2,g=t.view.measure.heights,v=0;v=r.text.length?(u=r.text.length,c="before"):u<=0&&(u=0,c="after"),!l)return a("before"==c?u-1:u,"before"==c);var d=Ce(l,u,c),p=Ga,f=s(u,d,"before"==c);return null!=p&&(f.other=s(u,p,"before"!=c)),f}function fn(e,t){var n=0;t=V(e.doc,t),e.options.lineWrapping||(n=xn(e.display)*t.ch);var r=T(e.doc,t.line),i=ye(r)+Ht(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function hn(e,t,n,r,i){var o=R(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function mn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return hn(r.first,0,null,!0,-1);var i=O(r,n),o=r.first+r.size-1;if(i>o)return hn(r.first+r.size-1,T(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=T(r,i);;){var s=yn(e,a,i,t,n),l=ue(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=D(a=u.to.line)}}function gn(e,t,n,r){var i=function(r){return un(e,t,Zt(e,n,r),"line")},o=t.text.length,a=E(function(e){return i(e-1).bottom<=r},o,0);return o=E(function(e){return i(e).top>r},a,o),{begin:a,end:o}}function vn(e,t,n,r){var i=un(e,t,Zt(e,n,r),"line").top;return gn(e,t,n,i)}function yn(e,t,n,r,i){i-=ye(t);var o,a=0,s=t.text.length,l=Qt(e,t),u=ke(t,e.doc.direction);if(u){if(e.options.lineWrapping){var c;c=gn(e,t,l,i),a=c.begin,s=c.end,c}o=new R(n,Math.floor(a+(s-a)/2));var d,p,f=pn(e,o,"line",t,l).left,h=f1){var b=Math.abs(m-d)/g;g=Math.min(g,Math.ceil(Math.abs(m)/b)),h=m<0?1:-1}}while(0!=m&&(g>1||h<0!=m<0&&Math.abs(m)<=Math.abs(d)));if(Math.abs(m)>Math.abs(d)){if(m<0==d<0)throw new Error("Broke out of infinite loop in coordsCharInner");o=p}}else{var x=E(function(n){var o=un(e,t,Zt(e,l,n),"line");return o.top>i?(s=Math.min(n,s),!0):!(o.bottom<=i)&&(o.left>r||!(o.rightw.right?1:0,o}function bn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==cs){cs=r("pre");for(var i=0;i<49;++i)cs.appendChild(document.createTextNode("x")),cs.appendChild(r("br"));cs.appendChild(document.createTextNode("x"))}n(e.measure,cs);var o=cs.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 wn(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:Cn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Cn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function kn(e){var t=bn(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=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r=e.display.viewTo||s.to().line3&&(i(f,m.top,null,m.bottom),f=c,m.bottoml.bottom||u.bottom==l.bottom&&u.right>l.right)&&(l=u),f0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function On(e){e.state.focused||(e.display.input.focus(),In(e))}function An(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Rn(e))},100)}function In(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,s(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ma&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Dn(e))}function Rn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,Oa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Pn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||l<-.005)&&(L(i.line,o),Bn(i.line),i.rest))for(var u=0;u=a&&(o=O(t,ye(T(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function Wn(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Cn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!wa){var a=r("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Ht(e.display))+"px;\n height: "+(t.bottom-t.top+jt(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(o),e.display.lineSpace.removeChild(a)}}}function Vn(e,t,n,r){null==r&&(r=0);var i;e.options.lineWrapping||t!=n||(t=t.ch?R(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?R(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,s=pn(e,t),l=n&&n!=t?pn(e,n):s;i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r};var u=zn(e,i),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=u.scrollTop&&(Qn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(Jn(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function jn(e,t){var n=zn(e,t);null!=n.scrollTop&&Qn(e,n.scrollTop),null!=n.scrollLeft&&Jn(e,n.scrollLeft)}function zn(e,t){var n=e.display,r=bn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=qt(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Ut(n),l=t.tops-r;if(t.topi+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(a.scrollTop=c)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,p=zt(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),f=t.right-t.left>p;return f&&(t.right=t.left+p),t.left<10?a.scrollLeft=0:t.leftp+d-3&&(a.scrollLeft=t.right+(f?0:10)-p),a}function qn(e,t){null!=t&&($n(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Yn(e){$n(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Gn(e,t,n){null==t&&null==n||$n(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Kn(e,t){$n(e),e.curOp.scrollToPos=t}function $n(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=fn(e,t.from),r=fn(e,t.to);Xn(e,n,r,t.margin)}}function Xn(e,t,n,r){var i=zn(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Gn(e,i.scrollLeft,i.scrollTop)}function Qn(e,t){Math.abs(e.doc.scrollTop-t)<2||(ua||Mr(e,{top:t}),Zn(e,t,!0),ua&&Mr(e),Cr(e,100))}function Zn(e,t,n){t=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 Jn(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Wn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function er(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ut(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:r,scrollHeight:r+jt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function tr(e,t){t||(t=er(e));var n=e.display.barWidth,r=e.display.barHeight;nr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Pn(e),nr(e,er(e)),n=e.display.barWidth,r=e.display.barHeight}function nr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function rr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Oa(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ys[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Xa(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?Jn(e,t):Qn(e,t)},e),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)}function ir(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++bs},wt(e.curOp)}function or(e){var t=e.curOp;kt(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xs(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function lr(e){e.updatedDisplay=e.mustUpdate&&Tr(e.cm,e.update)}function ur(e){var t=e.cm,n=t.display;e.updatedDisplay&&Pn(t),e.barMeasure=er(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$t(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+jt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-zt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection(e.focus))}function cr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeftt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ya&&he(e.doc,t)i.viewFrom?yr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)yr(e);else if(t<=i.viewFrom){var o=br(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):yr(e)}else if(n>=i.viewTo){var a=br(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):yr(e)}else{var s=br(e,t,t,-1),l=br(e,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(xt(e,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):yr(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Nn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);p(a,n)==-1&&a.push(n)}}}function yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function br(e,t,n,r){var i,o=Nn(e,t),a=e.display.view;if(!Ya||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;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;he(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function xr(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=xt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=xt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function wr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo)){var n=+new Date+e.options.workTime,r=et(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?$e(t.mode,r.state):null,l=Ze(e,o,r,!0);s&&(r.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),p=0;!d&&pn)return Cr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&pr(e,function(){for(var t=0;t=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==wr(e))return!1;Hn(e)&&(yr(e),n.dims=wn(e));var o=i.first+i.size,a=Math.max(n.visible.from-e.options.viewportMargin,i.first),s=Math.min(o,n.visible.to+e.options.viewportMargin);r.viewFroms&&r.viewTo-s<20&&(s=Math.min(o,r.viewTo)),Ya&&(a=he(e.doc,a),s=me(e.doc,s));var l=a!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;xr(e,a,s),r.viewOffset=ye(T(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=wr(e);if(!l&&0==u&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Er(e);return u>4&&(r.lineDiv.style.display="none"),Lr(e,r.updateLineNumbers,n.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Nr(c),t(r.cursorDiv),t(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,Cr(e,400)),r.updateLineNumbers=null,!0}function _r(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=zt(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ut(e.display)-qt(e),n.top)}),t.visible=Fn(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&Tr(e,t);r=!1){Pn(e);var i=er(e);Tn(e),tr(e,i),Or(e,i),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 Mr(e,t){var n=new xs(e,t);if(Tr(e,n)){Pn(e),_r(e,n);var r=er(e);Tn(e),tr(e,r),Or(e,r),n.finish()}}function Lr(e,n,r){function i(t){var n=t.nextSibling;return ma&&Ea&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var o=e.display,a=e.options.lineNumbers,s=o.lineDiv,l=s.firstChild,u=o.view,c=o.viewFrom,d=0;d-1&&(h=!1),Nt(e,f,c,r)),h&&(t(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(I(e.options,c)))),l=f.node.nextSibling}else{var m=It(e,f,c,r);s.insertBefore(m,l)}c+=f.size}for(;l;)l=i(l)}function Dr(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Or(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+jt(e)+"px"}function Ar(e){var n=e.display.gutters,i=e.options.gutters;t(n);for(var o=0;o-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function Rr(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Pr(e){var t=Rr(e);return t.x*=Cs,t.y*=Cs,t}function Br(e,t){var n=Rr(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&Ea&&ma)e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode)for(var d=0;d=0){var a=H(o.from(),i.from()),s=W(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new Ss(l?s:a,l?a:s))}}return new ks(e,t)}function Wr(e,t){return new ks([new Ss(e,t||e)],0)}function Hr(e){return e.text?R(e.from.line+e.text.length-1,m(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ur(e,t){if(P(e,t.from)<0)return e;if(P(e,t.to)<=0)return Hr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Hr(t).ch-t.to.ch),R(n,r)}function Vr(e,t){for(var n=[],r=0;r1&&e.remove(s.line+1,h-1),e.insert(s.line+1,y)}St(e,"change",e,t)}function $r(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges?(e.done.pop(),m(e.done)):void 0}function ri(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ni(i,i.lastOp==r)))a=m(o.changes),0==P(t.from,t.to)&&0==P(t.from,a.to)?a.to=Hr(t):o.changes.push(ei(e,t));else{var l=m(i.done);for(l&&l.ranges||ai(e.sel,i.done),o={changes:[ei(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||Le(e,"historyAdded")}function ii(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function oi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ii(e,o,m(i.done),t))?i.done[i.done.length-1]=t:ai(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ti(i.undone)}function ai(e,t){var n=m(t);n&&n.ranges&&n.equals(e)||t.push(e)}function si(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function li(e){if(!e)return null;for(var t,n=0;n-1&&(m(s)[d]=u[d],delete u[d])}}}return r}function pi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=P(t,i)<0;o!=P(n,i)<0?(i=t,t=n):o!=P(t,n)<0&&(t=n)}return new Ss(i,t)}return new Ss(n||t,t)}function fi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),bi(e,new ks([pi(e.sel.primary(),t,n,i)],0),r)}function hi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(i&&(Le(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var u=l.find(r<0?1:-1),c=void 0;if((r<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Ni(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=P(u,n))&&(r<0?c<0:c>0))return Si(e,u,t,r,i)}var d=l.find(r<0?-1:1);return(r<0?l.inclusiveLeft:l.inclusiveRight)&&(d=Ni(e,d,r,d.line==t.line?o:null)),d?Si(e,d,t,r,i):null}}return t}function Ei(e,t,n,r,i){var o=r||1,a=Si(e,t,n,o,i)||!i&&Si(e,t,n,o,!0)||Si(e,t,n,-o,i)||!i&&Si(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,R(e.first,0))}function Ni(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?V(e,R(t.line-1)):null:n>0&&t.ch==(r||T(e,t.line)).text.length?t.line=0;--i)Li(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Li(e,t)}}function Li(e,t){if(1!=t.text.length||""!=t.text[0]||0!=P(t.from,t.to)){var n=Vr(e,t);ri(e,t,n,e.cm?e.cm.curOp.id:NaN),Ai(e,t,n,J(e,t));var r=[];$r(e,function(e,n){n||p(r,e.history)!=-1||(Fi(e.history,t),r.push(e.history)),Ai(e,t,null,J(e,t))})}}function Di(e,t,n){if(!e.cm||!e.cm.state.suppressEdits||n){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--f){var h=d(f);if(h)return h.v}}}}function Oi(e,t){if(0!=t&&(e.first+=t,e.sel=new ks(g(e.sel.ranges,function(e){return new Ss(R(e.anchor.line+t,e.anchor.ch),R(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){gr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:R(o,T(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=_(e,t.from,t.to),n||(n=Vr(e,t)),e.cm?Ii(e.cm,t,r):Kr(e,t,r),xi(e,n,Wa)}}function Ii(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=D(de(T(r,o.line))),r.iter(l,a.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Oe(e),Kr(r,t,n,kn(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,function(e){var t=be(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),lt(r,o.line),Cr(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?gr(e):o.line!=a.line||1!=t.text.length||Gr(e.doc,t)?gr(e,o.line,a.line+1,u):vr(e,o.line,"text");var c=Ae(e,"changes"),d=Ae(e,"change");if(d||c){var p={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&St(e,"change",e,p),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Ri(e,t,n,r,i){if(r||(r=n),P(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Mi(e,{from:n,to:r,text:t,origin:i})}function Pi(e,t,n,r){n0||0==s&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=i("span",[a.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ce(e,t.line,t,n,a)||t.line!=n.line&&ce(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Y()}a.addToHistory&&ri(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,u=t.line,d=e.cm;if(e.iter(u,n.line+1,function(e){d&&a.collapsed&&!d.options.lineWrapping&&de(e)==d.display.maxLine&&(l=!0),a.collapsed&&u!=t.line&&L(e,0),X(e,new G(a,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),a.collapsed&&e.iter(t.line,n.line+1,function(t){ge(e,t)&&L(t,0)}),a.clearOnEnter&&Xa(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(q(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Ns,a.atomic=!0),d){if(l&&(d.curOp.updateMaxLine=!0),a.collapsed)gr(d,t.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var p=t.line;p<=n.line;p++)vr(d,p,"text");a.atomic&&Ci(d.doc),St(d,"markerAdded",d,a)}return a}function qi(e,t,n,r,i){r=c(r),r.shared=!1;var o=[zi(e,t,n,r,i)],a=o[0],s=r.widgetNode;return $r(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)), -o.push(zi(e,V(e,t),V(e,n),r,i));for(var l=0;l-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),xi(t.doc,Wr(n,n)),c)for(var d=0;d=0;t--)Ri(e.doc,"",r[t].from,r[t].to,"+delete");Yn(e)})}function po(e,t){var n=T(e.doc,t),r=de(n);return r!=n&&(t=D(r)),Ne(!0,e,r,t,1)}function fo(e,t){var n=T(e.doc,t),r=pe(n);return r!=n&&(t=D(r)),Ne(!0,e,n,t,-1)}function ho(e,t){var n=po(e,t.line),r=T(e.doc,n.line),i=ke(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return R(n.line,a?0:o,n.sticky)}return n}function mo(e,t,n){if("string"==typeof t&&(t=Fs[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Fa}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function go(e,t,n){for(var r=0;r-1&&(P((i=s.ranges[i]).from(),t)<0||t.xRel>0)&&(P(i.to(),t)>0||t.xRel<0)?Mo(e,r,t,o):Do(e,r,t,o)}function Mo(e,t,n,r){var i=e.display,o=!1,a=fr(e,function(t){ma&&(i.scroller.draggable=!1),e.state.draggingText=!1,Me(document,"mouseup",a),Me(document,"mousemove",s),Me(i.scroller,"dragstart",l),Me(i.scroller,"drop",a),o||(Re(t),r.addNew||fi(e.doc,n,null,null,r.extend),ma||fa&&9==ha?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),s=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},l=function(){return o=!0};ma&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Xa(document,"mouseup",a),Xa(document,"mousemove",s),Xa(i.scroller,"dragstart",l),Xa(i.scroller,"drop",a),An(e),setTimeout(function(){return i.input.focus()},20)}function Lo(e,t,n){if("char"==n)return new Ss(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ss(R(t.line,0),V(e.doc,R(t.line+1,0)));var r=n(e,t);return new Ss(r.from,r.to)}function Do(e,t,n,r){function i(t){if(0!=P(v,t))if(v=t,"rectangle"==r.unit){for(var i=[],o=e.options.tabSize,a=d(T(u,n.line).text,n.ch,o),s=d(T(u,t.line).text,t.ch,o),l=Math.min(a,s),m=Math.max(a,s),g=Math.min(n.line,t.line),y=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=y;g++){var b=T(u,g).text,x=f(b,l,o);l==m?i.push(new Ss(R(g,x),R(g,x))):b.length>x&&i.push(new Ss(R(g,x),R(g,f(b,m,o))))}i.length||i.push(new Ss(n,n)),bi(u,Fr(h.ranges.slice(0,p).concat(i),p),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var w,C=c,k=Lo(e,t,r.unit),S=C.anchor;P(k.anchor,S)>0?(w=k.head,S=H(C.from(),k.anchor)):(w=k.anchor,S=W(C.to(),k.head));var E=h.ranges.slice(0);E[p]=new Ss(V(u,S),w),bi(u,Fr(E,p),Ha)}}function o(t){var n=++b,s=En(e,t,!0,"rectangle"==r.unit);if(s)if(0!=P(s,v)){e.curOp.focus=a(),i(s);var c=Fn(l,u);(s.line>=c.to||s.liney.bottom?20:0;d&&setTimeout(fr(e,function(){b==n&&(l.scroller.scrollTop+=d,o(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,Re(t),l.input.focus(),Me(document,"mousemove",x),Me(document,"mouseup",w),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Re(t);var c,p,h=u.sel,m=h.ranges;if(r.addNew&&!r.extend?(p=u.sel.contains(n),c=p>-1?m[p]:new Ss(n,n)):(c=u.sel.primary(),p=u.sel.primIndex),"rectangle"==r.unit)r.addNew||(c=new Ss(n,n)),n=En(e,t,!0,!0),p=-1;else{var g=Lo(e,n,r.unit);c=r.extend?pi(c,g.anchor,g.head,r.extend):g}r.addNew?p==-1?(p=m.length,bi(u,Fr(m.concat([c]),p),{scroll:!1,origin:"*mouse"})):m.length>1&&m[p].empty()&&"char"==r.unit&&!r.extend?(bi(u,Fr(m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),h=u.sel):mi(u,p,c,Ha):(p=0,bi(u,new ks([c],0),Ha),h=u.sel);var v=n,y=l.wrapper.getBoundingClientRect(),b=0,x=fr(e,function(e){He(e)?o(e):s(e)}),w=fr(e,s);e.state.selectingText=w,Xa(document,"mousemove",x),Xa(document,"mouseup",w)}function Oo(e,t,n,r){var i,o;try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Re(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ae(e,n))return Be(t);o-=s.top-a.viewOffset;for(var l=0;l=i){var c=O(e.doc,o),d=e.options.gutters[l];return Le(e,n,e,c,d,t),Be(t)}}}function Ao(e,t){return Oo(e,t,"gutterClick",!0)}function Io(e,t){Wt(e.display,t)||Ro(e,t)||De(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function Ro(e,t){return!!Ae(e,"gutterContextMenu")&&Oo(e,t,"gutterContextMenu",!1)}function Po(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}function Bo(e){function t(t,r,i,o){e.defaults[t]=r,i&&(n[t]=o?function(e,t,n){n!=qs&&i(e,t,n)}:i)}var n=e.optionHandlers;e.defineOption=t,e.Init=qs,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,qr(e)},!0),t("indentUnit",2,qr,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Yr(e),an(e),gr(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,n.push(R(r,o))}r++});for(var i=n.length-1;i>=0;i--)Ri(e.doc,t,n[i],R(n[i].line,n[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=qs&&e.refresh()}),t("specialCharPlaceholder",ft,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Sa?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("rtlMoveVisually",!Ta),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Po(e),Fo(e)},!0),t("keyMap","default",function(e,t,n){var r=uo(t),i=n!=qs&&uo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Ho,!0),t("gutters",[],function(e){Ir(e.options),Fo(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Cn(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return tr(e)},!0),t("scrollbarStyle","native",function(e){rr(e),tr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){Ir(e.options),Fo(e)},!0),t("firstLineNumber",1,Fo,!0),t("lineNumberFormatter",function(e){return e},Fo,!0),t("showCursorWhenSelecting",!1,Tn,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("readOnly",!1,function(e,t){"nocursor"==t&&(Rn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Wo),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Tn,!0),t("singleCursorHeightPerLine",!0,Tn,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Yr,!0),t("addModeClass",!1,Yr,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Yr,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}function Fo(e){Ar(e),gr(e),Wn(e)}function Wo(e,t,n){var r=n&&n!=qs;if(!t!=!r){var i=e.display.dragFunctions,o=t?Xa:Me;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ho(e){e.options.lineWrapping?(s(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Oa(e.display.wrapper,"CodeMirror-wrap"),xe(e)),Sn(e),gr(e),an(e),setTimeout(function(){return tr(e)},100)}function Uo(e,t){var n=this;if(!(this instanceof Uo))return new Uo(e,t);this.options=t=t?c(t):{},c(Ys,t,!1),Ir(t);var r=t.value;"string"==typeof r&&(r=new Ls(r,t.mode,null,t.lineSeparator,t.direction)),this.doc=r;var i=new Uo.inputStyles[t.inputStyle](this),o=this.display=new N(e,r,i);o.wrapper.CodeMirror=this,Ar(this),Po(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),rr(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 Ia,keySeq:null,specialChars:null},t.autofocus&&!Sa&&o.input.focus(),fa&&ha<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Vo(this),eo(),ir(this),this.curOp.forceUpdate=!0,Xr(this,r),t.autofocus&&!Sa||this.hasFocus()?setTimeout(u(In,this),20):Rn(this);for(var a in Gs)Gs.hasOwnProperty(a)&&Gs[a](n,t[a],qs);Hn(this),t.finishInit&&t.finishInit(this);for(var s=0;s400}var i=e.display;Xa(i.scroller,"mousedown",fr(e,Eo)),fa&&ha<11?Xa(i.scroller,"dblclick",fr(e,function(t){if(!De(e,t)){var n=En(e,t);if(n&&!Ao(e,t)&&!Wt(e.display,t)){Re(t);var r=e.findWordAt(n);fi(e.doc,r.anchor,r.head)}}})):Xa(i.scroller,"dblclick",function(t){return De(e,t)||Re(t)}),Da||Xa(i.scroller,"contextmenu",function(t){return Io(e,t)});var o,a={end:0};Xa(i.scroller,"touchstart",function(t){if(!De(e,t)&&!n(t)){i.input.ensurePolled(),clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Xa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Xa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Wt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new Ss(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new Ss(R(s.line,0),V(e.doc,R(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Re(n)}t()}),Xa(i.scroller,"touchcancel",t),Xa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Qn(e,i.scroller.scrollTop),Jn(e,i.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Xa(i.scroller,"mousewheel",function(t){return Br(e,t)}),Xa(i.scroller,"DOMMouseScroll",function(t){return Br(e,t)}),Xa(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){De(e,t)||Fe(t)},over:function(t){De(e,t)||(Qi(e,t),Fe(t))},start:function(t){return Xi(e,t)},drop:fr(e,$i),leave:function(t){De(e,t)||Zi(e)}};var s=i.input.getField();Xa(s,"keyup",function(t){return Co.call(e,t)}),Xa(s,"keydown",fr(e,xo)),Xa(s,"keypress",fr(e,ko)),Xa(s,"focus",function(t){return In(e,t)}),Xa(s,"blur",function(t){return Rn(e,t)})}function jo(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=et(e,t).state:n="prev");var a=e.options.tabSize,s=T(o,t),l=d(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Fa||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?d(T(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 p="",f=0;if(e.options.indentWithTabs)for(var m=Math.floor(u/a);m;--m)f+=a,p+="\t";if(f1)if($s&&$s.text.join("\n")==t){if(r.ranges.length%$s.text.length==0){l=[];for(var u=0;u<$s.text.length;u++)l.push(o.splitLines($s.text[u]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(l=g(s,function(e){return[e]}));for(var c,d=r.ranges.length-1;d>=0;d--){var p=r.ranges[d],f=p.from(),h=p.to();p.empty()&&(n&&n>0?f=R(f.line,f.ch-n):e.state.overwrite&&!a?h=R(h.line,Math.min(T(o,h.line).text.length,h.ch+m(s).length)):$s&&$s.lineWise&&$s.text.join("\n")==t&&(f=h=R(f.line,0))),c=e.curOp.updateInput;var v={from:f,to:h,text:l?l[d%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Mi(e.doc,v),St(e,"inputRead",e,v)}t&&!a&&Go(e,t),Yn(e),e.curOp.updateInput=c,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Yo(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||pr(t,function(){return qo(t,n,0,null,"paste")}),!0}function Go(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=jo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(T(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jo(e,i.head.line,"smart"));a&&St(e,"electricInput",e,i.head.line)}}}function Ko(e){for(var t=[],n=[],r=0;r=e.first+e.size)&&(t=new R(r,t.ch,t.sticky),u=T(e,r))}function a(r){var a;if(a=i?Te(e.cm,u,t,n):Ee(u,t,n),null==a){if(r||!o())return!1;t=Ne(i,e.cm,u,t.line,n)}else t=a;return!0}var s=t,l=n,u=T(e,t.line);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var c=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||a(!f);f=!1){var h=u.text.charAt(t.ch)||"\n",m=w(h,p)?"w":d&&"\n"==h?"n":!d||/\s/.test(h)?null:"p";if(!d||f||m||(m="s"),c&&c!=m){n<0&&(n=1,a(),t.sticky="after");break}if(m&&(c=m),n>0&&!a(!f))break}var g=Ei(e,t,s,l,!0);return B(s,g)&&(g.hitSide=!0),g}function Zo(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*bn(e.display),3);i=(n>0?t.bottom:t.top)+n*l}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(var u;u=mn(e,a,i),u.outside;){if(n<0?i<=0:i>=o.height){u.hitSide=!0;break}i+=5*n}return u}function Jo(e,t){var n=Xt(e,t.line);if(!n||n.hidden)return null;var r=T(e.doc,t.line),i=Gt(n,r,t.line),o=ke(r,e.doc.direction),a="left";if(o){var s=Ce(o,t.ch);a=s%2?"right":"left"}var l=Jt(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function ea(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ta(e,t){return t&&(e.bad=!0),e}function na(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(){c&&(u+=d,c=!1)}function s(e){e&&(a(),u+=e)}function l(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return void s(n||t.textContent.replace(/\u200b/g,""));var u,p=t.getAttribute("cm-marker");if(p){var f=e.findMarks(R(r,0),R(i+1,0),o(+p));return void(f.length&&(u=f[0].find(0))&&s(_(e.doc,u.from,u.to).join(d)))}if("false"==t.getAttribute("contenteditable"))return;var h=/^(pre|div|p)$/i.test(t.nodeName);h&&a();for(var m=0;m=15&&(ya=!1,ma=!0);var Ma,La=Ea&&(ga||ya&&(null==_a||_a<12.11)),Da=ua||fa&&ha>=9,Oa=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:"")}};Ma=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 Aa=function(e){e.select()};Ca?Aa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:fa&&(Aa=function(e){try{e.select()}catch(e){}});var Ia=function(){this.id=null};Ia.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Ra,Pa,Ba=30,Fa={toString:function(){return"CodeMirror.Pass"}},Wa={scroll:!1},Ha={origin:"*mouse"},Ua={origin:"+move"},Va=[""],ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,za=/[\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]/,qa=!1,Ya=!1,Ga=null,Ka=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/; -return function(n,r){var u="ltr"==r?"L":"R";if(0==n.length||"ltr"==r&&!i.test(n))return!1;for(var c=n.length,d=[],p=0;p=this.string.length},os.prototype.sol=function(){return this.pos==this.lineStart},os.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},os.prototype.next=function(){if(this.post},os.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},os.prototype.skipToEnd=function(){this.pos=this.string.length},os.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},os.prototype.backUp=function(e){this.pos-=e},os.prototype.column=function(){return this.lastColumnPos0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0},os.prototype.current=function(){return this.string.slice(this.start,this.pos)},os.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},os.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};var as=function(e,t){this.state=e,this.lookAhead=t},ss=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0};ss.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ss.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ss.fromSaved=function(e,t,n){return t instanceof as?new ss(e,$e(e.mode,t.state),n,t.lookAhead):new ss(e,$e(e.mode,t),n)},ss.prototype.save=function(e){var t=e!==!1?$e(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new as(t,this.maxLookAhead):t};var ls=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n},us=function(e,t,n){this.text=e,re(this,t),this.height=n?n(this):1};us.prototype.lineNo=function(){return D(this)},Ie(us);var cs,ds={},ps={},fs=null,hs=null,ms={left:0,right:0,top:0,bottom:0},gs=function(e,t,n){this.cm=n;var i=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=r("div",[r("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(i),e(o),Xa(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Xa(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,fa&&ha<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gs.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},gs.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gs.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gs.prototype.zeroWidthHack=function(){var e=Ea&&!xa?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ia,this.disableVert=new Ia},gs.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},gs.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vs=function(){};vs.prototype.update=function(){return{bottom:0,right:0}},vs.prototype.setScrollLeft=function(){},vs.prototype.setScrollTop=function(){},vs.prototype.clear=function(){};var ys={native:gs,null:vs},bs=0,xs=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Fn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=zt(e),this.force=n,this.dims=wn(e),this.events=[]};xs.prototype.signal=function(e,t){Ae(e,t)&&this.events.push(arguments)},xs.prototype.finish=function(){for(var e=this,t=0;t=0&&P(e,i.to())<=0)return r}return-1};var Ss=function(e,t){this.anchor=e,this.head=t};Ss.prototype.from=function(){return H(this.anchor,this.head)},Ss.prototype.to=function(){return W(this.anchor,this.head)},Ss.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,r=e,i=e+t;r1||!(this.children[0]instanceof Hi))){var l=[];this.collapse(l),this.children=[new Hi(l)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n50){for(var s=o.lines.length%25+25,l=s;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=this,i=0;it.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&gr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ci(t.doc)),t&&St(t,"markerCleared",t,this,i,o),n&&or(t),this.parent&&this.parent.clear()}},Ts.prototype.find=function(e,t){var n=this;null==e&&"bookmark"==this.type&&(e=1);for(var r,i,o=0;o=0;u--)Mi(r,i[u]);l?yi(this,l):this.cm&&Yn(this.cm)}),undo:mr(function(){Di(this,"undo")}),redo:mr(function(){Di(this,"redo")}),undoSelection:mr(function(){Di(this,"undo",!0)}),redoSelection:mr(function(){Di(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.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=V(this,e),t=V(this,t);var r=[],i=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&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=o,void++n)}),V(this,R(n,t))},indexFromPos:function(e){e=V(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.to0)i=new R(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),R(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=T(e.doc,i.line-1).text;a&&(i=new R(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),R(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ss(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return pr(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;re&&0==P(t,this.pos)&&n==this.button};var js,zs,qs={toString:function(){return"CodeMirror.Init"}},Ys={},Gs={};Uo.defaults=Ys,Uo.optionHandlers=Gs;var Ks=[];Uo.defineInitHook=function(e){return Ks.push(e)};var $s=null,Xs=function(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)&&fr(this,t[e])(this,n,i),Le(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](uo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nr&&(jo(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Yn(t));else{var a=o.from(),s=o.to(),l=Math.max(r,a.line);r=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=l;u0&&mi(t.doc,i,new Ss(a,c[i].to()),Wa)}}}),getTokenAt:function(e,t){return it(this,e,t)},getLineTokens:function(e,t){return it(this,R(e),t,!0)},getTokenTypeAt:function(e){e=V(this.doc,e);var t,n=Je(this,T(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&&(e=o,i=!0),r=T(this.doc,e)}else r=e;return un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-ye(r):0)},defaultTextHeight:function(){return bn(this.display)},defaultCharWidth:function(){return xn(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=pn(this,V(this.doc,e));var a=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"==r)a=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||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"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&jn(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:hr(xo),triggerOnKeyPress:hr(ko),triggerOnKeyUp:Co,triggerOnMouseDown:hr(Eo),execCommand:function(e){if(Fs.hasOwnProperty(e))return Fs[e].call(null,this)},triggerElectric:hr(function(e){Go(this,e)}),findPosH:function(e,t,n,r){var i=this,o=1;t<0&&(o=-1,t=-t);for(var a=V(this.doc,e),s=0;s0&&s(n.charAt(r-1));)--r;for(;i.5)&&Sn(this),Le(this,"refresh",this)}),swapDoc:hr(function(e){var t=this.doc;return t.cm=null,Xr(this,e),an(this),this.display.input.reset(),Gn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,St(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ie(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}},Qs=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ia,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qs.prototype.init=function(e){function t(e){if(!De(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=Ko(i);zo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,Wa),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=$s.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var a=Xo(),s=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),s.value=$s.text.join("\n");var l=document.activeElement;Aa(s),setTimeout(function(){i.display.lineSpace.removeChild(a),l.focus(),l==o&&r.showPrimarySelection()},50)}}var n=this,r=this,i=r.cm,o=r.div=e.lineDiv;$o(o,i.options.spellcheck),Xa(o,"paste",function(e){De(i,e)||Yo(e,i)||ha<=11&&setTimeout(fr(i,function(){return n.updateFromDOM()}),20)}),Xa(o,"compositionstart",function(e){n.composing={data:e.data,done:!1}}),Xa(o,"compositionupdate",function(e){n.composing||(n.composing={data:e.data,done:!1})}),Xa(o,"compositionend",function(e){n.composing&&(e.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),Xa(o,"touchstart",function(){return r.forceCompositionEnd()}),Xa(o,"input",function(){n.composing||n.readFromDOMSoon()}),Xa(o,"copy",t),Xa(o,"cut",t)},Qs.prototype.prepareSelection=function(){var e=_n(this.cm,!1);return e.focus=this.cm.state.focused,e},Qs.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Qs.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Jo(t,r)||{node:s[0].measure.map[2],offset:0},u=i.linee.firstLine()&&(r=R(r.line-1,T(e.doc,r.line-1).length)),i.ch==T(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,s;r.line==t.viewFrom||0==(o=Nn(e,r.line))?(a=D(t.view[0].line),s=t.view[0].node):(a=D(t.view[o].line),s=t.view[o-1].node.nextSibling);var l,u,c=Nn(e,i.line);if(c==t.view.length-1?(l=t.viewTo-1,u=t.lineDiv.lastChild):(l=D(t.view[c+1].line)-1,u=t.view[c+1].node.previousSibling),!s)return!1;for(var d=e.doc.splitLines(na(e,s,u,a,l)),p=_(e.doc,R(a,0),R(l,T(e.doc,l).text.length));d.length>1&&p.length>1;)if(m(d)==m(p))d.pop(),p.pop(),l--;else{if(d[0]!=p[0])break;d.shift(),p.shift(),a++}for(var f=0,h=0,g=d[0],v=p[0],y=Math.min(g.length,v.length);fr.ch&&b.charCodeAt(b.length-h-1)==x.charCodeAt(x.length-h-1);)f--,h++;d[d.length-1]=b.slice(0,b.length-h).replace(/^\u200b+/,""),d[0]=d[0].slice(f).replace(/\u200b+$/,"");var C=R(a,f),k=R(l,p.length?m(p).length-h:0);return d.length>1||d[0]||P(C,k)?(Ri(e.doc,d,C,k,"+input"),!0):void 0},Qs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qs.prototype.reset=function(){this.forceCompositionEnd()},Qs.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Qs.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))},Qs.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||pr(this.cm,function(){return gr(e.cm)})},Qs.prototype.setUneditable=function(e){e.contentEditable="false"},Qs.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||fr(this.cm,qo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Qs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Qs.prototype.onContextMenu=function(){},Qs.prototype.resetPosition=function(){},Qs.prototype.needsContentAttribute=!0;var Zs=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ia,this.hasSelection=!1,this.composing=null};Zs.prototype.init=function(e){function t(e){if(!De(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ko(i);zo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,Wa):(r.prevInput="",a.value=t.text.join("\n"),Aa(a))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var n=this,r=this,i=this.cm,o=this.wrapper=Xo(),a=this.textarea=o.firstChild;e.wrapper.insertBefore(o,e.wrapper.firstChild),Ca&&(a.style.width="0px"),Xa(a,"input",function(){fa&&ha>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()}),Xa(a,"paste",function(e){De(i,e)||Yo(e,i)||(i.state.pasteIncoming=!0,r.fastPoll())}),Xa(a,"cut",t),Xa(a,"copy",t),Xa(e.scroller,"paste",function(t){Wt(e,t)||De(i,t)||(i.state.pasteIncoming=!0,r.focus())}),Xa(e.lineSpace,"selectstart",function(t){Wt(e,t)||Re(t)}),Xa(a,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Xa(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Zs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=_n(e);if(e.options.moveInputWithCursor){var i=pn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Zs.prototype.showSelection=function(e){var t=this.cm,r=t.display;n(r.cursorDiv,e.cursors),n(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Zs.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Aa(this.textarea),fa&&ha>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",fa&&ha>=9&&(this.hasSelection=null))}},Zs.prototype.getField=function(){return this.textarea},Zs.prototype.supportsTouch=function(){return!1},Zs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Sa||a()!=this.textarea))try{this.textarea.focus()}catch(e){}},Zs.prototype.blur=function(){this.textarea.blur()},Zs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Zs.prototype.receivedFocus=function(){this.slowPoll()},Zs.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Zs.prototype.fastPoll=function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},Zs.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ja(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(fa&&ha>=9&&this.hasSelection===i||Ea&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,s=Math.min(r.length,i.length);a1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Zs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Zs.prototype.onKeyPress=function(){fa&&ha>=9&&(this.hasSelection=null),this.fastPoll()},Zs.prototype.onContextMenu=function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=d,a.style.cssText=c,fa&&ha<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!fa||fa&&ha<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==r.prevInput?fr(i,Ti)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,s=En(i,e),l=o.scroller.scrollTop;if(s&&!ya){var u=i.options.resetSelectionOnContextMenu;u&&i.doc.sel.contains(s)==-1&&fr(i,bi)(i.doc,Wr(s),Wa);var c=a.style.cssText,d=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var p=r.wrapper.getBoundingClientRect();a.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: "+(fa?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(ma&&(f=window.scrollY),o.input.focus(),ma&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),fa&&ha>=9&&t(),Da){Fe(e);var h=function(){Me(window,"mouseup",h),setTimeout(n,20)};Xa(window,"mouseup",h)}else setTimeout(n,50)}},Zs.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Zs.prototype.setUneditable=function(){},Zs.prototype.needsContentAttribute=!1,Bo(Uo),Xs(Uo);var Js="iter insert remove copy getEditor constructor".split(" ");for(var el in Ls.prototype)Ls.prototype.hasOwnProperty(el)&&p(Js,el)<0&&(Uo.prototype[el]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ls.prototype[el]));return Ie(Ls),Uo.inputStyles={textarea:Zs,contenteditable:Qs},Uo.defineMode=function(e){Uo.defaults.mode||"null"==e||(Uo.defaults.mode=e),ze.apply(this,arguments)},Uo.defineMIME=qe,Uo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Uo.defineMIME("text/plain","null"),Uo.defineExtension=function(e,t){Uo.prototype[e]=t},Uo.defineDocExtension=function(e,t){Ls.prototype[e]=t},Uo.fromTextArea=oa,aa(Uo),Uo.version="5.29.0",Uo})},function(e,t,n){!function(e){e(n(15))}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s\s*$/.test(p)||i.replaceRange("",{line:l.line,ch:0},{line:l.line,ch:l.ch+1}),a[s]="\n";else{var h=f[1],m=f[5],g=r.test(f[2])||f[2].indexOf(">")>=0?f[2].replace("x"," "):parseInt(f[3],10)+1+f[4];a[s]="\n"+h+g+m}}i.replaceSelections(a)}})},function(e,t,n){var r=n(15);r.commands.tabAndIndentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentMore");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}},r.commands.shiftTabAndUnindentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentLess");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}}},function(e,t,n){!function(e){e(n(15))}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(r,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(r):n(r))})})},function(e,t,n){!function(e){e(n(15),n(20),n(21))}(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 s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==u&&(e.f=f,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function l(t,o){var s=t.column()===o.indentation,l=a(o.prevLine.stream),u=o.indentedCode,p=o.prevLine.hr,f=o.list!==!1,h=(o.listStack[o.listStack.length-1]||0)+3;o.indentedCode=!1;var m=o.indentation;if(null===o.indentationDiff&&(o.indentationDiff=o.indentation,f)){for(o.list=null;m=4&&(u||o.prevLine.fencedCodeEnd||o.prevLine.header||l))return t.skipToEnd(),o.indentedCode=!0,C.code;if(t.eatSpace())return null;if(s&&o.indentation<=h&&(b=t.match(T))&&b[1].length<=6)return o.quote=0,o.header=b[1].length,o.thisLine.header=!0,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(o.indentation<=h&&t.eat(">"))return o.quote=s?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),d(o);if(!y&&!o.setext&&s&&o.indentation<=h&&(b=t.match(E))){var x=b[1]?"ol":"ul";return o.indentation=m+t.current().length,o.list=!0,o.quote=0,o.listStack.push(o.indentation),n.taskLists&&t.match(N,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+x]),d(o)}return s&&o.indentation<=h&&(b=t.match(L,!0))?(o.quote=0,o.fencedEndRE=new RegExp(b[1]+"+ *$"),o.localMode=n.fencedCodeBlockHighlighting&&r(b[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=c,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,d(o)):o.setext||!(g&&f||o.quote||o.list!==!1||o.code||y||D.test(t.string))&&(b=t.lookAhead(1))&&(b=b.match(_))?(o.setext?(o.header=o.setext,o.setext=0,t.skipToEnd(),n.highlightFormatting&&(o.formatting="header")):(o.header="="==b[0].charAt(0)?1:2,o.setext=o.header),o.thisLine.header=!0,o.f=o.inline,d(o)):y?(t.skipToEnd(),o.hr=!0,o.thisLine.hr=!0,C.hr):"["===t.peek()?i(t,o,v):i(t,o,o.inline)}function u(t,n){var r=x.token(t,n.htmlState);if(!w){var i=e.innerMode(x,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=f,n.block=l,n.htmlState=null)}return r}function c(e,t){var r=t.listStack[t.listStack.length-1]||0,i=t.indentation=e.quote?t.push(C.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(C.linkHref,"url"):(e.strong&&t.push(C.strong),e.em&&t.push(C.em),e.strikethrough&&t.push(C.strikethrough),e.emoji&&t.push(C.emoji),e.linkText&&t.push(C.linkText),e.code&&t.push(C.code),e.image&&t.push(C.image),e.imageAltText&&t.push(C.imageAltText,"link"),e.imageMarker&&t.push(C.imageMarker)),e.header&&t.push(C.header,C.header+"-"+e.header),e.quote&&(t.push(C.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(C.quote+"-"+e.quote):t.push(C.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(C.list2):t.push(C.list3):t.push(C.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 p(e,t){if(e.match(M,!0))return d(t)}function f(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,d(r);if(r.taskList){var a="x"!==t.match(N,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,d(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),d(r);var s=t.next();if(r.linkTitle){r.linkTitle=!1;var l=s;"("===s&&(l=")"),l=(l+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var c="^\\s*(?:[^"+l+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(t.match(new RegExp(c),!0))return C.linkHref}if("`"===s){var p=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var g=t.current().length;if(0!=r.code||r.quote&&1!=g){if(g==r.code){var v=d(r);return r.code=0,v}return r.formatting=p,d(r)}return r.code=g,d(r)}if(r.code)return d(r);if("\\"===s&&(t.next(),n.highlightFormatting)){var y=d(r),b=C.formatting+"-escape";return y?y+" "+b:b}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("["===s&&r.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return r.imageMarker=!1,r.imageAltText=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("]"===s&&r.imageAltText){n.highlightFormatting&&(r.formatting="image");var y=d(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=m,y}if("["===s&&!r.image)return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),d(r);if("]"===s&&r.linkText){n.highlightFormatting&&(r.formatting="link");var y=d(r);return r.linkText=!1,r.inline=r.f=t.match(/\(.*?\)| ?\[.*?\]/,!1)?m:f,y}if("<"===s&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+C.linkInline}if("<"===s&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+C.linkEmail}if(n.xml&&"<"===s&&t.match(/^(!--|[a-z]+(?:\s+[a-z_:.\-]+(?:\s*=\s*[^ >]+)?)*\s*>)/i,!1)){var w=t.string.indexOf(">",t.pos);if(w!=-1){var k=t.string.substring(t.start,w);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(k)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(x),o(t,r,u)}if(n.xml&&"<"===s&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";if("*"===s||"_"===s){for(var S=1,E=1==t.pos?" ":t.string.charAt(t.pos-2);S<3&&t.eat(s);)S++;var T=t.peek()||" ",_=!/\s/.test(T)&&(!O.test(T)||/\s/.test(E)||O.test(E)),M=!/\s/.test(E)&&(!O.test(E)||/\s/.test(T)||O.test(T)),L=null,D=null;if(S%2&&(r.em||!_||"*"!==s&&M&&!O.test(E)?r.em!=s||!M||"*"!==s&&_&&!O.test(T)||(L=!1):L=!0),S>1&&(r.strong||!_||"*"!==s&&M&&!O.test(E)?r.strong!=s||!M||"*"!==s&&_&&!O.test(T)||(D=!1):D=!0),null!=D||null!=L){n.highlightFormatting&&(r.formatting=null==L?"strong":null==D?"em":"strong em"),L===!0&&(r.em=s),D===!0&&(r.strong=s);var v=d(r);return L===!1&&(r.em=!1),D===!1&&(r.strong=!1),v}}else if(" "===s&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(r); -t.backUp(1)}if(n.strikethrough)if("~"===s&&t.eatWhile(s)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=d(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),d(r)}else if(" "===s&&t.match(/^~~/,!0)){if(" "===t.peek())return d(r);t.backUp(2)}if(n.emoji&&":"===s&&t.match(/^[a-z_\d+-]+:/)){r.emoji=!0,n.highlightFormatting&&(r.formatting="emoji");var A=d(r);return r.emoji=!1,A}return" "===s&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),d(r)}function h(e,t){var r=e.next();if(">"===r){t.f=t.inline=f,n.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+C.linkInline}return e.match(/^[^>]+/,!0),C.linkInline}function m(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=g("("===r?")":"]"),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function g(e){return function(t,r){var i=t.next();if(i===e){r.f=r.inline=f,n.highlightFormatting&&(r.formatting="link-string");var o=d(r);return r.linkHref=!1,o}return t.match(I[e]),r.linkHref=!0,d(r)}}function v(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=y,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,f)}function y(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,n.highlightFormatting&&(t.formatting="link");var r=d(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),C.linkText}function b(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=f,C.linkHref+" url")}var x=e.getMode(t,"text/html"),w="null"==x.name;void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1),void 0===n.emoji&&(n.emoji=!1),void 0===n.fencedCodeBlockHighlighting&&(n.fencedCodeBlockHighlighting=!0),void 0===n.xml&&(n.xml=!0),void 0===n.tokenTypeOverrides&&(n.tokenTypeOverrides={});var C={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in C)C.hasOwnProperty(k)&&n.tokenTypeOverrides[k]&&(C[k]=n.tokenTypeOverrides[k]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,E=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,N=/^\[(x| )\](?=\s)/,T=n.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ *(?:\={1,}|-{1,})\s*$/,M=/^[^#!\[\]*_\\<>` "'(~:]+/,L=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,D=/^\s*\[[^\]]+?\]:\s*\S+(\s*\S*\s*)?$/,O=/[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/,A=" ",I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/},R={startState:function(){return{f:l,prevLine:{stream:null},thisLine:{stream:null},block:l,htmlState:null,indentation:0,inline:f,text:p,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(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(x,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkText:t.linkText,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.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 s(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block,t.f!=u){var n=e.match(/^\s*/,!0)[0].replace(/\t/g,A).length;if(t.indentation=n,t.indentationDiff=null,n>0)return null}}return t.f(e,t)},innerMode:function(e){return e.block==u?{state:e.htmlState,mode:x}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:R}},indent:function(t,n,r){return t.block==u?x.indent(t.htmlState,n,r):t.localState?t.localMode.indent(t.localState,n,r):e.Pass},blankLine:s,getType:d,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return R},"xml"),e.defineMIME("text/x-markdown","markdown")})},function(e,t,n){!function(e){e(n(15))}(function(e){"use strict";var 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,caseFold:!1};e.defineMode("xml",function(r,i){function o(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(l("atom","]]>")):null:e.match("--")?n(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(u(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(N=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==r){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=o,N=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return N="equals",null;if("<"==n){t.tokenize=o,t.state=f,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=o;break}n.next()}return e}}function u(e){return function(t,n){for(var r;null!=(r=t.next());){if("<"==r)return n.tokenize=u(e+1),n.tokenize(t,n);if(">"==r){if(1==e){n.tokenize=o;break}return n.tokenize=u(e-1),n.tokenize(t,n)}}return"meta"}}function c(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(k.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function p(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!k.contextGrabbers.hasOwnProperty(n)||!k.contextGrabbers[n].hasOwnProperty(t))return;d(e)}}function f(e,t,n){return"openTag"==e?(n.tagStart=t.column(),h):"closeTag"==e?m:f}function h(e,t,n){return"word"==e?(n.tagName=t.current(),T="tag",y):(T="error",h)}function m(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&k.implicitlyClosed.hasOwnProperty(n.context.tagName)&&d(n),n.context&&n.context.tagName==r||k.matchClosing===!1?(T="tag",g):(T="tag error",v)}return T="error",v}function g(e,t,n){return"endTag"!=e?(T="error",g):(d(n),f)}function v(e,t,n){return T="error",g(e,t,n)}function y(e,t,n){if("word"==e)return T="attribute",b;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||k.autoSelfClosers.hasOwnProperty(r)?p(n,r):(p(n,r),n.context=new c(n,r,i==n.indented)),f}return T="error",y}function b(e,t,n){return"equals"==e?x:(k.allowMissing||(T="error"),y(e,t,n))}function x(e,t,n){return"string"==e?w:"word"==e&&k.allowUnquoted?(T="string",y):(T="error",y(e,t,n))}function w(e,t,n){return"string"==e?w:y(e,t,n)}var C=r.indentUnit,k={},S=i.htmlMode?t:n;for(var E in S)k[E]=S[E];for(var E in i)k[E]=i[E];var N,T;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:f,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;N=null;var n=t.tokenize(e,t);return(n||N)&&"comment"!=n&&(T=null,t.state=t.state(N||n,e,t),T&&(n="error"==T?n+" error":T)),n},indent:function(t,n,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+C;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return k.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+C*(k.multilineTagIndentFactor||1);if(k.alignCDATA&&/$/,blockCommentStart:"",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})})},function(e,t,n){!function(e){e(n(15))}(function(e){"use strict";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"]},{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"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{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:"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"]},{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"],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:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["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"]},{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","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",mime:"application/x-httpd-php",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:"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:"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"],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"]}];for(var t=0;t-1&&t.substring(i+1,t.length);if(o)return e.findModeByExtension(o)},e.findModeByName=function(t){t=t.toLowerCase();for(var n=0;n=n.line,f=p?n:l(d,0),h=e.markText(c,f,{className:o});if(null==r?i.push(h):i.splice(r++,0,h),p)break;a=d}}function i(e){for(var t=e.state.markedSelection,n=0;n1)return o(e);var t=e.getCursor("start"),n=e.getCursor("end"),a=e.state.markedSelection;if(!a.length)return r(e,t,n);var l=a[0].find(),c=a[a.length-1].find();if(!l||!c||n.line-t.line=0||u(n,l.from)<=0)return o(e);for(;u(t,l.from)>0;)a.shift().clear(),l=a[0].find();for(u(t,l.from)<0&&(l.to.line-t.line0&&(n.line-c.from.line]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(n,r){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,n){if(n.combineTokens=null,n.codeBlock)return e.match(/^```+/)?(n.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(n.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),n.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return n.code?a===o&&(n.code=!1):(o=a,n.code=!0),null}if(n.code)return e.next(),null;if(e.eatSpace())return n.ateSpace=!0,null;if((e.sol()||n.ateSpace)&&(n.ateSpace=!1,r.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return n.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return n.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(n.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={taskLists:!0,strikethrough:!0,emoji:!0};for(var l in r)s[l]=r[l];return s.name="markdown",e.overlayMode(e.getMode(n,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")})},function(e,t,n){"use strict";function r(e){return e=e||{},"function"!=typeof e.codeMirrorInstance||"function"!=typeof e.codeMirrorInstance.defineMode?void console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`"):(String.prototype.includes||(String.prototype.includes=function(){return String.prototype.indexOf.apply(this,arguments)!==-1}),void e.codeMirrorInstance.defineMode("spell-checker",function(t){if(!r.aff_loading){r.aff_loading=!0;var n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),n.onload=function(){4===n.readyState&&200===n.status&&(r.aff_data=n.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},n.send(null)}if(!r.dic_loading){r.dic_loading=!0;var o=new XMLHttpRequest;o.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),o.onload=function(){4===o.readyState&&200===o.status&&(r.dic_data=o.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},o.send(null)}var a='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',s={token:function(e){var t=e.peek(),n="";if(a.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!a.includes(t);)n+=t,e.next();return r.typo&&!r.typo.check(n)?"spell-error":null}},l=e.codeMirrorInstance.getMode(t,t.backdrop||"text/plain");return e.codeMirrorInstance.overlayMode(l,s,!0)}))}var i=n(27);r.num_loaded=0,r.aff_loading=!1,r.dic_loading=!1,r.aff_data="",r.dic_data="",r.typo,e.exports=r},function(e,t,n){(function(t,r){var i;!function(){"use strict";i=function(e,n,r,i){function o(e,t){var n=h._readFile(e,null,i.asyncLoad);i.asyncLoad?n.then(function(e){t(e)}):t(n)}function a(e){n=e,r&&l()}function s(e){r=e,n&&l()}function l(){for(h.rules=h._parseAFF(n),h.compoundRuleCodes={},c=0,p=h.compoundRules.length;c0&&(w.continuationClasses=b),"."!==x&&("SFX"===p?w.match=new RegExp(x+"$"):w.match=new RegExp("^"+x)),"0"!=g&&("SFX"===p?w.remove=new RegExp(g+"$"):w.remove=g),m.push(w)}u[f]={type:p,combineable:"Y"==h,entries:m},o+=r}else if("COMPOUNDRULE"===p){for(r=parseInt(d[1],10),a=o+1,l=o+1+r;a0&&(null===r[e]&&(r[e]=[]),r[e].push(t))}e=this._removeDicComments(e);for(var n=e.split("\n"),r={},i=1,o=n.length;i1){var u=this.parseRuleCodes(s[1]);"NEEDAFFIX"in this.flags&&u.indexOf(this.flags.NEEDAFFIX)!=-1||t(l,u);for(var c=0,d=u.length;c=this.flags.COMPOUNDMIN)for(t=0,n=this.compoundRules.length;t1&&u[1][1]!==u[1][0]&&s.push(u[0]+u[1][1]+u[1][0]+u[1].substring(2)),u[1])for(r=0,a=c.alphabet.length;r/g,">").replace(/"/g,""").replace(/'/g,"'")}function a(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 s(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 l(){}function u(e){for(var t,n,r=1;rAn error occured:

"+o(e.message+"",!0)+"
";throw e}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,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:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=s(d.item,"gm")(/bull/g,d.bullet)(),d.list=s(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=s(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=s(d.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,d._tag)(),d.paragraph=s(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=u({},d),d.gfm=u({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=s(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=u({},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,s,l,u,c,p,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),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},c=0;c ?/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,p=o.length,c=0;c1&&s.length>1||(e=o.slice(c+1).join("\n")+e,c=p-1)),i=r||/\n\n(?!\s*$)/.test(l),c!==p-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(l,!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),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=s(p.link)("inside",p._inside)("href",p._href)(),p.reflink=s(p.reflink)("inside",p._inside)(),p.normal=u({},p),p.pedantic=u({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=u({},p.normal,{escape:s(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=u({},p.gfm,{br:s(p.br)("{2,}","*")(),text:s(p.gfm.text)("{2,}","*")()}),n.rules=p,n.output=function(e,t,r){var i=new n(t,r);return i.output(e)},n.prototype.output=function(e){for(var t,n,r,i,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=o(i[1]),r=n),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(o(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),a+=this.renderer.text(o(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=o(i[1]),r=n,a+=this.renderer.link(r,null,n);return a},n.prototype.outputLink=function(e,t){var n=o(t.href),r=t.title?o(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,o(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
'+(n?e:o(e,!0))+"\n
\n":"
"+(n?e:o(e,!0))+"\n
"},r.prototype.blockquote=function(e){return"
\n"+e+"
\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"'+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='
    "},r.prototype.image=function(e,t,n){var r=''+n+'":">"},r.prototype.text=function(e){return e},i.parse=function(e,t,n){var r=new i(t,n);return r.parse(e)},i.prototype.parse=function(e){this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i,o="",a="";for(n="",e=0;e=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return D(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function x(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,l=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}var u;if(i){var c=-1;for(u=n;us&&(n=s-l),u=n;u>=0;u--){for(var d=!0,p=0;pi&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var l,u,c,d;switch(s){case 1:o<128&&(a=o);break;case 2:l=e[i+1],128===(192&l)&&(d=(31&o)<<6|63&l,d>127&&(a=d));break;case 3:l=e[i+1],u=e[i+2],128===(192&l)&&128===(192&u)&&(d=(15&o)<<12|(63&l)<<6|63&u,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=e[i+1],u=e[i+2],c=e[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(d=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,d>65535&&d<1114112&&(a=d))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return L(r)}function L(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function B(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function F(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function W(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,i){return i||W(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return i||W(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function V(e){if(e=j(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function K(e){return Q.toByteArray(V(e))}function $(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e){return e!==e}var Q=n(11),Z=n(12),J=n(13);t.Buffer=a,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),t.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return s(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return u(null,e,t,n)},a.allocUnsafe=function(e){return c(null,e)},a.allocUnsafeSlow=function(e){return c(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,l=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),d=0;di)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return C(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return N(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;P(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function r(e){return 3*e.length/4-n(e)}function i(e){var t,r,i,o,a,s=e.length;o=n(e),a=new c(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function a(e,t,n){for(var r,i=[],a=t;ac?c:u+s));return 1===r?(t=e[n-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),o.push(i),o.join("")}t.byteLength=r,t.toByteArray=i,t.fromByteArray=s;for(var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=d.length;p>1,c=-7,d=n?i-1:0,p=n?-1:1,f=e[t+d];for(d+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(f?-1:1)*(1/0);a+=Math.pow(2,r),o-=u}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),t+=a+d>=1?p/l:p*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=h,s/=256,i-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,u-=8);e[n+f-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),l(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function l(e,n,r){if(e.customInspect&&n&&N(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=l(e,i,r)),i}var o=u(e,n);if(o)return o;var a=Object.keys(n),m=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),E(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(n);if(0===a.length){if(N(n)){var g=n.name?": "+n.name:"";return e.stylize("[Function"+g+"]","special")}if(C(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(S(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return c(n)}var v="",y=!1,x=["{","}"];if(h(n)&&(y=!0,x=["[","]"]),N(n)){var w=n.name?": "+n.name:"";v=" [Function"+w+"]"}if(C(n)&&(v=" "+RegExp.prototype.toString.call(n)),S(n)&&(v=" "+Date.prototype.toUTCString.call(n)),E(n)&&(v=" "+c(n)),0===a.length&&(!y||0==n.length))return x[0]+v+x[1];if(r<0)return C(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var k;return k=y?d(e,n,r,m,a):a.map(function(t){return p(e,n,r,m,t,y)}),e.seen.pop(),f(k,v,x)}function u(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){for(var o=[],a=0,s=t.length;a-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function f(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return null==e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function w(e){return void 0===e}function C(e){return k(e)&&"[object RegExp]"===_(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===_(e)}function E(e){return k(e)&&("[object Error]"===_(e)||e instanceof Error)}function N(e){return"function"==typeof e}function T(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(e){return Object.prototype.toString.call(e)}function M(e){return e<10?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[M(e.getHours()),M(e.getMinutes()),M(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var O=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n1)for(var n=1;n=0&&(f=u.getLineHandle(o),!t(f));o--);var v,y,b,x,w=u.getTokenAt({line:o,ch:1}),C=n(w).fencedChars;t(u.getLineHandle(c.line))?(v="",y=c.line):t(u.getLineHandle(c.line-1))?(v="",y=c.line-1):(v=C+"\n",y=c.line),t(u.getLineHandle(d.line))?(b="",x=d.line,0===d.ch&&(x+=1)):0!==d.ch&&t(u.getLineHandle(d.line+1))?(b="",x=d.line+1):(b=C+"\n",x=d.line+1),0===d.ch&&(x-=1),u.operation(function(){u.replaceRange(b,{line:x,ch:0},{line:x+(b?0:1),ch:0}),u.replaceRange(v,{line:y,ch:0},{line:y+(v?0:1),ch:0})}),u.setSelection({line:y+(v?1:0),ch:0},{line:x+(v?1:-1),ch:0}),u.focus()}else{var k=c.line;if(t(u.getLineHandle(c.line))&&("fenced"===r(u,c.line+1)?(o=c.line,k=c.line+1):(a=c.line,k=c.line-1)),void 0===o)for(o=k;o>=0&&(f=u.getLineHandle(o),!t(f));o--);if(void 0===a)for(s=u.lineCount(),a=k;a=0;o--)if(f=u.getLineHandle(o),!f.text.match(/^\s*$/)&&"indented"!==r(u,o,f)){o+=1;break}for(s=u.lineCount(),a=c.line;a\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},l=r.line;l<=i.line;l++)!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})}(l);e.focus()}}function A(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r="undefined"==typeof r?n:r;var i,o=e.codemirror,a=s(o),l=n,u=r,c=o.getCursor("start"),d=o.getCursor("end");a[t]?(i=o.getLine(c.line),l=i.slice(0,c.ch),u=i.slice(c.ch),"bold"==t?(l=l.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),u=u.replace(/(\*\*|__)/,"")):"italic"==t?(l=l.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),u=u.replace(/(\*|_)/,"")):"strikethrough"==t&&(l=l.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),u=u.replace(/(\*\*|~~)/,"")),o.replaceRange(l+u,{line:c.line,ch:0},{line:c.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(c.ch-=2,c!==d&&(d.ch-=2)):"italic"==t&&(c.ch-=1,c!==d&&(d.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(l+i+u),c.ch+=n.length,d.ch=c.ch+i.length),o.setSelection(c,d),o.focus()}}function I(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 R(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]=R(e[n]||{},t[n]):e[n]=t[n]);return e}function P(e){for(var t=1;t=19968?n[i].length:1;return r}function F(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-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 $)$.hasOwnProperty(o)&&(o.indexOf("separator-")!=-1&&e.toolbar.push("|"),($[o].default===!0||e.showIcons&&e.showIcons.constructor===Array&&e.showIcons.indexOf(o)!=-1)&&e.toolbar.push(o))}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=P({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=P({},X,e.insertTexts||{}),e.promptTexts=Q,e.blockStyles=P({},Z,e.blockStyles||{}),e.shortcuts=P({},q,e.shortcuts||{}),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 W(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var H=n(20);n(21),n(22),n(23),n(24),n(27),n(28),n(29),n(30),n(25);var U=n(31),V=n(34),j=/Mac/.test(navigator.platform),z={toggleBold:u,toggleItalic:c,drawLink:C,toggleHeadingSmaller:h,toggleHeadingBigger:m,drawImage:k,toggleBlockquote:f,toggleOrderedList:x,toggleUnorderedList:b,toggleCodeBlock:p,togglePreview:M,toggleStrikethrough:d,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:S,drawHorizontalRule:E,undo:N,redo:T,toggleSideBySide:_,toggleFullScreen:l},q={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 z)if(z[t]===e)return t;return null},G=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.userAgent||navigator.vendor||window.opera),e},K="",$={bold:{name:"bold",action:u,className:"fa fa-bold",title:"Bold",default:!0},italic:{name:"italic",action:c,className:"fa fa-italic",title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:d,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:h,className:"fa fa-header",title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:h,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:p,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:f,className:"fa fa-quote-left",title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:b,className:"fa fa-list-ul",title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:x,className:"fa fa-list-ol",title:"Numbered List",default:!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:C,className:"fa fa-link",title:"Create Link",default:!0},image:{name:"image",action:k,className:"fa fa-picture-o",title:"Insert Image",default:!0},table:{name:"table",action:S,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:E,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:M,className:"fa fa-eye no-disable",title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:_,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:l,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:N,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:T,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Q={link:"URL for the link:",image:"URL of the image:"},Z={bold:"**",code:"```",italic:"*"};F.prototype.markdown=function(e){if(V){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),V.setOptions(t),V(e)}},F.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==z[o]&&!function(e){i[r(t.shortcuts[e])]=function(){z[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&l(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&l(n)},!1);var a,s;if(t.spellChecker!==!1?(a="spell-checker",s=t.parsingConfig,s.name="gfm",s.gitHubSpice=!1,U({codeMirrorInstance:H})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=H.fromTextArea(e,{mode:a,backdrop:s,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0==t.styleSelectedText||t.styleSelectedText}),t.forceSync===!0){var u=this.codemirror;u.on("change",function(){u.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var c=this.codemirror;setTimeout(function(){c.refresh()}.bind(c),0)}},F.prototype.autosave=function(){if(W()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=i<10?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},F.prototype.clearAutosavedValue=function(){if(W()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},F.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},F.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t0;--t)e.removeChild(e.firstChild);return e}function n(e,n){return t(e).appendChild(n)}function r(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.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}}function p(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function h(e){for(;Va.length<=e;)Va.push(m(Va)+" ");return Va[e]}function m(e){return e[e.length-1]}function g(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||ja.test(e))}function w(e,t){return t?!!(t.source.indexOf("\\w")>-1&&x(e))||t.test(e):x(e)}function C(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return e.charCodeAt(0)>=768&&za.test(e)}function S(e,t,n){for(;(n<0?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=e.first&&tn?R(n,T(e,n).text.length):j(t,T(e,t.line).text.length)}function j(e,t){var n=e.ch;return null==n||n>t?R(e.line,t):n<0?R(e.line,0):e}function z(e,t){for(var n=[],r=0;r=t:o.to>t);(r||(r=[])).push(new G(a,o.from,l?null:o.to))}}return r}function Z(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var w=0;w0)){var c=[l,1],d=P(u.from,s.from),f=P(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}function ne(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?P(u.to,n)>=0:P(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?P(u.from,r)<=0:P(u.from,r)<0)))return!0}}}function de(e){for(var t;t=le(e);)e=t.find(-1,!0).line;return e}function pe(e){for(var t;t=ue(e);)e=t.find(1,!0).line;return e}function fe(e){for(var t,n;t=ue(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function he(e,t){var n=T(e,t),r=de(n);return n==r?t:D(r)}function me(e,t){if(t>e.lastLine())return t;var n,r=T(e,t);if(!ge(e,r))return t;for(;n=ue(r);)r=n.find(1,!0).line;return D(r)+1}function ge(e,t){var n=Ya&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function we(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function Ce(e,t,n){var r;Ga=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Ga=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Ga=i)}return null!=r?r:Ga}function ke(e,t){var n=e.order;return null==n&&(n=e.order=Ka(e.text,t)),n}function Se(e,t,n){var r=S(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ee(e,t,n){var r=Se(e,t.ch,n);return null==r?null:new R(t.line,r,n<0?"after":"before")}function Ne(e,t,n,r,i){if(e){var o=ke(n,t.doc.direction);if(o){var a,s=i<0?m(o):o[0],l=i<0==(1==s.level),u=l?"after":"before";if(s.level>0){var c=Qt(t,n);a=i<0?n.text.length-1:0;var d=Zt(t,c,a).top;a=E(function(e){return Zt(t,c,e).top==d},i<0==(1==s.level)?s.from:s.to-1,a),"before"==u&&(a=Se(n,a,1))}else a=i<0?s.to:s.from;return new R(r,a,u)}}return new R(r,i<0?n.text.length:0,i<0?"before":"after")}function Te(e,t,n,r){var i=ke(t,e.doc.direction);if(!i)return Ee(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Ce(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&p>=c.begin)){var f=d?"before":"after";return new R(n.line,p,f)}}var h=function(e,t,r){for(var o=function(e,t){return t?new R(n.line,l(e,1),"before"):new R(n.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==g||r>0&&g==t.text.length||!(m=h(r>0?0:i.length-1,r,u(g)))?null:m}function _e(e,t){return e._handlers&&e._handlers[t]||$a}function Me(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=p(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Le(e,t){var n=_e(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Ie(e){e.prototype.on=function(e,t){Xa(this,e,t)},e.prototype.off=function(e,t){Me(this,e,t)}}function Re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Pe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Be(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Fe(e){Re(e),Pe(e)}function We(e){return e.target||e.srcElement}function He(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Ea&&e.ctrlKey&&1==t&&(t=3),t}function Ue(e){if(null==Ra){var t=r("span","​");n(e,r("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ra=t.offsetWidth<=1&&t.offsetHeight>2&&!(fa&&ha<8))}var i=Ra?r("span","​"):r("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Ve(e){if(null!=Pa)return Pa;var r=n(e,document.createTextNode("AخA")),i=Ma(r,0,1).getBoundingClientRect(),o=Ma(r,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(Pa=o.right-i.right<3)}function je(e){if(null!=ts)return ts;var t=n(e,r("span","x")),i=t.getBoundingClientRect(),o=Ma(t,0,1).getBoundingClientRect();return ts=Math.abs(i.left-o.left)>1}function ze(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ns[e]=t}function qe(e,t){rs[e]=t}function Ye(e){if("string"==typeof e&&rs.hasOwnProperty(e))e=rs[e];else if(e&&"string"==typeof e.name&&rs.hasOwnProperty(e.name)){var t=rs[e.name];"string"==typeof t&&(t={name:t}),e=b(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ye("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ye("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ge(e,t){t=Ye(t);var n=ns[t.name];if(!n)return Ge(e,"text/plain");var r=n(e,t);if(is.hasOwnProperty(t.name)){var i=is[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}function Ke(e,t){var n=is.hasOwnProperty(e)?is[e]:is[e]={};c(t,n)}function $e(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Xe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),n&&n.mode!=e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Qe(e,t,n){return!e.startState||e.startState(t,n)}function Ze(e,t,n,r){var i=[e.state.modeGen],o={};at(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,s=function(r){var a=e.state.overlays[r],s=1,l=0;n.state=!0,at(e,t.text,a.mode,n,function(e,t){for(var n=s;le&&i.splice(s,1,e,i[s+1],r),s+=2,l=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&$e(e.doc.mode,r.state),o=Ze(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),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 et(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ss(r,!0,t);var o=st(e,t,n),a=o>r.first&&T(r,o-1).stateAfter,s=a?ss.fromSaved(r,a,o):new ss(r,Qe(r.mode),o);return r.iter(o,t,function(n){tt(e,n.text,s);var r=s.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function it(e,t,n,r){var i,o=e.doc,a=o.mode;t=V(o,t);var s,l=T(o,t.line),u=et(e,t.line,n),c=new os(l.text,e.options.tabSize,u);for(r&&(s=[]);(r||c.pose.options.maxHighlightLength?(s=!1,a&&tt(e,t,r,d.pos),d.pos=t.length,l=null):l=ot(rt(n,d,r.state,p),o),p){var f=p[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=T(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof as?u.lookAhead:0)<=o.modeFrontier))return s;var c=d(l.text,null,e.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function lt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=T(e,r).stateAfter;if(i&&(!(i instanceof as)||r+i.lookAhead1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iu&&d.from<=u));p++);if(d.to>=c)return e(n,r,i,o,a,s,l);e(n,r.slice(0,d.to-u),i,o,null,s,l),o=null,r=r.slice(d.to-u),u=d.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function yt(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,u,c,d,p,f=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=u=c=d=s="",p=null,v=1/0;for(var y=[],b=void 0,x=0;xh||C.collapsed&&w.to==h&&w.from==h)?(null!=w.to&&w.to!=h&&v>w.to&&(v=w.to,u=""),C.className&&(l+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&w.from==h&&(c+=" "+C.startStyle),C.endStyle&&w.to==v&&(b||(b=[])).push(C.endStyle,w.to),C.title&&!d&&(d=C.title),C.collapsed&&(!p||ae(p.marker,C)<0)&&(p=w)):w.from>h&&v>w.from&&(v=w.from)}if(b)for(var k=0;k=f)break;for(var E=Math.min(f,v);;){if(g){var N=h+g.length;if(!p){var T=N>E?g.slice(0,E-h):g;t.addToken(t,T,a?a+l:l,c,h+T.length==v?u:"",d,s)}if(N>=E){g=g.slice(E-h),h=E;break}h=N,c=""}g=i.slice(o,o=n[m++]),a=dt(n[m++],t.cm.options)}}else for(var _=1;_2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Gt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Kt(e,t){t=de(t);var r=D(t),i=e.display.externalMeasured=new bt(e.doc,t,r);i.lineN=r;var o=i.built=pt(e,i);return i.text=o.pre,n(e.display.lineMeasure,o.pre),i}function $t(e,t,n,r){return Zt(e,Qt(e,t),n,r)}function Xt(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=l-s,i=o-1,t>=l&&(a="right")),null!=i){if(r=e[u+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if("right"==n&&i==l-s)for(;u=0&&(n=e[i]).left==n.right;i--);return n}function tn(e,t,n,r){var i,o=Jt(t.map,n,r),a=o.node,s=o.start,l=o.end,u=o.collapse;if(3==a.nodeType){for(var c=0;c<4;c++){for(;s&&k(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l0&&(u=r="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==r?d.length-1:0]:a.getBoundingClientRect()}if(fa&&ha<9&&!s&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+xn(e.display),top:p.top,bottom:p.bottom}:ms}for(var f=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(f+h)/2,g=t.view.measure.heights,v=0;v=r.text.length?(u=r.text.length,c="before"):u<=0&&(u=0,c="after"),!l)return a("before"==c?u-1:u,"before"==c);var d=Ce(l,u,c),p=Ga,f=s(u,d,"before"==c);return null!=p&&(f.other=s(u,p,"before"!=c)),f}function fn(e,t){var n=0;t=V(e.doc,t),e.options.lineWrapping||(n=xn(e.display)*t.ch);var r=T(e.doc,t.line),i=ye(r)+Ht(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function hn(e,t,n,r,i){var o=R(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function mn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return hn(r.first,0,null,!0,-1);var i=O(r,n),o=r.first+r.size-1;if(i>o)return hn(r.first+r.size-1,T(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=T(r,i);;){var s=yn(e,a,i,t,n),l=ue(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=D(a=u.to.line)}}function gn(e,t,n,r){var i=function(r){return un(e,t,Zt(e,n,r),"line")},o=t.text.length,a=E(function(e){return i(e-1).bottom<=r},o,0);return o=E(function(e){return i(e).top>r},a,o),{begin:a,end:o}}function vn(e,t,n,r){var i=un(e,t,Zt(e,n,r),"line").top;return gn(e,t,n,i)}function yn(e,t,n,r,i){i-=ye(t);var o,a=0,s=t.text.length,l=Qt(e,t),u=ke(t,e.doc.direction);if(u){if(e.options.lineWrapping){var c;c=gn(e,t,l,i),a=c.begin,s=c.end,c}o=new R(n,Math.floor(a+(s-a)/2));var d,p,f=pn(e,o,"line",t,l).left,h=f1){var b=Math.abs(m-d)/g;g=Math.min(g,Math.ceil(Math.abs(m)/b)),h=m<0?1:-1}}while(0!=m&&(g>1||h<0!=m<0&&Math.abs(m)<=Math.abs(d)));if(Math.abs(m)>Math.abs(d)){if(m<0==d<0)throw new Error("Broke out of infinite loop in coordsCharInner");o=p}}else{var x=E(function(n){var o=un(e,t,Zt(e,l,n),"line");return o.top>i?(s=Math.min(n,s),!0):!(o.bottom<=i)&&(o.left>r||!(o.rightw.right?1:0,o}function bn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==cs){cs=r("pre");for(var i=0;i<49;++i)cs.appendChild(document.createTextNode("x")),cs.appendChild(r("br"));cs.appendChild(document.createTextNode("x"))}n(e.measure,cs);var o=cs.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 wn(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:Cn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Cn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function kn(e){var t=bn(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=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r=e.display.viewTo||s.to().line3&&(i(f,m.top,null,m.bottom),f=c,m.bottoml.bottom||u.bottom==l.bottom&&u.right>l.right)&&(l=u),f0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function On(e){e.state.focused||(e.display.input.focus(),In(e))}function An(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Rn(e))},100)}function In(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,s(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ma&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Dn(e))}function Rn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,Oa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Pn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||l<-.005)&&(L(i.line,o),Bn(i.line),i.rest))for(var u=0;u=a&&(o=O(t,ye(T(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function Wn(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Cn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!wa){var a=r("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Ht(e.display))+"px;\n height: "+(t.bottom-t.top+jt(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(o),e.display.lineSpace.removeChild(a)}}}function Vn(e,t,n,r){null==r&&(r=0);var i;e.options.lineWrapping||t!=n||(t=t.ch?R(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?R(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,s=pn(e,t),l=n&&n!=t?pn(e,n):s;i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r};var u=zn(e,i),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=u.scrollTop&&(Qn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(Jn(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function jn(e,t){var n=zn(e,t);null!=n.scrollTop&&Qn(e,n.scrollTop),null!=n.scrollLeft&&Jn(e,n.scrollLeft)}function zn(e,t){var n=e.display,r=bn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=qt(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Ut(n),l=t.tops-r;if(t.topi+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(a.scrollTop=c)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,p=zt(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),f=t.right-t.left>p;return f&&(t.right=t.left+p),t.left<10?a.scrollLeft=0:t.leftp+d-3&&(a.scrollLeft=t.right+(f?0:10)-p),a}function qn(e,t){null!=t&&($n(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Yn(e){$n(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Gn(e,t,n){null==t&&null==n||$n(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Kn(e,t){$n(e),e.curOp.scrollToPos=t}function $n(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=fn(e,t.from),r=fn(e,t.to);Xn(e,n,r,t.margin)}}function Xn(e,t,n,r){var i=zn(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Gn(e,i.scrollLeft,i.scrollTop)}function Qn(e,t){Math.abs(e.doc.scrollTop-t)<2||(ua||Mr(e,{top:t}),Zn(e,t,!0),ua&&Mr(e),Cr(e,100))}function Zn(e,t,n){t=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 Jn(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Wn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function er(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ut(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:r,scrollHeight:r+jt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function tr(e,t){t||(t=er(e));var n=e.display.barWidth,r=e.display.barHeight;nr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Pn(e),nr(e,er(e)),n=e.display.barWidth,r=e.display.barHeight}function nr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function rr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Oa(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ys[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Xa(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?Jn(e,t):Qn(e,t)},e),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)}function ir(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++bs},wt(e.curOp)}function or(e){var t=e.curOp;kt(t,function(e){for(var t=0;t=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xs(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function lr(e){e.updatedDisplay=e.mustUpdate&&Tr(e.cm,e.update)}function ur(e){var t=e.cm,n=t.display;e.updatedDisplay&&Pn(t),e.barMeasure=er(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$t(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+jt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-zt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection(e.focus))}function cr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeftt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ya&&he(e.doc,t)i.viewFrom?yr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)yr(e);else if(t<=i.viewFrom){var o=br(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):yr(e)}else if(n>=i.viewTo){var a=br(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):yr(e)}else{var s=br(e,t,t,-1),l=br(e,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(xt(e,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):yr(e)}var u=i.externalMeasured;u&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Nn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);p(a,n)==-1&&a.push(n)}}}function yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function br(e,t,n,r){var i,o=Nn(e,t),a=e.display.view;if(!Ya||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;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;he(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function xr(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=xt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=xt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function wr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo)){var n=+new Date+e.options.workTime,r=et(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?$e(t.mode,r.state):null,l=Ze(e,o,r,!0);s&&(r.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),p=0;!d&&pn)return Cr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&pr(e,function(){for(var t=0;t=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==wr(e))return!1;Hn(e)&&(yr(e),n.dims=wn(e));var o=i.first+i.size,a=Math.max(n.visible.from-e.options.viewportMargin,i.first),s=Math.min(o,n.visible.to+e.options.viewportMargin);r.viewFroms&&r.viewTo-s<20&&(s=Math.min(o,r.viewTo)),Ya&&(a=he(e.doc,a),s=me(e.doc,s));var l=a!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;xr(e,a,s),r.viewOffset=ye(T(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=wr(e);if(!l&&0==u&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Er(e);return u>4&&(r.lineDiv.style.display="none"),Lr(e,r.updateLineNumbers,n.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Nr(c),t(r.cursorDiv),t(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,Cr(e,400)),r.updateLineNumbers=null,!0}function _r(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=zt(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ut(e.display)-qt(e),n.top)}),t.visible=Fn(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&Tr(e,t);r=!1){Pn(e);var i=er(e);Tn(e),tr(e,i),Or(e,i),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 Mr(e,t){var n=new xs(e,t);if(Tr(e,n)){Pn(e),_r(e,n);var r=er(e);Tn(e),tr(e,r),Or(e,r),n.finish()}}function Lr(e,n,r){function i(t){var n=t.nextSibling;return ma&&Ea&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var o=e.display,a=e.options.lineNumbers,s=o.lineDiv,l=s.firstChild,u=o.view,c=o.viewFrom,d=0;d-1&&(h=!1),Nt(e,f,c,r)),h&&(t(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(I(e.options,c)))),l=f.node.nextSibling}else{var m=It(e,f,c,r);s.insertBefore(m,l)}c+=f.size}for(;l;)l=i(l)}function Dr(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Or(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+jt(e)+"px"}function Ar(e){var n=e.display.gutters,i=e.options.gutters;t(n);for(var o=0;o-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function Rr(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Pr(e){var t=Rr(e);return t.x*=Cs,t.y*=Cs,t}function Br(e,t){var n=Rr(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&Ea&&ma)e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode)for(var d=0;d=0){var a=H(o.from(),i.from()),s=W(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new Ss(l?s:a,l?a:s))}}return new ks(e,t)}function Wr(e,t){return new ks([new Ss(e,t||e)],0)}function Hr(e){return e.text?R(e.from.line+e.text.length-1,m(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ur(e,t){if(P(e,t.from)<0)return e;if(P(e,t.to)<=0)return Hr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Hr(t).ch-t.to.ch),R(n,r)}function Vr(e,t){for(var n=[],r=0;r1&&e.remove(s.line+1,h-1),e.insert(s.line+1,y)}St(e,"change",e,t)}function $r(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges?(e.done.pop(),m(e.done)):void 0}function ri(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ni(i,i.lastOp==r)))a=m(o.changes),0==P(t.from,t.to)&&0==P(t.from,a.to)?a.to=Hr(t):o.changes.push(ei(e,t));else{var l=m(i.done);for(l&&l.ranges||ai(e.sel,i.done),o={changes:[ei(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||Le(e,"historyAdded")}function ii(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function oi(e,t,n,r){var i=e.history,o=r&&r.origin; +n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ii(e,o,m(i.done),t))?i.done[i.done.length-1]=t:ai(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&ti(i.undone)}function ai(e,t){var n=m(t);n&&n.ranges&&n.equals(e)||t.push(e)}function si(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function li(e){if(!e)return null;for(var t,n=0;n-1&&(m(s)[d]=u[d],delete u[d])}}}return r}function pi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=P(t,i)<0;o!=P(n,i)<0?(i=t,t=n):o!=P(t,n)<0&&(t=n)}return new Ss(i,t)}return new Ss(n||t,t)}function fi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),bi(e,new ks([pi(e.sel.primary(),t,n,i)],0),r)}function hi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(i&&(Le(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var u=l.find(r<0?1:-1),c=void 0;if((r<0?l.inclusiveRight:l.inclusiveLeft)&&(u=Ni(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=P(u,n))&&(r<0?c<0:c>0))return Si(e,u,t,r,i)}var d=l.find(r<0?-1:1);return(r<0?l.inclusiveLeft:l.inclusiveRight)&&(d=Ni(e,d,r,d.line==t.line?o:null)),d?Si(e,d,t,r,i):null}}return t}function Ei(e,t,n,r,i){var o=r||1,a=Si(e,t,n,o,i)||!i&&Si(e,t,n,o,!0)||Si(e,t,n,-o,i)||!i&&Si(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,R(e.first,0))}function Ni(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?V(e,R(t.line-1)):null:n>0&&t.ch==(r||T(e,t.line)).text.length?t.line=0;--i)Li(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Li(e,t)}}function Li(e,t){if(1!=t.text.length||""!=t.text[0]||0!=P(t.from,t.to)){var n=Vr(e,t);ri(e,t,n,e.cm?e.cm.curOp.id:NaN),Ai(e,t,n,J(e,t));var r=[];$r(e,function(e,n){n||p(r,e.history)!=-1||(Fi(e.history,t),r.push(e.history)),Ai(e,t,null,J(e,t))})}}function Di(e,t,n){if(!e.cm||!e.cm.state.suppressEdits||n){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--f){var h=d(f);if(h)return h.v}}}}function Oi(e,t){if(0!=t&&(e.first+=t,e.sel=new ks(g(e.sel.ranges,function(e){return new Ss(R(e.anchor.line+t,e.anchor.ch),R(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){gr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:R(o,T(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=_(e,t.from,t.to),n||(n=Vr(e,t)),e.cm?Ii(e.cm,t,r):Kr(e,t,r),xi(e,n,Wa)}}function Ii(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=D(de(T(r,o.line))),r.iter(l,a.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Oe(e),Kr(r,t,n,kn(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,function(e){var t=be(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),lt(r,o.line),Cr(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?gr(e):o.line!=a.line||1!=t.text.length||Gr(e.doc,t)?gr(e,o.line,a.line+1,u):vr(e,o.line,"text");var c=Ae(e,"changes"),d=Ae(e,"change");if(d||c){var p={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&St(e,"change",e,p),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Ri(e,t,n,r,i){if(r||(r=n),P(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Mi(e,{from:n,to:r,text:t,origin:i})}function Pi(e,t,n,r){n0||0==s&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=i("span",[a.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ce(e,t.line,t,n,a)||t.line!=n.line&&ce(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Y()}a.addToHistory&&ri(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,u=t.line,d=e.cm;if(e.iter(u,n.line+1,function(e){d&&a.collapsed&&!d.options.lineWrapping&&de(e)==d.display.maxLine&&(l=!0),a.collapsed&&u!=t.line&&L(e,0),X(e,new G(a,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),a.collapsed&&e.iter(t.line,n.line+1,function(t){ge(e,t)&&L(t,0)}),a.clearOnEnter&&Xa(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(q(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Ns,a.atomic=!0),d){if(l&&(d.curOp.updateMaxLine=!0),a.collapsed)gr(d,t.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var p=t.line;p<=n.line;p++)vr(d,p,"text");a.atomic&&Ci(d.doc),St(d,"markerAdded",d,a)}return a}function qi(e,t,n,r,i){r=c(r),r.shared=!1;var o=[zi(e,t,n,r,i)],a=o[0],s=r.widgetNode;return $r(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(zi(e,V(e,t),V(e,n),r,i));for(var l=0;l-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),xi(t.doc,Wr(n,n)),c)for(var d=0;d=0;t--)Ri(e.doc,"",r[t].from,r[t].to,"+delete");Yn(e)})}function po(e,t){var n=T(e.doc,t),r=de(n);return r!=n&&(t=D(r)),Ne(!0,e,r,t,1)}function fo(e,t){var n=T(e.doc,t),r=pe(n);return r!=n&&(t=D(r)),Ne(!0,e,n,t,-1)}function ho(e,t){var n=po(e,t.line),r=T(e.doc,n.line),i=ke(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return R(n.line,a?0:o,n.sticky)}return n}function mo(e,t,n){if("string"==typeof t&&(t=Fs[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Fa}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function go(e,t,n){for(var r=0;r-1&&(P((i=s.ranges[i]).from(),t)<0||t.xRel>0)&&(P(i.to(),t)>0||t.xRel<0)?Mo(e,r,t,o):Do(e,r,t,o)}function Mo(e,t,n,r){var i=e.display,o=!1,a=fr(e,function(t){ma&&(i.scroller.draggable=!1),e.state.draggingText=!1,Me(document,"mouseup",a),Me(document,"mousemove",s),Me(i.scroller,"dragstart",l),Me(i.scroller,"drop",a),o||(Re(t),r.addNew||fi(e.doc,n,null,null,r.extend),ma||fa&&9==ha?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),s=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},l=function(){return o=!0};ma&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Xa(document,"mouseup",a),Xa(document,"mousemove",s),Xa(i.scroller,"dragstart",l),Xa(i.scroller,"drop",a),An(e),setTimeout(function(){return i.input.focus()},20)}function Lo(e,t,n){if("char"==n)return new Ss(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ss(R(t.line,0),V(e.doc,R(t.line+1,0)));var r=n(e,t);return new Ss(r.from,r.to)}function Do(e,t,n,r){function i(t){if(0!=P(v,t))if(v=t,"rectangle"==r.unit){for(var i=[],o=e.options.tabSize,a=d(T(u,n.line).text,n.ch,o),s=d(T(u,t.line).text,t.ch,o),l=Math.min(a,s),m=Math.max(a,s),g=Math.min(n.line,t.line),y=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=y;g++){var b=T(u,g).text,x=f(b,l,o);l==m?i.push(new Ss(R(g,x),R(g,x))):b.length>x&&i.push(new Ss(R(g,x),R(g,f(b,m,o))))}i.length||i.push(new Ss(n,n)),bi(u,Fr(h.ranges.slice(0,p).concat(i),p),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var w,C=c,k=Lo(e,t,r.unit),S=C.anchor;P(k.anchor,S)>0?(w=k.head,S=H(C.from(),k.anchor)):(w=k.anchor,S=W(C.to(),k.head));var E=h.ranges.slice(0);E[p]=new Ss(V(u,S),w),bi(u,Fr(E,p),Ha)}}function o(t){var n=++b,s=En(e,t,!0,"rectangle"==r.unit);if(s)if(0!=P(s,v)){e.curOp.focus=a(),i(s);var c=Fn(l,u);(s.line>=c.to||s.liney.bottom?20:0;d&&setTimeout(fr(e,function(){b==n&&(l.scroller.scrollTop+=d,o(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,Re(t),l.input.focus(),Me(document,"mousemove",x),Me(document,"mouseup",w),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Re(t);var c,p,h=u.sel,m=h.ranges;if(r.addNew&&!r.extend?(p=u.sel.contains(n),c=p>-1?m[p]:new Ss(n,n)):(c=u.sel.primary(),p=u.sel.primIndex),"rectangle"==r.unit)r.addNew||(c=new Ss(n,n)),n=En(e,t,!0,!0),p=-1;else{var g=Lo(e,n,r.unit);c=r.extend?pi(c,g.anchor,g.head,r.extend):g}r.addNew?p==-1?(p=m.length,bi(u,Fr(m.concat([c]),p),{scroll:!1,origin:"*mouse"})):m.length>1&&m[p].empty()&&"char"==r.unit&&!r.extend?(bi(u,Fr(m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),h=u.sel):mi(u,p,c,Ha):(p=0,bi(u,new ks([c],0),Ha),h=u.sel);var v=n,y=l.wrapper.getBoundingClientRect(),b=0,x=fr(e,function(e){He(e)?o(e):s(e)}),w=fr(e,s);e.state.selectingText=w,Xa(document,"mousemove",x),Xa(document,"mouseup",w)}function Oo(e,t,n,r){var i,o;try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Re(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ae(e,n))return Be(t);o-=s.top-a.viewOffset;for(var l=0;l=i){var c=O(e.doc,o),d=e.options.gutters[l];return Le(e,n,e,c,d,t),Be(t)}}}function Ao(e,t){return Oo(e,t,"gutterClick",!0)}function Io(e,t){Wt(e.display,t)||Ro(e,t)||De(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function Ro(e,t){return!!Ae(e,"gutterContextMenu")&&Oo(e,t,"gutterContextMenu",!1)}function Po(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}function Bo(e){function t(t,r,i,o){e.defaults[t]=r,i&&(n[t]=o?function(e,t,n){n!=qs&&i(e,t,n)}:i)}var n=e.optionHandlers;e.defineOption=t,e.Init=qs,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,qr(e)},!0),t("indentUnit",2,qr,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Yr(e),an(e),gr(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,n.push(R(r,o))}r++});for(var i=n.length-1;i>=0;i--)Ri(e.doc,t,n[i],R(n[i].line,n[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=qs&&e.refresh()}),t("specialCharPlaceholder",ft,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Sa?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("rtlMoveVisually",!Ta),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Po(e),Fo(e)},!0),t("keyMap","default",function(e,t,n){var r=uo(t),i=n!=qs&&uo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Ho,!0),t("gutters",[],function(e){Ir(e.options),Fo(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Cn(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return tr(e)},!0),t("scrollbarStyle","native",function(e){rr(e),tr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){Ir(e.options),Fo(e)},!0),t("firstLineNumber",1,Fo,!0),t("lineNumberFormatter",function(e){return e},Fo,!0),t("showCursorWhenSelecting",!1,Tn,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("readOnly",!1,function(e,t){"nocursor"==t&&(Rn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Wo),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Tn,!0),t("singleCursorHeightPerLine",!0,Tn,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Yr,!0),t("addModeClass",!1,Yr,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Yr,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}function Fo(e){Ar(e),gr(e),Wn(e)}function Wo(e,t,n){var r=n&&n!=qs;if(!t!=!r){var i=e.display.dragFunctions,o=t?Xa:Me;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ho(e){e.options.lineWrapping?(s(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Oa(e.display.wrapper,"CodeMirror-wrap"),xe(e)),Sn(e),gr(e),an(e),setTimeout(function(){return tr(e)},100)}function Uo(e,t){var n=this;if(!(this instanceof Uo))return new Uo(e,t);this.options=t=t?c(t):{},c(Ys,t,!1),Ir(t);var r=t.value;"string"==typeof r&&(r=new Ls(r,t.mode,null,t.lineSeparator,t.direction)),this.doc=r;var i=new Uo.inputStyles[t.inputStyle](this),o=this.display=new N(e,r,i);o.wrapper.CodeMirror=this,Ar(this),Po(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),rr(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 Ia,keySeq:null,specialChars:null},t.autofocus&&!Sa&&o.input.focus(),fa&&ha<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Vo(this),eo(),ir(this),this.curOp.forceUpdate=!0,Xr(this,r),t.autofocus&&!Sa||this.hasFocus()?setTimeout(u(In,this),20):Rn(this);for(var a in Gs)Gs.hasOwnProperty(a)&&Gs[a](n,t[a],qs);Hn(this),t.finishInit&&t.finishInit(this);for(var s=0;s400}var i=e.display;Xa(i.scroller,"mousedown",fr(e,Eo)),fa&&ha<11?Xa(i.scroller,"dblclick",fr(e,function(t){if(!De(e,t)){var n=En(e,t);if(n&&!Ao(e,t)&&!Wt(e.display,t)){Re(t);var r=e.findWordAt(n);fi(e.doc,r.anchor,r.head)}}})):Xa(i.scroller,"dblclick",function(t){return De(e,t)||Re(t)}),Da||Xa(i.scroller,"contextmenu",function(t){return Io(e,t)});var o,a={end:0};Xa(i.scroller,"touchstart",function(t){if(!De(e,t)&&!n(t)){i.input.ensurePolled(),clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Xa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Xa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Wt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new Ss(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new Ss(R(s.line,0),V(e.doc,R(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Re(n)}t()}),Xa(i.scroller,"touchcancel",t),Xa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Qn(e,i.scroller.scrollTop),Jn(e,i.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Xa(i.scroller,"mousewheel",function(t){return Br(e,t)}),Xa(i.scroller,"DOMMouseScroll",function(t){return Br(e,t)}),Xa(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){De(e,t)||Fe(t)},over:function(t){De(e,t)||(Qi(e,t),Fe(t))},start:function(t){return Xi(e,t)},drop:fr(e,$i),leave:function(t){De(e,t)||Zi(e)}};var s=i.input.getField();Xa(s,"keyup",function(t){return Co.call(e,t)}),Xa(s,"keydown",fr(e,xo)),Xa(s,"keypress",fr(e,ko)),Xa(s,"focus",function(t){return In(e,t)}),Xa(s,"blur",function(t){return Rn(e,t)})}function jo(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=et(e,t).state:n="prev");var a=e.options.tabSize,s=T(o,t),l=d(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Fa||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?d(T(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 p="",f=0;if(e.options.indentWithTabs)for(var m=Math.floor(u/a);m;--m)f+=a,p+="\t";if(f1)if($s&&$s.text.join("\n")==t){if(r.ranges.length%$s.text.length==0){l=[];for(var u=0;u<$s.text.length;u++)l.push(o.splitLines($s.text[u]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(l=g(s,function(e){return[e]}));for(var c,d=r.ranges.length-1;d>=0;d--){var p=r.ranges[d],f=p.from(),h=p.to();p.empty()&&(n&&n>0?f=R(f.line,f.ch-n):e.state.overwrite&&!a?h=R(h.line,Math.min(T(o,h.line).text.length,h.ch+m(s).length)):$s&&$s.lineWise&&$s.text.join("\n")==t&&(f=h=R(f.line,0))), +c=e.curOp.updateInput;var v={from:f,to:h,text:l?l[d%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Mi(e.doc,v),St(e,"inputRead",e,v)}t&&!a&&Go(e,t),Yn(e),e.curOp.updateInput=c,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Yo(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||pr(t,function(){return qo(t,n,0,null,"paste")}),!0}function Go(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=jo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(T(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jo(e,i.head.line,"smart"));a&&St(e,"electricInput",e,i.head.line)}}}function Ko(e){for(var t=[],n=[],r=0;r=e.first+e.size)&&(t=new R(r,t.ch,t.sticky),u=T(e,r))}function a(r){var a;if(a=i?Te(e.cm,u,t,n):Ee(u,t,n),null==a){if(r||!o())return!1;t=Ne(i,e.cm,u,t.line,n)}else t=a;return!0}var s=t,l=n,u=T(e,t.line);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var c=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||a(!f);f=!1){var h=u.text.charAt(t.ch)||"\n",m=w(h,p)?"w":d&&"\n"==h?"n":!d||/\s/.test(h)?null:"p";if(!d||f||m||(m="s"),c&&c!=m){n<0&&(n=1,a(),t.sticky="after");break}if(m&&(c=m),n>0&&!a(!f))break}var g=Ei(e,t,s,l,!0);return B(s,g)&&(g.hitSide=!0),g}function Zo(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*bn(e.display),3);i=(n>0?t.bottom:t.top)+n*l}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(var u;u=mn(e,a,i),u.outside;){if(n<0?i<=0:i>=o.height){u.hitSide=!0;break}i+=5*n}return u}function Jo(e,t){var n=Xt(e,t.line);if(!n||n.hidden)return null;var r=T(e.doc,t.line),i=Gt(n,r,t.line),o=ke(r,e.doc.direction),a="left";if(o){var s=Ce(o,t.ch);a=s%2?"right":"left"}var l=Jt(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function ea(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ta(e,t){return t&&(e.bad=!0),e}function na(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(){c&&(u+=d,c=!1)}function s(e){e&&(a(),u+=e)}function l(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return void s(n||t.textContent.replace(/\u200b/g,""));var u,p=t.getAttribute("cm-marker");if(p){var f=e.findMarks(R(r,0),R(i+1,0),o(+p));return void(f.length&&(u=f[0].find(0))&&s(_(e.doc,u.from,u.to).join(d)))}if("false"==t.getAttribute("contenteditable"))return;var h=/^(pre|div|p)$/i.test(t.nodeName);h&&a();for(var m=0;m=15&&(ya=!1,ma=!0);var Ma,La=Ea&&(ga||ya&&(null==_a||_a<12.11)),Da=ua||fa&&ha>=9,Oa=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:"")}};Ma=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 Aa=function(e){e.select()};Ca?Aa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:fa&&(Aa=function(e){try{e.select()}catch(e){}});var Ia=function(){this.id=null};Ia.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Ra,Pa,Ba=30,Fa={toString:function(){return"CodeMirror.Pass"}},Wa={scroll:!1},Ha={origin:"*mouse"},Ua={origin:"+move"},Va=[""],ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,za=/[\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]/,qa=!1,Ya=!1,Ga=null,Ka=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/;return function(n,r){var u="ltr"==r?"L":"R";if(0==n.length||"ltr"==r&&!i.test(n))return!1;for(var c=n.length,d=[],p=0;p=this.string.length},os.prototype.sol=function(){return this.pos==this.lineStart},os.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},os.prototype.next=function(){if(this.post},os.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},os.prototype.skipToEnd=function(){this.pos=this.string.length},os.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},os.prototype.backUp=function(e){this.pos-=e},os.prototype.column=function(){return this.lastColumnPos0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0},os.prototype.current=function(){return this.string.slice(this.start,this.pos)},os.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},os.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};var as=function(e,t){this.state=e,this.lookAhead=t},ss=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0};ss.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ss.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ss.fromSaved=function(e,t,n){return t instanceof as?new ss(e,$e(e.mode,t.state),n,t.lookAhead):new ss(e,$e(e.mode,t),n)},ss.prototype.save=function(e){var t=e!==!1?$e(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new as(t,this.maxLookAhead):t};var ls=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n},us=function(e,t,n){this.text=e,re(this,t),this.height=n?n(this):1};us.prototype.lineNo=function(){return D(this)},Ie(us);var cs,ds={},ps={},fs=null,hs=null,ms={left:0,right:0,top:0,bottom:0},gs=function(e,t,n){this.cm=n;var i=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=r("div",[r("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(i),e(o),Xa(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Xa(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,fa&&ha<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gs.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},gs.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gs.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gs.prototype.zeroWidthHack=function(){var e=Ea&&!xa?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ia,this.disableVert=new Ia},gs.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},gs.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vs=function(){};vs.prototype.update=function(){return{bottom:0,right:0}},vs.prototype.setScrollLeft=function(){},vs.prototype.setScrollTop=function(){},vs.prototype.clear=function(){};var ys={native:gs,null:vs},bs=0,xs=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Fn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=zt(e),this.force=n,this.dims=wn(e),this.events=[]};xs.prototype.signal=function(e,t){Ae(e,t)&&this.events.push(arguments)},xs.prototype.finish=function(){for(var e=this,t=0;t=0&&P(e,i.to())<=0)return r}return-1};var Ss=function(e,t){this.anchor=e,this.head=t};Ss.prototype.from=function(){return H(this.anchor,this.head)},Ss.prototype.to=function(){return W(this.anchor,this.head)},Ss.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,r=e,i=e+t;r1||!(this.children[0]instanceof Hi))){var l=[];this.collapse(l),this.children=[new Hi(l)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n50){for(var s=o.lines.length%25+25,l=s;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=this,i=0;it.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&gr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ci(t.doc)),t&&St(t,"markerCleared",t,this,i,o),n&&or(t),this.parent&&this.parent.clear()}},Ts.prototype.find=function(e,t){var n=this;null==e&&"bookmark"==this.type&&(e=1);for(var r,i,o=0;o=0;u--)Mi(r,i[u]);l?yi(this,l):this.cm&&Yn(this.cm)}),undo:mr(function(){Di(this,"undo")}),redo:mr(function(){Di(this,"redo")}),undoSelection:mr(function(){Di(this,"undo",!0)}),redoSelection:mr(function(){Di(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.ch)&&t.push(i.marker.parent||i.marker); +}return t},findMarks:function(e,t,n){e=V(this,e),t=V(this,t);var r=[],i=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&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=o,void++n)}),V(this,R(n,t))},indexFromPos:function(e){e=V(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.to0)i=new R(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),R(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=T(e.doc,i.line-1).text;a&&(i=new R(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),R(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ss(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return pr(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;re&&0==P(t,this.pos)&&n==this.button};var js,zs,qs={toString:function(){return"CodeMirror.Init"}},Ys={},Gs={};Uo.defaults=Ys,Uo.optionHandlers=Gs;var Ks=[];Uo.defineInitHook=function(e){return Ks.push(e)};var $s=null,Xs=function(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)&&fr(this,t[e])(this,n,i),Le(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](uo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nr&&(jo(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Yn(t));else{var a=o.from(),s=o.to(),l=Math.max(r,a.line);r=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=l;u0&&mi(t.doc,i,new Ss(a,c[i].to()),Wa)}}}),getTokenAt:function(e,t){return it(this,e,t)},getLineTokens:function(e,t){return it(this,R(e),t,!0)},getTokenTypeAt:function(e){e=V(this.doc,e);var t,n=Je(this,T(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&&(e=o,i=!0),r=T(this.doc,e)}else r=e;return un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-ye(r):0)},defaultTextHeight:function(){return bn(this.display)},defaultCharWidth:function(){return xn(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=pn(this,V(this.doc,e));var a=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"==r)a=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||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"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&jn(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:hr(xo),triggerOnKeyPress:hr(ko),triggerOnKeyUp:Co,triggerOnMouseDown:hr(Eo),execCommand:function(e){if(Fs.hasOwnProperty(e))return Fs[e].call(null,this)},triggerElectric:hr(function(e){Go(this,e)}),findPosH:function(e,t,n,r){var i=this,o=1;t<0&&(o=-1,t=-t);for(var a=V(this.doc,e),s=0;s0&&s(n.charAt(r-1));)--r;for(;i.5)&&Sn(this),Le(this,"refresh",this)}),swapDoc:hr(function(e){var t=this.doc;return t.cm=null,Xr(this,e),an(this),this.display.input.reset(),Gn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,St(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ie(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}},Qs=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ia,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qs.prototype.init=function(e){function t(e){if(!De(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=Ko(i);zo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,Wa),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=$s.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var a=Xo(),s=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),s.value=$s.text.join("\n");var l=document.activeElement;Aa(s),setTimeout(function(){i.display.lineSpace.removeChild(a),l.focus(),l==o&&r.showPrimarySelection()},50)}}var n=this,r=this,i=r.cm,o=r.div=e.lineDiv;$o(o,i.options.spellcheck),Xa(o,"paste",function(e){De(i,e)||Yo(e,i)||ha<=11&&setTimeout(fr(i,function(){return n.updateFromDOM()}),20)}),Xa(o,"compositionstart",function(e){n.composing={data:e.data,done:!1}}),Xa(o,"compositionupdate",function(e){n.composing||(n.composing={data:e.data,done:!1})}),Xa(o,"compositionend",function(e){n.composing&&(e.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),Xa(o,"touchstart",function(){return r.forceCompositionEnd()}),Xa(o,"input",function(){n.composing||n.readFromDOMSoon()}),Xa(o,"copy",t),Xa(o,"cut",t)},Qs.prototype.prepareSelection=function(){var e=_n(this.cm,!1);return e.focus=this.cm.state.focused,e},Qs.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Qs.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Jo(t,r)||{node:s[0].measure.map[2],offset:0},u=i.linee.firstLine()&&(r=R(r.line-1,T(e.doc,r.line-1).length)),i.ch==T(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,s;r.line==t.viewFrom||0==(o=Nn(e,r.line))?(a=D(t.view[0].line),s=t.view[0].node):(a=D(t.view[o].line),s=t.view[o-1].node.nextSibling);var l,u,c=Nn(e,i.line);if(c==t.view.length-1?(l=t.viewTo-1,u=t.lineDiv.lastChild):(l=D(t.view[c+1].line)-1,u=t.view[c+1].node.previousSibling),!s)return!1;for(var d=e.doc.splitLines(na(e,s,u,a,l)),p=_(e.doc,R(a,0),R(l,T(e.doc,l).text.length));d.length>1&&p.length>1;)if(m(d)==m(p))d.pop(),p.pop(),l--;else{if(d[0]!=p[0])break;d.shift(),p.shift(),a++}for(var f=0,h=0,g=d[0],v=p[0],y=Math.min(g.length,v.length);fr.ch&&b.charCodeAt(b.length-h-1)==x.charCodeAt(x.length-h-1);)f--,h++;d[d.length-1]=b.slice(0,b.length-h).replace(/^\u200b+/,""),d[0]=d[0].slice(f).replace(/\u200b+$/,"");var C=R(a,f),k=R(l,p.length?m(p).length-h:0);return d.length>1||d[0]||P(C,k)?(Ri(e.doc,d,C,k,"+input"),!0):void 0},Qs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Qs.prototype.reset=function(){this.forceCompositionEnd()},Qs.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Qs.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))},Qs.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||pr(this.cm,function(){return gr(e.cm)})},Qs.prototype.setUneditable=function(e){e.contentEditable="false"},Qs.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||fr(this.cm,qo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Qs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Qs.prototype.onContextMenu=function(){},Qs.prototype.resetPosition=function(){},Qs.prototype.needsContentAttribute=!0;var Zs=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ia,this.hasSelection=!1,this.composing=null};Zs.prototype.init=function(e){function t(e){if(!De(i,e)){if(i.somethingSelected())zo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ko(i);zo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,Wa):(r.prevInput="",a.value=t.text.join("\n"),Aa(a))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var n=this,r=this,i=this.cm,o=this.wrapper=Xo(),a=this.textarea=o.firstChild;e.wrapper.insertBefore(o,e.wrapper.firstChild),Ca&&(a.style.width="0px"),Xa(a,"input",function(){fa&&ha>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()}),Xa(a,"paste",function(e){De(i,e)||Yo(e,i)||(i.state.pasteIncoming=!0,r.fastPoll())}),Xa(a,"cut",t),Xa(a,"copy",t),Xa(e.scroller,"paste",function(t){Wt(e,t)||De(i,t)||(i.state.pasteIncoming=!0,r.focus())}),Xa(e.lineSpace,"selectstart",function(t){Wt(e,t)||Re(t)}),Xa(a,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Xa(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Zs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=_n(e);if(e.options.moveInputWithCursor){var i=pn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Zs.prototype.showSelection=function(e){var t=this.cm,r=t.display;n(r.cursorDiv,e.cursors),n(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Zs.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Aa(this.textarea),fa&&ha>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",fa&&ha>=9&&(this.hasSelection=null))}},Zs.prototype.getField=function(){return this.textarea},Zs.prototype.supportsTouch=function(){return!1},Zs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Sa||a()!=this.textarea))try{this.textarea.focus()}catch(e){}},Zs.prototype.blur=function(){this.textarea.blur()},Zs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Zs.prototype.receivedFocus=function(){this.slowPoll()},Zs.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Zs.prototype.fastPoll=function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},Zs.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ja(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(fa&&ha>=9&&this.hasSelection===i||Ea&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,s=Math.min(r.length,i.length);a1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Zs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Zs.prototype.onKeyPress=function(){fa&&ha>=9&&(this.hasSelection=null),this.fastPoll()},Zs.prototype.onContextMenu=function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=d,a.style.cssText=c,fa&&ha<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!fa||fa&&ha<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==r.prevInput?fr(i,Ti)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,s=En(i,e),l=o.scroller.scrollTop;if(s&&!ya){var u=i.options.resetSelectionOnContextMenu;u&&i.doc.sel.contains(s)==-1&&fr(i,bi)(i.doc,Wr(s),Wa);var c=a.style.cssText,d=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var p=r.wrapper.getBoundingClientRect();a.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: "+(fa?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var f;if(ma&&(f=window.scrollY),o.input.focus(),ma&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "), +r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),fa&&ha>=9&&t(),Da){Fe(e);var h=function(){Me(window,"mouseup",h),setTimeout(n,20)};Xa(window,"mouseup",h)}else setTimeout(n,50)}},Zs.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Zs.prototype.setUneditable=function(){},Zs.prototype.needsContentAttribute=!1,Bo(Uo),Xs(Uo);var Js="iter insert remove copy getEditor constructor".split(" ");for(var el in Ls.prototype)Ls.prototype.hasOwnProperty(el)&&p(Js,el)<0&&(Uo.prototype[el]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ls.prototype[el]));return Ie(Ls),Uo.inputStyles={textarea:Zs,contenteditable:Qs},Uo.defineMode=function(e){Uo.defaults.mode||"null"==e||(Uo.defaults.mode=e),ze.apply(this,arguments)},Uo.defineMIME=qe,Uo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Uo.defineMIME("text/plain","null"),Uo.defineExtension=function(e,t){Uo.prototype[e]=t},Uo.defineDocExtension=function(e,t){Ls.prototype[e]=t},Uo.fromTextArea=oa,aa(Uo),Uo.version="5.29.0",Uo})},function(e,t,n){!function(e){e(n(20))}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s\s*$/.test(p)||i.replaceRange("",{line:l.line,ch:0},{line:l.line,ch:l.ch+1}),a[s]="\n";else{var h=f[1],m=f[5],g=r.test(f[2])||f[2].indexOf(">")>=0?f[2].replace("x"," "):parseInt(f[3],10)+1+f[4];a[s]="\n"+h+g+m}}i.replaceSelections(a)}})},function(e,t,n){var r=n(20);r.commands.tabAndIndentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentMore");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}},r.commands.shiftTabAndUnindentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentLess");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}}},function(e,t,n){!function(e){e(n(20))}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(r,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(r):n(r))})})},function(e,t,n){!function(e){e(n(20),n(25),n(26))}(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 s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==u&&(e.f=f,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function l(t,o){var s=t.column()===o.indentation,l=a(o.prevLine.stream),u=o.indentedCode,p=o.prevLine.hr,f=o.list!==!1,h=(o.listStack[o.listStack.length-1]||0)+3;o.indentedCode=!1;var m=o.indentation;if(null===o.indentationDiff&&(o.indentationDiff=o.indentation,f)){for(o.list=null;m=4&&(u||o.prevLine.fencedCodeEnd||o.prevLine.header||l))return t.skipToEnd(),o.indentedCode=!0,C.code;if(t.eatSpace())return null;if(s&&o.indentation<=h&&(b=t.match(T))&&b[1].length<=6)return o.quote=0,o.header=b[1].length,o.thisLine.header=!0,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,d(o);if(o.indentation<=h&&t.eat(">"))return o.quote=s?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),d(o);if(!y&&!o.setext&&s&&o.indentation<=h&&(b=t.match(E))){var x=b[1]?"ol":"ul";return o.indentation=m+t.current().length,o.list=!0,o.quote=0,o.listStack.push(o.indentation),n.taskLists&&t.match(N,!1)&&(o.taskList=!0),o.f=o.inline,n.highlightFormatting&&(o.formatting=["list","list-"+x]),d(o)}return s&&o.indentation<=h&&(b=t.match(L,!0))?(o.quote=0,o.fencedEndRE=new RegExp(b[1]+"+ *$"),o.localMode=n.fencedCodeBlockHighlighting&&r(b[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=c,n.highlightFormatting&&(o.formatting="code-block"),o.code=-1,d(o)):o.setext||!(g&&f||o.quote||o.list!==!1||o.code||y||D.test(t.string))&&(b=t.lookAhead(1))&&(b=b.match(_))?(o.setext?(o.header=o.setext,o.setext=0,t.skipToEnd(),n.highlightFormatting&&(o.formatting="header")):(o.header="="==b[0].charAt(0)?1:2,o.setext=o.header),o.thisLine.header=!0,o.f=o.inline,d(o)):y?(t.skipToEnd(),o.hr=!0,o.thisLine.hr=!0,C.hr):"["===t.peek()?i(t,o,v):i(t,o,o.inline)}function u(t,n){var r=x.token(t,n.htmlState);if(!w){var i=e.innerMode(x,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=f,n.block=l,n.htmlState=null)}return r}function c(e,t){var r=t.listStack[t.listStack.length-1]||0,i=t.indentation=e.quote?t.push(C.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(C.linkHref,"url"):(e.strong&&t.push(C.strong),e.em&&t.push(C.em),e.strikethrough&&t.push(C.strikethrough),e.emoji&&t.push(C.emoji),e.linkText&&t.push(C.linkText),e.code&&t.push(C.code),e.image&&t.push(C.image),e.imageAltText&&t.push(C.imageAltText,"link"),e.imageMarker&&t.push(C.imageMarker)),e.header&&t.push(C.header,C.header+"-"+e.header),e.quote&&(t.push(C.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(C.quote+"-"+e.quote):t.push(C.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(C.list2):t.push(C.list3):t.push(C.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 p(e,t){if(e.match(M,!0))return d(t)}function f(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,d(r);if(r.taskList){var a="x"!==t.match(N,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,d(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"),d(r);var s=t.next();if(r.linkTitle){r.linkTitle=!1;var l=s;"("===s&&(l=")"),l=(l+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var c="^\\s*(?:[^"+l+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(t.match(new RegExp(c),!0))return C.linkHref}if("`"===s){var p=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var g=t.current().length;if(0!=r.code||r.quote&&1!=g){if(g==r.code){var v=d(r);return r.code=0,v}return r.formatting=p,d(r)}return r.code=g,d(r)}if(r.code)return d(r);if("\\"===s&&(t.next(),n.highlightFormatting)){var y=d(r),b=C.formatting+"-escape";return y?y+" "+b:b}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return r.imageMarker=!0,r.image=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("["===s&&r.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return r.imageMarker=!1,r.imageAltText=!0,n.highlightFormatting&&(r.formatting="image"),d(r);if("]"===s&&r.imageAltText){n.highlightFormatting&&(r.formatting="image");var y=d(r);return r.imageAltText=!1,r.image=!1,r.inline=r.f=m,y}if("["===s&&!r.image)return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),d(r);if("]"===s&&r.linkText){n.highlightFormatting&&(r.formatting="link");var y=d(r);return r.linkText=!1,r.inline=r.f=t.match(/\(.*?\)| ?\[.*?\]/,!1)?m:f,y}if("<"===s&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+C.linkInline}if("<"===s&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=h,n.highlightFormatting&&(r.formatting="link");var y=d(r);return y?y+=" ":y="",y+C.linkEmail}if(n.xml&&"<"===s&&t.match(/^(!--|[a-z]+(?:\s+[a-z_:.\-]+(?:\s*=\s*[^ >]+)?)*\s*>)/i,!1)){var w=t.string.indexOf(">",t.pos);if(w!=-1){var k=t.string.substring(t.start,w);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(k)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(x),o(t,r,u)}if(n.xml&&"<"===s&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";if("*"===s||"_"===s){for(var S=1,E=1==t.pos?" ":t.string.charAt(t.pos-2);S<3&&t.eat(s);)S++;var T=t.peek()||" ",_=!/\s/.test(T)&&(!O.test(T)||/\s/.test(E)||O.test(E)),M=!/\s/.test(E)&&(!O.test(E)||/\s/.test(T)||O.test(T)),L=null,D=null;if(S%2&&(r.em||!_||"*"!==s&&M&&!O.test(E)?r.em!=s||!M||"*"!==s&&_&&!O.test(T)||(L=!1):L=!0),S>1&&(r.strong||!_||"*"!==s&&M&&!O.test(E)?r.strong!=s||!M||"*"!==s&&_&&!O.test(T)||(D=!1):D=!0),null!=D||null!=L){n.highlightFormatting&&(r.formatting=null==L?"strong":null==D?"em":"strong em"),L===!0&&(r.em=s),D===!0&&(r.strong=s);var v=d(r);return L===!1&&(r.em=!1),D===!1&&(r.strong=!1),v}}else if(" "===s&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(r);t.backUp(1)}if(n.strikethrough)if("~"===s&&t.eatWhile(s)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=d(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),d(r)}else if(" "===s&&t.match(/^~~/,!0)){if(" "===t.peek())return d(r);t.backUp(2)}if(n.emoji&&":"===s&&t.match(/^[a-z_\d+-]+:/)){r.emoji=!0,n.highlightFormatting&&(r.formatting="emoji");var A=d(r);return r.emoji=!1,A}return" "===s&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),d(r)}function h(e,t){var r=e.next();if(">"===r){t.f=t.inline=f,n.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+C.linkInline}return e.match(/^[^>]+/,!0),C.linkInline}function m(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=g("("===r?")":"]"),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function g(e){return function(t,r){var i=t.next();if(i===e){r.f=r.inline=f,n.highlightFormatting&&(r.formatting="link-string");var o=d(r);return r.linkHref=!1,o}return t.match(I[e]),r.linkHref=!0,d(r)}}function v(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=y,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,f)}function y(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,n.highlightFormatting&&(t.formatting="link");var r=d(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),C.linkText}function b(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=f,C.linkHref+" url")}var x=e.getMode(t,"text/html"),w="null"==x.name;void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1),void 0===n.emoji&&(n.emoji=!1),void 0===n.fencedCodeBlockHighlighting&&(n.fencedCodeBlockHighlighting=!0),void 0===n.xml&&(n.xml=!0),void 0===n.tokenTypeOverrides&&(n.tokenTypeOverrides={});var C={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in C)C.hasOwnProperty(k)&&n.tokenTypeOverrides[k]&&(C[k]=n.tokenTypeOverrides[k]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,E=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,N=/^\[(x| )\](?=\s)/,T=n.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ *(?:\={1,}|-{1,})\s*$/,M=/^[^#!\[\]*_\\<>` "'(~:]+/,L=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,D=/^\s*\[[^\]]+?\]:\s*\S+(\s*\S*\s*)?$/,O=/[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~—]/,A=" ",I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/},R={startState:function(){return{f:l,prevLine:{stream:null},thisLine:{stream:null},block:l,htmlState:null,indentation:0,inline:f,text:p,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(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(x,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkText:t.linkText,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.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 s(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block,t.f!=u){var n=e.match(/^\s*/,!0)[0].replace(/\t/g,A).length;if(t.indentation=n,t.indentationDiff=null,n>0)return null}}return t.f(e,t)},innerMode:function(e){return e.block==u?{state:e.htmlState,mode:x}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:R}},indent:function(t,n,r){return t.block==u?x.indent(t.htmlState,n,r):t.localState?t.localMode.indent(t.localState,n,r):e.Pass},blankLine:s,getType:d,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return R},"xml"),e.defineMIME("text/x-markdown","markdown")})},function(e,t,n){!function(e){e(n(20))}(function(e){"use strict";var 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,caseFold:!1};e.defineMode("xml",function(r,i){function o(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(l("atom","]]>")):null:e.match("--")?n(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(u(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(N=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==r){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=o,N=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return N="equals",null;if("<"==n){t.tokenize=o,t.state=f,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=o;break}n.next()}return e}}function u(e){return function(t,n){for(var r;null!=(r=t.next());){if("<"==r)return n.tokenize=u(e+1),n.tokenize(t,n);if(">"==r){if(1==e){n.tokenize=o;break}return n.tokenize=u(e-1),n.tokenize(t,n)}}return"meta"}}function c(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(k.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function p(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!k.contextGrabbers.hasOwnProperty(n)||!k.contextGrabbers[n].hasOwnProperty(t))return;d(e)}}function f(e,t,n){return"openTag"==e?(n.tagStart=t.column(),h):"closeTag"==e?m:f}function h(e,t,n){return"word"==e?(n.tagName=t.current(),T="tag",y):(T="error",h)}function m(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&k.implicitlyClosed.hasOwnProperty(n.context.tagName)&&d(n),n.context&&n.context.tagName==r||k.matchClosing===!1?(T="tag",g):(T="tag error",v)}return T="error",v}function g(e,t,n){return"endTag"!=e?(T="error",g):(d(n),f)}function v(e,t,n){return T="error",g(e,t,n)}function y(e,t,n){if("word"==e)return T="attribute",b;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||k.autoSelfClosers.hasOwnProperty(r)?p(n,r):(p(n,r),n.context=new c(n,r,i==n.indented)),f}return T="error",y}function b(e,t,n){return"equals"==e?x:(k.allowMissing||(T="error"),y(e,t,n))}function x(e,t,n){return"string"==e?w:"word"==e&&k.allowUnquoted?(T="string",y):(T="error",y(e,t,n))}function w(e,t,n){return"string"==e?w:y(e,t,n)}var C=r.indentUnit,k={},S=i.htmlMode?t:n;for(var E in S)k[E]=S[E];for(var E in i)k[E]=i[E];var N,T;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:f,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;N=null;var n=t.tokenize(e,t);return(n||N)&&"comment"!=n&&(T=null,t.state=t.state(N||n,e,t),T&&(n="error"==T?n+" error":T)),n},indent:function(t,n,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+C;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return k.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+C*(k.multilineTagIndentFactor||1);if(k.alignCDATA&&/$/,blockCommentStart:"",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})})},function(e,t,n){!function(e){e(n(20))}(function(e){"use strict";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"]},{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"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{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:"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"]},{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"],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:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["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"]},{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","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",mime:"application/x-httpd-php",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:"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:"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"],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"]}];for(var t=0;t-1&&t.substring(i+1,t.length);if(o)return e.findModeByExtension(o)},e.findModeByName=function(t){t=t.toLowerCase();for(var n=0;n=n.line,f=p?n:l(d,0),h=e.markText(c,f,{className:o});if(null==r?i.push(h):i.splice(r++,0,h),p)break;a=d}}function i(e){for(var t=e.state.markedSelection,n=0;n1)return o(e);var t=e.getCursor("start"),n=e.getCursor("end"),a=e.state.markedSelection;if(!a.length)return r(e,t,n);var l=a[0].find(),c=a[a.length-1].find();if(!l||!c||n.line-t.line=0||u(n,l.from)<=0)return o(e);for(;u(t,l.from)>0;)a.shift().clear(),l=a[0].find();for(u(t,l.from)<0&&(l.to.line-t.line0&&(n.line-c.from.line]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(n,r){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,n){if(n.combineTokens=null,n.codeBlock)return e.match(/^```+/)?(n.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(n.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),n.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return n.code?a===o&&(n.code=!1):(o=a,n.code=!0),null}if(n.code)return e.next(),null;if(e.eatSpace())return n.ateSpace=!0,null;if((e.sol()||n.ateSpace)&&(n.ateSpace=!1,r.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return n.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return n.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(n.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={taskLists:!0,strikethrough:!0,emoji:!0};for(var l in r)s[l]=r[l];return s.name="markdown",e.overlayMode(e.getMode(n,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")})},function(e,t,n){"use strict";function r(e){return e=e||{},"function"!=typeof e.codeMirrorInstance||"function"!=typeof e.codeMirrorInstance.defineMode?void console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`"):(String.prototype.includes||(String.prototype.includes=function(){return String.prototype.indexOf.apply(this,arguments)!==-1}),void e.codeMirrorInstance.defineMode("spell-checker",function(t){if(!r.aff_loading){r.aff_loading=!0;var n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),n.onload=function(){4===n.readyState&&200===n.status&&(r.aff_data=n.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},n.send(null)}if(!r.dic_loading){r.dic_loading=!0;var o=new XMLHttpRequest;o.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),o.onload=function(){4===o.readyState&&200===o.status&&(r.dic_data=o.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},o.send(null)}var a='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',s={token:function(e){var t=e.peek(),n="";if(a.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!a.includes(t);)n+=t,e.next();return r.typo&&!r.typo.check(n)?"spell-error":null}},l=e.codeMirrorInstance.getMode(t,t.backdrop||"text/plain");return e.codeMirrorInstance.overlayMode(l,s,!0)}))}var i=n(32);r.num_loaded=0,r.aff_loading=!1,r.dic_loading=!1,r.aff_data="",r.dic_data="",r.typo,e.exports=r},function(e,t,n){(function(t,r){var i;!function(){"use strict";i=function(e,n,r,i){function o(e,t){var n=h._readFile(e,null,i.asyncLoad);i.asyncLoad?n.then(function(e){t(e)}):t(n)}function a(e){n=e,r&&l()}function s(e){r=e,n&&l()}function l(){for(h.rules=h._parseAFF(n),h.compoundRuleCodes={},c=0,p=h.compoundRules.length;c0&&(w.continuationClasses=b),"."!==x&&("SFX"===p?w.match=new RegExp(x+"$"):w.match=new RegExp("^"+x)),"0"!=g&&("SFX"===p?w.remove=new RegExp(g+"$"):w.remove=g),m.push(w)}u[f]={type:p,combineable:"Y"==h,entries:m},o+=r}else if("COMPOUNDRULE"===p){for(r=parseInt(d[1],10),a=o+1,l=o+1+r;a0&&(null===r[e]&&(r[e]=[]),r[e].push(t))}e=this._removeDicComments(e);for(var n=e.split("\n"),r={},i=1,o=n.length;i1){var u=this.parseRuleCodes(s[1]);"NEEDAFFIX"in this.flags&&u.indexOf(this.flags.NEEDAFFIX)!=-1||t(l,u);for(var c=0,d=u.length;c=this.flags.COMPOUNDMIN)for(t=0,n=this.compoundRules.length;t1&&u[1][1]!==u[1][0]&&s.push(u[0]+u[1][1]+u[1][0]+u[1].substring(2)),u[1])for(r=0,a=c.alphabet.length;r/g,">").replace(/"/g,""").replace(/'/g,"'")}function a(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 s(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 l(){}function u(e){for(var t,n,r=1;rAn error occured:

    "+o(e.message+"",!0)+"
    ";throw e}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,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:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=s(d.item,"gm")(/bull/g,d.bullet)(),d.list=s(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=s(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=s(d.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,d._tag)(),d.paragraph=s(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=u({},d),d.gfm=u({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=s(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=u({},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,s,l,u,c,p,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),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},c=0;c ?/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,p=o.length,c=0;c1&&s.length>1||(e=o.slice(c+1).join("\n")+e,c=p-1)),i=r||/\n\n(?!\s*$)/.test(l),c!==p-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(l,!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),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=s(p.link)("inside",p._inside)("href",p._href)(),p.reflink=s(p.reflink)("inside",p._inside)(),p.normal=u({},p),p.pedantic=u({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=u({},p.normal,{escape:s(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=u({},p.gfm,{br:s(p.br)("{2,}","*")(),text:s(p.gfm.text)("{2,}","*")()}),n.rules=p,n.output=function(e,t,r){var i=new n(t,r);return i.output(e)},n.prototype.output=function(e){for(var t,n,r,i,a="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=o(i[1]),r=n),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^
    /i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){a+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,a+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),a+=this.renderer.codespan(o(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),a+=this.renderer.text(o(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=o(i[1]),r=n,a+=this.renderer.link(r,null,n);return a},n.prototype.outputLink=function(e,t){var n=o(t.href),r=t.title?o(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,o(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:o(e,!0))+"\n
    \n":"
    "+(n?e:o(e,!0))+"\n
    "},r.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"'+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='
    "},r.prototype.image=function(e,t,n){var r=''+n+'":">"},r.prototype.text=function(e){return e},i.parse=function(e,t,n){var r=new i(t,n);return r.parse(e)},i.prototype.parse=function(e){this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i,o="",a="";for(n="",e=0;e'; +}); class MarkdownEditorField extends React.Component { @@ -60,10 +67,19 @@ class MarkdownEditorField extends React.Component { this.props.textarea.value = value; } + previewRender(plainText){ + let parsedText = parser.parse(plainText); + return this.parent.markdown(parsedText); + } + static addCustomAction(key, action) { ss.markdownConfigs[key] = action; }; + static registerShortCodes(key, callback) { + + } + render() { return (
    ); @@ -130,7 +147,8 @@ jQuery.entwine('ss', ($) => { }, refresh() { let textArea = $(this).parent().find('textarea')[0]; - let toolbar = ss.markdownConfigs.readToolbarConfigs(textArea.dataset.config); + let data = JSON.parse(textArea.dataset.config); + let toolbar = ss.markdownConfigs.readToolbarConfigs(data.toolbar); ReactDOM.render( , diff --git a/client/src/components/ShortCodeParser/ShortcodeParser.js b/client/src/components/ShortCodeParser/ShortcodeParser.js new file mode 100644 index 0000000..5890750 --- /dev/null +++ b/client/src/components/ShortCodeParser/ShortcodeParser.js @@ -0,0 +1,136 @@ +'use strict'; + + +var util = require('util'); + +const SHORTCODE_ATTRS = /(\s+([a-z0-9\-_]+|([a-z0-9\-_]+)\s*=\s*([a-z0-9\-_]+|\d+\.\d+|'[^']*'|"[^"]*")))*/.toString().slice(1,-1); +const SHORTCODE_SLASH = /\s*\/?\s*/.toString().slice(1,-1); +const SHORTCODE_OPEN = /\[\s*%s/.toString().slice(1,-1); +const SHORTCODE_RIGHT_BRACKET = '\\]'; +const SHORTCODE_CLOSE = /\[\s*\/\s*%s\s*\]/.toString().slice(1,-1); +const SHORTCODE_CONTENT = /(.|\n|)*?/.toString().slice(1,-1); +const SHORTCODE_SPACE = /\s*/.toString().slice(1,-1); + + +class ShortcodeParser { + + construct() { + this.shortCodes = {}; + } + + registerShortCode(key, callback) { + this.shortCodes[key] = callback; + } + + typecast(val) { + val = val.trim().replace(/(^['"]|['"]$)/g, ''); + if (/^\d+$/.test(val)) { + return parseInt(val, 10); + } else if (/^\d+\.\d+$/.test(val)) { + return parseFloat(val); + } else if (/^(true|false)$/.test(val)) { + return (val === 'true'); + } else if (/^undefined$/.test(val)) { + return undefined; + } else if (/^null$/i.test(val)) { + return null; + } else { + return val; + } + } + + closeTagString(name) { + return /^[^a-z0-9]/.test(name) ? util.format('[%s]?%s', name[0].replace('$', '\\$'), name.slice(1)) : name; + } + + + parseShortcode(name, buf, inline) { + var regex, match, data = {}, attr = {}; + + if (inline) { + regex = new RegExp('^' + util.format(SHORTCODE_OPEN, name) + + SHORTCODE_ATTRS + + SHORTCODE_SPACE + + SHORTCODE_SLASH + + SHORTCODE_RIGHT_BRACKET, 'i'); + } else { + regex = new RegExp('^' + util.format(SHORTCODE_OPEN, name) + + SHORTCODE_ATTRS + + SHORTCODE_SPACE + + SHORTCODE_RIGHT_BRACKET, 'i'); + } + + while ((match = buf.match(regex)) !== null) { + var key = match[3] || match[2]; + var val = match[4] || match[3]; + var pattern = match[1]; + if (pattern) { + var idx = buf.lastIndexOf(pattern); + attr[key] = (val !== undefined) ? this.typecast(val) : true; + buf = buf.slice(0, idx) + buf.slice(idx + pattern.length); + } else { + break; + } + } + + attr = Object.keys(attr).reverse().reduce(function(prev, current) { + prev[current] = attr[current]; return prev; + }, {}); + + buf = buf.replace(regex, '').replace(new RegExp(util.format(SHORTCODE_CLOSE, this.closeTagString(name))), ''); + + return { + attr: attr, + content: inline ? buf : buf.replace(/(^\n|\n$)/g, '') + } + + } + + parse(plainText) { + + for (var name in this.shortCodes) { + var regex = { + wrapper: new RegExp(util.format(SHORTCODE_OPEN, name) + + SHORTCODE_ATTRS + + SHORTCODE_RIGHT_BRACKET + + SHORTCODE_CONTENT + + util.format(SHORTCODE_CLOSE, this.closeTagString(name)), 'gi'), + inline: new RegExp(util.format(SHORTCODE_OPEN, name) + + SHORTCODE_ATTRS + + SHORTCODE_SLASH + + SHORTCODE_RIGHT_BRACKET, 'gi') + } + + + let matches = plainText.match(regex.wrapper); + + if (matches) { + for (let m,data,i=0,len=matches.length; i < len; i++) { + m = matches[i]; + data = this.parseShortcode(name, m); + plainText = plainText.replace(m, this.shortCodes[name].call(null, data.content, data.attr)); + } + } + + matches = plainText.match(regex.inline); + if (matches) { + let m = null; + while((m = matches.shift()) !== undefined) { + let data = this.parseShortcode(name, m, true); + plainText = plainText.replace(m, this.shortCodes[name].call(null, data.content, data.attr)); + } + + } + + + } + + return plainText; + } + +} + + +ShortcodeParser.prototype.shortCodes = {}; + +export default ShortcodeParser; \ No newline at end of file diff --git a/client/src/entwine/Markdown_ssmedia.js b/client/src/entwine/Markdown_ssmedia.js index e2b7616..c6dcc90 100644 --- a/client/src/entwine/Markdown_ssmedia.js +++ b/client/src/entwine/Markdown_ssmedia.js @@ -190,10 +190,9 @@ jQuery.entwine('ss', ($) => { } const data = this.getData(); const extraData = this.getExtraData(); - let markdown = '![' + (extraData.CaptionText ? extraData.CaptionText : data.title) - + ']([image_link id=' + data.ID +' width=' + data.width + ' height=' + data.height + '] "' + + ']([image_link id=' + data.ID +' width=' + data.InsertWidth + ' height=' + data.InsertHeight + ' url=\''+ data.url +'\'] "' + data.title + '")'; diff --git a/package-lock.json b/package-lock.json index aef3d84..a4c6480 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11064,7 +11064,6 @@ "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, "requires": { "inherits": "2.0.1" }, @@ -11072,8 +11071,7 @@ "inherits": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" } } }, diff --git a/package.json b/package.json index 4fc9419..6f4d734 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "react": "^15.6.1", "react-dom": "^15.6.1", "react-simplemde-editor": "3.6.11", - "bootstrap": "4.0.0-beta" + "bootstrap": "4.0.0-beta", + "util": "0.10.3" }, "devDependencies": { "@silverstripe/webpack-config": "0.3.0", diff --git a/src/db/MarkdownText.php b/src/db/MarkdownText.php index 6c9ce8c..37ec2d9 100644 --- a/src/db/MarkdownText.php +++ b/src/db/MarkdownText.php @@ -65,8 +65,8 @@ public function ParseMarkdown($bCache = true, $strValue = '') // shortcodes $regexes = [ - '/\[image_link*\s[a-z|A-Z|0-9\s\=]*\]/', - '/\[file_link\,[a-z|A-Z|0-9\s\=]*\]/' + '/\[image_link(.+?)\]/', + '/\[file_link(.+?)\]/' ]; foreach ($regexes as $pattern) { @@ -79,6 +79,8 @@ public function ParseMarkdown($bCache = true, $strValue = '') } } + + $parseDown = new GithubMarkdown(); $parsed = $parseDown->parse($parsed); diff --git a/src/forms/MarkdownEditorConfig.php b/src/forms/MarkdownEditorConfig.php index cea0f62..a086f1e 100644 --- a/src/forms/MarkdownEditorConfig.php +++ b/src/forms/MarkdownEditorConfig.php @@ -13,6 +13,10 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injectable; +use SilverStripe\Control\Director; +use SilverStripe\Core\Manifest\ModuleResourceLoader; +use SilverStripe\View\SSViewer; +use SilverStripe\View\ThemeResourceLoader; class MarkdownEditorConfig { @@ -23,9 +27,10 @@ class MarkdownEditorConfig protected static $configs = []; protected static $current; + private static $editor_css = []; private static $default_config = 'default'; - protected $settings = [ + protected $toolbar = [ [ 'name' => 'heading', 'className' => 'fa fa-header', @@ -173,12 +178,44 @@ public static function set_config($identifier, MarkdownEditorConfig $config = nu return $config; } + + /** + * @return array + */ + protected function getEditorCSS() + { + $editor = array(); + + // Add standard editor.css + $editorCSSFiles = $this->config()->get('editor_css'); + if ($editorCSSFiles) { + foreach ($editorCSSFiles as $editorCSS) { + $path = ModuleResourceLoader::singleton() + ->resolveURL($editorCSS); + $editor[] = Director::absoluteURL($path); + } + } + + // Themed editor.css + $themes = SSViewer::get_themes(); + $themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $themes); + if ($themedEditor) { + $editor[] = Director::absoluteURL($themedEditor); + } + + return $editor; + } + + /** * @return array */ public function getConfig() { - return $this->settings; + return [ + 'toolbar' => $this->toolbar, + 'editor_css' => $this->getEditorCSS() + ]; } /** @@ -186,7 +223,7 @@ public function getConfig() */ public function addSeparator() { - array_push($this->settings, '|'); + array_push($this->toolbar, '|'); return $this; } @@ -196,7 +233,7 @@ public function addSeparator() */ public function addButton($button) { - array_push($this->settings, $button); + array_push($this->toolbar, $button); return $this; } From 76f0e7cdbd7dda302b14dbd7cf8a76467c25884d Mon Sep 17 00:00:00 2001 From: Nivanka Fonseka Date: Thu, 2 Nov 2017 11:20:24 +0530 Subject: [PATCH 2/2] added the ability to plug in preview CSS to customize the font sizes colors etc --- README.md | 36 +++++++++++++++++++ client/dist/bundle.min.js | 4 +-- .../MarkdownEditorField.js | 9 +++-- src/forms/MarkdownEditorConfig.php | 31 ++++++++++++---- src/forms/MarkdownEditorField.php | 7 ++++ 5 files changed, 76 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b4f5e60..adb3c9f 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,39 @@ SilverStripe\Core\Injector\Injector: class: SilverStripers\markdown\db\MarkdownText ``` +## Add preview styles + +You can add your own CSS styles to the editor previews. This would let the users to check how their content will be displayed before they save in. + +To achived this create a css file in `mysite/css/` and name it as `editor.css`. + +Your CSS rules have to be nested in a class so it wont affect other areas of the CMS. + +``` +.markdown-preview { + background-color: white; + padding: 20px; + font-size: 20px; +} + +.markdown-preview h1 { + font-size: 30px; +} +```` + +If you are using a separate config and wanting to add styles to that EditorConfig you just add a new class name. This is possible because the fields adds +the EditorConfig's identifier on to the preview pane. The below is an example for the default configs. + +``` +.markdown-preview.default { + background-color: white; + padding: 20px; + font-size: 14px; + line-height: 20px; +} + +.markdown-preview.default h1 { + font-size: 24px; + line-height: 30px; +} +```` \ No newline at end of file diff --git a/client/dist/bundle.min.js b/client/dist/bundle.min.js index 3f33aa3..650e193 100644 --- a/client/dist/bundle.min.js +++ b/client/dist/bundle.min.js @@ -1,5 +1,5 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";n(1),n(7),n(8)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertEmbedModal.default);o.default.entwine("ss",function(e){e("#insert-md-embed-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this.setData({}),this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=function(){return t._handleCreate.apply(t,arguments)},o=function(){return t._handleLoadingError.apply(t,arguments)},a=window.ss.store,l=window.ss.apolloClient,d=this.getOriginalAttributes();u.default.render(s.default.createElement(c.ApolloProvider,{store:a,client:l},s.default.createElement(p,{show:e,onCreate:i,onInsert:r,onHide:n,onLoadingError:o,fileAttributes:d,bodyClassName:"modal__dialog modal__dialog--scrollable",className:"insert-embed-react__dialog-wrapper"})),this[0])},_handleLoadingError:function(){this.setData({}),this.open()},_handleInsert:function(e){var t=this.getData();this.setData(Object.assign({Url:t.Url},e)),this.insertRemote(),this.close()},_handleCreate:function(e){this.setData(Object.assign({},this.getData(),e)),this.open()},getOriginalAttributes:function(){var e=this.getData();return e},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var n=e.split(" ");return t.find(function(e){return n.indexOf(e)>-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertMediaModal.default);o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.InsertWidth+" height="+t.InsertHeight+" url='"+t.url+"'] \""+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("
    ").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'});var w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=x.markdownConfigs,n}return a(t,e),s(t,[{key:"handleChange",value:function(e){this.props.textarea.value=e}},{key:"previewRender",value:function(e){var t=b.parse(e);return this.parent.markdown(t)}},{key:"render",value:function(){return u.default.createElement("div",{className:"editor-container"},u.default.createElement(f.default,{value:this.props.textarea.value,onChange:this.handleChange.bind(this),options:{spellChecker:!0,dragDrop:!1,keyMap:"sublime",toolbar:this.props.toolbar,previewRender:this.previewRender}}))}}],[{key:"addCustomAction",value:function(e,t){x.markdownConfigs[e]=t}},{key:"registerShortCodes",value:function(e,t){}}]),t}(u.default.Component);window.MarkdownEditorField=w,m.default.entwine("ss",function(e){w.addCustomAction("ssEmbed",function(t){if(window.InsertMediaModal){var n=e("#insert-md-embed-react__dialog-wrapper");n.length||(n=e('
    '),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),w.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
    '),e("body").append(n)),n.setElement(t),n.open()}else y.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=JSON.parse(t.dataset.config),r=x.markdownConfigs.readToolbarConfigs(n.toolbar);d.default.render(u.default.createElement(w,{textarea:t,toolbar:r}),this[0])}})}),t.default={MarkdownEditorField:w}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like ,

    , or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
    "],c=[3,"","
    "],d=[1,'',""],p={"*":[1,"?

    "],area:[1,"",""],col:[2,"","
    "],legend:[1,"
    ","
    "],param:[1,"",""],tr:[2,"","
    "],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

    , or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertMediaModal.default);o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.InsertWidth+" height="+t.InsertHeight+" url='"+t.url+"'] \""+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("

    ").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'});var w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=x.markdownConfigs,n}return a(t,e),s(t,[{key:"handleChange",value:function(e){this.props.textarea.value=e}},{key:"previewRender",value:function(e,t){t.classList.add("markdown-preview"),t.classList.add(this.identifier);var n=b.parse(e);return this.parent.markdown(n)}},{key:"render",value:function(){return u.default.createElement("div",{className:"editor-container"},u.default.createElement(f.default,{value:this.props.textarea.value,onChange:this.handleChange.bind(this),options:{spellChecker:!0,dragDrop:!1,keyMap:"sublime",toolbar:this.props.toolbar,previewRender:this.previewRender,identifier:this.props.identifier}}))}}],[{key:"addCustomAction",value:function(e,t){x.markdownConfigs[e]=t}},{key:"registerShortCodes",value:function(e,t){}}]),t}(u.default.Component);window.MarkdownEditorField=w,m.default.entwine("ss",function(e){w.addCustomAction("ssEmbed",function(t){if(window.InsertMediaModal){var n=e("#insert-md-embed-react__dialog-wrapper");n.length||(n=e('
    '),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),w.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
    '),e("body").append(n)),n.setElement(t),n.open()}else y.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=JSON.parse(t.dataset.config),r=x.markdownConfigs.readToolbarConfigs(n.toolbar);d.default.render(u.default.createElement(w,{textarea:t,toolbar:r,identifier:n.identifier}),this[0])}})}),t.default={MarkdownEditorField:w}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like ,

    , or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
    "],c=[3,"","
    "],d=[1,'',""],p={"*":[1,"?

    "],area:[1,"",""],col:[2,"","
    "],legend:[1,"
    ","
    "],param:[1,"",""],tr:[2,"","
    "],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

    , or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o

    ); @@ -151,7 +154,7 @@ jQuery.entwine('ss', ($) => { let toolbar = ss.markdownConfigs.readToolbarConfigs(data.toolbar); ReactDOM.render( - , + , this[0] ); } diff --git a/src/forms/MarkdownEditorConfig.php b/src/forms/MarkdownEditorConfig.php index a086f1e..0f48d27 100644 --- a/src/forms/MarkdownEditorConfig.php +++ b/src/forms/MarkdownEditorConfig.php @@ -13,7 +13,6 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injectable; -use SilverStripe\Control\Director; use SilverStripe\Core\Manifest\ModuleResourceLoader; use SilverStripe\View\SSViewer; use SilverStripe\View\ThemeResourceLoader; @@ -29,6 +28,7 @@ class MarkdownEditorConfig protected static $current; private static $editor_css = []; private static $default_config = 'default'; + private $identifier; protected $toolbar = [ [ @@ -131,7 +131,7 @@ public static function get($identifier = null) } // Create new instance if unconfigured if (!isset(self::$configs[$identifier])) { - self::$configs[$identifier] = static::create(); + self::$configs[$identifier] = static::create()->setIdentifier($identifier); } return self::$configs[$identifier]; @@ -145,6 +145,24 @@ public static function get_active_identifier() return static::config()->get('current') ?: static::config()->get('default_config'); } + /** + * @param $identifier + * @return $this + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + return $this; + } + + /** + * @return mixed + */ + public function getIdentifier() + { + return $this->identifier; + } + /** * @return mixed */ @@ -182,7 +200,7 @@ public static function set_config($identifier, MarkdownEditorConfig $config = nu /** * @return array */ - protected function getEditorCSS() + public function getEditorCSS() { $editor = array(); @@ -192,7 +210,7 @@ protected function getEditorCSS() foreach ($editorCSSFiles as $editorCSS) { $path = ModuleResourceLoader::singleton() ->resolveURL($editorCSS); - $editor[] = Director::absoluteURL($path); + $editor[$path] = $path; } } @@ -200,7 +218,7 @@ protected function getEditorCSS() $themes = SSViewer::get_themes(); $themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $themes); if ($themedEditor) { - $editor[] = Director::absoluteURL($themedEditor); + $editor[$themedEditor] = $themedEditor; } return $editor; @@ -214,7 +232,8 @@ public function getConfig() { return [ 'toolbar' => $this->toolbar, - 'editor_css' => $this->getEditorCSS() + 'editor_css' => $this->getEditorCSS(), + 'identifier' => $this->getIdentifier() ]; } diff --git a/src/forms/MarkdownEditorField.php b/src/forms/MarkdownEditorField.php index 772a087..c4ae09c 100644 --- a/src/forms/MarkdownEditorField.php +++ b/src/forms/MarkdownEditorField.php @@ -12,6 +12,7 @@ use SilverStripe\ORM\DataObjectInterface; use Exception; use SilverStripe\ORM\FieldType\DBHTMLText; +use SilverStripe\View\Requirements; class MarkdownEditorField extends TextareaField { @@ -65,6 +66,12 @@ public function getAttributes() */ public function Field($properties = []) { + $config = $this->getEditorConfig(); + foreach($config->getEditorCSS() as $path) { + Requirements::css($path); + } + + return parent::Field($properties); }