@sme.up/ketchup 11.0.0-SNAPSHOT-20250109172510 → 11.0.0-SNAPSHOT-20250110101023
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{f-cell-a8e37702.js → f-cell-45213331.js} +4 -4
- package/dist/cjs/{f-chip-a1a38005.js → f-chip-6df032a5.js} +1 -1
- package/dist/cjs/{f-object-field-a6c12a08.js → f-object-field-f2ef5096.js} +2 -2
- package/dist/cjs/{f-paginator-utils-39ded702.js → f-paginator-utils-c6892f51.js} +1 -1
- package/dist/cjs/{f-text-field-700b8ec5.js → f-text-field-3eba8257.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kup-accordion.cjs.entry.js +1 -1
- package/dist/cjs/kup-activity-timeline.cjs.entry.js +2 -2
- package/dist/cjs/kup-autocomplete_28.cjs.entry.js +35 -22
- package/dist/cjs/kup-box.cjs.entry.js +7 -7
- package/dist/cjs/kup-calendar.cjs.entry.js +2 -2
- package/dist/cjs/kup-card-list.cjs.entry.js +1 -1
- package/dist/cjs/kup-cell.cjs.entry.js +5 -5
- package/dist/cjs/kup-dashboard.cjs.entry.js +2 -2
- package/dist/cjs/{kup-data-table-helper-eb507104.js → kup-data-table-helper-8981fb6a.js} +1 -1
- package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
- package/dist/cjs/kup-echart.cjs.entry.js +1 -1
- package/dist/cjs/kup-editor.cjs.entry.js +2 -2
- package/dist/cjs/kup-family-tree.cjs.entry.js +1 -1
- package/dist/cjs/kup-grid.cjs.entry.js +1 -1
- package/dist/cjs/kup-htm.cjs.entry.js +1 -1
- package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
- package/dist/cjs/kup-image-list.cjs.entry.js +5 -5
- package/dist/cjs/kup-input-panel.cjs.entry.js +5 -5
- package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
- package/dist/cjs/kup-magic-box.cjs.entry.js +1 -1
- package/dist/cjs/{kup-manager-8623e363.js → kup-manager-e865005c.js} +4 -1
- package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
- package/dist/cjs/kup-object-field.cjs.entry.js +3 -3
- package/dist/cjs/kup-pdf.cjs.entry.js +1 -1
- package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
- package/dist/cjs/kup-planner.cjs.entry.js +2 -2
- package/dist/cjs/kup-probe.cjs.entry.js +1 -1
- package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
- package/dist/cjs/kup-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/kup-txt.cjs.entry.js +1 -1
- package/dist/cjs/kup-typography-list.cjs.entry.js +1 -1
- package/dist/cjs/kup-typography.cjs.entry.js +1 -1
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +17 -4
- package/dist/collection/components/kup-data-table/kup-data-table.js +11 -11
- package/dist/collection/components/kup-editor/kup-editor.js +1 -1
- package/dist/collection/managers/kup-data/kup-data.js +4 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kup-accordion.js +2 -2
- package/dist/components/kup-activity-timeline.js +2 -2
- package/dist/components/kup-autocomplete.js +1 -1
- package/dist/components/kup-badge.js +1 -1
- package/dist/components/kup-box.js +1 -1
- package/dist/components/kup-button-list.js +1 -1
- package/dist/components/kup-button.js +1 -1
- package/dist/components/kup-calendar.js +2 -2
- package/dist/components/kup-card-list.js +3 -3
- package/dist/components/kup-card.js +1 -1
- package/dist/components/kup-cell.js +2 -2
- package/dist/components/kup-chart.js +1 -1
- package/dist/components/kup-checkbox.js +1 -1
- package/dist/components/kup-chip.js +1 -1
- package/dist/components/kup-color-picker.js +1 -1
- package/dist/components/kup-combobox.js +1 -1
- package/dist/components/kup-dashboard.js +2 -2
- package/dist/components/kup-data-table.js +1 -1
- package/dist/components/kup-date-picker.js +1 -1
- package/dist/components/kup-dialog.js +1 -1
- package/dist/components/kup-drawer.js +2 -2
- package/dist/components/kup-dropdown-button.js +1 -1
- package/dist/components/kup-echart.js +1 -1
- package/dist/components/kup-editor.js +1 -1
- package/dist/components/kup-family-tree.js +3 -3
- package/dist/components/kup-form.js +1 -1
- package/dist/components/kup-gauge.js +1 -1
- package/dist/components/kup-grid.js +1 -1
- package/dist/components/kup-htm.js +2 -2
- package/dist/components/kup-iframe.js +2 -2
- package/dist/components/kup-image-list.js +2 -2
- package/dist/components/kup-image.js +1 -1
- package/dist/components/kup-input-panel.js +3 -3
- package/dist/components/kup-lazy.js +2 -2
- package/dist/components/kup-list.js +1 -1
- package/dist/components/kup-magic-box.js +4 -4
- package/dist/components/kup-nav-bar.js +2 -2
- package/dist/components/kup-numeric-picker.js +2 -2
- package/dist/components/kup-object-field.js +2 -2
- package/dist/components/kup-pdf.js +2 -2
- package/dist/components/kup-photo-frame.js +2 -2
- package/dist/components/kup-planner.js +2 -2
- package/dist/components/kup-probe.js +2 -2
- package/dist/components/kup-progress-bar.js +1 -1
- package/dist/components/kup-qlik.js +2 -2
- package/dist/components/kup-radio.js +1 -1
- package/dist/components/kup-rating.js +1 -1
- package/dist/components/kup-snackbar.js +2 -2
- package/dist/components/kup-spinner.js +1 -1
- package/dist/components/kup-switch.js +1 -1
- package/dist/components/kup-tab-bar.js +1 -1
- package/dist/components/kup-text-field.js +1 -1
- package/dist/components/kup-time-picker.js +1 -1
- package/dist/components/kup-toolbar.js +1 -1
- package/dist/components/kup-tree.js +1 -1
- package/dist/components/kup-txt.js +2 -2
- package/dist/components/kup-typography-list.js +2 -2
- package/dist/components/kup-typography.js +2 -2
- package/dist/components/{p-c8389c1a.js → p-009bdee7.js} +4 -1
- package/dist/components/{p-b260469d.js → p-13875920.js} +3 -3
- package/dist/components/{p-502aa07f.js → p-240c81fa.js} +29 -16
- package/dist/components/{p-10a39340.js → p-664854bf.js} +2 -2
- package/dist/components/{p-24b36774.js → p-a988a243.js} +2 -2
- package/dist/components/{p-f115f2de.js → p-ee8432da.js} +2 -2
- package/dist/esm/{f-cell-2047701f.js → f-cell-b484e3c7.js} +4 -4
- package/dist/esm/{f-chip-207d4e6a.js → f-chip-cc0af5b0.js} +1 -1
- package/dist/esm/{f-object-field-fc05da83.js → f-object-field-65df4ce0.js} +2 -2
- package/dist/esm/{f-paginator-utils-e5824c9d.js → f-paginator-utils-a6ff95c6.js} +1 -1
- package/dist/esm/{f-text-field-ae84246a.js → f-text-field-a667b660.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/kup-accordion.entry.js +1 -1
- package/dist/esm/kup-activity-timeline.entry.js +2 -2
- package/dist/esm/kup-autocomplete_28.entry.js +35 -22
- package/dist/esm/kup-box.entry.js +7 -7
- package/dist/esm/kup-calendar.entry.js +2 -2
- package/dist/esm/kup-card-list.entry.js +1 -1
- package/dist/esm/kup-cell.entry.js +5 -5
- package/dist/esm/kup-dashboard.entry.js +2 -2
- package/dist/esm/{kup-data-table-helper-814e63ca.js → kup-data-table-helper-7064700b.js} +1 -1
- package/dist/esm/kup-drawer.entry.js +1 -1
- package/dist/esm/kup-echart.entry.js +1 -1
- package/dist/esm/kup-editor.entry.js +2 -2
- package/dist/esm/kup-family-tree.entry.js +1 -1
- package/dist/esm/kup-grid.entry.js +1 -1
- package/dist/esm/kup-htm.entry.js +1 -1
- package/dist/esm/kup-iframe.entry.js +1 -1
- package/dist/esm/kup-image-list.entry.js +5 -5
- package/dist/esm/kup-input-panel.entry.js +5 -5
- package/dist/esm/kup-lazy.entry.js +1 -1
- package/dist/esm/kup-magic-box.entry.js +1 -1
- package/dist/esm/{kup-manager-69018613.js → kup-manager-2cecde50.js} +4 -1
- package/dist/esm/kup-nav-bar.entry.js +1 -1
- package/dist/esm/kup-numeric-picker.entry.js +2 -2
- package/dist/esm/kup-object-field.entry.js +3 -3
- package/dist/esm/kup-pdf.entry.js +1 -1
- package/dist/esm/kup-photo-frame.entry.js +1 -1
- package/dist/esm/kup-planner.entry.js +2 -2
- package/dist/esm/kup-probe.entry.js +1 -1
- package/dist/esm/kup-qlik.entry.js +1 -1
- package/dist/esm/kup-snackbar.entry.js +1 -1
- package/dist/esm/kup-txt.entry.js +1 -1
- package/dist/esm/kup-typography-list.entry.js +1 -1
- package/dist/esm/kup-typography.entry.js +1 -1
- package/dist/ketchup/index.esm.js +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-1de5af30.entry.js → p-02f7572a.entry.js} +1 -1
- package/dist/ketchup/{p-d3dec47b.entry.js → p-0488ffed.entry.js} +1 -1
- package/dist/ketchup/{p-ca700b27.entry.js → p-06d9d159.entry.js} +1 -1
- package/dist/ketchup/p-1a234ef5.js +1 -0
- package/dist/ketchup/{p-b15208a3.entry.js → p-253ebc7b.entry.js} +1 -1
- package/dist/ketchup/{p-9fb64fa4.entry.js → p-3d30da76.entry.js} +1 -1
- package/dist/ketchup/{p-7029eb59.entry.js → p-616a1fb9.entry.js} +1 -1
- package/dist/ketchup/{p-e2d84f0b.entry.js → p-61c7295c.entry.js} +1 -1
- package/dist/ketchup/p-688c9ac5.entry.js +1 -0
- package/dist/ketchup/{p-c8c31335.entry.js → p-6ced9d0e.entry.js} +1 -1
- package/dist/ketchup/{p-d7991871.entry.js → p-6f145f53.entry.js} +1 -1
- package/dist/ketchup/{p-f7136e2e.entry.js → p-74dcb62d.entry.js} +1 -1
- package/dist/ketchup/{p-556e06eb.entry.js → p-78cc215e.entry.js} +1 -1
- package/dist/ketchup/{p-a3247374.entry.js → p-7bb35e89.entry.js} +1 -1
- package/dist/ketchup/{p-8ce7aae9.entry.js → p-7bc6b673.entry.js} +1 -1
- package/dist/ketchup/{p-ea4fd414.entry.js → p-8765b1d8.entry.js} +1 -1
- package/dist/ketchup/{p-3dddbeba.entry.js → p-8df5caf6.entry.js} +1 -1
- package/dist/ketchup/{p-59ea2e16.js → p-8e4212a7.js} +1 -1
- package/dist/ketchup/{p-f943d857.entry.js → p-905aa115.entry.js} +1 -1
- package/dist/ketchup/{p-613e2c59.entry.js → p-92a731c1.entry.js} +1 -1
- package/dist/ketchup/{p-3f5ee4c7.entry.js → p-9bf28495.entry.js} +1 -1
- package/dist/ketchup/{p-8270992b.entry.js → p-a35d9244.entry.js} +1 -1
- package/dist/ketchup/p-a905d4a7.js +1 -0
- package/dist/ketchup/{p-f1d16d73.js → p-ac3b7d2c.js} +1 -1
- package/dist/ketchup/{p-f4372c3c.entry.js → p-b14e4ae1.entry.js} +1 -1
- package/dist/ketchup/{p-3bfc8144.entry.js → p-bb6a9abd.entry.js} +2 -2
- package/dist/ketchup/{p-8667f590.entry.js → p-bdc41b60.entry.js} +1 -1
- package/dist/ketchup/{p-b9094df4.js → p-ccc4a1ea.js} +1 -1
- package/dist/ketchup/{p-474e978a.entry.js → p-d066bbc9.entry.js} +1 -1
- package/dist/ketchup/{p-e2c78ebc.js → p-d3857c06.js} +1 -1
- package/dist/ketchup/p-e3e74d87.entry.js +1 -0
- package/dist/ketchup/{p-5d98bad4.entry.js → p-e4fead91.entry.js} +1 -1
- package/dist/ketchup/{p-ba661cef.entry.js → p-eb4e0f54.entry.js} +1 -1
- package/dist/ketchup/{p-3fcc6d1d.entry.js → p-f46d1a6f.entry.js} +1 -1
- package/dist/ketchup/{p-24dddc23.entry.js → p-f563967a.entry.js} +2 -2
- package/dist/ketchup/p-f79d76b3.js +1 -0
- package/dist/ketchup/{p-a29926c9.entry.js → p-f81a7dd5.entry.js} +1 -1
- package/dist/ketchup/{p-24015160.entry.js → p-fe321427.entry.js} +1 -1
- package/package.json +1 -1
- package/dist/ketchup/p-2252ad30.js +0 -1
- package/dist/ketchup/p-6954ad12.js +0 -1
- package/dist/ketchup/p-7982cbcf.entry.js +0 -1
- package/dist/ketchup/p-8ddd83f1.js +0 -1
- package/dist/ketchup/p-fd091486.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,c as n,f as r,h as i,H as e,d as o}from"./p-b0368f88.js";import{k as u,g as a,s}from"./p-b9094df4.js";import{c}from"./p-635bb4b3.js";import{c as f,g as h}from"./p-1ee561ba.js";var l,v={exports:{}};v.exports=function(){var t=navigator.userAgent,n=navigator.platform,r=/gecko\/\d/i.test(t),i=/MSIE \d/.test(t),e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),u=i||e||o,a=u&&(i?document.documentMode||6:+(o||e)[1]),s=!o&&/WebKit\//.test(t),c=s&&/Qt\/\d+\.\d+/.test(t),f=!o&&/Chrome\/(\d+)/.exec(t),h=f&&+f[1],l=/Opera\//.test(t),v=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=v&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),b=/Android/.test(t),m=g||b||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),w=g||/Mac/.test(n),y=/\bCrOS\b/.test(t),k=/win/i.test(n),T=l&&t.match(/Version\/(\d*\.\d*)/);T&&(T=Number(T[1])),T&&T>=15&&(l=!1,s=!0);var A=w&&(c||l&&(null==T||T<12.11)),E=r||u&&a>=9;function L(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var x,C=function(t,n){var r=t.className,i=L(n).exec(r);if(i){var e=r.slice(i.index+i[0].length);t.className=r.slice(0,i.index)+(e?i[1]+e:"")}};function D(t){for(var n=t.childNodes.length;n>0;--n)t.removeChild(t.firstChild);return t}function O(t,n){return D(t).appendChild(n)}function S(t,n,r,i){var e=document.createElement(t);if(r&&(e.className=r),i&&(e.style.cssText=i),"string"==typeof n)e.appendChild(document.createTextNode(n));else if(n)for(var o=0;o<n.length;++o)e.appendChild(n[o]);return e}function N(t,n,r,i){var e=S(t,n,r,i);return e.setAttribute("role","presentation"),e}function M(t,n){if(3==n.nodeType&&(n=n.parentNode),t.contains)return t.contains(n);do{if(11==n.nodeType&&(n=n.host),n==t)return!0}while(n=n.parentNode)}function R(t){var n,r=t.ownerDocument||t;try{n=t.activeElement}catch(t){n=r.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function B(t,n){var r=t.className;L(n).test(r)||(t.className+=(r?" ":"")+n)}function I(t,n){for(var r=t.split(" "),i=0;i<r.length;i++)r[i]&&!L(r[i]).test(n)&&(n+=" "+r[i]);return n}x=document.createRange?function(t,n,r,i){var e=document.createRange();return e.setEnd(i||t,r),e.setStart(t,n),e}:function(t,n,r){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",n),i};var q=function(t){t.select()};function F(t){return t.display.wrapper.ownerDocument}function P(t){return j(t.display.wrapper)}function j(t){return t.getRootNode?t.getRootNode():t.ownerDocument}function _(t){return F(t).defaultView}function U(t){var n=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,n)}}function H(t,n,r){for(var i in n||(n={}),t)!t.hasOwnProperty(i)||!1===r&&n.hasOwnProperty(i)||(n[i]=t[i]);return n}function z(t,n,r,i,e){null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length);for(var o=i||0,u=e||0;;){var a=t.indexOf("\t",o);if(a<0||a>=n)return u+(n-o);u+=a-o,u+=r-u%r,o=a+1}}g?q=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:u&&(q=function(t){try{t.select()}catch(t){}});var V=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};function $(t,n){for(var r=0;r<t.length;++r)if(t[r]==n)return r;return-1}V.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},V.prototype.set=function(t,n){this.f=n;var r=+new Date+t;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=r)};var G=50,W={toString:function(){return"CodeMirror.Pass"}},Z={scroll:!1},K={origin:"*mouse"},Y={origin:"+move"};function Q(t,n,r){for(var i=0,e=0;;){var o=t.indexOf("\t",i);-1==o&&(o=t.length);var u=o-i;if(o==t.length||e+u>=n)return i+Math.min(u,n-e);if(e+=o-i,i=o+1,(e+=r-e%r)>=n)return i}}var X=[""];function J(t){for(;X.length<=t;)X.push(tt(X)+" ");return X[t]}function tt(t){return t[t.length-1]}function nt(t,n){for(var r=[],i=0;i<t.length;i++)r[i]=n(t[i],i);return r}function rt(){}function it(t,n){var r;return Object.create?r=Object.create(t):(rt.prototype=t,r=new rt),n&&H(n,r),r}var et=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ot(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||et.test(t))}function ut(t,n){return n?!!(n.source.indexOf("\\w")>-1&&ot(t))||n.test(t):ot(t)}function at(t){for(var n in t)if(t.hasOwnProperty(n)&&t[n])return!1;return!0}var st=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ct(t){return t.charCodeAt(0)>=768&&st.test(t)}function ft(t,n,r){for(;(r<0?n>0:n<t.length)&&ct(t.charAt(n));)n+=r;return n}function ht(t,n,r){for(var i=n>r?-1:1;;){if(n==r)return n;var e=(n+r)/2,o=i<0?Math.ceil(e):Math.floor(e);if(o==n)return t(o)?n:r;t(o)?r=o:n=o+i}}var lt=null;function vt(t,n,r){var i;lt=null;for(var e=0;e<t.length;++e){var o=t[e];if(o.from<n&&o.to>n)return e;o.to==n&&(o.from!=o.to&&"before"==r?i=e:lt=e),o.from==n&&(o.from!=o.to&&"before"!=r?i=e:lt=e)}return null!=i?i:lt}var dt=function(){var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,r=/[LRr]/,i=/[Lb1n]/,e=/[1n]/;function o(t,n,r){this.level=t,this.from=n,this.to=r}return function(u,a){var s,c="ltr"==a?"L":"R";if(0==u.length||"ltr"==a&&!t.test(u))return!1;for(var f=u.length,h=[],l=0;l<f;++l)h.push((s=u.charCodeAt(l))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(s):1424<=s&&s<=1524?"R":1536<=s&&s<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(s-1536):1774<=s&&s<=2220?"r":8192<=s&&s<=8203?"w":8204==s?"b":"L");for(var v=0,d=c;v<f;++v){var p=h[v];"m"==p?h[v]=d:d=p}for(var g=0,b=c;g<f;++g){var m=h[g];"1"==m&&"r"==b?h[g]="n":r.test(m)&&(b=m,"r"==m&&(h[g]="R"))}for(var w=1,y=h[0];w<f-1;++w){var k=h[w];"+"==k&&"1"==y&&"1"==h[w+1]?h[w]="1":","!=k||y!=h[w+1]||"1"!=y&&"n"!=y||(h[w]=y),y=k}for(var T=0;T<f;++T){var A=h[T];if(","==A)h[T]="N";else if("%"==A){var E=void 0;for(E=T+1;E<f&&"%"==h[E];++E);for(var L=T&&"!"==h[T-1]||E<f&&"1"==h[E]?"1":"N",x=T;x<E;++x)h[x]=L;T=E-1}}for(var C=0,D=c;C<f;++C){var O=h[C];"L"==D&&"1"==O?h[C]="L":r.test(O)&&(D=O)}for(var S=0;S<f;++S)if(n.test(h[S])){var N=void 0;for(N=S+1;N<f&&n.test(h[N]);++N);for(var M="L"==(S?h[S-1]:c),R=M==("L"==(N<f?h[N]:c))?M?"L":"R":c,B=S;B<N;++B)h[B]=R;S=N-1}for(var I,q=[],F=0;F<f;)if(i.test(h[F])){var P=F;for(++F;F<f&&i.test(h[F]);++F);q.push(new o(0,P,F))}else{var j=F,_=q.length,U="rtl"==a?1:0;for(++F;F<f&&"L"!=h[F];++F);for(var H=j;H<F;)if(e.test(h[H])){j<H&&(q.splice(_,0,new o(1,j,H)),_+=U);var z=H;for(++H;H<F&&e.test(h[H]);++H);q.splice(_,0,new o(2,z,H)),_+=U,j=H}else++H;j<F&&q.splice(_,0,new o(1,j,F))}return"ltr"==a&&(1==q[0].level&&(I=u.match(/^\s+/))&&(q[0].from=I[0].length,q.unshift(new o(0,0,I[0].length))),1==tt(q).level&&(I=u.match(/\s+$/))&&(tt(q).to-=I[0].length,q.push(new o(0,f-I[0].length,f)))),"rtl"==a?q.reverse():q}}();function pt(t,n){var r=t.order;return null==r&&(r=t.order=dt(t.text,n)),r}var gt=[],bt=function(t,n,r){if(t.addEventListener)t.addEventListener(n,r,!1);else if(t.attachEvent)t.attachEvent("on"+n,r);else{var i=t._handlers||(t._handlers={});i[n]=(i[n]||gt).concat(r)}};function mt(t,n){return t._handlers&&t._handlers[n]||gt}function wt(t,n,r){if(t.removeEventListener)t.removeEventListener(n,r,!1);else if(t.detachEvent)t.detachEvent("on"+n,r);else{var i=t._handlers,e=i&&i[n];if(e){var o=$(e,r);o>-1&&(i[n]=e.slice(0,o).concat(e.slice(o+1)))}}}function yt(t,n){var r=mt(t,n);if(r.length)for(var i=Array.prototype.slice.call(arguments,2),e=0;e<r.length;++e)r[e].apply(null,i)}function kt(t,n,r){return"string"==typeof n&&(n={type:n,preventDefault:function(){this.defaultPrevented=!0}}),yt(t,r||n.type,t,n),Ct(n)||n.codemirrorIgnore}function Tt(t){var n=t._handlers&&t._handlers.cursorActivity;if(n)for(var r=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<n.length;++i)-1==$(r,n[i])&&r.push(n[i])}function At(t,n){return mt(t,n).length>0}function Et(t){t.prototype.on=function(t,n){bt(this,t,n)},t.prototype.off=function(t,n){wt(this,t,n)}}function Lt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function xt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Ct(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Dt(t){Lt(t),xt(t)}function Ot(t){return t.target||t.srcElement}function St(t){var n=t.which;return null==n&&(1&t.button?n=1:2&t.button?n=3:4&t.button&&(n=2)),w&&t.ctrlKey&&1==n&&(n=3),n}var Nt,Mt,Rt=function(){if(u&&a<9)return!1;var t=S("div");return"draggable"in t||"dragDrop"in t}();function Bt(t){if(null==Nt){var n=S("span","");O(t,S("span",[n,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Nt=n.offsetWidth<=1&&n.offsetHeight>2&&!(u&&a<8))}var r=Nt?S("span",""):S("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function It(t){if(null!=Mt)return Mt;var n=O(t,document.createTextNode("AخA")),r=x(n,0,1).getBoundingClientRect(),i=x(n,1,2).getBoundingClientRect();return D(t),!(!r||r.left==r.right)&&(Mt=i.right-r.right<3)}var qt,Ft=3!="\n\nb".split(/\n/).length?function(t){for(var n=0,r=[],i=t.length;n<=i;){var e=t.indexOf("\n",n);-1==e&&(e=t.length);var o=t.slice(n,"\r"==t.charAt(e-1)?e-1:e),u=o.indexOf("\r");-1!=u?(r.push(o.slice(0,u)),n+=u+1):(r.push(o),n=e+1)}return r}:function(t){return t.split(/\r\n?|\n/)},Pt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var n;try{n=t.ownerDocument.selection.createRange()}catch(t){}return!(!n||n.parentElement()!=t)&&0!=n.compareEndPoints("StartToEnd",n)},jt="oncopy"in(qt=S("div"))||(qt.setAttribute("oncopy","return;"),"function"==typeof qt.oncopy),_t=null;var Ut={},Ht={};function zt(t,n){arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Ut[t]=n}function Vt(t){if("string"==typeof t&&Ht.hasOwnProperty(t))t=Ht[t];else if(t&&"string"==typeof t.name&&Ht.hasOwnProperty(t.name)){var n=Ht[t.name];"string"==typeof n&&(n={name:n}),(t=it(n,t)).name=n.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Vt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Vt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function $t(t,n){n=Vt(n);var r=Ut[n.name];if(!r)return $t(t,"text/plain");var i=r(t,n);if(Gt.hasOwnProperty(n.name)){var e=Gt[n.name];for(var o in e)e.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=e[o])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var u in n.modeProps)i[u]=n.modeProps[u];return i}var Gt={};function Wt(t,n){H(n,Gt.hasOwnProperty(t)?Gt[t]:Gt[t]={})}function Zt(t,n){if(!0===n)return n;if(t.copyState)return t.copyState(n);var r={};for(var i in n){var e=n[i];e instanceof Array&&(e=e.concat([])),r[i]=e}return r}function Kt(t,n){for(var r;t.innerMode&&(r=t.innerMode(n))&&r.mode!=t;)n=r.state,t=r.mode;return r||{mode:t,state:n}}function Yt(t,n,r){return!t.startState||t.startState(n,r)}var Qt=function(t,n,r){this.pos=this.start=0,this.string=t,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Xt(t,n){if((n-=t.first)<0||n>=t.size)throw new Error("There is no line "+(n+t.first)+" in the document.");for(var r=t;!r.lines;)for(var i=0;;++i){var e=r.children[i],o=e.chunkSize();if(n<o){r=e;break}n-=o}return r.lines[n]}function Jt(t,n,r){var i=[],e=n.line;return t.iter(n.line,r.line+1,(function(t){var o=t.text;e==r.line&&(o=o.slice(0,r.ch)),e==n.line&&(o=o.slice(n.ch)),i.push(o),++e})),i}function tn(t,n,r){var i=[];return t.iter(n,r,(function(t){i.push(t.text)})),i}function nn(t,n){var r=n-t.height;if(r)for(var i=t;i;i=i.parent)i.height+=r}function rn(t){if(null==t.parent)return null;for(var n=t.parent,r=$(n.lines,t),i=n.parent;i;n=i,i=i.parent)for(var e=0;i.children[e]!=n;++e)r+=i.children[e].chunkSize();return r+n.first}function en(t,n){var r=t.first;t:do{for(var i=0;i<t.children.length;++i){var e=t.children[i],o=e.height;if(n<o){t=e;continue t}n-=o,r+=e.chunkSize()}return r}while(!t.lines);for(var u=0;u<t.lines.length;++u){var a=t.lines[u].height;if(n<a)break;n-=a}return r+u}function on(t,n){return n>=t.first&&n<t.first+t.size}function un(t,n){return String(t.lineNumberFormatter(n+t.firstLineNumber))}function an(t,n,r){if(void 0===r&&(r=null),!(this instanceof an))return new an(t,n,r);this.line=t,this.ch=n,this.sticky=r}function sn(t,n){return t.line-n.line||t.ch-n.ch}function cn(t,n){return t.sticky==n.sticky&&0==sn(t,n)}function fn(t){return an(t.line,t.ch)}function hn(t,n){return sn(t,n)<0?n:t}function ln(t,n){return sn(t,n)<0?t:n}function vn(t,n){return Math.max(t.first,Math.min(n,t.first+t.size-1))}function dn(t,n){if(n.line<t.first)return an(t.first,0);var r=t.first+t.size-1;return n.line>r?an(r,Xt(t,r).text.length):function(t,n){var r=t.ch;return null==r||r>n?an(t.line,n):r<0?an(t.line,0):t}(n,Xt(t,n.line).text.length)}function pn(t,n){for(var r=[],i=0;i<n.length;i++)r[i]=dn(t,n[i]);return r}Qt.prototype.eol=function(){return this.pos>=this.string.length},Qt.prototype.sol=function(){return this.pos==this.lineStart},Qt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Qt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Qt.prototype.eat=function(t){var n=this.string.charAt(this.pos);if("string"==typeof t?n==t:n&&(t.test?t.test(n):t(n)))return++this.pos,n},Qt.prototype.eatWhile=function(t){for(var n=this.pos;this.eat(t););return this.pos>n},Qt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Qt.prototype.skipToEnd=function(){this.pos=this.string.length},Qt.prototype.skipTo=function(t){var n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0},Qt.prototype.backUp=function(t){this.pos-=t},Qt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Qt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Qt.prototype.match=function(t,n,r){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==n&&(this.pos+=i[0].length),i)}var e=function(t){return r?t.toLowerCase():t};if(e(this.string.substr(this.pos,t.length))==e(t))return!1!==n&&(this.pos+=t.length),!0},Qt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Qt.prototype.hideFirstChars=function(t,n){this.lineStart+=t;try{return n()}finally{this.lineStart-=t}},Qt.prototype.lookAhead=function(t){var n=this.lineOracle;return n&&n.lookAhead(t)},Qt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var gn=function(t,n){this.state=t,this.lookAhead=n},bn=function(t,n,r,i){this.state=n,this.doc=t,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function mn(t,n,r,i){var e=[t.state.modeGen],o={};Cn(t,n.text,t.doc.mode,r,(function(t,n){return e.push(t,n)}),o,i);for(var u=r.state,a=function(i){r.baseTokens=e;var a=t.state.overlays[i],s=1,c=0;r.state=!0,Cn(t,n.text,a.mode,r,(function(t,n){for(var r=s;c<t;){var i=e[s];i>t&&e.splice(s,1,t,e[s+1],i),s+=2,c=Math.min(t,i)}if(n)if(a.opaque)e.splice(r,s-r,t,"overlay "+n),s=r+2;else for(;r<s;r+=2){var o=e[r+1];e[r+1]=(o?o+" ":"")+"overlay "+n}}),o),r.state=u,r.baseTokens=null,r.baseTokenPos=1},s=0;s<t.state.overlays.length;++s)a(s);return{styles:e,classes:o.bgClass||o.textClass?o:null}}function wn(t,n,r){if(!n.styles||n.styles[0]!=t.state.modeGen){var i=yn(t,rn(n)),e=n.text.length>t.options.maxHighlightLength&&Zt(t.doc.mode,i.state),o=mn(t,n,i);e&&(i.state=e),n.stateAfter=i.save(!e),n.styles=o.styles,o.classes?n.styleClasses=o.classes:n.styleClasses&&(n.styleClasses=null),r===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return n.styles}function yn(t,n,r){var i=t.doc,e=t.display;if(!i.mode.startState)return new bn(i,!0,n);var o=function(t,n,r){for(var i,e,o=t.doc,u=r?-1:n-(t.doc.mode.innerMode?1e3:100),a=n;a>u;--a){if(a<=o.first)return o.first;var s=Xt(o,a-1),c=s.stateAfter;if(c&&(!r||a+(c instanceof gn?c.lookAhead:0)<=o.modeFrontier))return a;var f=z(s.text,null,t.options.tabSize);(null==e||i>f)&&(e=a-1,i=f)}return e}(t,n,r),u=o>i.first&&Xt(i,o-1).stateAfter,a=u?bn.fromSaved(i,u,o):new bn(i,Yt(i.mode),o);return i.iter(o,n,(function(r){kn(t,r.text,a);var i=a.line;r.stateAfter=i==n-1||i%5==0||i>=e.viewFrom&&i<e.viewTo?a.save():null,a.nextLine()})),r&&(i.modeFrontier=a.line),a}function kn(t,n,r,i){var e=t.doc.mode,o=new Qt(n,t.options.tabSize,r);for(o.start=o.pos=i||0,""==n&&Tn(e,r.state);!o.eol();)An(e,o,r.state),o.start=o.pos}function Tn(t,n){if(t.blankLine)return t.blankLine(n);if(t.innerMode){var r=Kt(t,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function An(t,n,r,i){for(var e=0;e<10;e++){i&&(i[0]=Kt(t,r).mode);var o=t.token(n,r);if(n.pos>n.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}bn.prototype.lookAhead=function(t){var n=this.doc.getLine(this.line+t);return null!=n&&t>this.maxLookAhead&&(this.maxLookAhead=t),n},bn.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},bn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},bn.fromSaved=function(t,n,r){return n instanceof gn?new bn(t,Zt(t.mode,n.state),r,n.lookAhead):new bn(t,Zt(t.mode,n),r)},bn.prototype.save=function(t){var n=!1!==t?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new gn(n,this.maxLookAhead):n};var En=function(t,n,r){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=n||null,this.state=r};function Ln(t,n,r,i){var e,o,u=t.doc,a=u.mode,s=Xt(u,(n=dn(u,n)).line),c=yn(t,n.line,r),f=new Qt(s.text,t.options.tabSize,c);for(i&&(o=[]);(i||f.pos<n.ch)&&!f.eol();)f.start=f.pos,e=An(a,f,c.state),i&&o.push(new En(f,e,Zt(u.mode,c.state)));return i?o:new En(f,e,c.state)}function xn(t,n){if(t)for(;;){var r=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;t=t.slice(0,r.index)+t.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";null==n[i]?n[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(n[i])||(n[i]+=" "+r[2])}return t}function Cn(t,n,r,i,e,o,u){var a=r.flattenSpans;null==a&&(a=t.options.flattenSpans);var s,c=0,f=null,h=new Qt(n,t.options.tabSize,i),l=t.options.addModeClass&&[null];for(""==n&&xn(Tn(r,i.state),o);!h.eol();){if(h.pos>t.options.maxHighlightLength?(a=!1,u&&kn(t,n,i,h.pos),h.pos=n.length,s=null):s=xn(An(r,h,i.state,l),o),l){var v=l[0].name;v&&(s="m-"+(s?v+" "+s:v))}if(!a||f!=s){for(;c<h.start;)e(c=Math.min(h.start,c+5e3),f);f=s}h.start=h.pos}for(;c<h.pos;){var d=Math.min(h.pos,c+5e3);e(d,f),c=d}}var Dn=!1,On=!1;function Sn(t,n,r){this.marker=t,this.from=n,this.to=r}function Nn(t,n){if(t)for(var r=0;r<t.length;++r){var i=t[r];if(i.marker==n)return i}}function Mn(t,n){for(var r,i=0;i<t.length;++i)t[i]!=n&&(r||(r=[])).push(t[i]);return r}function Rn(t,n){if(n.full)return null;var r=on(t,n.from.line)&&Xt(t,n.from.line).markedSpans,i=on(t,n.to.line)&&Xt(t,n.to.line).markedSpans;if(!r&&!i)return null;var e=n.from.ch,o=n.to.ch,u=0==sn(n.from,n.to),a=function(t,n,r){var i;if(t)for(var e=0;e<t.length;++e){var o=t[e],u=o.marker;null!=o.from&&!(u.inclusiveLeft?o.from<=n:o.from<n)&&(o.from!=n||"bookmark"!=u.type||r&&o.marker.insertLeft)||(i||(i=[])).push(new Sn(u,o.from,null==o.to||(u.inclusiveRight?o.to>=n:o.to>n)?null:o.to))}return i}(r,e,u),s=function(t,n,r){var i;if(t)for(var e=0;e<t.length;++e){var o=t[e],u=o.marker;(null==o.to||(u.inclusiveRight?o.to>=n:o.to>n)||o.from==n&&"bookmark"==u.type&&(!r||o.marker.insertLeft))&&(i||(i=[])).push(new Sn(u,null==o.from||(u.inclusiveLeft?o.from<=n:o.from<n)?null:o.from-n,null==o.to?null:o.to-n))}return i}(i,o,u),c=1==n.text.length,f=tt(n.text).length+(c?e:0);if(a)for(var h=0;h<a.length;++h){var l=a[h];if(null==l.to){var v=Nn(s,l.marker);v?c&&(l.to=null==v.to?null:v.to+f):l.to=e}}if(s)for(var d=0;d<s.length;++d){var p=s[d];null!=p.to&&(p.to+=f),null==p.from?Nn(a,p.marker)||(p.from=f,c&&(a||(a=[])).push(p)):(p.from+=f,c&&(a||(a=[])).push(p))}a&&(a=Bn(a)),s&&s!=a&&(s=Bn(s));var g=[a];if(!c){var b,m=n.text.length-2;if(m>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(b||(b=[])).push(new Sn(a[w].marker,null,null));for(var y=0;y<m;++y)g.push(b);g.push(s)}return g}function Bn(t){for(var n=0;n<t.length;++n){var r=t[n];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&t.splice(n--,1)}return t.length?t:null}function In(t){var n=t.markedSpans;if(n){for(var r=0;r<n.length;++r)n[r].marker.detachLine(t);t.markedSpans=null}}function qn(t,n){if(n){for(var r=0;r<n.length;++r)n[r].marker.attachLine(t);t.markedSpans=n}}function Fn(t){return t.inclusiveLeft?-1:0}function Pn(t){return t.inclusiveRight?1:0}function jn(t,n){var r=t.lines.length-n.lines.length;if(0!=r)return r;var i=t.find(),e=n.find(),o=sn(i.from,e.from)||Fn(t)-Fn(n);return o?-o:sn(i.to,e.to)||Pn(t)-Pn(n)||n.id-t.id}function _n(t,n){var r,i=On&&t.markedSpans;if(i)for(var e=void 0,o=0;o<i.length;++o)(e=i[o]).marker.collapsed&&null==(n?e.from:e.to)&&(!r||jn(r,e.marker)<0)&&(r=e.marker);return r}function Un(t){return _n(t,!0)}function Hn(t){return _n(t,!1)}function zn(t,n){var r,i=On&&t.markedSpans;if(i)for(var e=0;e<i.length;++e){var o=i[e];o.marker.collapsed&&(null==o.from||o.from<n)&&(null==o.to||o.to>n)&&(!r||jn(r,o.marker)<0)&&(r=o.marker)}return r}function Vn(t,n,r,i,e){var o=Xt(t,n),u=On&&o.markedSpans;if(u)for(var a=0;a<u.length;++a){var s=u[a];if(s.marker.collapsed){var c=s.marker.find(0),f=sn(c.from,r)||Fn(s.marker)-Fn(e),h=sn(c.to,i)||Pn(s.marker)-Pn(e);if(!(f>=0&&h<=0||f<=0&&h>=0)&&(f<=0&&(s.marker.inclusiveRight&&e.inclusiveLeft?sn(c.to,r)>=0:sn(c.to,r)>0)||f>=0&&(s.marker.inclusiveRight&&e.inclusiveLeft?sn(c.from,i)<=0:sn(c.from,i)<0)))return!0}}}function $n(t){for(var n;n=Un(t);)t=n.find(-1,!0).line;return t}function Gn(t,n){var r=Xt(t,n),i=$n(r);return r==i?n:rn(i)}function Wn(t,n){if(n>t.lastLine())return n;var r,i=Xt(t,n);if(!Zn(t,i))return n;for(;r=Hn(i);)i=r.find(1,!0).line;return rn(i)+1}function Zn(t,n){var r=On&&n.markedSpans;if(r)for(var i=void 0,e=0;e<r.length;++e)if((i=r[e]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&Kn(t,n,i))return!0}}function Kn(t,n,r){if(null==r.to){var i=r.marker.find(1,!0);return Kn(t,i.line,Nn(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var e=void 0,o=0;o<n.markedSpans.length;++o)if((e=n.markedSpans[o]).marker.collapsed&&!e.marker.widgetNode&&e.from==r.to&&(null==e.to||e.to!=r.from)&&(e.marker.inclusiveLeft||r.marker.inclusiveRight)&&Kn(t,n,e))return!0}function Yn(t){for(var n=0,r=(t=$n(t)).parent,i=0;i<r.lines.length;++i){var e=r.lines[i];if(e==t)break;n+=e.height}for(var o=r.parent;o;o=(r=o).parent)for(var u=0;u<o.children.length;++u){var a=o.children[u];if(a==r)break;n+=a.height}return n}function Qn(t){if(0==t.height)return 0;for(var n,r=t.text.length,i=t;n=Un(i);){var e=n.find(0,!0);i=e.from.line,r+=e.from.ch-e.to.ch}for(i=t;n=Hn(i);){var o=n.find(0,!0);r-=i.text.length-o.from.ch,r+=(i=o.to.line).text.length-o.to.ch}return r}function Xn(t){var n=t.display,r=t.doc;n.maxLine=Xt(r,r.first),n.maxLineLength=Qn(n.maxLine),n.maxLineChanged=!0,r.iter((function(t){var r=Qn(t);r>n.maxLineLength&&(n.maxLineLength=r,n.maxLine=t)}))}var Jn=function(t,n,r){this.text=t,qn(this,n),this.height=r?r(this):1};function tr(t){t.parent=null,In(t)}Jn.prototype.lineNo=function(){return rn(this)},Et(Jn);var nr={},rr={};function ir(t,n){if(!t||/^\s*$/.test(t))return null;var r=n.addModeClass?rr:nr;return r[t]||(r[t]=t.replace(/\S+/g,"cm-$&"))}function er(t,n){var r=N("span",null,null,s?"padding-right: .1px":null),i={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};n.measure={};for(var e=0;e<=(n.rest?n.rest.length:0);e++){var o=e?n.rest[e-1]:n.line,u=void 0;i.pos=0,i.addToken=ur,It(t.display.measure)&&(u=pt(o,t.doc.direction))&&(i.addToken=ar(i.addToken,u)),i.map=[],cr(o,i,wn(t,o,n!=t.display.externalMeasured&&rn(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=I(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=I(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Bt(t.display.measure))),0==e?(n.measure.map=i.map,n.measure.cache={}):((n.measure.maps||(n.measure.maps=[])).push(i.map),(n.measure.caches||(n.measure.caches=[])).push({}))}if(s){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return yt(t,"renderLine",t,n.line,i.pre),i.pre.className&&(i.textClass=I(i.pre.className,i.textClass||"")),i}function or(t){var n=S("span","•","cm-invalidchar");return n.title="\\u"+t.charCodeAt(0).toString(16),n.setAttribute("aria-label",n.title),n}function ur(t,n,r,i,e,o,s){if(n){var c,f=t.splitSpaces?function(t,n){if(t.length>1&&!/ /.test(t))return t;for(var r=n,i="",e=0;e<t.length;e++){var o=t.charAt(e);" "!=o||!r||e!=t.length-1&&32!=t.charCodeAt(e+1)||(o=" "),i+=o,r=" "==o}return i}(n,t.trailingSpace):n,h=t.cm.state.specialChars,l=!1;if(h.test(n)){c=document.createDocumentFragment();for(var v=0;;){h.lastIndex=v;var d=h.exec(n),p=d?d.index-v:n.length-v;if(p){var g=document.createTextNode(f.slice(v,v+p));c.appendChild(u&&a<9?S("span",[g]):g),t.map.push(t.pos,t.pos+p,g),t.col+=p,t.pos+=p}if(!d)break;v+=p+1;var b=void 0;if("\t"==d[0]){var m=t.cm.options.tabSize,w=m-t.col%m;(b=c.appendChild(S("span",J(w),"cm-tab"))).setAttribute("role","presentation"),b.setAttribute("cm-text","\t"),t.col+=w}else"\r"==d[0]||"\n"==d[0]?((b=c.appendChild(S("span","\r"==d[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",d[0]),t.col+=1):((b=t.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),c.appendChild(u&&a<9?S("span",[b]):b),t.col+=1);t.map.push(t.pos,t.pos+1,b),t.pos++}}else t.col+=n.length,c=document.createTextNode(f),t.map.push(t.pos,t.pos+n.length,c),u&&a<9&&(l=!0),t.pos+=n.length;if(t.trailingSpace=32==f.charCodeAt(n.length-1),r||i||e||l||o||s){var y=r||"";i&&(y+=i),e&&(y+=e);var k=S("span",[c],y,o);if(s)for(var T in s)s.hasOwnProperty(T)&&"style"!=T&&"class"!=T&&k.setAttribute(T,s[T]);return t.content.appendChild(k)}t.content.appendChild(c)}}function ar(t,n){return function(r,i,e,o,u,a,s){e=e?e+" cm-force-border":"cm-force-border";for(var c=r.pos,f=c+i.length;;){for(var h=void 0,l=0;l<n.length&&!((h=n[l]).to>c&&h.from<=c);l++);if(h.to>=f)return t(r,i,e,o,u,a,s);t(r,i.slice(0,h.to-c),e,o,null,a,s),o=null,i=i.slice(h.to-c),c=h.to}}}function sr(t,n,r,i){var e=!i&&r.widgetNode;e&&t.map.push(t.pos,t.pos+n,e),!i&&t.cm.display.input.needsContentAttribute&&(e||(e=t.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",r.id)),e&&(t.cm.display.input.setUneditable(e),t.content.appendChild(e)),t.pos+=n,t.trailingSpace=!1}function cr(t,n,r){var i=t.markedSpans,e=t.text,o=0;if(i)for(var u,a,s,c,f,h,l,v=e.length,d=0,p=1,g="",b=0;;){if(b==d){s=c=f=a="",l=null,h=null,b=1/0;for(var m=[],w=void 0,y=0;y<i.length;++y){var k=i[y],T=k.marker;if("bookmark"==T.type&&k.from==d&&T.widgetNode)m.push(T);else if(k.from<=d&&(null==k.to||k.to>d||T.collapsed&&k.to==d&&k.from==d)){if(null!=k.to&&k.to!=d&&b>k.to&&(b=k.to,c=""),T.className&&(s+=" "+T.className),T.css&&(a=(a?a+";":"")+T.css),T.startStyle&&k.from==d&&(f+=" "+T.startStyle),T.endStyle&&k.to==b&&(w||(w=[])).push(T.endStyle,k.to),T.title&&((l||(l={})).title=T.title),T.attributes)for(var A in T.attributes)(l||(l={}))[A]=T.attributes[A];T.collapsed&&(!h||jn(h.marker,T)<0)&&(h=k)}else k.from>d&&b>k.from&&(b=k.from)}if(w)for(var E=0;E<w.length;E+=2)w[E+1]==b&&(c+=" "+w[E]);if(!h||h.from==d)for(var L=0;L<m.length;++L)sr(n,0,m[L]);if(h&&(h.from||0)==d){if(sr(n,(null==h.to?v+1:h.to)-d,h.marker,null==h.from),null==h.to)return;h.to==d&&(h=!1)}}if(d>=v)break;for(var x=Math.min(v,b);;){if(g){var C=d+g.length;if(!h){var D=C>x?g.slice(0,x-d):g;n.addToken(n,D,u?u+s:s,f,d+D.length==b?c:"",a,l)}if(C>=x){g=g.slice(x-d),d=x;break}d=C,f=""}g=e.slice(o,o=r[p++]),u=ir(r[p++],n.cm.options)}}else for(var O=1;O<r.length;O+=2)n.addToken(n,e.slice(o,o=r[O]),ir(r[O+1],n.cm.options))}function fr(t,n,r){this.line=n,this.rest=function(t){for(var n,r;n=Hn(t);)t=n.find(1,!0).line,(r||(r=[])).push(t);return r}(n),this.size=this.rest?rn(tt(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Zn(t,n)}function hr(t,n,r){for(var i,e=[],o=n;o<r;o=i){var u=new fr(t.doc,Xt(t.doc,o),o);i=o+u.size,e.push(u)}return e}var lr=null;var vr=null;function dr(t,n){var r=mt(t,n);if(r.length){var i,e=Array.prototype.slice.call(arguments,2);lr?i=lr.delayedCallbacks:vr?i=vr:(i=vr=[],setTimeout(pr,0));for(var o=function(t){i.push((function(){return r[t].apply(null,e)}))},u=0;u<r.length;++u)o(u)}}function pr(){var t=vr;vr=null;for(var n=0;n<t.length;++n)t[n]()}function gr(t,n,r,i){for(var e=0;e<n.changes.length;e++){var o=n.changes[e];"text"==o?wr(t,n):"gutter"==o?kr(t,n,r,i):"class"==o?yr(t,n):"widget"==o&&Tr(t,n,i)}n.changes=null}function br(t){return t.node==t.text&&(t.node=S("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),u&&a<8&&(t.node.style.zIndex=2)),t.node}function mr(t,n){var r=t.display.externalMeasured;return r&&r.line==n.line?(t.display.externalMeasured=null,n.measure=r.measure,r.built):er(t,n)}function wr(t,n){var r=n.text.className,i=mr(t,n);n.text==n.node&&(n.node=i.pre),n.text.parentNode.replaceChild(i.pre,n.text),n.text=i.pre,i.bgClass!=n.bgClass||i.textClass!=n.textClass?(n.bgClass=i.bgClass,n.textClass=i.textClass,yr(t,n)):r&&(n.text.className=r)}function yr(t,n){(function(t,n){var r=n.bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),n.background)r?n.background.className=r:(n.background.parentNode.removeChild(n.background),n.background=null);else if(r){var i=br(n);n.background=i.insertBefore(S("div",null,r),i.firstChild),t.display.input.setUneditable(n.background)}})(t,n),n.line.wrapClass?br(n).className=n.line.wrapClass:n.node!=n.text&&(n.node.className=""),n.text.className=(n.textClass?n.textClass+" "+(n.line.textClass||""):n.line.textClass)||""}function kr(t,n,r,i){if(n.gutter&&(n.node.removeChild(n.gutter),n.gutter=null),n.gutterBackground&&(n.node.removeChild(n.gutterBackground),n.gutterBackground=null),n.line.gutterClass){var e=br(n);n.gutterBackground=S("div",null,"CodeMirror-gutter-background "+n.line.gutterClass,"left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),t.display.input.setUneditable(n.gutterBackground),e.insertBefore(n.gutterBackground,n.text)}var o=n.line.gutterMarkers;if(t.options.lineNumbers||o){var u=br(n),a=n.gutter=S("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),t.display.input.setUneditable(a),u.insertBefore(a,n.text),n.line.gutterClass&&(a.className+=" "+n.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(n.lineNumber=a.appendChild(S("div",un(t.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<t.display.gutterSpecs.length;++s){var c=t.display.gutterSpecs[s].className,f=o.hasOwnProperty(c)&&o[c];f&&a.appendChild(S("div",[f],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function Tr(t,n,r){n.alignable&&(n.alignable=null);for(var i=L("CodeMirror-linewidget"),e=n.node.firstChild,o=void 0;e;e=o)o=e.nextSibling,i.test(e.className)&&n.node.removeChild(e);Er(t,n,r)}function Ar(t,n,r,i){var e=mr(t,n);return n.text=n.node=e.pre,e.bgClass&&(n.bgClass=e.bgClass),e.textClass&&(n.textClass=e.textClass),yr(t,n),kr(t,n,r,i),Er(t,n,i),n.node}function Er(t,n,r){if(Lr(t,n.line,n,r,!0),n.rest)for(var i=0;i<n.rest.length;i++)Lr(t,n.rest[i],n,r,!1)}function Lr(t,n,r,i,e){if(n.widgets)for(var o=br(r),u=0,a=n.widgets;u<a.length;++u){var s=a[u],c=S("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),xr(s,c,r,i),t.display.input.setUneditable(c),e&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),dr(s,"redraw")}}function xr(t,n,r,i){if(t.noHScroll){(r.alignable||(r.alignable=[])).push(n);var e=i.wrapperWidth;n.style.left=i.fixedPos+"px",t.coverGutter||(e-=i.gutterTotalWidth,n.style.paddingLeft=i.gutterTotalWidth+"px"),n.style.width=e+"px"}t.coverGutter&&(n.style.zIndex=5,n.style.position="relative",t.noHScroll||(n.style.marginLeft=-i.gutterTotalWidth+"px"))}function Cr(t){if(null!=t.height)return t.height;var n=t.doc.cm;if(!n)return 0;if(!M(document.body,t.node)){var r="position: relative;";t.coverGutter&&(r+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),t.noHScroll&&(r+="width: "+n.display.wrapper.clientWidth+"px;"),O(n.display.measure,S("div",[t.node],null,r))}return t.height=t.node.parentNode.offsetHeight}function Dr(t,n){for(var r=Ot(n);r!=t.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==t.sizer&&r!=t.mover)return!0}function Or(t){return t.lineSpace.offsetTop}function Sr(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Nr(t){if(t.cachedPaddingH)return t.cachedPaddingH;var n=O(t.measure,S("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(n):n.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(t.cachedPaddingH=i),i}function Mr(t){return G-t.display.nativeBarWidth}function Rr(t){return t.display.scroller.clientWidth-Mr(t)-t.display.barWidth}function Br(t){return t.display.scroller.clientHeight-Mr(t)-t.display.barHeight}function Ir(t,n,r){if(t.line==n)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var i=0;i<t.rest.length;i++)if(t.rest[i]==n)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var e=0;e<t.rest.length;e++)if(rn(t.rest[e])>r)return{map:t.measure.maps[e],cache:t.measure.caches[e],before:!0}}}function qr(t,n,r,i){return jr(t,Pr(t,n),r,i)}function Fr(t,n){if(n>=t.display.viewFrom&&n<t.display.viewTo)return t.display.view[gi(t,n)];var r=t.display.externalMeasured;return r&&n>=r.lineN&&n<r.lineN+r.size?r:void 0}function Pr(t,n){var r=rn(n),i=Fr(t,r);i&&!i.text?i=null:i&&i.changes&&(gr(t,i,r,hi(t)),t.curOp.forceUpdate=!0),i||(i=function(t,n){var r=rn(n=$n(n)),i=t.display.externalMeasured=new fr(t.doc,n,r);i.lineN=r;var e=i.built=er(t,i);return i.text=e.pre,O(t.display.lineMeasure,e.pre),i}(t,n));var e=Ir(i,n,r);return{line:n,view:i,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function jr(t,n,r,i,e){n.before&&(r=-1);var o,s=r+(i||"");return n.cache.hasOwnProperty(s)?o=n.cache[s]:(n.rect||(n.rect=n.view.text.getBoundingClientRect()),n.hasHeights||(function(t,n,r){var i=t.options.lineWrapping,e=i&&Rr(t);if(!n.measure.heights||i&&n.measure.width!=e){var o=n.measure.heights=[];if(i){n.measure.width=e;for(var u=n.text.firstChild.getClientRects(),a=0;a<u.length-1;a++){var s=u[a],c=u[a+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(t,n.view,n.rect),n.hasHeights=!0),(o=function(t,n,r,i){var e,o=Hr(n.map,r,i),s=o.node,c=o.start,f=o.end,h=o.collapse;if(3==s.nodeType){for(var l=0;l<4;l++){for(;c&&ct(n.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+f<o.coverEnd&&ct(n.line.text.charAt(o.coverStart+f));)++f;if((e=u&&a<9&&0==c&&f==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():zr(x(s,c,f).getClientRects(),i)).left||e.right||0==c)break;f=c,c-=1,h="right"}u&&a<11&&(e=function(t,n){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(t){if(null!=_t)return _t;var n=O(t,S("span","x")),r=n.getBoundingClientRect(),i=x(n,0,1).getBoundingClientRect();return _t=Math.abs(r.left-i.left)>1}(t))return n;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:n.left*r,right:n.right*r,top:n.top*i,bottom:n.bottom*i}}(t.display.measure,e))}else{var v;c>0&&(h=i="right"),e=t.options.lineWrapping&&(v=s.getClientRects()).length>1?v["right"==i?v.length-1:0]:s.getBoundingClientRect()}if(u&&a<9&&!c&&(!e||!e.left&&!e.right)){var d=s.parentNode.getClientRects()[0];e=d?{left:d.left,right:d.left+fi(t.display),top:d.top,bottom:d.bottom}:Ur}for(var p=e.top-n.rect.top,g=e.bottom-n.rect.top,b=(p+g)/2,m=n.view.measure.heights,w=0;w<m.length-1&&!(b<m[w]);w++);var y={left:("right"==h?e.right:e.left)-n.rect.left,right:("left"==h?e.left:e.right)-n.rect.left,top:w?m[w-1]:0,bottom:m[w]};return e.left||e.right||(y.bogus=!0),t.options.singleCursorHeightPerLine||(y.rtop=p,y.rbottom=g),y}(t,n,r,i)).bogus||(n.cache[s]=o)),{left:o.left,right:o.right,top:e?o.rtop:o.top,bottom:e?o.rbottom:o.bottom}}var _r,Ur={left:0,right:0,top:0,bottom:0};function Hr(t,n,r){for(var i,e,o,u,a,s,c=0;c<t.length;c+=3)if(s=t[c+1],n<(a=t[c])?(e=0,o=1,u="left"):n<s?o=1+(e=n-a):(c==t.length-3||n==s&&t[c+3]>n)&&(e=(o=s-a)-1,n>=s&&(u="right")),null!=e){if(i=t[c+2],a==s&&r==(i.insertLeft?"left":"right")&&(u=r),"left"==r&&0==e)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],u="left";if("right"==r&&e==s-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)i=t[(c+=3)+2],u="right";break}return{node:i,start:e,end:o,collapse:u,coverStart:a,coverEnd:s}}function zr(t,n){var r=Ur;if("left"==n)for(var i=0;i<t.length&&(r=t[i]).left==r.right;i++);else for(var e=t.length-1;e>=0&&(r=t[e]).left==r.right;e--);return r}function Vr(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var n=0;n<t.rest.length;n++)t.measure.caches[n]={}}function $r(t){t.display.externalMeasure=null,D(t.display.lineMeasure);for(var n=0;n<t.display.view.length;n++)Vr(t.display.view[n])}function Gr(t){$r(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Wr(t){return f&&b?-(t.body.getBoundingClientRect().left-parseInt(getComputedStyle(t.body).marginLeft)):t.defaultView.pageXOffset||(t.documentElement||t.body).scrollLeft}function Zr(t){return f&&b?-(t.body.getBoundingClientRect().top-parseInt(getComputedStyle(t.body).marginTop)):t.defaultView.pageYOffset||(t.documentElement||t.body).scrollTop}function Kr(t){var n=$n(t).widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=Cr(n[i]));return r}function Yr(t,n,r,i,e){if(!e){var o=Kr(n);r.top+=o,r.bottom+=o}if("line"==i)return r;i||(i="local");var u=Yn(n);if("local"==i?u+=Or(t.display):u-=t.display.viewOffset,"page"==i||"window"==i){var a=t.display.lineSpace.getBoundingClientRect();u+=a.top+("window"==i?0:Zr(F(t)));var s=a.left+("window"==i?0:Wr(F(t)));r.left+=s,r.right+=s}return r.top+=u,r.bottom+=u,r}function Qr(t,n,r){if("div"==r)return n;var i=n.left,e=n.top;if("page"==r)i-=Wr(F(t)),e-=Zr(F(t));else if("local"==r||!r){var o=t.display.sizer.getBoundingClientRect();i+=o.left,e+=o.top}var u=t.display.lineSpace.getBoundingClientRect();return{left:i-u.left,top:e-u.top}}function Xr(t,n,r,i,e){return i||(i=Xt(t.doc,n.line)),Yr(t,i,qr(t,i,n.ch,e),r)}function Jr(t,n,r,i,e,o){function u(n,u){var a=jr(t,e,n,u?"right":"left",o);return u?a.left=a.right:a.right=a.left,Yr(t,i,a,r)}i=i||Xt(t.doc,n.line),e||(e=Pr(t,i));var a=pt(i,t.doc.direction),s=n.ch,c=n.sticky;if(s>=i.text.length?(s=i.text.length,c="before"):s<=0&&(s=0,c="after"),!a)return u("before"==c?s-1:s,"before"==c);function f(t,n,r){return u(r?t-1:t,1==a[n].level!=r)}var h=vt(a,s,c),l=lt,v=f(s,h,"before"==c);return null!=l&&(v.other=f(s,l,"before"!=c)),v}function ti(t,n){var r=0;n=dn(t.doc,n),t.options.lineWrapping||(r=fi(t.display)*n.ch);var i=Xt(t.doc,n.line),e=Yn(i)+Or(t.display);return{left:r,right:r,top:e,bottom:e+i.height}}function ni(t,n,r,i,e){var o=an(t,n,r);return o.xRel=e,i&&(o.outside=i),o}function ri(t,n,r){var i=t.doc;if((r+=t.display.viewOffset)<0)return ni(i.first,0,null,-1,-1);var e=en(i,r),o=i.first+i.size-1;if(e>o)return ni(i.first+i.size-1,Xt(i,o).text.length,null,1,1);n<0&&(n=0);for(var u=Xt(i,e);;){var a=ui(t,u,e,n,r),s=zn(u,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var c=s.find(1);if(c.line==e)return c;u=Xt(i,e=c.line)}}function ii(t,n,r,i){i-=Kr(n);var e=n.text.length,o=ht((function(n){return jr(t,r,n-1).bottom<=i}),e,0);return{begin:o,end:e=ht((function(n){return jr(t,r,n).top>i}),o,e)}}function ei(t,n,r,i){return r||(r=Pr(t,n)),ii(t,n,r,Yr(t,n,jr(t,r,i),"line").top)}function oi(t,n,r,i){return!(t.bottom<=r)&&(t.top>r||(i?t.left:t.right)>n)}function ui(t,n,r,i,e){e-=Yn(n);var o=Pr(t,n),u=Kr(n),a=0,s=n.text.length,c=!0,f=pt(n,t.doc.direction);if(f){var h=(t.options.lineWrapping?si:ai)(t,n,r,o,f,i,e);a=(c=1!=h.level)?h.from:h.to-1,s=c?h.to:h.from-1}var l,v,d=null,p=null,g=ht((function(n){var r=jr(t,o,n);return r.top+=u,r.bottom+=u,!!oi(r,i,e,!1)&&(r.top<=e&&r.left<=i&&(d=n,p=r),!0)}),a,s),b=!1;if(p){var m=i-p.left<p.right-i,w=m==c;g=d+(w?0:1),v=w?"after":"before",l=m?p.left:p.right}else{c||g!=s&&g!=a||g++,v=0==g?"after":g==n.text.length?"before":jr(t,o,g-(c?1:0)).bottom+u<=e==c?"after":"before";var y=Jr(t,an(r,g,v),"line",n,o);l=y.left,b=e<y.top?-1:e>=y.bottom?1:0}return ni(r,g=ft(n.text,g,1),v,b,i-l)}function ai(t,n,r,i,e,o,u){var a=ht((function(a){var s=e[a],c=1!=s.level;return oi(Jr(t,an(r,c?s.to:s.from,c?"before":"after"),"line",n,i),o,u,!0)}),0,e.length-1),s=e[a];if(a>0){var c=1!=s.level,f=Jr(t,an(r,c?s.from:s.to,c?"after":"before"),"line",n,i);oi(f,o,u,!0)&&f.top>u&&(s=e[a-1])}return s}function si(t,n,r,i,e,o,u){var a=ii(t,n,i,u),s=a.begin,c=a.end;/\s/.test(n.text.charAt(c-1))&&c--;for(var f=null,h=null,l=0;l<e.length;l++){var v=e[l];if(!(v.from>=c||v.to<=s)){var d=jr(t,i,1!=v.level?Math.min(c,v.to)-1:Math.max(s,v.from)).right,p=d<o?o-d+1e9:d-o;(!f||h>p)&&(f=v,h=p)}}return f||(f=e[e.length-1]),f.from<s&&(f={from:s,to:f.to,level:f.level}),f.to>c&&(f={from:f.from,to:c,level:f.level}),f}function ci(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==_r){_r=S("pre",null,"CodeMirror-line-like");for(var n=0;n<49;++n)_r.appendChild(document.createTextNode("x")),_r.appendChild(S("br"));_r.appendChild(document.createTextNode("x"))}O(t.measure,_r);var r=_r.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),D(t.measure),r||1}function fi(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var n=S("span","xxxxxxxxxx"),r=S("pre",[n],"CodeMirror-line-like");O(t.measure,r);var i=n.getBoundingClientRect(),e=(i.right-i.left)/10;return e>2&&(t.cachedCharWidth=e),e||10}function hi(t){for(var n=t.display,r={},i={},e=n.gutters.clientLeft,o=n.gutters.firstChild,u=0;o;o=o.nextSibling,++u){var a=t.display.gutterSpecs[u].className;r[a]=o.offsetLeft+o.clientLeft+e,i[a]=o.clientWidth}return{fixedPos:li(n),gutterTotalWidth:n.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:n.wrapper.clientWidth}}function li(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function vi(t){var n=ci(t.display),r=t.options.lineWrapping,i=r&&Math.max(5,t.display.scroller.clientWidth/fi(t.display)-3);return function(e){if(Zn(t.doc,e))return 0;var o=0;if(e.widgets)for(var u=0;u<e.widgets.length;u++)e.widgets[u].height&&(o+=e.widgets[u].height);return r?o+(Math.ceil(e.text.length/i)||1)*n:o+n}}function di(t){var n=t.doc,r=vi(t);n.iter((function(t){var n=r(t);n!=t.height&&nn(t,n)}))}function pi(t,n,r,i){var e=t.display;if(!r&&"true"==Ot(n).getAttribute("cm-not-content"))return null;var o,u,a=e.lineSpace.getBoundingClientRect();try{o=n.clientX-a.left,u=n.clientY-a.top}catch(t){return null}var s,c=ri(t,o,u);if(i&&c.xRel>0&&(s=Xt(t.doc,c.line).text).length==c.ch){var f=z(s,s.length,t.options.tabSize)-s.length;c=an(c.line,Math.max(0,Math.round((o-Nr(t.display).left)/fi(t.display))-f))}return c}function gi(t,n){if(n>=t.display.viewTo)return null;if((n-=t.display.viewFrom)<0)return null;for(var r=t.display.view,i=0;i<r.length;i++)if((n-=r[i].size)<0)return i}function bi(t,n,r,i){null==n&&(n=t.doc.first),null==r&&(r=t.doc.first+t.doc.size),i||(i=0);var e=t.display;if(i&&r<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>n)&&(e.updateLineNumbers=n),t.curOp.viewChanged=!0,n>=e.viewTo)On&&Gn(t.doc,n)<e.viewTo&&wi(t);else if(r<=e.viewFrom)On&&Wn(t.doc,r+i)>e.viewFrom?wi(t):(e.viewFrom+=i,e.viewTo+=i);else if(n<=e.viewFrom&&r>=e.viewTo)wi(t);else if(n<=e.viewFrom){var o=yi(t,r,r+i,1);o?(e.view=e.view.slice(o.index),e.viewFrom=o.lineN,e.viewTo+=i):wi(t)}else if(r>=e.viewTo){var u=yi(t,n,n,-1);u?(e.view=e.view.slice(0,u.index),e.viewTo=u.lineN):wi(t)}else{var a=yi(t,n,n,-1),s=yi(t,r,r+i,1);a&&s?(e.view=e.view.slice(0,a.index).concat(hr(t,a.lineN,s.lineN)).concat(e.view.slice(s.index)),e.viewTo+=i):wi(t)}var c=e.externalMeasured;c&&(r<c.lineN?c.lineN+=i:n<c.lineN+c.size&&(e.externalMeasured=null))}function mi(t,n,r){t.curOp.viewChanged=!0;var i=t.display,e=t.display.externalMeasured;if(e&&n>=e.lineN&&n<e.lineN+e.size&&(i.externalMeasured=null),!(n<i.viewFrom||n>=i.viewTo)){var o=i.view[gi(t,n)];if(null!=o.node){var u=o.changes||(o.changes=[]);-1==$(u,r)&&u.push(r)}}}function wi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function yi(t,n,r,i){var e,o=gi(t,n),u=t.display.view;if(!On||r==t.doc.first+t.doc.size)return{index:o,lineN:r};for(var a=t.display.viewFrom,s=0;s<o;s++)a+=u[s].size;if(a!=n){if(i>0){if(o==u.length-1)return null;e=a+u[o].size-n,o++}else e=a-n;n+=e,r+=e}for(;Gn(t.doc,r)!=r;){if(o==(i<0?0:u.length-1))return null;r+=i*u[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:r}}function ki(t){for(var n=t.display.view,r=0,i=0;i<n.length;i++){var e=n[i];e.hidden||e.node&&!e.changes||++r}return r}function Ti(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Ai(t,n){void 0===n&&(n=!0);var r=t.doc,i={},e=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),u=t.options.$customCursor;u&&(n=!0);for(var a=0;a<r.sel.ranges.length;a++)if(n||a!=r.sel.primIndex){var s=r.sel.ranges[a];if(!(s.from().line>=t.display.viewTo||s.to().line<t.display.viewFrom)){var c=s.empty();if(u){var f=u(t,s);f&&Ei(t,f,e)}else(c||t.options.showCursorWhenSelecting)&&Ei(t,s.head,e);c||xi(t,s,o)}}return i}function Ei(t,n,r){var i=Jr(t,n,"div",null,null,!t.options.singleCursorHeightPerLine),e=r.appendChild(S("div"," ","CodeMirror-cursor"));if(e.style.left=i.left+"px",e.style.top=i.top+"px",e.style.height=Math.max(0,i.bottom-i.top)*t.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(t.getWrapperElement().className)){var o=Xr(t,n,"div",null,null),u=o.right-o.left;e.style.width=(u>0?u:t.defaultCharWidth())+"px"}if(i.other){var a=r.appendChild(S("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=i.other.left+"px",a.style.top=i.other.top+"px",a.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Li(t,n){return t.top-n.top||t.left-n.left}function xi(t,n,r){var i=t.display,e=t.doc,o=document.createDocumentFragment(),u=Nr(t.display),a=u.left,s=Math.max(i.sizerWidth,Rr(t)-i.sizer.offsetLeft)-u.right,c="ltr"==e.direction;function f(t,n,r,i){n<0&&(n=0),n=Math.round(n),i=Math.round(i),o.appendChild(S("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+n+"px; width: "+(null==r?s-t:r)+"px;\n height: "+(i-n)+"px"))}function h(n,r,i){var o,u,h=Xt(e,n),l=h.text.length;function v(r,i){return Xr(t,an(n,r),"div",h,i)}function d(n,r,i){var e=ei(t,h,null,n),o="ltr"==r==("after"==i)?"left":"right";return v("after"==i?e.begin:e.end-(/\s/.test(h.text.charAt(e.end-1))?2:1),o)[o]}var p=pt(h,e.direction);return function(t,n,r,i){if(!t)return i(n,r,"ltr",0);for(var e=!1,o=0;o<t.length;++o){var u=t[o];(u.from<r&&u.to>n||n==r&&u.to==n)&&(i(Math.max(u.from,n),Math.min(u.to,r),1==u.level?"rtl":"ltr",o),e=!0)}e||i(n,r,"ltr")}(p,r||0,null==i?l:i,(function(t,n,e,h){var g="ltr"==e,b=v(t,g?"left":"right"),m=v(n-1,g?"right":"left"),w=null==r&&0==t,y=null==i&&n==l,k=0==h,T=!p||h==p.length-1;if(m.top-b.top<=3){var A=(c?w:y)&&k?a:(g?b:m).left;f(A,b.top,((c?y:w)&&T?s:(g?m:b).right)-A,b.bottom)}else{var E,L,x,C;g?(E=c&&w&&k?a:b.left,L=c?s:d(t,e,"before"),x=c?a:d(n,e,"after"),C=c&&y&&T?s:m.right):(E=c?d(t,e,"before"):a,L=!c&&w&&k?s:b.right,x=!c&&y&&T?a:m.left,C=c?d(n,e,"after"):s),f(E,b.top,L-E,b.bottom),b.bottom<m.top&&f(a,b.bottom,null,m.top),f(x,m.top,C-x,m.bottom)}(!o||Li(b,o)<0)&&(o=b),Li(m,o)<0&&(o=m),(!u||Li(b,u)<0)&&(u=b),Li(m,u)<0&&(u=m)})),{start:o,end:u}}var l=n.from(),v=n.to();if(l.line==v.line)h(l.line,l.ch,v.ch);else{var d=Xt(e,l.line),p=Xt(e,v.line),g=$n(d)==$n(p),b=h(l.line,l.ch,g?d.text.length+1:null).end,m=h(v.line,g?0:null,v.ch).start;g&&(b.top<m.top-2?(f(b.right,b.top,null,b.bottom),f(a,m.top,m.left,m.bottom)):f(b.right,b.top,m.left-b.right,b.bottom)),b.bottom<m.top&&f(a,b.bottom,null,m.top)}r.appendChild(o)}function Ci(t){if(t.state.focused){var n=t.display;clearInterval(n.blinker);var r=!0;n.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?n.blinker=setInterval((function(){t.hasFocus()||Ni(t),n.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(n.cursorDiv.style.visibility="hidden")}}function Di(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Si(t))}function Oi(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Ni(t))}),100)}function Si(t,n){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(yt(t,"focus",t,n),t.state.focused=!0,B(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),s&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),Ci(t))}function Ni(t,n){t.state.delayingBlurEvent||(t.state.focused&&(yt(t,"blur",t,n),t.state.focused=!1,C(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Mi(t){for(var n=t.display,r=n.lineDiv.offsetTop,i=Math.max(0,n.scroller.getBoundingClientRect().top),e=n.lineDiv.getBoundingClientRect().top,o=0,s=0;s<n.view.length;s++){var c=n.view[s],f=t.options.lineWrapping,h=void 0,l=0;if(!c.hidden){if(e+=c.line.height,u&&a<8){var v=c.node.offsetTop+c.node.offsetHeight;h=v-r,r=v}else{var d=c.node.getBoundingClientRect();h=d.bottom-d.top,!f&&c.text.firstChild&&(l=c.text.firstChild.getBoundingClientRect().right-d.left-1)}var p=c.line.height-h;if((p>.005||p<-.005)&&(e<i&&(o-=p),nn(c.line,h),Ri(c.line),c.rest))for(var g=0;g<c.rest.length;g++)Ri(c.rest[g]);if(l>t.display.sizerWidth){var b=Math.ceil(l/fi(t.display));b>t.display.maxLineLength&&(t.display.maxLineLength=b,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(n.scroller.scrollTop+=o)}function Ri(t){if(t.widgets)for(var n=0;n<t.widgets.length;++n){var r=t.widgets[n],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Bi(t,n,r){var i=r&&null!=r.top?Math.max(0,r.top):t.scroller.scrollTop;i=Math.floor(i-Or(t));var e=r&&null!=r.bottom?r.bottom:i+t.wrapper.clientHeight,o=en(n,i),u=en(n,e);if(r&&r.ensure){var a=r.ensure.from.line,s=r.ensure.to.line;a<o?(o=a,u=en(n,Yn(Xt(n,a))+t.wrapper.clientHeight)):Math.min(s,n.lastLine())>=u&&(o=en(n,Yn(Xt(n,s))-t.wrapper.clientHeight),u=s)}return{from:o,to:Math.max(u,o+1)}}function Ii(t,n){var r=t.display,i=ci(t.display);n.top<0&&(n.top=0);var e=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:r.scroller.scrollTop,o=Br(t),u={};n.bottom-n.top>o&&(n.bottom=n.top+o);var a=t.doc.height+Sr(r),s=n.bottom>a-i;if(n.top<e)u.scrollTop=n.top<i?0:n.top;else if(n.bottom>e+o){var c=Math.min(n.top,(s?a:n.bottom)-o);c!=e&&(u.scrollTop=c)}var f=t.options.fixedGutter?0:r.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:r.scroller.scrollLeft-f,l=Rr(t)-r.gutters.offsetWidth,v=n.right-n.left>l;return v&&(n.right=n.left+l),n.left<10?u.scrollLeft=0:n.left<h?u.scrollLeft=Math.max(0,n.left+f-(v?0:10)):n.right>l+h-3&&(u.scrollLeft=n.right+(v?0:10)-l),u}function qi(t,n){null!=n&&(ji(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+n)}function Fi(t){ji(t);var n=t.getCursor();t.curOp.scrollToPos={from:n,to:n,margin:t.options.cursorScrollMargin}}function Pi(t,n,r){null==n&&null==r||ji(t),null!=n&&(t.curOp.scrollLeft=n),null!=r&&(t.curOp.scrollTop=r)}function ji(t){var n=t.curOp.scrollToPos;n&&(t.curOp.scrollToPos=null,_i(t,ti(t,n.from),ti(t,n.to),n.margin))}function _i(t,n,r,i){var e=Ii(t,{left:Math.min(n.left,r.left),top:Math.min(n.top,r.top)-i,right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)+i});Pi(t,e.scrollLeft,e.scrollTop)}function Ui(t,n){Math.abs(t.doc.scrollTop-n)<2||(r||de(t,{top:n}),Hi(t,n,!0),r&&de(t),ce(t,100))}function Hi(t,n,r){n=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,n)),(t.display.scroller.scrollTop!=n||r)&&(t.doc.scrollTop=n,t.display.scrollbars.setScrollTop(n),t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n))}function zi(t,n,r,i){n=Math.max(0,Math.min(n,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(r?n==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-n)<2)&&!i||(t.doc.scrollLeft=n,be(t),t.display.scroller.scrollLeft!=n&&(t.display.scroller.scrollLeft=n),t.display.scrollbars.setScrollLeft(n))}function Vi(t){var n=t.display,r=n.gutters.offsetWidth,i=Math.round(t.doc.height+Sr(t.display));return{clientHeight:n.scroller.clientHeight,viewHeight:n.wrapper.clientHeight,scrollWidth:n.scroller.scrollWidth,clientWidth:n.scroller.clientWidth,viewWidth:n.wrapper.clientWidth,barLeft:t.options.fixedGutter?r:0,docHeight:i,scrollHeight:i+Mr(t)+n.barHeight,nativeBarWidth:n.nativeBarWidth,gutterWidth:r}}var $i=function(t,n,r){this.cm=r;var i=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=S("div",[S("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=e.tabIndex=-1,t(i),t(e),bt(i,"scroll",(function(){i.clientHeight&&n(i.scrollTop,"vertical")})),bt(e,"scroll",(function(){e.clientWidth&&n(e.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,u&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};$i.prototype.update=function(t){var n=t.scrollWidth>t.clientWidth+1,r=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+(t.viewHeight-(n?i:0)))+"px"):(this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=t.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+(t.viewWidth-t.barLeft-(r?i:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},$i.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},$i.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},$i.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=w&&!d?"12px":"18px",this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new V,this.disableVert=new V},$i.prototype.enableZeroWidthBar=function(t,n,r){t.style.visibility="",n.set(1e3,(function i(){var e=t.getBoundingClientRect();("vert"==r?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=t?t.style.visibility="hidden":n.set(1e3,i)}))},$i.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Gi=function(){};function Wi(t,n){n||(n=Vi(t));var r=t.display.barWidth,i=t.display.barHeight;Zi(t,n);for(var e=0;e<4&&r!=t.display.barWidth||i!=t.display.barHeight;e++)r!=t.display.barWidth&&t.options.lineWrapping&&Mi(t),Zi(t,Vi(t)),r=t.display.barWidth,i=t.display.barHeight}function Zi(t,n){var r=t.display,i=r.scrollbars.update(n);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=n.gutterWidth+"px"):r.gutterFiller.style.display=""}Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};var Ki={native:$i,null:Gi};function Yi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&C(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Ki[t.options.scrollbarStyle]((function(n){t.display.wrapper.insertBefore(n,t.display.scrollbarFiller),bt(n,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),n.setAttribute("cm-not-content","true")}),(function(n,r){"horizontal"==r?zi(t,n):Ui(t,n)}),t),t.display.scrollbars.addClass&&B(t.display.wrapper,t.display.scrollbars.addClass)}var Qi=0;function Xi(t){var n;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qi,markArrays:null},n=t.curOp,lr?lr.ops.push(n):n.ownsGroup=lr={ops:[n],delayedCallbacks:[]}}function Ji(t){var n=t.curOp;n&&function(t,n){var r=t.ownsGroup;if(r)try{!function(t){var n=t.delayedCallbacks,r=0;do{for(;r<n.length;r++)n[r].call(null);for(var i=0;i<t.ops.length;i++){var e=t.ops[i];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(r<n.length)}(r)}finally{lr=null,n(r)}}(n,(function(t){for(var n=0;n<t.ops.length;n++)t.ops[n].cm.curOp=null;!function(t){for(var n=t.ops,r=0;r<n.length;r++)te(n[r]);for(var i=0;i<n.length;i++)ne(n[i]);for(var e=0;e<n.length;e++)re(n[e]);for(var o=0;o<n.length;o++)ie(n[o]);for(var u=0;u<n.length;u++)ee(n[u])}(t)}))}function te(t){var n=t.cm,r=n.display;(function(t){var n=t.display;!n.scrollbarsClipped&&n.scroller.offsetWidth&&(n.nativeBarWidth=n.scroller.offsetWidth-n.scroller.clientWidth,n.heightForcer.style.height=Mr(t)+"px",n.sizer.style.marginBottom=-n.nativeBarWidth+"px",n.sizer.style.borderRightWidth=Mr(t)+"px",n.scrollbarsClipped=!0)})(n),t.updateMaxLine&&Xn(n),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<r.viewFrom||t.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&n.options.lineWrapping,t.update=t.mustUpdate&&new he(n,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ne(t){t.updatedDisplay=t.mustUpdate&&le(t.cm,t.update)}function re(t){var n=t.cm,r=n.display;t.updatedDisplay&&Mi(n),t.barMeasure=Vi(n),r.maxLineChanged&&!n.options.lineWrapping&&(t.adjustWidthTo=qr(n,r.maxLine,r.maxLine.text.length).left+3,n.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+t.adjustWidthTo+Mr(n)+n.display.barWidth),t.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+t.adjustWidthTo-Rr(n))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=r.input.prepareSelection())}function ie(t){var n=t.cm;null!=t.adjustWidthTo&&(n.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<n.doc.scrollLeft&&zi(n,Math.min(n.display.scroller.scrollLeft,t.maxScrollLeft),!0),n.display.maxLineChanged=!1);var r=t.focus&&t.focus==R(P(n));t.preparedSelection&&n.display.input.showSelection(t.preparedSelection,r),(t.updatedDisplay||t.startHeight!=n.doc.height)&&Wi(n,t.barMeasure),t.updatedDisplay&&ge(n,t.barMeasure),t.selectionChanged&&Ci(n),n.state.focused&&t.updateInput&&n.display.input.reset(t.typing),r&&Di(t.cm)}function ee(t){var n=t.cm,r=n.display,i=n.doc;t.updatedDisplay&&ve(n,t.update),null==r.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=t.scrollTop&&Hi(n,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&zi(n,t.scrollLeft,!0,!0),t.scrollToPos&&function(t,n){if(!kt(t,"scrollCursorIntoView")){var r=t.display,i=r.sizer.getBoundingClientRect(),e=null,o=r.wrapper.ownerDocument;if(n.top+i.top<0?e=!0:n.bottom+i.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(e=!1),null!=e&&!p){var u=S("div","",null,"position: absolute;\n top: "+(n.top-r.viewOffset-Or(t.display))+"px;\n height: "+(n.bottom-n.top+Mr(t)+r.barHeight)+"px;\n left: "+n.left+"px; width: "+Math.max(2,n.right-n.left)+"px;");t.display.lineSpace.appendChild(u),u.scrollIntoView(e),t.display.lineSpace.removeChild(u)}}}(n,function(t,n,r,i){var e;null==i&&(i=0),t.options.lineWrapping||n!=r||(r="before"==n.sticky?an(n.line,n.ch+1,"before"):n,n=n.ch?an(n.line,"before"==n.sticky?n.ch-1:n.ch,"after"):n);for(var o=0;o<5;o++){var u=!1,a=Jr(t,n),s=r&&r!=n?Jr(t,r):a,c=Ii(t,e={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-i,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+i}),f=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(Ui(t,c.scrollTop),Math.abs(t.doc.scrollTop-f)>1&&(u=!0)),null!=c.scrollLeft&&(zi(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(u=!0)),!u)break}return e}(n,dn(i,t.scrollToPos.from),dn(i,t.scrollToPos.to),t.scrollToPos.margin));var e=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(e)for(var u=0;u<e.length;++u)e[u].lines.length||yt(e[u],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&yt(o[a],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=n.display.scroller.scrollTop),t.changeObjs&&yt(n,"changes",n,t.changeObjs),t.update&&t.update.finish()}function oe(t,n){if(t.curOp)return n();Xi(t);try{return n()}finally{Ji(t)}}function ue(t,n){return function(){if(t.curOp)return n.apply(t,arguments);Xi(t);try{return n.apply(t,arguments)}finally{Ji(t)}}}function ae(t){return function(){if(this.curOp)return t.apply(this,arguments);Xi(this);try{return t.apply(this,arguments)}finally{Ji(this)}}}function se(t){return function(){var n=this.cm;if(!n||n.curOp)return t.apply(this,arguments);Xi(n);try{return t.apply(this,arguments)}finally{Ji(n)}}}function ce(t,n){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(n,U(fe,t))}function fe(t){var n=t.doc;if(!(n.highlightFrontier>=t.display.viewTo)){var r=+new Date+t.options.workTime,i=yn(t,n.highlightFrontier),e=[];n.iter(i.line,Math.min(n.first+n.size,t.display.viewTo+500),(function(o){if(i.line>=t.display.viewFrom){var u=o.styles,a=o.text.length>t.options.maxHighlightLength?Zt(n.mode,i.state):null,s=mn(t,o,i,!0);a&&(i.state=a),o.styles=s.styles;var c=o.styleClasses,f=s.classes;f?o.styleClasses=f:c&&(o.styleClasses=null);for(var h=!u||u.length!=o.styles.length||c!=f&&(!c||!f||c.bgClass!=f.bgClass||c.textClass!=f.textClass),l=0;!h&&l<u.length;++l)h=u[l]!=o.styles[l];h&&e.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=t.options.maxHighlightLength&&kn(t,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return ce(t,t.options.workDelay),!0})),n.highlightFrontier=i.line,n.modeFrontier=Math.max(n.modeFrontier,i.line),e.length&&oe(t,(function(){for(var n=0;n<e.length;n++)mi(t,e[n],"text")}))}}var he=function(t,n,r){var i=t.display;this.viewport=n,this.visible=Bi(i,t.doc,n),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Rr(t),this.force=r,this.dims=hi(t),this.events=[]};function le(t,n){var r=t.display,i=t.doc;if(n.editorIsHidden)return wi(t),!1;if(!n.force&&n.visible.from>=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==ki(t))return!1;me(t)&&(wi(t),n.dims=hi(t));var e=i.first+i.size,o=Math.max(n.visible.from-t.options.viewportMargin,i.first),u=Math.min(e,n.visible.to+t.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(i.first,r.viewFrom)),r.viewTo>u&&r.viewTo-u<20&&(u=Math.min(e,r.viewTo)),On&&(o=Gn(t.doc,o),u=Wn(t.doc,u));var a=o!=r.viewFrom||u!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;(function(t,n,r){var i=t.display;0==i.view.length||n>=i.viewTo||r<=i.viewFrom?(i.view=hr(t,n,r),i.viewFrom=n):(i.viewFrom>n?i.view=hr(t,n,i.viewFrom).concat(i.view):i.viewFrom<n&&(i.view=i.view.slice(gi(t,n))),i.viewFrom=n,i.viewTo<r?i.view=i.view.concat(hr(t,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,gi(t,r)))),i.viewTo=r})(t,o,u),r.viewOffset=Yn(Xt(t.doc,r.viewFrom)),t.display.mover.style.top=r.viewOffset+"px";var c=ki(t);if(!a&&0==c&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var f=function(t){if(t.hasFocus())return null;var n=R(P(t));if(!n||!M(t.display.lineDiv,n))return null;var r={activeElt:n};if(window.getSelection){var i=_(t).getSelection();i.anchorNode&&i.extend&&M(t.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}(t);return c>4&&(r.lineDiv.style.display="none"),function(t,n,r){var i=t.display,e=t.options.lineNumbers,o=i.lineDiv,u=o.firstChild;function a(n){var r=n.nextSibling;return s&&w&&t.display.currentWheelTarget==n?n.style.display="none":n.parentNode.removeChild(n),r}for(var c=i.view,f=i.viewFrom,h=0;h<c.length;h++){var l=c[h];if(l.hidden);else if(l.node&&l.node.parentNode==o){for(;u!=l.node;)u=a(u);var v=e&&null!=n&&n<=f&&l.lineNumber;l.changes&&($(l.changes,"gutter")>-1&&(v=!1),gr(t,l,f,r)),v&&(D(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(un(t.options,f)))),u=l.node.nextSibling}else{var d=Ar(t,l,f,r);o.insertBefore(d,u)}f+=l.size}for(;u;)u=a(u)}(t,r.updateLineNumbers,n.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(t){if(t&&t.activeElt&&t.activeElt!=R(j(t.activeElt))&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&M(document.body,t.anchorNode)&&M(document.body,t.focusNode))){var n=t.activeElt.ownerDocument,r=n.defaultView.getSelection(),i=n.createRange();i.setEnd(t.anchorNode,t.anchorOffset),i.collapse(!1),r.removeAllRanges(),r.addRange(i),r.extend(t.focusNode,t.focusOffset)}}(f),D(r.cursorDiv),D(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,ce(t,400)),r.updateLineNumbers=null,!0}function ve(t,n){for(var r=n.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&n.oldDisplayWidth!=Rr(t))i&&(n.visible=Bi(t.display,t.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(t.doc.height+Sr(t.display)-Br(t),r.top)}),n.visible=Bi(t.display,t.doc,r),n.visible.from>=t.display.viewFrom&&n.visible.to<=t.display.viewTo)break;if(!le(t,n))break;Mi(t);var e=Vi(t);Ti(t),Wi(t,e),ge(t,e),n.force=!1}n.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(n.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function de(t,n){var r=new he(t,n);if(le(t,r)){Mi(t),ve(t,r);var i=Vi(t);Ti(t),Wi(t,i),ge(t,i),r.finish()}}function pe(t){t.sizer.style.marginLeft=t.gutters.offsetWidth+"px",dr(t,"gutterChanged",t)}function ge(t,n){t.display.sizer.style.minHeight=n.docHeight+"px",t.display.heightForcer.style.top=n.docHeight+"px",t.display.gutters.style.height=n.docHeight+t.display.barHeight+Mr(t)+"px"}function be(t){var n=t.display,r=n.view;if(n.alignWidgets||n.gutters.firstChild&&t.options.fixedGutter){for(var i=li(n)-n.scroller.scrollLeft+t.doc.scrollLeft,e=n.gutters.offsetWidth,o=i+"px",u=0;u<r.length;u++)if(!r[u].hidden){t.options.fixedGutter&&(r[u].gutter&&(r[u].gutter.style.left=o),r[u].gutterBackground&&(r[u].gutterBackground.style.left=o));var a=r[u].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}t.options.fixedGutter&&(n.gutters.style.left=i+e+"px")}}function me(t){if(!t.options.lineNumbers)return!1;var n=t.doc,r=un(t.options,n.first+n.size-1),i=t.display;if(r.length!=i.lineNumChars){var e=i.measure.appendChild(S("div",[S("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=e.firstChild.offsetWidth,u=e.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-u)+1,i.lineNumWidth=i.lineNumInnerWidth+u,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",pe(t.display),!0}return!1}function we(t,n){for(var r=[],i=!1,e=0;e<t.length;e++){var o=t[e],u=null;if("string"!=typeof o&&(u=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!n)continue;i=!0}r.push({className:o,style:u})}return n&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function ye(t){var n=t.gutters,r=t.gutterSpecs;D(n),t.lineGutter=null;for(var i=0;i<r.length;++i){var e=r[i],o=e.className,u=e.style,a=n.appendChild(S("div",null,"CodeMirror-gutter "+o));u&&(a.style.cssText=u),"CodeMirror-linenumbers"==o&&(t.lineGutter=a,a.style.width=(t.lineNumWidth||1)+"px")}n.style.display=r.length?"":"none",pe(t)}function ke(t){ye(t.display),bi(t),be(t)}function Te(t,n,i,e){var o=this;this.input=i,o.scrollbarFiller=S("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=S("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=N("div",null,"CodeMirror-code"),o.selectionDiv=S("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=S("div",null,"CodeMirror-cursors"),o.measure=S("div",null,"CodeMirror-measure"),o.lineMeasure=S("div",null,"CodeMirror-measure"),o.lineSpace=N("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=N("div",[o.lineSpace],"CodeMirror-lines");o.mover=S("div",[c],null,"position: relative"),o.sizer=S("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=S("div",null,null,"position: absolute; height: "+G+"px; width: 1px;"),o.gutters=S("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=S("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=S("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),f&&h>=105&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),u&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||r&&m||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=n.first,o.reportedViewFrom=o.reportedViewTo=n.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=we(e.gutters,e.lineNumbers),ye(o),i.init(o)}he.prototype.signal=function(t,n){At(t,n)&&this.events.push(arguments)},he.prototype.finish=function(){for(var t=0;t<this.events.length;t++)yt.apply(null,this.events[t])};var Ae=0,Ee=null;function Le(t){var n=t.wheelDeltaX,r=t.wheelDeltaY;return null==n&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(n=t.detail),null==r&&t.detail&&t.axis==t.VERTICAL_AXIS?r=t.detail:null==r&&(r=t.wheelDelta),{x:n,y:r}}function xe(t){var n=Le(t);return n.x*=Ee,n.y*=Ee,n}function Ce(t,n){f&&102==h&&(null==t.display.chromeScrollHack?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout((function(){t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""}),100));var i=Le(n),e=i.x,o=i.y,u=Ee;0===n.deltaMode&&(e=n.deltaX,o=n.deltaY,u=1);var a=t.display,c=a.scroller,v=c.scrollHeight>c.clientHeight;if(e&&c.scrollWidth>c.clientWidth||o&&v){if(o&&w&&s)t:for(var d=n.target,p=a.view;d!=c;d=d.parentNode)for(var g=0;g<p.length;g++)if(p[g].node==d){t.display.currentWheelTarget=d;break t}if(e&&!r&&!l&&null!=u)return o&&v&&Ui(t,Math.max(0,c.scrollTop+o*u)),zi(t,Math.max(0,c.scrollLeft+e*u)),(!o||o&&v)&&Lt(n),void(a.wheelStartX=null);if(o&&null!=u){var b=o*u,m=t.doc.scrollTop,y=m+a.wrapper.clientHeight;b<0?m=Math.max(0,m+b-50):y=Math.min(t.doc.height,y+b+50),de(t,{top:m,bottom:y})}Ae<20&&0!==n.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=c.scrollLeft,a.wheelStartY=c.scrollTop,a.wheelDX=e,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var t=c.scrollLeft-a.wheelStartX,n=c.scrollTop-a.wheelStartY,r=n&&a.wheelDY&&n/a.wheelDY||t&&a.wheelDX&&t/a.wheelDX;a.wheelStartX=a.wheelStartY=null,r&&(Ee=(Ee*Ae+r)/(Ae+1),++Ae)}}),200)):(a.wheelDX+=e,a.wheelDY+=o))}}u?Ee=-.53:r?Ee=15:f?Ee=-.7:v&&(Ee=-1/3);var De=function(t,n){this.ranges=t,this.primIndex=n};De.prototype.primary=function(){return this.ranges[this.primIndex]},De.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n],i=t.ranges[n];if(!cn(r.anchor,i.anchor)||!cn(r.head,i.head))return!1}return!0},De.prototype.deepCopy=function(){for(var t=[],n=0;n<this.ranges.length;n++)t[n]=new Oe(fn(this.ranges[n].anchor),fn(this.ranges[n].head));return new De(t,this.primIndex)},De.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},De.prototype.contains=function(t,n){n||(n=t);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(sn(n,i.from())>=0&&sn(t,i.to())<=0)return r}return-1};var Oe=function(t,n){this.anchor=t,this.head=n};function Se(t,n,r){var i=t&&t.options.selectionsMayTouch,e=n[r];n.sort((function(t,n){return sn(t.from(),n.from())})),r=$(n,e);for(var o=1;o<n.length;o++){var u=n[o],a=n[o-1],s=sn(a.to(),u.from());if(i&&!u.empty()?s>0:s>=0){var c=ln(a.from(),u.from()),f=hn(a.to(),u.to()),h=a.empty()?u.from()==u.head:a.from()==a.head;o<=r&&--r,n.splice(--o,2,new Oe(h?f:c,h?c:f))}}return new De(n,r)}function Ne(t,n){return new De([new Oe(t,n||t)],0)}function Me(t){return t.text?an(t.from.line+t.text.length-1,tt(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Re(t,n){if(sn(t,n.from)<0)return t;if(sn(t,n.to)<=0)return Me(n);var r=t.line+n.text.length-(n.to.line-n.from.line)-1,i=t.ch;return t.line==n.to.line&&(i+=Me(n).ch-n.to.ch),an(r,i)}function Be(t,n){for(var r=[],i=0;i<t.sel.ranges.length;i++){var e=t.sel.ranges[i];r.push(new Oe(Re(e.anchor,n),Re(e.head,n)))}return Se(t.cm,r,t.sel.primIndex)}function Ie(t,n,r){return t.line==n.line?an(r.line,t.ch-n.ch+r.ch):an(r.line+(t.line-n.line),t.ch)}function qe(t){t.doc.mode=$t(t.options,t.doc.modeOption),Fe(t)}function Fe(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,ce(t,100),t.state.modeGen++,t.curOp&&bi(t)}function Pe(t,n){return 0==n.from.ch&&0==n.to.ch&&""==tt(n.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function je(t,n,r,i){function e(t){return r?r[t]:null}function o(t,r,e){(function(t,n,r,i){t.text=n,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),In(t),qn(t,r);var e=i?i(t):1;e!=t.height&&nn(t,e)})(t,r,e,i),dr(t,"change",t,n)}function u(t,n){for(var r=[],o=t;o<n;++o)r.push(new Jn(c[o],e(o),i));return r}var a=n.from,s=n.to,c=n.text,f=Xt(t,a.line),h=Xt(t,s.line),l=tt(c),v=e(c.length-1),d=s.line-a.line;if(n.full)t.insert(0,u(0,c.length)),t.remove(c.length,t.size-c.length);else if(Pe(t,n)){var p=u(0,c.length-1);o(h,h.text,v),d&&t.remove(a.line,d),p.length&&t.insert(a.line,p)}else if(f==h)if(1==c.length)o(f,f.text.slice(0,a.ch)+l+f.text.slice(s.ch),v);else{var g=u(1,c.length-1);g.push(new Jn(l+f.text.slice(s.ch),v,i)),o(f,f.text.slice(0,a.ch)+c[0],e(0)),t.insert(a.line+1,g)}else if(1==c.length)o(f,f.text.slice(0,a.ch)+c[0]+h.text.slice(s.ch),e(0)),t.remove(a.line+1,d);else{o(f,f.text.slice(0,a.ch)+c[0],e(0)),o(h,l+h.text.slice(s.ch),v);var b=u(1,c.length-1);d>1&&t.remove(a.line+1,d-1),t.insert(a.line+1,b)}dr(t,"change",t,n)}function _e(t,n,r){!function t(i,e,o){if(i.linked)for(var u=0;u<i.linked.length;++u){var a=i.linked[u];if(a.doc!=e){var s=o&&a.sharedHist;r&&!s||(n(a.doc,s),t(a.doc,i,s))}}}(t,null,!0)}function Ue(t,n){if(n.cm)throw new Error("This document is already in use.");t.doc=n,n.cm=t,di(t),qe(t),He(t),t.options.direction=n.direction,t.options.lineWrapping||Xn(t),t.options.mode=n.modeOption,bi(t)}function He(t){("rtl"==t.doc.direction?B:C)(t.display.lineDiv,"CodeMirror-rtl")}function ze(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Ve(t,n){var r={from:fn(n.from),to:Me(n),text:Jt(t,n.from,n.to)};return Ke(t,r,n.from.line,n.to.line+1),_e(t,(function(t){return Ke(t,r,n.from.line,n.to.line+1)}),!0),r}function $e(t){for(;t.length&&tt(t).ranges;)t.pop()}function Ge(t,n,r,i){var e=t.history;e.undone.length=0;var o,u,a=+new Date;if((e.lastOp==i||e.lastOrigin==n.origin&&n.origin&&("+"==n.origin.charAt(0)&&e.lastModTime>a-(t.cm?t.cm.options.historyEventDelay:500)||"*"==n.origin.charAt(0)))&&(o=function(t,n){return n?($e(t.done),tt(t.done)):t.done.length&&!tt(t.done).ranges?tt(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),tt(t.done)):void 0}(e,e.lastOp==i)))u=tt(o.changes),0==sn(n.from,n.to)&&0==sn(n.from,u.to)?u.to=Me(n):o.changes.push(Ve(t,n));else{var s=tt(e.done);for(s&&s.ranges||Ze(t.sel,e.done),o={changes:[Ve(t,n)],generation:e.generation},e.done.push(o);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(r),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=a,e.lastOp=e.lastSelOp=i,e.lastOrigin=e.lastSelOrigin=n.origin,u||yt(t,"historyAdded")}function We(t,n,r,i){var e=t.history,o=i&&i.origin;r==e.lastSelOp||o&&e.lastSelOrigin==o&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==o||function(t,n,r,i){var e=n.charAt(0);return"*"==e||"+"==e&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}(t,o,tt(e.done),n))?e.done[e.done.length-1]=n:Ze(n,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=o,e.lastSelOp=r,i&&!1!==i.clearRedo&&$e(e.undone)}function Ze(t,n){var r=tt(n);r&&r.ranges&&r.equals(t)||n.push(t)}function Ke(t,n,r,i){var e=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,r),Math.min(t.first+t.size,i),(function(r){r.markedSpans&&((e||(e=n["spans_"+t.id]={}))[o]=r.markedSpans),++o}))}function Ye(t){if(!t)return null;for(var n,r=0;r<t.length;++r)t[r].marker.explicitlyCleared?n||(n=t.slice(0,r)):n&&n.push(t[r]);return n?n.length?n:null:t}function Qe(t,n){var r=function(t,n){var r=n["spans_"+t.id];if(!r)return null;for(var i=[],e=0;e<n.text.length;++e)i.push(Ye(r[e]));return i}(t,n),i=Rn(t,n);if(!r)return i;if(!i)return r;for(var e=0;e<r.length;++e){var o=r[e],u=i[e];if(o&&u)t:for(var a=0;a<u.length;++a){for(var s=u[a],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue t;o.push(s)}else u&&(r[e]=u)}return r}function Xe(t,n,r){for(var i=[],e=0;e<t.length;++e){var o=t[e];if(o.ranges)i.push(r?De.prototype.deepCopy.call(o):o);else{var u=o.changes,a=[];i.push({changes:a});for(var s=0;s<u.length;++s){var c=u[s],f=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),n)for(var h in c)(f=h.match(/^spans_(\d+)$/))&&$(n,Number(f[1]))>-1&&(tt(a)[h]=c[h],delete c[h])}}}return i}function Je(t,n,r,i){if(i){var e=t.anchor;if(r){var o=sn(n,e)<0;o!=sn(r,e)<0?(e=n,n=r):o!=sn(n,r)<0&&(n=r)}return new Oe(e,n)}return new Oe(r||n,n)}function to(t,n,r,i,e){null==e&&(e=t.cm&&(t.cm.display.shift||t.extend)),oo(t,new De([Je(t.sel.primary(),n,r,e)],0),i)}function no(t,n,r){for(var i=[],e=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)i[o]=Je(t.sel.ranges[o],n[o],null,e);oo(t,Se(t.cm,i,t.sel.primIndex),r)}function ro(t,n,r,i){var e=t.sel.ranges.slice(0);e[n]=r,oo(t,Se(t.cm,e,t.sel.primIndex),i)}function io(t,n,r,i){oo(t,Ne(n,r),i)}function eo(t,n,r){var i=t.history.done,e=tt(i);e&&e.ranges?(i[i.length-1]=n,uo(t,n,r)):oo(t,n,r)}function oo(t,n,r){uo(t,n,r),We(t,t.sel,t.cm?t.cm.curOp.id:NaN,r)}function uo(t,n,r){(At(t,"beforeSelectionChange")||t.cm&&At(t.cm,"beforeSelectionChange"))&&(n=function(t,n,r){var i={ranges:n.ranges,update:function(n){this.ranges=[];for(var r=0;r<n.length;r++)this.ranges[r]=new Oe(dn(t,n[r].anchor),dn(t,n[r].head))},origin:r&&r.origin};return yt(t,"beforeSelectionChange",t,i),t.cm&&yt(t.cm,"beforeSelectionChange",t.cm,i),i.ranges!=n.ranges?Se(t.cm,i.ranges,i.ranges.length-1):n}(t,n,r));var i=r&&r.bias||(sn(n.primary().head,t.sel.primary().head)<0?-1:1);ao(t,co(t,n,i,!0)),r&&!1===r.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||Fi(t.cm)}function ao(t,n){n.equals(t.sel)||(t.sel=n,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,Tt(t.cm)),dr(t,"cursorActivity",t))}function so(t){ao(t,co(t,t.sel,null,!1))}function co(t,n,r,i){for(var e,o=0;o<n.ranges.length;o++){var u=n.ranges[o],a=n.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],s=ho(t,u.anchor,a&&a.anchor,r,i),c=u.head==u.anchor?s:ho(t,u.head,a&&a.head,r,i);(e||s!=u.anchor||c!=u.head)&&(e||(e=n.ranges.slice(0,o)),e[o]=new Oe(s,c))}return e?Se(t.cm,e,n.primIndex):n}function fo(t,n,r,i,e){var o=Xt(t,n.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var a=o.markedSpans[u],s=a.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,f="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==a.from||(c?a.from<=n.ch:a.from<n.ch))&&(null==a.to||(f?a.to>=n.ch:a.to>n.ch))){if(e&&(yt(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--u;continue}break}if(!s.atomic)continue;if(r){var h=s.find(i<0?1:-1),l=void 0;if((i<0?f:c)&&(h=lo(t,h,-i,h&&h.line==n.line?o:null)),h&&h.line==n.line&&(l=sn(h,r))&&(i<0?l<0:l>0))return fo(t,h,n,i,e)}var v=s.find(i<0?-1:1);return(i<0?c:f)&&(v=lo(t,v,i,v.line==n.line?o:null)),v?fo(t,v,n,i,e):null}}return n}function ho(t,n,r,i,e){var o=i||1;return fo(t,n,r,o,e)||!e&&fo(t,n,r,o,!0)||fo(t,n,r,-o,e)||!e&&fo(t,n,r,-o,!0)||(t.cantEdit=!0,an(t.first,0))}function lo(t,n,r,i){return r<0&&0==n.ch?n.line>t.first?dn(t,an(n.line-1)):null:r>0&&n.ch==(i||Xt(t,n.line)).text.length?n.line<t.first+t.size-1?an(n.line+1,0):null:new an(n.line,n.ch+r)}function vo(t){t.setSelection(an(t.firstLine(),0),an(t.lastLine()),Z)}function po(t,n,r){var i={canceled:!1,from:n.from,to:n.to,text:n.text,origin:n.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(n,r,e,o){n&&(i.from=dn(t,n)),r&&(i.to=dn(t,r)),e&&(i.text=e),void 0!==o&&(i.origin=o)}),yt(t,"beforeChange",t,i),t.cm&&yt(t.cm,"beforeChange",t.cm,i),i.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function go(t,n,r){if(t.cm){if(!t.cm.curOp)return ue(t.cm,go)(t,n,r);if(t.cm.state.suppressEdits)return}if(!(At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"))||(n=po(t,n,!0))){var i=Dn&&!r&&function(t,n,r){var i=null;if(t.iter(n.line,r.line+1,(function(t){if(t.markedSpans)for(var n=0;n<t.markedSpans.length;++n){var r=t.markedSpans[n].marker;!r.readOnly||i&&-1!=$(i,r)||(i||(i=[])).push(r)}})),!i)return null;for(var e=[{from:n,to:r}],o=0;o<i.length;++o)for(var u=i[o],a=u.find(0),s=0;s<e.length;++s){var c=e[s];if(!(sn(c.to,a.from)<0||sn(c.from,a.to)>0)){var f=[s,1],h=sn(c.from,a.from),l=sn(c.to,a.to);(h<0||!u.inclusiveLeft&&!h)&&f.push({from:c.from,to:a.from}),(l>0||!u.inclusiveRight&&!l)&&f.push({from:a.to,to:c.to}),e.splice.apply(e,f),s+=f.length-3}}return e}(t,n.from,n.to);if(i)for(var e=i.length-1;e>=0;--e)bo(t,{from:i[e].from,to:i[e].to,text:e?[""]:n.text,origin:n.origin});else bo(t,n)}}function bo(t,n){if(1!=n.text.length||""!=n.text[0]||0!=sn(n.from,n.to)){var r=Be(t,n);Ge(t,n,r,t.cm?t.cm.curOp.id:NaN),yo(t,n,r,Rn(t,n));var i=[];_e(t,(function(t,r){r||-1!=$(i,t.history)||(Eo(t.history,n),i.push(t.history)),yo(t,n,null,Rn(t,n))}))}}function mo(t,n,r){var i=t.cm&&t.cm.state.suppressEdits;if(!i||r){for(var e,o=t.history,u=t.sel,a="undo"==n?o.done:o.undone,s="undo"==n?o.undone:o.done,c=0;c<a.length&&(e=a[c],r?!e.ranges||e.equals(t.sel):e.ranges);c++);if(c!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(e=a.pop()).ranges){if(i)return void a.push(e);break}if(Ze(e,s),r&&!e.equals(t.sel))return void oo(t,e,{clearRedo:!1});u=e}var f=[];Ze(u,s),s.push({changes:f,generation:o.generation}),o.generation=e.generation||++o.maxGeneration;for(var h=At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"),l=function(r){var i=e.changes[r];if(i.origin=n,h&&!po(t,i,!1))return a.length=0,{};f.push(Ve(t,i));var o=r?Be(t,i):tt(a);yo(t,i,o,Qe(t,i)),!r&&t.cm&&t.cm.scrollIntoView({from:i.from,to:Me(i)});var u=[];_e(t,(function(t,n){n||-1!=$(u,t.history)||(Eo(t.history,i),u.push(t.history)),yo(t,i,null,Qe(t,i))}))},v=e.changes.length-1;v>=0;--v){var d=l(v);if(d)return d.v}}}}function wo(t,n){if(0!=n&&(t.first+=n,t.sel=new De(nt(t.sel.ranges,(function(t){return new Oe(an(t.anchor.line+n,t.anchor.ch),an(t.head.line+n,t.head.ch))})),t.sel.primIndex),t.cm)){bi(t.cm,t.first,t.first-n,n);for(var r=t.cm.display,i=r.viewFrom;i<r.viewTo;i++)mi(t.cm,i,"gutter")}}function yo(t,n,r,i){if(t.cm&&!t.cm.curOp)return ue(t.cm,yo)(t,n,r,i);if(n.to.line<t.first)wo(t,n.text.length-1-(n.to.line-n.from.line));else if(!(n.from.line>t.lastLine())){if(n.from.line<t.first){var e=n.text.length-1-(t.first-n.from.line);wo(t,e),n={from:an(t.first,0),to:an(n.to.line+e,n.to.ch),text:[tt(n.text)],origin:n.origin}}var o=t.lastLine();n.to.line>o&&(n={from:n.from,to:an(o,Xt(t,o).text.length),text:[n.text[0]],origin:n.origin}),n.removed=Jt(t,n.from,n.to),r||(r=Be(t,n)),t.cm?function(t,n,r){var i=t.doc,e=t.display,o=n.from,u=n.to,a=!1,s=o.line;t.options.lineWrapping||(s=rn($n(Xt(i,o.line))),i.iter(s,u.line+1,(function(t){if(t==e.maxLine)return a=!0,!0}))),i.sel.contains(n.from,n.to)>-1&&Tt(t),je(i,n,r,vi(t)),t.options.lineWrapping||(i.iter(s,o.line+n.text.length,(function(t){var n=Qn(t);n>e.maxLineLength&&(e.maxLine=t,e.maxLineLength=n,e.maxLineChanged=!0,a=!1)})),a&&(t.curOp.updateMaxLine=!0)),function(t,n){if(t.modeFrontier=Math.min(t.modeFrontier,n),!(t.highlightFrontier<n-10)){for(var r=t.first,i=n-1;i>r;i--){var e=Xt(t,i).stateAfter;if(e&&(!(e instanceof gn)||i+e.lookAhead<n)){r=i+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,r)}}(i,o.line),ce(t,400);var c=n.text.length-(u.line-o.line)-1;n.full?bi(t):o.line!=u.line||1!=n.text.length||Pe(t.doc,n)?bi(t,o.line,u.line+1,c):mi(t,o.line,"text");var f=At(t,"changes"),h=At(t,"change");if(h||f){var l={from:o,to:u,text:n.text,removed:n.removed,origin:n.origin};h&&dr(t,"change",t,l),f&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(l)}t.display.selForContextMenu=null}(t.cm,n,i):je(t,n,i),uo(t,r,Z),t.cantEdit&&ho(t,an(t.firstLine(),0))&&(t.cantEdit=!1)}}function ko(t,n,r,i,e){var o;i||(i=r),sn(i,r)<0&&(r=(o=[i,r])[0],i=o[1]),"string"==typeof n&&(n=t.splitLines(n)),go(t,{from:r,to:i,text:n,origin:e})}function To(t,n,r,i){r<t.line?t.line+=i:n<t.line&&(t.line=n,t.ch=0)}function Ao(t,n,r,i){for(var e=0;e<t.length;++e){var o=t[e],u=!0;if(o.ranges){o.copied||((o=t[e]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)To(o.ranges[a].anchor,n,r,i),To(o.ranges[a].head,n,r,i)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=an(c.from.line+i,c.from.ch),c.to=an(c.to.line+i,c.to.ch);else if(n<=c.to.line){u=!1;break}}u||(t.splice(0,e+1),e=0)}}}function Eo(t,n){var r=n.from.line,i=n.to.line,e=n.text.length-(i-r)-1;Ao(t.done,r,i,e),Ao(t.undone,r,i,e)}function Lo(t,n,r,i){var e=n,o=n;return"number"==typeof n?o=Xt(t,vn(t,n)):e=rn(n),null==e?null:(i(o,e)&&t.cm&&mi(t.cm,e,r),o)}function xo(t){this.lines=t,this.parent=null;for(var n=0,r=0;r<t.length;++r)t[r].parent=this,n+=t[r].height;this.height=n}function Co(t){this.children=t;for(var n=0,r=0,i=0;i<t.length;++i){var e=t[i];n+=e.chunkSize(),r+=e.height,e.parent=this}this.size=n,this.height=r,this.parent=null}Oe.prototype.from=function(){return ln(this.anchor,this.head)},Oe.prototype.to=function(){return hn(this.anchor,this.head)},Oe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,n){for(var r=t,i=t+n;r<i;++r){var e=this.lines[r];this.height-=e.height,tr(e),dr(e,"delete")}this.lines.splice(t,n)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,n,r){this.height+=r,this.lines=this.lines.slice(0,t).concat(n).concat(this.lines.slice(t));for(var i=0;i<n.length;++i)n[i].parent=this},iterN:function(t,n,r){for(var i=t+n;t<i;++t)if(r(this.lines[t]))return!0}},Co.prototype={chunkSize:function(){return this.size},removeInner:function(t,n){this.size-=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],e=i.chunkSize();if(t<e){var o=Math.min(n,e-t),u=i.height;if(i.removeInner(t,o),this.height-=u-i.height,e==o&&(this.children.splice(r--,1),i.parent=null),0==(n-=o))break;t=0}else t-=e}if(this.size-n<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var a=[];this.collapse(a),this.children=[new xo(a)],this.children[0].parent=this}},collapse:function(t){for(var n=0;n<this.children.length;++n)this.children[n].collapse(t)},insertInner:function(t,n,r){this.size+=n.length,this.height+=r;for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(t<=o){if(e.insertInner(t,n,r),e.lines&&e.lines.length>50){for(var u=e.lines.length%25+25,a=u;a<e.lines.length;){var s=new xo(e.lines.slice(a,a+=25));e.height-=s.height,this.children.splice(++i,0,s),s.parent=this}e.lines=e.lines.slice(0,u),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var n=new Co(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=n.size,t.height-=n.height;var r=$(t.parent.children,t);t.parent.children.splice(r+1,0,n)}else{var i=new Co(t.children);i.parent=t,t.children=[i,n],t=i}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,n,r){for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(t<o){var u=Math.min(n,o-t);if(e.iterN(t,u,r))return!0;if(0==(n-=u))break;t=0}else t-=o}}};var Do=function(t,n,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=t,this.node=n};function Oo(t,n,r){Yn(n)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&qi(t,r)}Do.prototype.clear=function(){var t=this.doc.cm,n=this.line.widgets,r=this.line,i=rn(r);if(null!=i&&n){for(var e=0;e<n.length;++e)n[e]==this&&n.splice(e--,1);n.length||(r.widgets=null);var o=Cr(this);nn(r,Math.max(0,r.height-o)),t&&(oe(t,(function(){Oo(t,r,-o),mi(t,i,"widget")})),dr(t,"lineWidgetCleared",t,this,i))}},Do.prototype.changed=function(){var t=this,n=this.height,r=this.doc.cm,i=this.line;this.height=null;var e=Cr(this)-n;e&&(Zn(this.doc,i)||nn(i,i.height+e),r&&oe(r,(function(){r.curOp.forceUpdate=!0,Oo(r,i,e),dr(r,"lineWidgetChanged",r,t,rn(i))})))},Et(Do);var So=0,No=function(t,n){this.lines=[],this.type=n,this.doc=t,this.id=++So};function Mo(t,n,r,i,e){if(i&&i.shared)return function(t,n,r,i,e){(i=H(i)).shared=!1;var o=[Mo(t,n,r,i,e)],u=o[0],a=i.widgetNode;return _e(t,(function(t){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Mo(t,dn(t,n),dn(t,r),i,e));for(var s=0;s<t.linked.length;++s)if(t.linked[s].isParent)return;u=tt(o)})),new Ro(o,u)}(t,n,r,i,e);if(t.cm&&!t.cm.curOp)return ue(t.cm,Mo)(t,n,r,i,e);var o=new No(t,e),u=sn(n,r);if(i&&H(i,o,!1),u>0||0==u&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Vn(t,n.line,n,r,o)||n.line!=r.line&&Vn(t,r.line,n,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");On=!0}o.addToHistory&&Ge(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var a,s=n.line,c=t.cm;if(t.iter(s,r.line+1,(function(i){c&&o.collapsed&&!c.options.lineWrapping&&$n(i)==c.display.maxLine&&(a=!0),o.collapsed&&s!=n.line&&nn(i,0),function(t,n,r){var i=r&&window.WeakSet&&(r.markedSpans||(r.markedSpans=new WeakSet));i&&t.markedSpans&&i.has(t.markedSpans)?t.markedSpans.push(n):(t.markedSpans=t.markedSpans?t.markedSpans.concat([n]):[n],i&&i.add(t.markedSpans)),n.marker.attachLine(t)}(i,new Sn(o,s==n.line?n.ch:null,s==r.line?r.ch:null),t.cm&&t.cm.curOp),++s})),o.collapsed&&t.iter(n.line,r.line+1,(function(n){Zn(t,n)&&nn(n,0)})),o.clearOnEnter&&bt(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Dn=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)bi(c,n.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var f=n.line;f<=r.line;f++)mi(c,f,"text");o.atomic&&so(c.doc),dr(c,"markerAdded",c,o)}return o}No.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&Xi(t),At(this,"clear")){var r=this.find();r&&dr(this,"clear",r.from,r.to)}for(var i=null,e=null,o=0;o<this.lines.length;++o){var u=this.lines[o],a=Nn(u.markedSpans,this);t&&!this.collapsed?mi(t,rn(u),"text"):t&&(null!=a.to&&(e=rn(u)),null!=a.from&&(i=rn(u))),u.markedSpans=Mn(u.markedSpans,a),null==a.from&&this.collapsed&&!Zn(this.doc,u)&&t&&nn(u,ci(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=$n(this.lines[s]),f=Qn(c);f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&bi(t,i,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&so(t.doc)),t&&dr(t,"markerCleared",t,this,i,e),n&&Ji(t),this.parent&&this.parent.clear()}},No.prototype.find=function(t,n){var r,i;null==t&&"bookmark"==this.type&&(t=1);for(var e=0;e<this.lines.length;++e){var o=this.lines[e],u=Nn(o.markedSpans,this);if(null!=u.from&&(r=an(n?o:rn(o),u.from),-1==t))return r;if(null!=u.to&&(i=an(n?o:rn(o),u.to),1==t))return i}return r&&{from:r,to:i}},No.prototype.changed=function(){var t=this,n=this.find(-1,!0),r=this,i=this.doc.cm;n&&i&&oe(i,(function(){var e=n.line,o=rn(n.line),u=Fr(i,o);if(u&&(Vr(u),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Zn(r.doc,e)&&null!=r.height){var a=r.height;r.height=null;var s=Cr(r)-a;s&&nn(e,e.height+s)}dr(i,"markerChanged",i,t)}))},No.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;n.maybeHiddenMarkers&&-1!=$(n.maybeHiddenMarkers,this)||(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},No.prototype.detachLine=function(t){if(this.lines.splice($(this.lines,t),1),!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}},Et(No);var Ro=function(t,n){this.markers=t,this.primary=n;for(var r=0;r<t.length;++r)t[r].parent=this};function Bo(t){return t.findMarks(an(t.first,0),t.clipPos(an(t.lastLine())),(function(t){return t.parent}))}function Io(t){for(var n=function(n){var r=t[n],i=[r.primary.doc];_e(r.primary.doc,(function(t){return i.push(t)}));for(var e=0;e<r.markers.length;e++){var o=r.markers[e];-1==$(i,o.doc)&&(o.parent=null,r.markers.splice(e--,1))}},r=0;r<t.length;r++)n(r)}Ro.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();dr(this,"clear")}},Ro.prototype.find=function(t,n){return this.primary.find(t,n)},Et(Ro);var qo=0,Fo=function(t,n,r,i,e){if(!(this instanceof Fo))return new Fo(t,n,r,i,e);null==r&&(r=0),Co.call(this,[new xo([new Jn("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=an(r,0);this.sel=Ne(o),this.history=new ze(null),this.id=++qo,this.modeOption=n,this.lineSep=i,this.direction="rtl"==e?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),je(this,{from:o,to:o,text:t}),oo(this,Ne(o),Z)};Fo.prototype=it(Co.prototype,{constructor:Fo,iter:function(t,n,r){r?this.iterN(t-this.first,n-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,n){for(var r=0,i=0;i<n.length;++i)r+=n[i].height;this.insertInner(t-this.first,n,r)},remove:function(t,n){this.removeInner(t-this.first,n)},getValue:function(t){var n=tn(this,this.first,this.first+this.size);return!1===t?n:n.join(t||this.lineSeparator())},setValue:se((function(t){var n=an(this.first,0),r=this.first+this.size-1;go(this,{from:n,to:an(r,Xt(this,r).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Pi(this.cm,0,0),oo(this,Ne(n),Z)})),replaceRange:function(t,n,r,i){ko(this,t,n=dn(this,n),r=r?dn(this,r):n,i)},getRange:function(t,n,r){var i=Jt(this,dn(this,t),dn(this,n));return!1===r?i:i.join(""===r?"":r||this.lineSeparator())},getLine:function(t){var n=this.getLineHandle(t);return n&&n.text},getLineHandle:function(t){if(on(this,t))return Xt(this,t)},getLineNumber:function(t){return rn(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Xt(this,t)),$n(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return dn(this,t)},getCursor:function(t){var n=this.sel.primary();return null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||!1===t?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:se((function(t,n,r){io(this,dn(this,"number"==typeof t?an(t,n||0):t),null,r)})),setSelection:se((function(t,n,r){io(this,dn(this,t),dn(this,n||t),r)})),extendSelection:se((function(t,n,r){to(this,dn(this,t),n&&dn(this,n),r)})),extendSelections:se((function(t,n){no(this,pn(this,t),n)})),extendSelectionsBy:se((function(t,n){no(this,pn(this,nt(this.sel.ranges,t)),n)})),setSelections:se((function(t,n,r){if(t.length){for(var i=[],e=0;e<t.length;e++)i[e]=new Oe(dn(this,t[e].anchor),dn(this,t[e].head||t[e].anchor));null==n&&(n=Math.min(t.length-1,this.sel.primIndex)),oo(this,Se(this.cm,i,n),r)}})),addSelection:se((function(t,n,r){var i=this.sel.ranges.slice(0);i.push(new Oe(dn(this,t),dn(this,n||t))),oo(this,Se(this.cm,i,i.length-1),r)})),getSelection:function(t){for(var n,r=this.sel.ranges,i=0;i<r.length;i++){var e=Jt(this,r[i].from(),r[i].to());n=n?n.concat(e):e}return!1===t?n:n.join(t||this.lineSeparator())},getSelections:function(t){for(var n=[],r=this.sel.ranges,i=0;i<r.length;i++){var e=Jt(this,r[i].from(),r[i].to());!1!==t&&(e=e.join(t||this.lineSeparator())),n[i]=e}return n},replaceSelection:function(t,n,r){for(var i=[],e=0;e<this.sel.ranges.length;e++)i[e]=t;this.replaceSelections(i,n,r||"+input")},replaceSelections:se((function(t,n,r){for(var i=[],e=this.sel,o=0;o<e.ranges.length;o++){var u=e.ranges[o];i[o]={from:u.from(),to:u.to(),text:this.splitLines(t[o]),origin:r}}for(var a=n&&"end"!=n&&function(t,n,r){for(var i=[],e=an(t.first,0),o=e,u=0;u<n.length;u++){var a=n[u],s=Ie(a.from,e,o),c=Ie(Me(a),e,o);if(e=a.to,o=c,"around"==r){var f=t.sel.ranges[u],h=sn(f.head,f.anchor)<0;i[u]=new Oe(h?c:s,h?s:c)}else i[u]=new Oe(s,s)}return new De(i,t.sel.primIndex)}(this,i,n),s=i.length-1;s>=0;s--)go(this,i[s]);a?eo(this,a):this.cm&&Fi(this.cm)})),undo:se((function(){mo(this,"undo")})),redo:se((function(){mo(this,"redo")})),undoSelection:se((function(){mo(this,"undo",!0)})),redoSelection:se((function(){mo(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,n=0,r=0,i=0;i<t.done.length;i++)t.done[i].ranges||++n;for(var e=0;e<t.undone.length;e++)t.undone[e].ranges||++r;return{undo:n,redo:r}},clearHistory:function(){var t=this;this.history=new ze(this.history),_e(this,(function(n){return n.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Xe(this.history.done),undone:Xe(this.history.undone)}},setHistory:function(t){var n=this.history=new ze(this.history);n.done=Xe(t.done.slice(0),null,!0),n.undone=Xe(t.undone.slice(0),null,!0)},setGutterMarker:se((function(t,n,r){return Lo(this,t,"gutter",(function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[n]=r,!r&&at(i)&&(t.gutterMarkers=null),!0}))})),clearGutter:se((function(t){var n=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[t]&&Lo(n,r,"gutter",(function(){return r.gutterMarkers[t]=null,at(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var n;if("number"==typeof t){if(!on(this,t))return null;if(n=t,!(t=Xt(this,t)))return null}else if(null==(n=rn(t)))return null;return{line:n,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:se((function(t,n,r){return Lo(this,t,"gutter"==n?"gutter":"class",(function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(t[i]){if(L(r).test(t[i]))return!1;t[i]+=" "+r}else t[i]=r;return!0}))})),removeLineClass:se((function(t,n,r){return Lo(this,t,"gutter"==n?"gutter":"class",(function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",e=t[i];if(!e)return!1;if(null==r)t[i]=null;else{var o=e.match(L(r));if(!o)return!1;var u=o.index+o[0].length;t[i]=e.slice(0,o.index)+(o.index&&u!=e.length?" ":"")+e.slice(u)||null}return!0}))})),addLineWidget:se((function(t,n,r){return function(t,n,r,i){var e=new Do(t,r,i),o=t.cm;return o&&e.noHScroll&&(o.display.alignWidgets=!0),Lo(t,n,"widget",(function(n){var r=n.widgets||(n.widgets=[]);if(null==e.insertAt?r.push(e):r.splice(Math.min(r.length,Math.max(0,e.insertAt)),0,e),e.line=n,o&&!Zn(t,n)){var i=Yn(n)<t.scrollTop;nn(n,n.height+Cr(e)),i&&qi(o,e.height),o.curOp.forceUpdate=!0}return!0})),o&&dr(o,"lineWidgetAdded",o,e,"number"==typeof n?n:rn(n)),e}(this,t,n,r)})),removeLineWidget:function(t){t.clear()},markText:function(t,n,r){return Mo(this,dn(this,t),dn(this,n),r,r&&r.type||"range")},setBookmark:function(t,n){var r={replacedWith:n&&(null==n.nodeType?n.widget:n),insertLeft:n&&n.insertLeft,clearWhenEmpty:!1,shared:n&&n.shared,handleMouseEvents:n&&n.handleMouseEvents};return Mo(this,t=dn(this,t),t,r,"bookmark")},findMarksAt:function(t){var n=[],r=Xt(this,(t=dn(this,t)).line).markedSpans;if(r)for(var i=0;i<r.length;++i){var e=r[i];(null==e.from||e.from<=t.ch)&&(null==e.to||e.to>=t.ch)&&n.push(e.marker.parent||e.marker)}return n},findMarks:function(t,n,r){t=dn(this,t),n=dn(this,n);var i=[],e=t.line;return this.iter(t.line,n.line+1,(function(o){var u=o.markedSpans;if(u)for(var a=0;a<u.length;a++){var s=u[a];null!=s.to&&e==t.line&&t.ch>=s.to||null==s.from&&e!=t.line||null!=s.from&&e==n.line&&s.from>=n.ch||r&&!r(s.marker)||i.push(s.marker.parent||s.marker)}++e})),i},getAllMarks:function(){var t=[];return this.iter((function(n){var r=n.markedSpans;if(r)for(var i=0;i<r.length;++i)null!=r[i].from&&t.push(r[i].marker)})),t},posFromIndex:function(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter((function(e){var o=e.text.length+i;if(o>t)return n=t,!0;t-=o,++r})),dn(this,an(r,n))},indexFromPos:function(t){var n=(t=dn(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){n+=t.text.length+r})),n},copy:function(t){var n=new Fo(tn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return n.scrollTop=this.scrollTop,n.scrollLeft=this.scrollLeft,n.sel=this.sel,n.extend=!1,t&&(n.history.undoDepth=this.history.undoDepth,n.setHistory(this.getHistory())),n},linkedDoc:function(t){t||(t={});var n=this.first,r=this.first+this.size;null!=t.from&&t.from>n&&(n=t.from),null!=t.to&&t.to<r&&(r=t.to);var i=new Fo(tn(this,n,r),t.mode||this.modeOption,n,this.lineSep,this.direction);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],function(t,n){for(var r=0;r<n.length;r++){var i=n[r],e=i.find(),o=t.clipPos(e.from),u=t.clipPos(e.to);if(sn(o,u)){var a=Mo(t,o,u,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}(i,Bo(this)),i},unlinkDoc:function(t){if(t instanceof Ru&&(t=t.doc),this.linked)for(var n=0;n<this.linked.length;++n)if(this.linked[n].doc==t){this.linked.splice(n,1),t.unlinkDoc(this),Io(Bo(this));break}if(t.history==this.history){var r=[t.id];_e(t,(function(t){return r.push(t.id)}),!0),t.history=new ze(null),t.history.done=Xe(this.history.done,r),t.history.undone=Xe(this.history.undone,r)}},iterLinkedDocs:function(t){_e(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Ft(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:se((function(t){var n;"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&oe(n=this.cm,(function(){He(n),bi(n)})))}))}),Fo.prototype.eachLine=Fo.prototype.iter;var Po=0;function jo(t){var n=this;if(_o(n),!kt(n,t)&&!Dr(n.display,t)){Lt(t),u&&(Po=+new Date);var r=pi(n,t,!0),i=t.dataTransfer.files;if(r&&!n.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var e=i.length,o=Array(e),a=0,s=function(){++a==e&&ue(n,(function(){var t={from:r=dn(n.doc,r),to:r,text:n.doc.splitLines(o.filter((function(t){return null!=t})).join(n.doc.lineSeparator())),origin:"paste"};go(n.doc,t),eo(n.doc,Ne(dn(n.doc,r),dn(n.doc,Me(t))))}))()},c=function(t,r){if(n.options.allowDropFileTypes&&-1==$(n.options.allowDropFileTypes,t.type))s();else{var i=new FileReader;i.onerror=function(){return s()},i.onload=function(){var t=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(o[r]=t),s()},i.readAsText(t)}},f=0;f<i.length;f++)c(i[f],f);else{if(n.state.draggingText&&n.doc.sel.contains(r)>-1)return n.state.draggingText(t),void setTimeout((function(){return n.display.input.focus()}),20);try{var h=t.dataTransfer.getData("Text");if(h){var l;if(n.state.draggingText&&!n.state.draggingText.copy&&(l=n.listSelections()),uo(n.doc,Ne(r,r)),l)for(var v=0;v<l.length;++v)ko(n.doc,"",l[v].anchor,l[v].head,"drag");n.replaceSelection(h,"around","paste"),n.display.input.focus()}}catch(t){}}}}function _o(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Uo(t){if(document.getElementsByClassName){for(var n=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<n.length;i++){var e=n[i].CodeMirror;e&&r.push(e)}r.length&&r[0].operation((function(){for(var n=0;n<r.length;n++)t(r[n])}))}}var Ho=!1;function zo(){var t;Ho||(bt(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,Uo(Vo)}),100))})),bt(window,"blur",(function(){return Uo(Ni)})),Ho=!0)}function Vo(t){var n=t.display;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.scrollbarsClipped=!1,t.setSize()}for(var $o={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Go=0;Go<10;Go++)$o[Go+48]=$o[Go+96]=String(Go);for(var Wo=65;Wo<=90;Wo++)$o[Wo]=String.fromCharCode(Wo);for(var Zo=1;Zo<=12;Zo++)$o[Zo+111]=$o[Zo+63235]="F"+Zo;var Ko={};function Yo(t){var n,r,i,e,o=t.split(/-(?!$)/);t=o[o.length-1];for(var u=0;u<o.length-1;u++){var a=o[u];if(/^(cmd|meta|m)$/i.test(a))e=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return n&&(t="Alt-"+t),r&&(t="Ctrl-"+t),e&&(t="Cmd-"+t),i&&(t="Shift-"+t),t}function Qo(t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==i){delete t[r];continue}for(var e=nt(r.split(" "),Yo),o=0;o<e.length;o++){var u=void 0,a=void 0;o==e.length-1?(a=e.join(" "),u=i):(a=e.slice(0,o+1).join(" "),u="...");var s=n[a];if(s){if(s!=u)throw new Error("Inconsistent bindings for "+a)}else n[a]=u}delete t[r]}for(var c in n)t[c]=n[c];return t}function Xo(t,n,r,i){var e=(n=ru(n)).call?n.call(t,i):n[t];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&r(e))return"handled";if(n.fallthrough){if("[object Array]"!=Object.prototype.toString.call(n.fallthrough))return Xo(t,n.fallthrough,r,i);for(var o=0;o<n.fallthrough.length;o++){var u=Xo(t,n.fallthrough[o],r,i);if(u)return u}}}function Jo(t){var n="string"==typeof t?t:$o[t.keyCode];return"Ctrl"==n||"Alt"==n||"Shift"==n||"Mod"==n}function tu(t,n,r){var i=t;return n.altKey&&"Alt"!=i&&(t="Alt-"+t),(A?n.metaKey:n.ctrlKey)&&"Ctrl"!=i&&(t="Ctrl-"+t),(A?n.ctrlKey:n.metaKey)&&"Mod"!=i&&(t="Cmd-"+t),!r&&n.shiftKey&&"Shift"!=i&&(t="Shift-"+t),t}function nu(t,n){if(l&&34==t.keyCode&&t.char)return!1;var r=$o[t.keyCode];return null!=r&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(r=t.code),tu(r,t,n))}function ru(t){return"string"==typeof t?Ko[t]:t}function iu(t,n){for(var r=t.doc.sel.ranges,i=[],e=0;e<r.length;e++){for(var o=n(r[e]);i.length&&sn(o.from,tt(i).to)<=0;){var u=i.pop();if(sn(u.from,o.from)<0){o.from=u.from;break}}i.push(o)}oe(t,(function(){for(var n=i.length-1;n>=0;n--)ko(t.doc,"",i[n].from,i[n].to,"+delete");Fi(t)}))}function eu(t,n,r){var i=ft(t.text,n+r,r);return i<0||i>t.text.length?null:i}function ou(t,n,r){var i=eu(t,n.ch,r);return null==i?null:new an(n.line,i,r<0?"after":"before")}function uu(t,n,r,i,e){if(t){"rtl"==n.doc.direction&&(e=-e);var o=pt(r,n.doc.direction);if(o){var u,a=e<0?tt(o):o[0],s=e<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==n.doc.direction){var c=Pr(n,r),f=jr(n,c,u=e<0?r.text.length-1:0).top;u=ht((function(t){return jr(n,c,t).top==f}),e<0==(1==a.level)?a.from:a.to-1,u),"before"==s&&(u=eu(r,u,1))}else u=e<0?a.to:a.from;return new an(i,u,s)}}return new an(i,e<0?r.text.length:0,e<0?"before":"after")}Ko.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ko.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ko.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ko.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ko.default=w?Ko.macDefault:Ko.pcDefault;var au={selectAll:vo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Z)},killLine:function(t){return iu(t,(function(n){if(n.empty()){var r=Xt(t.doc,n.head.line).text.length;return n.head.ch==r&&n.head.line<t.lastLine()?{from:n.head,to:an(n.head.line+1,0)}:{from:n.head,to:an(n.head.line,r)}}return{from:n.from(),to:n.to()}}))},deleteLine:function(t){return iu(t,(function(n){return{from:an(n.from().line,0),to:dn(t.doc,an(n.to().line+1,0))}}))},delLineLeft:function(t){return iu(t,(function(t){return{from:an(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return iu(t,(function(n){var r=t.charCoords(n.head,"div").top+5;return{from:t.coordsChar({left:0,top:r},"div"),to:n.from()}}))},delWrappedLineRight:function(t){return iu(t,(function(n){var r=t.charCoords(n.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:r},"div");return{from:n.from(),to:i}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(an(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(an(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(n){return su(t,n.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(n){return cu(t,n.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(n){return function(t,n){var r=Xt(t.doc,n),i=function(t){for(var n;n=Hn(t);)t=n.find(1,!0).line;return t}(r);return i!=r&&(n=rn(i)),uu(!0,t,r,n,-1)}(t,n.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:r},"div")}),Y)},goLineLeft:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5;return t.coordsChar({left:0,top:r},"div")}),Y)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5,i=t.coordsChar({left:0,top:r},"div");return i.ch<t.getLine(i.line).search(/\S/)?cu(t,n.head):i}),Y)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var n=[],r=t.listSelections(),i=t.options.tabSize,e=0;e<r.length;e++){var o=r[e].from(),u=z(t.getLine(o.line),o.ch,i);n.push(J(i-u%i))}t.replaceSelections(n)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return oe(t,(function(){for(var n=t.listSelections(),r=[],i=0;i<n.length;i++)if(n[i].empty()){var e=n[i].head,o=Xt(t.doc,e.line).text;if(o)if(e.ch==o.length&&(e=new an(e.line,e.ch-1)),e.ch>0)e=new an(e.line,e.ch+1),t.replaceRange(o.charAt(e.ch-1)+o.charAt(e.ch-2),an(e.line,e.ch-2),e,"+transpose");else if(e.line>t.doc.first){var u=Xt(t.doc,e.line-1).text;u&&(e=new an(e.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+u.charAt(u.length-1),an(e.line-1,u.length-1),e,"+transpose"))}r.push(new Oe(e,e))}t.setSelections(r)}))},newlineAndIndent:function(t){return oe(t,(function(){for(var n=t.listSelections(),r=n.length-1;r>=0;r--)t.replaceRange(t.doc.lineSeparator(),n[r].anchor,n[r].head,"+input");n=t.listSelections();for(var i=0;i<n.length;i++)t.indentLine(n[i].from().line,null,!0);Fi(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function su(t,n){var r=Xt(t.doc,n),i=$n(r);return i!=r&&(n=rn(i)),uu(!0,t,i,n,1)}function cu(t,n){var r=su(t,n.line),i=Xt(t.doc,r.line),e=pt(i,t.doc.direction);if(!e||0==e[0].level){var o=Math.max(r.ch,i.text.search(/\S/));return an(r.line,n.line==r.line&&n.ch<=o&&n.ch?0:o,r.sticky)}return r}function fu(t,n,r){if("string"==typeof n&&!(n=au[n]))return!1;t.display.input.ensurePolled();var i=t.display.shift,e=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),r&&(t.display.shift=!1),e=n(t)!=W}finally{t.display.shift=i,t.state.suppressEdits=!1}return e}var hu=new V;function lu(t,n,r,i){var e=t.state.keySeq;if(e){if(Jo(n))return"handled";if(/\'$/.test(n)?t.state.keySeq=null:hu.set(50,(function(){t.state.keySeq==e&&(t.state.keySeq=null,t.display.input.reset())})),vu(t,e+" "+n,r,i))return!0}return vu(t,n,r,i)}function vu(t,n,r,i){var e=function(t,n,r){for(var i=0;i<t.state.keyMaps.length;i++){var e=Xo(n,t.state.keyMaps[i],r,t);if(e)return e}return t.options.extraKeys&&Xo(n,t.options.extraKeys,r,t)||Xo(n,t.options.keyMap,r,t)}(t,n,i);return"multi"==e&&(t.state.keySeq=n),"handled"==e&&dr(t,"keyHandled",t,n,r),"handled"!=e&&"multi"!=e||(Lt(r),Ci(t)),!!e}function du(t,n){var r=nu(n,!0);return!!r&&(n.shiftKey&&!t.state.keySeq?lu(t,"Shift-"+r,n,(function(n){return fu(t,n,!0)}))||lu(t,r,n,(function(n){if("string"==typeof n?/^go[A-Z]/.test(n):n.motion)return fu(t,n)})):lu(t,r,n,(function(n){return fu(t,n)})))}var pu=null;function gu(t){var n=this;if(!(t.target&&t.target!=n.display.input.getField()||(n.curOp.focus=R(P(n)),kt(n,t)))){u&&a<11&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;n.display.shift=16==i||t.shiftKey;var e=du(n,t);l&&(pu=e?i:null,e||88!=i||jt||!(w?t.metaKey:t.ctrlKey)||n.replaceSelection("",null,"cut")),r&&!w&&!e&&46==i&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=i||/\bCodeMirror-crosshair\b/.test(n.display.lineDiv.className)||function(t){var n=t.display.lineDiv;function r(t){18!=t.keyCode&&t.altKey||(C(n,"CodeMirror-crosshair"),wt(document,"keyup",r),wt(document,"mouseover",r))}B(n,"CodeMirror-crosshair"),bt(document,"keyup",r),bt(document,"mouseover",r)}(n)}}function bu(t){16==t.keyCode&&(this.doc.sel.shift=!1),kt(this,t)}function mu(t){var n=this;if(!(t.target&&t.target!=n.display.input.getField()||Dr(n.display,t)||kt(n,t)||t.ctrlKey&&!t.altKey||w&&t.metaKey)){var r=t.keyCode,i=t.charCode;if(l&&r==pu)return pu=null,void Lt(t);if(!l||t.which&&!(t.which<10)||!du(n,t)){var e=String.fromCharCode(null==i?r:i);"\b"!=e&&(function(t,n,r){return lu(t,"'"+r+"'",n,(function(n){return fu(t,n,!0)}))}(n,t,e)||n.display.input.onKeyPress(t))}}}var wu,yu,ku=function(t,n,r){this.time=t,this.pos=n,this.button=r};function Tu(t){var n=this,r=n.display;if(!(kt(n,t)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=t.shiftKey,Dr(r,t))s||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!Lu(n,t)){var i=pi(n,t),e=St(t),o=i?function(t,n){var r=+new Date;return yu&&yu.compare(r,t,n)?(wu=yu=null,"triple"):wu&&wu.compare(r,t,n)?(yu=new ku(r,t,n),wu=null,"double"):(wu=new ku(r,t,n),yu=null,"single")}(i,e):"single";_(n).focus(),1==e&&n.state.selectingText&&n.state.selectingText(t),i&&function(t,n,r,i,e){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),lu(t,tu(o=(1==n?"Left":2==n?"Middle":"Right")+o,e),e,(function(n){if("string"==typeof n&&(n=au[n]),!n)return!1;var i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i=n(t,r)!=W}finally{t.state.suppressEdits=!1}return i}))}(n,e,i,o,t)||(1==e?i?function(t,n,r,i){u?setTimeout(U(Di,t),0):t.curOp.focus=R(P(t));var e,o=function(t,n,r){var i=t.getOption("configureMouse"),e=i?i(t,n,r):{};return null==e.unit&&(e.unit=(y?r.shiftKey&&r.metaKey:r.altKey)?"rectangle":"single"==n?"char":"double"==n?"word":"line"),(null==e.extend||t.doc.extend)&&(e.extend=t.doc.extend||r.shiftKey),null==e.addNew&&(e.addNew=w?r.metaKey:r.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(w?r.altKey:r.ctrlKey)),e}(t,r,i),c=t.doc.sel;t.options.dragDrop&&Rt&&!t.isReadOnly()&&"single"==r&&(e=c.contains(n))>-1&&(sn((e=c.ranges[e]).from(),n)<0||n.xRel>0)&&(sn(e.to(),n)>0||n.xRel<0)?function(t,n,r,i){var e=t.display,o=!1,c=ue(t,(function(n){s&&(e.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Oi(t)),wt(e.wrapper.ownerDocument,"mouseup",c),wt(e.wrapper.ownerDocument,"mousemove",f),wt(e.scroller,"dragstart",h),wt(e.scroller,"drop",c),o||(Lt(n),i.addNew||to(t.doc,r,null,null,i.extend),s&&!v||u&&9==a?setTimeout((function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0}),e.input.focus()}),20):e.input.focus())})),f=function(t){o=o||Math.abs(n.clientX-t.clientX)+Math.abs(n.clientY-t.clientY)>=10},h=function(){return o=!0};s&&(e.scroller.draggable=!0),t.state.draggingText=c,c.copy=!i.moveOnDrag,bt(e.wrapper.ownerDocument,"mouseup",c),bt(e.wrapper.ownerDocument,"mousemove",f),bt(e.scroller,"dragstart",h),bt(e.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout((function(){return e.input.focus()}),20),e.scroller.dragDrop&&e.scroller.dragDrop()}(t,i,n,o):function(t,n,r,i){u&&Oi(t);var e=t.display,o=t.doc;Lt(n);var a,s,c=o.sel,f=c.ranges;if(i.addNew&&!i.extend?(s=o.sel.contains(r),a=s>-1?f[s]:new Oe(r,r)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Oe(r,r)),r=pi(t,n,!0,!0),s=-1;else{var h=Au(t,r,i.unit);a=i.extend?Je(a,h.anchor,h.head,i.extend):h}i.addNew?-1==s?(s=f.length,oo(o,Se(t,f.concat([a]),s),{scroll:!1,origin:"*mouse"})):f.length>1&&f[s].empty()&&"char"==i.unit&&!i.extend?(oo(o,Se(t,f.slice(0,s).concat(f.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):ro(o,s,a,K):(s=0,oo(o,new De([a],0),K),c=o.sel);var l=r;function v(n){if(0!=sn(l,n))if(l=n,"rectangle"==i.unit){for(var e=[],u=t.options.tabSize,f=z(Xt(o,r.line).text,r.ch,u),h=z(Xt(o,n.line).text,n.ch,u),v=Math.min(f,h),d=Math.max(f,h),p=Math.min(r.line,n.line),g=Math.min(t.lastLine(),Math.max(r.line,n.line));p<=g;p++){var b=Xt(o,p).text,m=Q(b,v,u);v==d?e.push(new Oe(an(p,m),an(p,m))):b.length>m&&e.push(new Oe(an(p,m),an(p,Q(b,d,u))))}e.length||e.push(new Oe(r,r)),oo(o,Se(t,c.ranges.slice(0,s).concat(e),s),{origin:"*mouse",scroll:!1}),t.scrollIntoView(n)}else{var w,y=a,k=Au(t,n,i.unit),T=y.anchor;sn(k.anchor,T)>0?(w=k.head,T=ln(y.from(),k.anchor)):(w=k.anchor,T=hn(y.to(),k.head));var A=c.ranges.slice(0);A[s]=function(t,n){var r=n.anchor,i=n.head,e=Xt(t.doc,r.line);if(0==sn(r,i)&&r.sticky==i.sticky)return n;var o=pt(e);if(!o)return n;var u=vt(o,r.ch,r.sticky),a=o[u];if(a.from!=r.ch&&a.to!=r.ch)return n;var s,c=u+(a.from==r.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return n;if(i.line!=r.line)s=(i.line-r.line)*("ltr"==t.doc.direction?1:-1)>0;else{var f=vt(o,i.ch,i.sticky),h=f-u||(i.ch-r.ch)*(1==a.level?-1:1);s=f==c-1||f==c?h<0:h>0}var l=o[c+(s?-1:0)],v=s==(1==l.level),d=v?l.from:l.to,p=v?"after":"before";return r.ch==d&&r.sticky==p?n:new Oe(new an(r.line,d,p),i)}(t,new Oe(dn(o,T),w)),oo(o,Se(t,A,s),K)}}var d=e.wrapper.getBoundingClientRect(),p=0;function g(n){var r=++p,u=pi(t,n,!0,"rectangle"==i.unit);if(u)if(0!=sn(u,l)){t.curOp.focus=R(P(t)),v(u);var a=Bi(e,o);(u.line>=a.to||u.line<a.from)&&setTimeout(ue(t,(function(){p==r&&g(n)})),150)}else{var s=n.clientY<d.top?-20:n.clientY>d.bottom?20:0;s&&setTimeout(ue(t,(function(){p==r&&(e.scroller.scrollTop+=s,g(n))})),50)}}function b(n){t.state.selectingText=!1,p=1/0,n&&(Lt(n),e.input.focus()),wt(e.wrapper.ownerDocument,"mousemove",m),wt(e.wrapper.ownerDocument,"mouseup",w),o.history.lastSelOrigin=null}var m=ue(t,(function(t){0!==t.buttons&&St(t)?g(t):b(t)})),w=ue(t,b);t.state.selectingText=w,bt(e.wrapper.ownerDocument,"mousemove",m),bt(e.wrapper.ownerDocument,"mouseup",w)}(t,i,n,o)}(n,i,o,t):Ot(t)==r.scroller&&Lt(t):2==e?(i&&to(n.doc,i),setTimeout((function(){return r.input.focus()}),20)):3==e&&(E?n.display.input.onContextMenu(t):Oi(n)))}}function Au(t,n,r){if("char"==r)return new Oe(n,n);if("word"==r)return t.findWordAt(n);if("line"==r)return new Oe(an(n.line,0),dn(t.doc,an(n.line+1,0)));var i=r(t,n);return new Oe(i.from,i.to)}function Eu(t,n,r,i){var e,o;if(n.touches)e=n.touches[0].clientX,o=n.touches[0].clientY;else try{e=n.clientX,o=n.clientY}catch(t){return!1}if(e>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Lt(n);var u=t.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!At(t,r))return Ct(n);o-=a.top-u.viewOffset;for(var s=0;s<t.display.gutterSpecs.length;++s){var c=u.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=e)return yt(t,r,t,en(t.doc,o),t.display.gutterSpecs[s].className,n),Ct(n)}}function Lu(t,n){return Eu(t,n,"gutterClick",!0)}function xu(t,n){Dr(t.display,n)||function(t,n){return!!At(t,"gutterContextMenu")&&Eu(t,n,"gutterContextMenu",!1)}(t,n)||kt(t,n,"contextmenu")||E||t.display.input.onContextMenu(n)}function Cu(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gr(t)}ku.prototype.compare=function(t,n,r){return this.time+400>t&&0==sn(n,this.pos)&&r==this.button};var Du={toString:function(){return"CodeMirror.Init"}},Ou={},Su={};function Nu(t,n,r){if(!n!=!(r&&r!=Du)){var i=t.display.dragFunctions,e=n?bt:wt;e(t.display.scroller,"dragstart",i.start),e(t.display.scroller,"dragenter",i.enter),e(t.display.scroller,"dragover",i.over),e(t.display.scroller,"dragleave",i.leave),e(t.display.scroller,"drop",i.drop)}}function Mu(t){t.options.lineWrapping?(B(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(C(t.display.wrapper,"CodeMirror-wrap"),Xn(t)),di(t),bi(t),Gr(t),setTimeout((function(){return Wi(t)}),100)}function Ru(t,n){var r=this;if(!(this instanceof Ru))return new Ru(t,n);this.options=n=n?H(n):{},H(Ou,n,!1);var i=n.value;"string"==typeof i?i=new Fo(i,n.mode,null,n.lineSeparator,n.direction):n.mode&&(i.modeOption=n.mode),this.doc=i;var e=new Ru.inputStyles[n.inputStyle](this),o=this.display=new Te(t,i,e,n);for(var c in o.wrapper.CodeMirror=this,Cu(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Yi(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 V,keySeq:null,specialChars:null},n.autofocus&&!m&&o.input.focus(),u&&a<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(t){var n=t.display;bt(n.scroller,"mousedown",ue(t,Tu)),bt(n.scroller,"dblclick",u&&a<11?ue(t,(function(n){if(!kt(t,n)){var r=pi(t,n);if(r&&!Lu(t,n)&&!Dr(t.display,n)){Lt(n);var i=t.findWordAt(r);to(t.doc,i.anchor,i.head)}}})):function(n){return kt(t,n)||Lt(n)}),bt(n.scroller,"contextmenu",(function(n){return xu(t,n)})),bt(n.input.getField(),"contextmenu",(function(r){n.scroller.contains(r.target)||xu(t,r)}));var r,i={end:0};function e(){n.activeTouch&&(r=setTimeout((function(){return n.activeTouch=null}),1e3),(i=n.activeTouch).end=+new Date)}function o(t){if(1!=t.touches.length)return!1;var n=t.touches[0];return n.radiusX<=1&&n.radiusY<=1}function s(t,n){if(null==n.left)return!0;var r=n.left-t.left,i=n.top-t.top;return r*r+i*i>400}bt(n.scroller,"touchstart",(function(e){if(!kt(t,e)&&!o(e)&&!Lu(t,e)){n.input.ensurePolled(),clearTimeout(r);var u=+new Date;n.activeTouch={start:u,moved:!1,prev:u-i.end<=300?i:null},1==e.touches.length&&(n.activeTouch.left=e.touches[0].pageX,n.activeTouch.top=e.touches[0].pageY)}})),bt(n.scroller,"touchmove",(function(){n.activeTouch&&(n.activeTouch.moved=!0)})),bt(n.scroller,"touchend",(function(r){var i=n.activeTouch;if(i&&!Dr(n,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,u=t.coordsChar(n.activeTouch,"page");o=!i.prev||s(i,i.prev)?new Oe(u,u):!i.prev.prev||s(i,i.prev.prev)?t.findWordAt(u):new Oe(an(u.line,0),dn(t.doc,an(u.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),Lt(r)}e()})),bt(n.scroller,"touchcancel",e),bt(n.scroller,"scroll",(function(){n.scroller.clientHeight&&(Ui(t,n.scroller.scrollTop),zi(t,n.scroller.scrollLeft,!0),yt(t,"scroll",t))})),bt(n.scroller,"mousewheel",(function(n){return Ce(t,n)})),bt(n.scroller,"DOMMouseScroll",(function(n){return Ce(t,n)})),bt(n.wrapper,"scroll",(function(){return n.wrapper.scrollTop=n.wrapper.scrollLeft=0})),n.dragFunctions={enter:function(n){kt(t,n)||Dt(n)},over:function(n){kt(t,n)||(function(t,n){var r=pi(t,n);if(r){var i=document.createDocumentFragment();Ei(t,r,i),t.display.dragCursor||(t.display.dragCursor=S("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),O(t.display.dragCursor,i)}}(t,n),Dt(n))},start:function(n){return function(t,n){if(u&&(!t.state.draggingText||+new Date-Po<100))Dt(n);else if(!kt(t,n)&&!Dr(t.display,n)&&(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!v)){var r=S("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",l&&(r.width=r.height=1,t.display.wrapper.appendChild(r),r._top=r.offsetTop),n.dataTransfer.setDragImage(r,0,0),l&&r.parentNode.removeChild(r)}}(t,n)},drop:ue(t,jo),leave:function(n){kt(t,n)||_o(t)}};var c=n.input.getField();bt(c,"keyup",(function(n){return bu.call(t,n)})),bt(c,"keydown",ue(t,gu)),bt(c,"keypress",ue(t,mu)),bt(c,"focus",(function(n){return Si(t,n)})),bt(c,"blur",(function(n){return Ni(t,n)}))}(this),zo(),Xi(this),this.curOp.forceUpdate=!0,Ue(this,i),n.autofocus&&!m||this.hasFocus()?setTimeout((function(){r.hasFocus()&&!r.state.focused&&Si(r)}),20):Ni(this),Su)Su.hasOwnProperty(c)&&Su[c](this,n[c],Du);me(this),n.finishInit&&n.finishInit(this);for(var f=0;f<Bu.length;++f)Bu[f](this);Ji(this),s&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ru.defaults=Ou,Ru.optionHandlers=Su;var Bu=[];function Iu(t,n,r,i){var e,o=t.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?e=yn(t,n).state:r="prev");var u=t.options.tabSize,a=Xt(o,n),s=z(a.text,null,u);a.stateAfter&&(a.stateAfter=null);var c,f=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==r&&((c=o.mode.indent(e,a.text.slice(f.length),a.text))==W||c>150)){if(!i)return;r="prev"}}else c=0,r="not";"prev"==r?c=n>o.first?z(Xt(o,n-1).text,null,u):0:"add"==r?c=s+t.options.indentUnit:"subtract"==r?c=s-t.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var h="",l=0;if(t.options.indentWithTabs)for(var v=Math.floor(c/u);v;--v)l+=u,h+="\t";if(l<c&&(h+=J(c-l)),h!=f)return ko(o,h,an(n,0),an(n,f.length),"+input"),a.stateAfter=null,!0;for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==n&&p.head.ch<f.length){var g=an(n,f.length);ro(o,d,new Oe(g,g));break}}}Ru.defineInitHook=function(t){return Bu.push(t)};var qu=null;function Fu(t){qu=t}function Pu(t,n,r,i,e){var o=t.doc;t.display.shift=!1,i||(i=o.sel);var u=+new Date-200,a="paste"==e||t.state.pasteIncoming>u,s=Ft(n),c=null;if(a&&i.ranges.length>1)if(qu&&qu.text.join("\n")==n){if(i.ranges.length%qu.text.length==0){c=[];for(var f=0;f<qu.text.length;f++)c.push(o.splitLines(qu.text[f]))}}else s.length==i.ranges.length&&t.options.pasteLinesPerSelection&&(c=nt(s,(function(t){return[t]})));for(var h=t.curOp.updateInput,l=i.ranges.length-1;l>=0;l--){var v=i.ranges[l],d=v.from(),p=v.to();v.empty()&&(r&&r>0?d=an(d.line,d.ch-r):t.state.overwrite&&!a?p=an(p.line,Math.min(Xt(o,p.line).text.length,p.ch+tt(s).length)):a&&qu&&qu.lineWise&&qu.text.join("\n")==s.join("\n")&&(d=p=an(d.line,0)));var g={from:d,to:p,text:c?c[l%c.length]:s,origin:e||(a?"paste":t.state.cutIncoming>u?"cut":"+input")};go(t.doc,g),dr(t,"inputRead",t,g)}n&&!a&&_u(t,n),Fi(t),t.curOp.updateInput<2&&(t.curOp.updateInput=h),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function ju(t,n){var r=t.clipboardData&&t.clipboardData.getData("Text");if(r)return t.preventDefault(),n.isReadOnly()||n.options.disableInput||!n.hasFocus()||oe(n,(function(){return Pu(n,r,0,null,"paste")})),!0}function _u(t,n){if(t.options.electricChars&&t.options.smartIndent)for(var r=t.doc.sel,i=r.ranges.length-1;i>=0;i--){var e=r.ranges[i];if(!(e.head.ch>100||i&&r.ranges[i-1].head.line==e.head.line)){var o=t.getModeAt(e.head),u=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(n.indexOf(o.electricChars.charAt(a))>-1){u=Iu(t,e.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xt(t.doc,e.head.line).text.slice(0,e.head.ch))&&(u=Iu(t,e.head.line,"smart"));u&&dr(t,"electricInput",t,e.head.line)}}}function Uu(t){for(var n=[],r=[],i=0;i<t.doc.sel.ranges.length;i++){var e=t.doc.sel.ranges[i].head.line,o={anchor:an(e,0),head:an(e+1,0)};r.push(o),n.push(t.getRange(o.anchor,o.head))}return{text:n,ranges:r}}function Hu(t,n,r,i){t.setAttribute("autocorrect",r?"on":"off"),t.setAttribute("autocapitalize",i?"on":"off"),t.setAttribute("spellcheck",!!n)}function zu(){var t=S("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),n=S("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?t.style.width="1000px":t.setAttribute("wrap","off"),g&&(t.style.border="1px solid black"),n}function Vu(t,n,r,i,e){var o=n,u=r,a=Xt(t,n.line),s=e&&"rtl"==t.direction?-r:r;function c(o){var u,c;if("codepoint"==i){var f=a.text.charCodeAt(n.ch+(r>0?0:-1));u=isNaN(f)?null:new an(n.line,Math.max(0,Math.min(a.text.length,n.ch+r*((r>0?f>=55296&&f<56320:f>=56320&&f<57343)?2:1))),-r)}else u=e?function(t,n,r,i){var e=pt(n,t.doc.direction);if(!e)return ou(n,r,i);r.ch>=n.text.length?(r.ch=n.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=vt(e,r.ch,r.sticky),u=e[o];if("ltr"==t.doc.direction&&u.level%2==0&&(i>0?u.to>r.ch:u.from<r.ch))return ou(n,r,i);var a,s=function(t,r){return eu(n,t instanceof an?t.ch:t,r)},c=function(r){return t.options.lineWrapping?(a=a||Pr(t,n),ei(t,n,a,r)):{begin:0,end:n.text.length}},f=c("before"==r.sticky?s(r,-1):r.ch);if("rtl"==t.doc.direction||1==u.level){var h=1==u.level==i<0,l=s(r,h?1:-1);if(null!=l&&(h?l<=u.to&&l<=f.end:l>=u.from&&l>=f.begin))return new an(r.line,l,h?"before":"after")}var v=function(t,n,i){for(var o=function(t,n){return n?new an(r.line,s(t,1),"before"):new an(r.line,t,"after")};t>=0&&t<e.length;t+=n){var u=e[t],a=n>0==(1!=u.level),c=a?i.begin:s(i.end,-1);if(u.from<=c&&c<u.to)return o(c,a);if(c=a?u.from:s(u.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},d=v(o+i,i,f);if(d)return d;var p=i>0?f.end:s(f.begin,-1);return null==p||i>0&&p==n.text.length||!(d=v(i>0?0:e.length-1,i,c(p)))?null:d}(t.cm,a,n,r):ou(a,n,r);if(null==u){if(o||((c=n.line+s)<t.first||c>=t.first+t.size||(n=new an(c,n.ch,n.sticky),!(a=Xt(t,c)))))return!1;n=uu(e,t.cm,a,n.line,s)}else n=u;return!0}if("char"==i||"codepoint"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var f=null,h="group"==i,l=t.cm&&t.cm.getHelper(n,"wordChars"),v=!0;!(r<0)||c(!v);v=!1){var d=a.text.charAt(n.ch)||"\n",p=ut(d,l)?"w":h&&"\n"==d?"n":!h||/\s/.test(d)?null:"p";if(!h||v||p||(p="s"),f&&f!=p){r<0&&(r=1,c(),n.sticky="after");break}if(p&&(f=p),r>0&&!c(!v))break}var g=ho(t,n,o,u,!0);return cn(o,g)&&(g.hitSide=!0),g}function $u(t,n,r,i){var e,o,u=t.doc,a=n.left;if("page"==i){var s=Math.min(t.display.wrapper.clientHeight,_(t).innerHeight||u(t).documentElement.clientHeight),c=Math.max(s-.5*ci(t.display),3);e=(r>0?n.bottom:n.top)+r*c}else"line"==i&&(e=r>0?n.bottom+3:n.top-3);for(;(o=ri(t,a,e)).outside;){if(r<0?e<=0:e>=u.height){o.hitSide=!0;break}e+=5*r}return o}var Gu=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new V,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wu(t,n){var r=Fr(t,n.line);if(!r||r.hidden)return null;var i=Xt(t.doc,n.line),e=Ir(r,i,n.line),o=pt(i,t.doc.direction),u="left";o&&(u=vt(o,n.ch)%2?"right":"left");var a=Hr(e.map,n.ch,u);return a.offset="right"==a.collapse?a.end:a.start,a}function Zu(t,n){return n&&(t.bad=!0),t}function Ku(t,n,r){var i;if(n==t.display.lineDiv){if(!(i=t.display.lineDiv.childNodes[r]))return Zu(t.clipPos(an(t.display.viewTo-1)),!0);n=null,r=0}else for(i=n;;i=i.parentNode){if(!i||i==t.display.lineDiv)return null;if(i.parentNode&&i.parentNode==t.display.lineDiv)break}for(var e=0;e<t.display.view.length;e++){var o=t.display.view[e];if(o.node==i)return Yu(o,n,r)}}function Yu(t,n,r){var i=t.text.firstChild,e=!1;if(!n||!M(i,n))return Zu(an(rn(t.line),0),!0);if(n==i&&(e=!0,n=i.childNodes[r],r=0,!n)){var o=t.rest?tt(t.rest):t.line;return Zu(an(rn(o),o.text.length),e)}var u=3==n.nodeType?n:null,a=n;for(u||1!=n.childNodes.length||3!=n.firstChild.nodeType||(u=n.firstChild,r&&(r=u.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var s=t.measure,c=s.maps;function f(n,r,i){for(var e=-1;e<(c?c.length:0);e++)for(var o=e<0?s.map:c[e],u=0;u<o.length;u+=3){var a=o[u+2];if(a==n||a==r){var f=rn(e<0?t.line:t.rest[e]),h=o[u]+i;return(i<0||a!=n)&&(h=o[u+(i?1:0)]),an(f,h)}}}var h=f(u,a,r);if(h)return Zu(h,e);for(var l=a.nextSibling,v=u?u.nodeValue.length-r:0;l;l=l.nextSibling){if(h=f(l,l.firstChild,0))return Zu(an(h.line,h.ch-v),e);v+=l.textContent.length}for(var d=a.previousSibling,p=r;d;d=d.previousSibling){if(h=f(d,d.firstChild,-1))return Zu(an(h.line,h.ch+p),e);p+=d.textContent.length}}Gu.prototype.init=function(t){var n=this,r=this,i=r.cm,e=r.div=t.lineDiv;function o(t){for(var n=t.target;n;n=n.parentNode){if(n==e)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(n.className))break}return!1}function u(t){if(o(t)&&!kt(i,t)){if(i.somethingSelected())Fu({lineWise:!1,text:i.getSelections()}),"cut"==t.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var n=Uu(i);Fu({lineWise:!0,text:n.text}),"cut"==t.type&&i.operation((function(){i.setSelections(n.ranges,0,Z),i.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var u=qu.text.join("\n");if(t.clipboardData.setData("Text",u),t.clipboardData.getData("Text")==u)return void t.preventDefault()}var a=zu(),s=a.firstChild;Hu(s),i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),s.value=qu.text.join("\n");var c=R(j(e));q(s),setTimeout((function(){i.display.lineSpace.removeChild(a),c.focus(),c==e&&r.showPrimarySelection()}),50)}}e.contentEditable=!0,Hu(e,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),bt(e,"paste",(function(t){!o(t)||kt(i,t)||ju(t,i)||a<=11&&setTimeout(ue(i,(function(){return n.updateFromDOM()})),20)})),bt(e,"compositionstart",(function(t){n.composing={data:t.data,done:!1}})),bt(e,"compositionupdate",(function(t){n.composing||(n.composing={data:t.data,done:!1})})),bt(e,"compositionend",(function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)})),bt(e,"touchstart",(function(){return r.forceCompositionEnd()})),bt(e,"input",(function(){n.composing||n.readFromDOMSoon()})),bt(e,"copy",u),bt(e,"cut",u)},Gu.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},Gu.prototype.prepareSelection=function(){var t=Ai(this.cm,!1);return t.focus=R(j(this.div))==this.div,t},Gu.prototype.showSelection=function(t,n){t&&this.cm.display.view.length&&((t.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Gu.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gu.prototype.showPrimarySelection=function(){var t=this.getSelection(),n=this.cm,i=n.doc.sel.primary(),e=i.from(),o=i.to();if(n.display.viewTo==n.display.viewFrom||e.line>=n.display.viewTo||o.line<n.display.viewFrom)t.removeAllRanges();else{var u=Ku(n,t.anchorNode,t.anchorOffset),a=Ku(n,t.focusNode,t.focusOffset);if(!u||u.bad||!a||a.bad||0!=sn(ln(u,a),e)||0!=sn(hn(u,a),o)){var s=n.display.view,c=e.line>=n.display.viewFrom&&Wu(n,e)||{node:s[0].measure.map[2],offset:0},f=o.line<n.display.viewTo&&Wu(n,o);if(!f){var h=s[s.length-1].measure,l=h.maps?h.maps[h.maps.length-1]:h.map;f={node:l[l.length-1],offset:l[l.length-2]-l[l.length-3]}}if(c&&f){var v,d=t.rangeCount&&t.getRangeAt(0);try{v=x(c.node,c.offset,f.offset,f.node)}catch(t){}v&&(!r&&n.state.focused?(t.collapse(c.node,c.offset),v.collapsed||(t.removeAllRanges(),t.addRange(v))):(t.removeAllRanges(),t.addRange(v)),d&&null==t.anchorNode?t.addRange(d):r&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Gu.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},Gu.prototype.showMultipleSelections=function(t){O(this.cm.display.cursorDiv,t.cursors),O(this.cm.display.selectionDiv,t.selection)},Gu.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Gu.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var n=t.getRangeAt(0).commonAncestorContainer;return M(this.div,n)},Gu.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&R(j(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gu.prototype.blur=function(){this.div.blur()},Gu.prototype.getField=function(){return this.div},Gu.prototype.supportsTouch=function(){return!0},Gu.prototype.receivedFocus=function(){var t=this,n=this;this.selectionInEditor()?setTimeout((function(){return t.pollSelection()}),20):oe(this.cm,(function(){return n.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}))},Gu.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Gu.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),n=this.cm;if(b&&f&&this.cm.display.gutterSpecs.length&&function(t){for(var n=t;n;n=n.parentNode)if(/CodeMirror-gutter-wrapper/.test(n.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Ku(n,t.anchorNode,t.anchorOffset),i=Ku(n,t.focusNode,t.focusOffset);r&&i&&oe(n,(function(){oo(n.doc,Ne(r,i),Z),(r.bad||i.bad)&&(n.curOp.selectionChanged=!0)}))}}},Gu.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,n,r,i=this.cm,e=i.display,o=i.doc.sel.primary(),u=o.from(),a=o.to();if(0==u.ch&&u.line>i.firstLine()&&(u=an(u.line-1,Xt(i.doc,u.line-1).length)),a.ch==Xt(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=an(a.line+1,0)),u.line<e.viewFrom||a.line>e.viewTo-1)return!1;u.line==e.viewFrom||0==(t=gi(i,u.line))?(n=rn(e.view[0].line),r=e.view[0].node):(n=rn(e.view[t].line),r=e.view[t-1].node.nextSibling);var s,c,f=gi(i,a.line);if(f==e.view.length-1?(s=e.viewTo-1,c=e.lineDiv.lastChild):(s=rn(e.view[f+1].line)-1,c=e.view[f+1].node.previousSibling),!r)return!1;for(var h=i.doc.splitLines(function(t,n,r,i,e){var o="",u=!1,a=t.doc.lineSeparator(),s=!1;function c(){u&&(o+=a,s&&(o+=a),u=s=!1)}function f(t){t&&(c(),o+=t)}function h(n){if(1==n.nodeType){var r=n.getAttribute("cm-text");if(r)return void f(r);var o,l=n.getAttribute("cm-marker");if(l){var v=t.findMarks(an(i,0),an(e+1,0),(g=+l,function(t){return t.id==g}));return void(v.length&&(o=v[0].find(0))&&f(Jt(t.doc,o.from,o.to).join(a)))}if("false"==n.getAttribute("contenteditable"))return;var d=/^(pre|div|p|li|table|br)$/i.test(n.nodeName);if(!/^br$/i.test(n.nodeName)&&0==n.textContent.length)return;d&&c();for(var p=0;p<n.childNodes.length;p++)h(n.childNodes[p]);/^(pre|p)$/i.test(n.nodeName)&&(s=!0),d&&(u=!0)}else 3==n.nodeType&&f(n.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var g}for(;h(n),n!=r;)n=n.nextSibling,s=!1;return o}(i,r,c,n,s)),l=Jt(i.doc,an(n,0),an(s,Xt(i.doc,s).text.length));h.length>1&&l.length>1;)if(tt(h)==tt(l))h.pop(),l.pop(),s--;else{if(h[0]!=l[0])break;h.shift(),l.shift(),n++}for(var v=0,d=0,p=h[0],g=l[0],b=Math.min(p.length,g.length);v<b&&p.charCodeAt(v)==g.charCodeAt(v);)++v;for(var m=tt(h),w=tt(l),y=Math.min(m.length-(1==h.length?v:0),w.length-(1==l.length?v:0));d<y&&m.charCodeAt(m.length-d-1)==w.charCodeAt(w.length-d-1);)++d;if(1==h.length&&1==l.length&&n==u.line)for(;v&&v>u.ch&&m.charCodeAt(m.length-d-1)==w.charCodeAt(w.length-d-1);)v--,d++;h[h.length-1]=m.slice(0,m.length-d).replace(/^\u200b+/,""),h[0]=h[0].slice(v).replace(/\u200b+$/,"");var k=an(n,v),T=an(s,l.length?tt(l).length-d:0);return h.length>1||h[0]||sn(k,T)?(ko(i.doc,h,k,T,"+input"),!0):void 0},Gu.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gu.prototype.reset=function(){this.forceCompositionEnd()},Gu.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Gu.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Gu.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||oe(this.cm,(function(){return bi(t.cm)}))},Gu.prototype.setUneditable=function(t){t.contentEditable="false"},Gu.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||ue(this.cm,Pu)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Gu.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Gu.prototype.onContextMenu=function(){},Gu.prototype.resetPosition=function(){},Gu.prototype.needsContentAttribute=!0;var Qu=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new V,this.hasSelection=!1,this.composing=null,this.resetting=!1};Qu.prototype.init=function(t){var n=this,r=this,i=this.cm;this.createField(t);var e=this.textarea;function o(t){if(!kt(i,t)){if(i.somethingSelected())Fu({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var n=Uu(i);Fu({lineWise:!0,text:n.text}),"cut"==t.type?i.setSelections(n.ranges,null,Z):(r.prevInput="",e.value=n.text.join("\n"),q(e))}"cut"==t.type&&(i.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(e.style.width="0px"),bt(e,"input",(function(){u&&a>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()})),bt(e,"paste",(function(t){kt(i,t)||ju(t,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())})),bt(e,"cut",o),bt(e,"copy",o),bt(t.scroller,"paste",(function(n){if(!Dr(t,n)&&!kt(i,n)){if(!e.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=n.clipboardData,e.dispatchEvent(o)}})),bt(t.lineSpace,"selectstart",(function(n){Dr(t,n)||Lt(n)})),bt(e,"compositionstart",(function(){var t=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:t,range:i.markText(t,i.getCursor("to"),{className:"CodeMirror-composing"})}})),bt(e,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Qu.prototype.createField=function(){this.wrapper=zu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Hu(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Qu.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},Qu.prototype.prepareSelection=function(){var t=this.cm,n=t.display,r=t.doc,i=Ai(t);if(t.options.moveInputWithCursor){var e=Jr(t,r.sel.primary().head,"div"),o=n.wrapper.getBoundingClientRect(),u=n.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,e.top+u.top-o.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,e.left+u.left-o.left))}return i},Qu.prototype.showSelection=function(t){var n=this.cm.display;O(n.cursorDiv,t.cursors),O(n.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},Qu.prototype.reset=function(t){if(!(this.contextMenuPending||this.composing&&t)){var n=this.cm;if(this.resetting=!0,n.somethingSelected()){this.prevInput="";var r=n.getSelection();this.textarea.value=r,n.state.focused&&q(this.textarea),u&&a>=9&&(this.hasSelection=r)}else t||(this.prevInput=this.textarea.value="",u&&a>=9&&(this.hasSelection=null));this.resetting=!1}},Qu.prototype.getField=function(){return this.textarea},Qu.prototype.supportsTouch=function(){return!1},Qu.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||R(j(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(t){}},Qu.prototype.blur=function(){this.textarea.blur()},Qu.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Qu.prototype.receivedFocus=function(){this.slowPoll()},Qu.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},Qu.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,(function r(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,r))}))},Qu.prototype.poll=function(){var t=this,n=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!n.state.focused||Pt(r)&&!i&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq)return!1;var e=r.value;if(e==i&&!n.somethingSelected())return!1;if(u&&a>=9&&this.hasSelection===e||w&&/[\uf700-\uf7ff]/.test(e))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu){var o=e.charCodeAt(0);if(8203!=o||i||(i=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(i.length,e.length);s<c&&i.charCodeAt(s)==e.charCodeAt(s);)++s;return oe(n,(function(){Pu(n,e.slice(s),i.length-s,null,t.composing?"*compose":null),e.length>1e3||e.indexOf("\n")>-1?r.value=t.prevInput="":t.prevInput=e,t.composing&&(t.composing.range.clear(),t.composing.range=n.markText(t.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Qu.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Qu.prototype.onKeyPress=function(){u&&a>=9&&(this.hasSelection=null),this.fastPoll()},Qu.prototype.onContextMenu=function(t){var n=this,r=n.cm,i=r.display,e=n.textarea;n.contextMenuPending&&n.contextMenuPending();var o=pi(r,t),c=i.scroller.scrollTop;if(o&&!l){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ue(r,oo)(r.doc,Ne(o),Z);var f,h=e.style.cssText,v=n.wrapper.style.cssText,d=n.wrapper.offsetParent.getBoundingClientRect();if(n.wrapper.style.cssText="position: static",e.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-d.top-5)+"px; left: "+(t.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(u?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(f=e.ownerDocument.defaultView.scrollY),i.input.focus(),s&&e.ownerDocument.defaultView.scrollTo(null,f),i.input.reset(),r.somethingSelected()||(e.value=n.prevInput=" "),n.contextMenuPending=b,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),u&&a>=9&&g(),E){Dt(t);var p=function(){wt(window,"mouseup",p),setTimeout(b,20)};bt(window,"mouseup",p)}else setTimeout(b,50)}function g(){if(null!=e.selectionStart){var t=r.somethingSelected(),o=""+(t?e.value:"");e.value="⇚",e.value=o,n.prevInput=t?"":"",e.selectionStart=1,e.selectionEnd=o.length,i.selForContextMenu=r.doc.sel}}function b(){if(n.contextMenuPending==b&&(n.contextMenuPending=!1,n.wrapper.style.cssText=v,e.style.cssText=h,u&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=c),null!=e.selectionStart)){(!u||u&&a<9)&&g();var t=0,o=function(){i.selForContextMenu==r.doc.sel&&0==e.selectionStart&&e.selectionEnd>0&&""==n.prevInput?ue(r,vo)(r):t++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},Qu.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},Qu.prototype.setUneditable=function(){},Qu.prototype.needsContentAttribute=!1,function(t){var n=t.optionHandlers;function r(r,i,e,o){t.defaults[r]=i,e&&(n[r]=o?function(t,n,r){r!=Du&&e(t,n,r)}:e)}t.defineOption=r,t.Init=Du,r("value","",(function(t,n){return t.setValue(n)}),!0),r("mode",null,(function(t,n){t.doc.modeOption=n,qe(t)}),!0),r("indentUnit",2,qe,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(t){Fe(t),Gr(t),bi(t)}),!0),r("lineSeparator",null,(function(t,n){if(t.doc.lineSep=n,n){var r=[],i=t.doc.first;t.doc.iter((function(t){for(var e=0;;){var o=t.text.indexOf(n,e);if(-1==o)break;e=o+n.length,r.push(an(i,o))}i++}));for(var e=r.length-1;e>=0;e--)ko(t.doc,n,r[e],an(r[e].line,r[e].ch+n.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),r!=Du&&t.refresh()})),r("specialCharPlaceholder",or,(function(t){return t.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(t,n){return t.getInputField().spellcheck=n}),!0),r("autocorrect",!1,(function(t,n){return t.getInputField().autocorrect=n}),!0),r("autocapitalize",!1,(function(t,n){return t.getInputField().autocapitalize=n}),!0),r("rtlMoveVisually",!k),r("wholeLineUpdateBefore",!0),r("theme","default",(function(t){Cu(t),ke(t)}),!0),r("keyMap","default",(function(t,n,r){var i=ru(n),e=r!=Du&&ru(r);e&&e.detach&&e.detach(t,i),i.attach&&i.attach(t,e||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Mu,!0),r("gutters",[],(function(t,n){t.display.gutterSpecs=we(n,t.options.lineNumbers),ke(t)}),!0),r("fixedGutter",!0,(function(t,n){t.display.gutters.style.left=n?li(t.display)+"px":"0",t.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(t){return Wi(t)}),!0),r("scrollbarStyle","native",(function(t){Yi(t),Wi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(t,n){t.display.gutterSpecs=we(t.options.gutters,n),ke(t)}),!0),r("firstLineNumber",1,ke,!0),r("lineNumberFormatter",(function(t){return t}),ke,!0),r("showCursorWhenSelecting",!1,Ti,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(t,n){"nocursor"==n&&(Ni(t),t.display.input.blur()),t.display.input.readOnlyChanged(n)})),r("screenReaderLabel",null,(function(t,n){t.display.input.screenReaderLabelChanged(n=""===n?null:n)})),r("disableInput",!1,(function(t,n){n||t.display.input.reset()}),!0),r("dragDrop",!0,Nu),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Ti,!0),r("singleCursorHeightPerLine",!0,Ti,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Fe,!0),r("addModeClass",!1,Fe,!0),r("pollInterval",100),r("undoDepth",200,(function(t,n){return t.doc.history.undoDepth=n})),r("historyEventDelay",1250),r("viewportMargin",10,(function(t){return t.refresh()}),!0),r("maxHighlightLength",1e4,Fe,!0),r("moveInputWithCursor",!0,(function(t,n){n||t.display.input.resetPosition()})),r("tabindex",null,(function(t,n){return t.display.input.getField().tabIndex=n||""})),r("autofocus",null),r("direction","ltr",(function(t,n){return t.doc.setDirection(n)}),!0),r("phrases",null)}(Ru),function(t){var n=t.optionHandlers,r=t.helpers={};t.prototype={constructor:t,focus:function(){_(this).focus(),this.display.input.focus()},setOption:function(t,r){var i=this.options,e=i[t];i[t]==r&&"mode"!=t||(i[t]=r,n.hasOwnProperty(t)&&ue(this,n[t])(this,r,e),yt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,n){this.state.keyMaps[n?"push":"unshift"](ru(t))},removeKeyMap:function(t){for(var n=this.state.keyMaps,r=0;r<n.length;++r)if(n[r]==t||n[r].name==t)return n.splice(r,1),!0},addOverlay:ae((function(n,r){var i=n.token?n:t.getMode(this.options,n);if(i.startState)throw new Error("Overlays may not be stateful.");(function(t,n,r){for(var i=0,e=r(n);i<t.length&&r(t[i])<=e;)i++;t.splice(i,0,n)})(this.state.overlays,{mode:i,modeSpec:n,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(t){return t.priority})),this.state.modeGen++,bi(this)})),removeOverlay:ae((function(t){for(var n=this.state.overlays,r=0;r<n.length;++r){var i=n[r].modeSpec;if(i==t||"string"==typeof t&&i.name==t)return n.splice(r,1),this.state.modeGen++,void bi(this)}})),indentLine:ae((function(t,n,r){"string"!=typeof n&&"number"!=typeof n&&(n=null==n?this.options.smartIndent?"smart":"prev":n?"add":"subtract"),on(this.doc,t)&&Iu(this,t,n,r)})),indentSelection:ae((function(t){for(var n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var e=n[i];if(e.empty())e.head.line>r&&(Iu(this,e.head.line,t,!0),r=e.head.line,i==this.doc.sel.primIndex&&Fi(this));else{var o=e.from(),u=e.to(),a=Math.max(r,o.line);r=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var s=a;s<r;++s)Iu(this,s,t);var c=this.doc.sel.ranges;0==o.ch&&n.length==c.length&&c[i].from().ch>0&&ro(this.doc,i,new Oe(o,c[i].to()),Z)}}})),getTokenAt:function(t,n){return Ln(this,t,n)},getLineTokens:function(t,n){return Ln(this,an(t),n,!0)},getTokenTypeAt:function(t){t=dn(this.doc,t);var n,r=wn(this,Xt(this.doc,t.line)),i=0,e=(r.length-1)/2,o=t.ch;if(0==o)n=r[2];else for(;;){var u=i+e>>1;if((u?r[2*u-1]:0)>=o)e=u;else{if(!(r[2*u+1]<o)){n=r[2*u+2];break}i=u+1}}var a=n?n.indexOf("overlay "):-1;return a<0?n:0==a?null:n.slice(0,a-1)},getModeAt:function(n){var r=this.doc.mode;return r.innerMode?t.innerMode(r,this.getTokenAt(n).state).mode:r},getHelper:function(t,n){return this.getHelpers(t,n)[0]},getHelpers:function(t,n){var i=[];if(!r.hasOwnProperty(n))return i;var e=r[n],o=this.getModeAt(t);if("string"==typeof o[n])e[o[n]]&&i.push(e[o[n]]);else if(o[n])for(var u=0;u<o[n].length;u++){var a=e[o[n][u]];a&&i.push(a)}else o.helperType&&e[o.helperType]?i.push(e[o.helperType]):e[o.name]&&i.push(e[o.name]);for(var s=0;s<e._global.length;s++){var c=e._global[s];c.pred(o,this)&&-1==$(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(t,n){var r=this.doc;return yn(this,(t=vn(r,null==t?r.first+r.size-1:t))+1,n).state},cursorCoords:function(t,n){var r=this.doc.sel.primary();return Jr(this,null==t?r.head:"object"==typeof t?dn(this.doc,t):t?r.from():r.to(),n||"page")},charCoords:function(t,n){return Xr(this,dn(this.doc,t),n||"page")},coordsChar:function(t,n){return ri(this,(t=Qr(this,t,n||"page")).left,t.top)},lineAtHeight:function(t,n){return t=Qr(this,{top:t,left:0},n||"page").top,en(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,n,r){var i,e=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,e=!0),i=Xt(this.doc,t)}else i=t;return Yr(this,i,{top:0,left:0},n||"page",r||e).top+(e?this.doc.height-Yn(i):0)},defaultTextHeight:function(){return ci(this.display)},defaultCharWidth:function(){return fi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,n,r,i,e){var o,u,a=this.display,s=(t=Jr(this,dn(this.doc,t))).bottom,c=t.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),a.sizer.appendChild(n),"over"==i)s=t.top;else if("above"==i||"near"==i){var f=Math.max(a.wrapper.clientHeight,this.doc.height),h=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==i||t.bottom+n.offsetHeight>f)&&t.top>n.offsetHeight?s=t.top-n.offsetHeight:t.bottom+n.offsetHeight<=f&&(s=t.bottom),c+n.offsetWidth>h&&(c=h-n.offsetWidth)}n.style.top=s+"px",n.style.left=n.style.right="","right"==e?(c=a.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):("left"==e?c=0:"middle"==e&&(c=(a.sizer.clientWidth-n.offsetWidth)/2),n.style.left=c+"px"),r&&(null!=(u=Ii(o=this,{left:c,top:s,right:c+n.offsetWidth,bottom:s+n.offsetHeight})).scrollTop&&Ui(o,u.scrollTop),null!=u.scrollLeft&&zi(o,u.scrollLeft))},triggerOnKeyDown:ae(gu),triggerOnKeyPress:ae(mu),triggerOnKeyUp:bu,triggerOnMouseDown:ae(Tu),execCommand:function(t){if(au.hasOwnProperty(t))return au[t].call(null,this)},triggerElectric:ae((function(t){_u(this,t)})),findPosH:function(t,n,r,i){var e=1;n<0&&(e=-1,n=-n);for(var o=dn(this.doc,t),u=0;u<n&&!(o=Vu(this.doc,o,e,r,i)).hitSide;++u);return o},moveH:ae((function(t,n){var r=this;this.extendSelectionsBy((function(i){return r.display.shift||r.doc.extend||i.empty()?Vu(r.doc,i.head,t,n,r.options.rtlMoveVisually):t<0?i.from():i.to()}),Y)})),deleteH:ae((function(t,n){var r=this.doc;this.doc.sel.somethingSelected()?r.replaceSelection("",null,"+delete"):iu(this,(function(i){var e=Vu(r,i.head,t,n,!1);return t<0?{from:e,to:i.head}:{from:i.head,to:e}}))})),findPosV:function(t,n,r,i){var e=1,o=i;n<0&&(e=-1,n=-n);for(var u=dn(this.doc,t),a=0;a<n;++a){var s=Jr(this,u,"div");if(null==o?o=s.left:s.left=o,(u=$u(this,s,e,r)).hitSide)break}return u},moveV:ae((function(t,n){var r=this,i=this.doc,e=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy((function(u){if(o)return t<0?u.from():u.to();var a=Jr(r,u.head,"div");null!=u.goalColumn&&(a.left=u.goalColumn),e.push(a.left);var s=$u(r,a,t,n);return"page"==n&&u==i.sel.primary()&&qi(r,Xr(r,s,"div").top-a.top),s}),Y),e.length)for(var u=0;u<i.sel.ranges.length;u++)i.sel.ranges[u].goalColumn=e[u]})),findWordAt:function(t){var n=Xt(this.doc,t.line).text,r=t.ch,i=t.ch;if(n){var e=this.getHelper(t,"wordChars");"before"!=t.sticky&&i!=n.length||!r?++i:--r;for(var o=n.charAt(r),u=ut(o,e)?function(t){return ut(t,e)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!ut(t)};r>0&&u(n.charAt(r-1));)--r;for(;i<n.length&&u(n.charAt(i));)++i}return new Oe(an(t.line,r),an(t.line,i))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),yt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R(P(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ae((function(t,n){Pi(this,t,n)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Mr(this)-this.display.barHeight,width:t.scrollWidth-Mr(this)-this.display.barWidth,clientHeight:Br(this),clientWidth:Rr(this)}},scrollIntoView:ae((function(t,n){null==t?(t={from:this.doc.sel.primary().head,to:null},null==n&&(n=this.options.cursorScrollMargin)):"number"==typeof t?t={from:an(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=n||0,null!=t.from.line?function(t,n){ji(t),t.curOp.scrollToPos=n}(this,t):_i(this,t.from,t.to,t.margin)})),setSize:ae((function(t,n){var r=this,i=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=i(t)),null!=n&&(this.display.wrapper.style.height=i(n)),this.options.lineWrapping&&$r(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,(function(t){if(t.widgets)for(var n=0;n<t.widgets.length;n++)if(t.widgets[n].noHScroll){mi(r,e,"widget");break}++e})),this.curOp.forceUpdate=!0,yt(this,"refresh",this)})),operation:function(t){return oe(this,t)},startOperation:function(){return Xi(this)},endOperation:function(){return Ji(this)},refresh:ae((function(){var t=this.display.cachedTextHeight;bi(this),this.curOp.forceUpdate=!0,Gr(this),Pi(this,this.doc.scrollLeft,this.doc.scrollTop),pe(this.display),(null==t||Math.abs(t-ci(this.display))>.5||this.options.lineWrapping)&&di(this),yt(this,"refresh",this)})),swapDoc:ae((function(t){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Ue(this,t),Gr(this),this.display.input.reset(),Pi(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,dr(this,"swapDoc",this,n),n})),phrase:function(t){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,t)?n[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}},Et(t),t.registerHelper=function(n,i,e){r.hasOwnProperty(n)||(r[n]=t[n]={_global:[]}),r[n][i]=e},t.registerGlobalHelper=function(n,i,e,o){t.registerHelper(n,i,o),r[n]._global.push({pred:e,val:o})}}(Ru);var Xu="iter insert remove copy getEditor constructor".split(" ");for(var Ju in Fo.prototype)Fo.prototype.hasOwnProperty(Ju)&&$(Xu,Ju)<0&&(Ru.prototype[Ju]=function(t){return function(){return t.apply(this.doc,arguments)}}(Fo.prototype[Ju]));return Et(Fo),Ru.inputStyles={textarea:Qu,contenteditable:Gu},Ru.defineMode=function(t){Ru.defaults.mode||"null"==t||(Ru.defaults.mode=t),zt.apply(this,arguments)},Ru.defineMIME=function(t,n){Ht[t]=n},Ru.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Ru.defineMIME("text/plain","null"),Ru.defineExtension=function(t,n){Ru.prototype[t]=n},Ru.defineDocExtension=function(t,n){Fo.prototype[t]=n},Ru.fromTextArea=function(t,n){if((n=n?H(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var r=R(j(t));n.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function i(){t.value=a.getValue()}var e;if(t.form&&(bt(t.form,"submit",i),!n.leaveSubmitMethodAlone)){var o=t.form;e=o.submit;try{var u=o.submit=function(){i(),o.submit=e,o.submit(),o.submit=u}}catch(t){}}n.finishInit=function(r){r.save=i,r.getTextArea=function(){return t},r.toTextArea=function(){r.toTextArea=isNaN,i(),t.parentNode.removeChild(r.getWrapperElement()),t.style.display="",t.form&&(wt(t.form,"submit",i),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=e))}},t.style.display="none";var a=Ru((function(n){return t.parentNode.insertBefore(n,t.nextSibling)}),n);return a},function(t){t.off=wt,t.on=bt,t.wheelEventPixels=xe,t.Doc=Fo,t.splitLines=Ft,t.countColumn=z,t.findColumn=Q,t.isWordChar=ot,t.Pass=W,t.signal=yt,t.Line=Jn,t.changeEnd=Me,t.scrollbarModel=Ki,t.Pos=an,t.cmpPos=sn,t.modes=Ut,t.mimeModes=Ht,t.resolveMode=Vt,t.getMode=$t,t.modeExtensions=Gt,t.extendMode=Wt,t.copyState=Zt,t.startState=Yt,t.innerMode=Kt,t.commands=au,t.keyMap=Ko,t.keyName=nu,t.isModifierKey=Jo,t.lookupKey=Xo,t.normalizeKeyMap=Qo,t.StringStream=Qt,t.SharedTextMarker=Ro,t.TextMarker=No,t.LineWidget=Do,t.e_preventDefault=Lt,t.e_stopPropagation=xt,t.e_stop=Dt,t.addClass=B,t.contains=M,t.rmClass=C,t.keyNames=$o}(Ru),Ru.version="5.65.18",Ru}(),window,l=function(t){return function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=65)}([function(t,n,r){var i=r(3),e=r.n(i),o=r(8),u=r.n(o),a=r(9),s=r.n(a),c=r(4),f=r.n(c),h=r(5),l=r.n(h),v=r(6),d=r.n(v),p=r(16),g=r.n(p),b=r(13),m=r.n(b),w=/\u200B/g,y=window.getComputedStyle,k=function(t){return t&&t.nodeType===Node.TEXT_NODE},T=function(t){return t&&t.nodeType===Node.ELEMENT_NODE},A=function(t){return T(t)?t.tagName:"TEXT"},E=function(t){var n;return T(t)?n=t.textContent.replace(w,"").length:k(t)&&(n=t.nodeValue.replace(w,"").length),n},L=function(t){var n,r,i,e=t.parentNode.childNodes;for(n=0,r=e.length;n<r;n+=1)if(e[n]===t){i=n;break}return i},x=function(t,n){var r;return k(t)?r=t:t.childNodes.length&&n>=0&&(r=t.childNodes[n]),r},C=function(t,n,r){for(var i,e,o=t+"Sibling";n&&!n[o]&&(i=A(n.parentNode))!==r&&"BODY"!==i;)n=n.parentNode;return n[o]&&(e=n[o]),e},D=function(t,n,r){for(;t.parentNode&&!n(t.parentNode)&&(t=t.parentNode,!r||!r(t)););return n(t.parentNode)?t:null},O=function(t,n){return s()(n)?D(t,(function(t){return n===A(t)})):D(t,(function(t){return n===t}))},S=function(t,n,r){var i,e=t+"Sibling";return(n=O(n,r))&&n[e]&&(i=n[e]),i},N=function(t){var n={};n.tagName=t.nodeName,t.id&&(n.id=t.id);var r=t.className.trim();return r&&(n.className=r),n},M=function(t,n,r){var i=n;if(i&&t===i.parentNode)for(;i!==r;){var e=i.nextSibling;t.removeChild(i),i=e}},R=function(t){return!!t&&("UL"===t.nodeName||"OL"===t.nodeName)},B=function(t,n){t.hasChildNodes()&&(e()(t.childNodes).forEach((function(){n.appendChild(t.firstChild)})),n.normalize()),t.parentNode&&t.parentNode.removeChild(t)},I=function(t,n){if("SPAN"!==t.nodeName)for(var r=t.parentNode,i=t;i.childNodes&&1===i.childNodes.length&&!k(i.firstChild)&&"SPAN"!==(i=i.firstChild).nodeName;)if(i.nodeName===n){var e=document.createElement(n);return B(i,i.parentNode),r.replaceChild(e,t),e.appendChild(t),e}return t},q=function(t,n,r){var i=I(t,r);if(i.nodeName===r)for(var e=I(n,r),o=i,u=i.nextSibling;u;){var a=u.nextSibling;if((u=I(u,r)).nodeName===r?o?B(u,o):o=u:o=null,u===e)break;u=a}};function F(t,n){var r=e()(t.querySelectorAll(n));return r.length?r:[]}function P(t,n,r){var i;for(r=r||document,i=s()(n)?function(t){return m()(t,n)}:function(t){return t===n};t&&t!==r;){if(T(t)&&i(t))return t;t=t.parentNode}return null}function j(t,n){for(var r=[];t&&t!==document;)(t=P(t.parentNode,n))&&r.push(t);return r}function _(t,n){var r;return r=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.childNodes:t.children,e()(r).filter((function(t){return m()(t,n)}))}function U(t){t.parentNode&&t.parentNode.removeChild(t)}n.a={getNodeName:A,isTextNode:k,isElemNode:T,isBlockNode:function(t){return/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|DETAILS|DIALOG|DD|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[\d]|HEADER|HGROUP|HR|LI|MAIN|NAV|OL|P|PRE|SECTION|UL)$/gi.test(this.getNodeName(t))},getTextLength:E,getOffsetLength:function(t){var n;return T(t)?n=t.childNodes.length:k(t)&&(n=t.nodeValue.replace(w,"").length),n},getPrevOffsetNodeUntil:function(t,n,r){return n>0?x(t,n-1):C("previous",t,r)},getNodeOffsetOfParent:L,getChildNodeByOffset:x,getNodeWithDirectionUntil:C,containsNode:function(t,n){for(var r=document.createTreeWalker(t,4,null,!1),i=t===n;!i&&r.nextNode();)i=r.currentNode===n;return i},getTopPrevNodeUnder:function(t,n){return S("previous",t,n)},getTopNextNodeUnder:function(t,n){return S("next",t,n)},getParentUntilBy:D,getParentUntil:O,getTopBlockNode:function(t){return O(t,"BODY")},getPrevTextNode:function(t){for(t=t.previousSibling||t.parentNode;!k(t)&&"BODY"!==A(t);)if(t.previousSibling)for(t=t.previousSibling;t.lastChild;)t=t.lastChild;else t=t.parentNode;return"BODY"===A(t)&&(t=null),t},findOffsetNode:function(t,n,r){var i,e=[],o="",a=0;if(!n.length)return e;for(var s=n.shift(),c=document.createTreeWalker(t,4,null,!1);c.nextNode();){for(o=c.currentNode.nodeValue||"",r&&(o=r(o)),i=a+o.length;i>=s;){if(e.push({container:c.currentNode,offsetInContainer:s-a,offset:s}),!n.length)return e;s=n.shift()}a=i}do{e.push({container:c.currentNode,offsetInContainer:o.length,offset:s}),s=n.shift()}while(!u()(s));return e},getPath:function(t,n){for(var r=[];t&&t!==n;)T(t)&&r.unshift(N(t)),t=t.parentNode;return r},getNodeInfo:N,getTableCellByDirection:function(t,n){var r=null;return u()(n)||"next"!==n&&"previous"!==n||(r="next"===n?t.nextElementSibling:t.previousElementSibling),r},getSiblingRowCellByDirection:function(t,n,r){var i,e,o,a,s,c=null;return u()(n)||"next"!==n&&"previous"!==n||t&&("next"===n?(e=t.parentNode&&t.parentNode.nextSibling,s=(a=(o=j(t,"thead"))[0]&&o[0].nextSibling)&&"TBODY"===A(a),i=0):(e=t.parentNode&&t.parentNode.previousSibling,s=(a=(o=j(t,"tbody"))[0]&&o[0].previousSibling)&&"THEAD"===A(a),i=t.parentNode.childNodes.length-1),!u()(r)&&r||(i=L(t)),e?c=_(e,"td,th")[i]:o[0]&&s&&(c=F(a,"td,th")[i])),c},isMDSupportInlineNode:function(t){return/^(A|B|BR|CODE|DEL|EM|I|IMG|S|SPAN|STRONG)$/gi.test(t.nodeName)},isStyledNode:function(t){return/^(A|ABBR|ACRONYM|B|BDI|BDO|BIG|CITE|CODE|DEL|DFN|EM|I|INS|KBD|MARK|Q|S|SAMP|SMALL|SPAN|STRONG|SUB|SUP|U|VAR)$/gi.test(t.nodeName)},removeChildFromStartToEndNode:M,removeNodesByDirection:function(t,n,r){for(var i=n;i!==t;){var e=i.parentNode,o=i.nextSibling,u=i.previousSibling;!r&&o?M(e,o,null):r&&u&&M(e,e.childNodes[0],i),i=e}},getLeafNode:function(t){for(var n=t;n.childNodes&&n.childNodes.length;){var r=n.firstChild;n=k(r)&&!E(r)&&r.nextSibling||r}return n},isInsideButtonBox:function(t,n,r){var i=parseInt(t.left,10),e=parseInt(t.top,10),o=parseInt(t.width,10),u=parseInt(t.height,10);return n>=i&&n<=i+o&&r>=e&&r<=e+u},isListNode:R,isFirstListItem:function(t){return"LI"===t.nodeName&&t===t.parentNode.firstChild},isFirstLevelListItem:function(t){return"LI"===t.nodeName&&!R(t.parentNode.parentNode)},mergeNode:B,createHorizontalRule:function(){var t=document.createElement("div"),n=document.createElement("hr");return t.setAttribute("contenteditable",!1),n.setAttribute("contenteditable",!1),t.appendChild(n),t},createEmptyLine:function(){var t=document.createElement("div");return t.appendChild(document.createElement("br")),t},changeTagOrder:I,mergeSameNodes:q,optimizeRange:function(t,n){var r=t.commonAncestorContainer,i=t.startContainer,e=t.endContainer;if(!t.collapsed){var o=null;if(i!==e){var u=O(i,r),a=O(e,r);u&&a&&q(u,a,n),o=r}else k(i)&&(o=i.parentNode);if(o&&o.nodeName===n){var s,c=o.previousSibling;c&&(s=I(c)).nodeName===n&&B(o,s);var f=o.nextSibling;f&&(s=I(f)).nodeName===n&&B(s,o)}}},getAllTextNode:function(t){for(var n=document.createTreeWalker(t,4,null,!1),r=[];n.nextNode();){var i=n.currentNode;k(i)&&r.push(i)}return r},isCellNode:function(t){return!!t&&("TD"===t.nodeName||"TH"===t.nodeName)},getLastNodeBy:function(t,n){for(var r=t&&t.lastChild;r&&n(r);)r=r.lastChild;return r},getParentNodeBy:function(t,n){for(;t&&n(t.parentNode,t);)t=t.parentNode;return t},getSiblingNodeBy:function(t,n,r){for(var i=n+"Sibling";t&&r(t[i],t);)t=t[i];return t},createElementWith:function(t,n){var r=document.createElement("div");s()(t)?r.innerHTML=t:r.appendChild(t);var i=r.firstChild;return n&&n.appendChild(i),i},findAll:F,isContain:function(t,n){return t!==n&&t.contains(n)},closest:P,parent:function(t,n){var r=t.parentNode;return n?r&&m()(r,n)?r:null:r},parents:j,parentsUntil:function(t,n){for(var r=[];t.parentNode&&!m()(t.parentNode,n);)(t=t.parentNode)&&r.push(t);return r},children:_,append:function(t,n){if(s()(n))t.insertAdjacentHTML("beforeEnd",n);else for(var r=0,i=(n=n.length?e()(n):[n]).length;r<i;r+=1)t.appendChild(n[r])},prepend:function(t,n){if(s()(n))t.insertAdjacentHTML("afterBegin",n);else for(var r=(n=n.length?e()(n):[n]).length-1;r>=0;r-=1)t.insertBefore(n[r],t.firstChild)},insertBefore:function(t,n){var r=n.parentNode;r&&r.insertBefore(t,n)},insertAfter:function(t,n){var r=n.parentNode;r&&r.insertBefore(t,n.nextSibling)},replaceWith:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){t.insertAdjacentHTML("afterEnd",n),t.parentNode.removeChild(t)}))},wrap:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){var r=document.createElement(n);t.parentNode.insertBefore(r,t),r.appendChild(t)}))},wrapInner:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){var r=document.createElement(n);for(t.appendChild(r);t.firstChild!==r;)r.appendChild(t.firstChild)}))},unwrap:function(t){for(var n=[];t.firstChild;)n.push(t.firstChild),t.parentNode.insertBefore(t.firstChild,t);return U(t),n},remove:U,empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},setOffset:function(t,n){var r=t.parentNode.getBoundingClientRect(),i=r.top,e=r.left;f()(t,{top:n.top-i-document.body.scrollTop+"px"}),f()(t,{left:n.left-e-document.body.scrollLeft+"px"})},getOffset:function(t,n){void 0===n&&(n="document");var r=0,i=0;do{r+=t.offsetTop||0,i+=t.offsetLeft||0,t=t.offsetParent}while(t&&!m()(t,n));return{top:r,left:i}},getOuterWidth:function(t,n){var r=t.offsetWidth;if(n){var i=y(t),e=i.marginRight;r+=parseInt(i.marginLeft,10)+parseInt(e,10)}return r},getOuterHeight:function(t,n){var r=t.offsetHeight;if(n){var i=y(t),e=i.marginBottom;r+=parseInt(i.marginTop,10)+parseInt(e,10)}return r},toggleClass:function(t,n,r){u()(r)&&(r=!g()(t,n)),(r?l.a:d.a)(t,n)},finalizeHtml:function(t,n){var r;if(n)r=t.innerHTML;else{for(var i=document.createDocumentFragment(),o=e()(t.childNodes),u=o.length,a=0;a<u;a+=1)i.appendChild(o[a]);r=i}return r},getFragmentReplacedByNewlineToBr:function(t){var n=document.createDocumentFragment(),r=t.split("\n");return r.forEach((function(t,i){var e=document.createTextNode(t);n.appendChild(e),i<r.length-1&&n.appendChild(document.createElement("br"))})),n}}},function(t,n,r){var i=r(7),e=r.n(i),o=function(){function t(t,n,r){this.name=t,this.type=n,r&&this.setKeyMap(r)}var n=t.prototype;return n.getName=function(){return this.name},n.getType=function(){return this.type},n.isMDType=function(){return this.type===t.TYPE.MD},n.isWWType=function(){return this.type===t.TYPE.WW},n.isGlobalType=function(){return this.type===t.TYPE.GB},n.setKeyMap=function(t,n){this.keyMap=[t,n]},t}();o.factory=function(t,n){var r;"markdown"===t?r=o.TYPE.MD:"wysiwyg"===t?r=o.TYPE.WW:"global"===t&&(r=o.TYPE.GB);var i=new o(n.name,r);return e()(i,n),i},o.TYPE={MD:0,WW:1,GB:2};var u=o,a=r(12),s=r(24),c=a.b?1:0,f=function(){function t(t,n){void 0===n&&(n={}),this._command=new s.a,this._mdCommand=new s.a,this._wwCommand=new s.a,this._options=e()({useCommandShortcut:!0},n),this.base=t,this.keyMapCommand={},this._initEvent()}var n=t.prototype;return n._addCommandBefore=function(t){var n={command:t};return this.base.eventManager.emit("addCommandBefore",n),n.command||t},n.addCommand=function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),e=1;e<r;e++)i[e-1]=arguments[e];i.length&&(n=t.command.apply(t,[n].concat(i)));var o,u=(n=this._addCommandBefore(n)).getName();return n.isMDType()?o=this._mdCommand:n.isWWType()?o=this._wwCommand:n.isGlobalType()&&(o=this._command),o.set(u,n),n.keyMap&&(this.keyMapCommand[n.keyMap[c]]=u),n},n._initEvent=function(){var t=this;this.base.eventManager.listen("command",(function(){t.exec.apply(t,arguments)})),this.base.eventManager.listen("keyMap",(function(n){if(t._options.useCommandShortcut){var r=t.keyMapCommand[n.keyMap];r&&(n.data.preventDefault(),t.exec(r))}}))},n.exec=function(t){var n,r,i=this.base;if((n=this._command.get(t))||(this.base.isMarkdownMode()?(n=this._mdCommand.get(t),i=this.base.mdEditor):(n=this._wwCommand.get(t),i=this.base.wwEditor)),n){for(var e,o=arguments.length,u=new Array(o>1?o-1:0),a=1;a<o;a++)u[a-1]=arguments[a];u.unshift(i),r=(e=n).exec.apply(e,u)}return r},t}();f.command=function(t,n){var r=u.factory(t,n.name,n.keyMap);return e()(r,n),r},n.a=f},function(t,n,r){function i(t){return t.sourcepos[0][0]}function e(t){return t.sourcepos[1][0]}function o(t){return t.sourcepos[0][1]}function u(t){return t.sourcepos[1][1]}function a(t){var n=t.type;return"codeBlock"===n||"paragraph"===n}function s(t){var n=t.type;return"htmlBlock"===n||"htmlInline"===n}function c(t){var n=t.type;return"strike"===n||"strong"===n||"emph"===n}function f(t){return"item"===t.type}function h(t){var n=t.type;return"tableCell"===n||"tableDelimCell"===n}function l(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":return!0;default:return!1}}function v(t,n,r){for(void 0===r&&(r=!0),t=r?t:t.parent;t&&"document"!==t.type;){if(n(t))return t;t=t.parent}return null}function d(t,n,r){for(void 0===r&&(r=!0),t=r?t:t.parent;t&&"document"!==t.type;)n(t),t=t.parent}function p(t,n){return{line:t.line,ch:t.ch+n}}function g(t,n){return{line:t.line,ch:n}}r.d(n,"f",(function(){return i})),r.d(n,"d",(function(){return e})),r.d(n,"e",(function(){return o})),r.d(n,"c",(function(){return u})),r.d(n,"j",(function(){return a})),r.d(n,"g",(function(){return s})),r.d(n,"k",(function(){return c})),r.d(n,"i",(function(){return f})),r.d(n,"l",(function(){return h})),r.d(n,"h",(function(){return l})),r.d(n,"b",(function(){return v})),r.d(n,"n",(function(){return d})),r.d(n,"a",(function(){return p})),r.d(n,"m",(function(){return g})),r(12)},function(t,n,r){var i=r(21);t.exports=function(t){var n;try{n=Array.prototype.slice.call(t)}catch(r){n=[],i(t,(function(t){n.push(t)}))}return n}},function(t,n,r){var i=r(9),e=r(26);t.exports=function(t,n,r){var o=t.style;i(n)?o[n]=r:e(n,(function(t,n){o[n]=t}))}},function(t,n,r){var i=r(26),e=r(14),o=r(33),u=r(39);t.exports=function(t){var n,r=Array.prototype.slice.call(arguments,1),a=[];t.classList?i(r,(function(n){t.classList.add(n)})):((n=o(t))&&(r=[].concat(n.split(/\s+/),r)),i(r,(function(t){e(t,a)<0&&a.push(t)})),u(t,a))}},function(t,n,r){var i=r(21),e=r(14),o=r(33),u=r(39);t.exports=function(t){var n,r,a=Array.prototype.slice.call(arguments,1),s=t.classList;s?i(a,(function(t){s.remove(t)})):(n=o(t).split(/\s+/),r=[],i(n,(function(t){e(t,a)<0&&r.push(t)})),u(t,r))}},function(t){t.exports=function(t,n){var r,i,e,o,u=Object.prototype.hasOwnProperty;for(e=1,o=arguments.length;e<o;e+=1)for(i in r=arguments[e])u.call(r,i)&&(t[i]=r[i]);return t}},function(t){t.exports=function(t){return void 0===t}},function(t){t.exports=function(t){return"string"==typeof t||t instanceof String}},function(t){t.exports=function(t,n,r){var i;for(i in r=r||null,t)if(t.hasOwnProperty(i)&&!1===n.call(r,t[i],i,t))break}},function(t){var n,r,i,e,o,u,a,s,c,f,h={chrome:!1,firefox:!1,safari:!1,msie:!1,edge:!1,others:!1,version:0};"undefined"!=typeof window&&window.navigator&&(e=(i=window.navigator).appName.replace(/\s/g,"_"),o=i.userAgent,u=/MSIE\s([0-9]+[.0-9]*)/,a=/Trident.*rv:11\./,s=/Edge\/(\d+)\./,c={firefox:/Firefox\/(\d+)\./,chrome:/Chrome\/(\d+)\./,safari:/Version\/([\d.]+).*Safari\/(\d+)/},(f={Microsoft_Internet_Explorer:function(){var t=o.match(u);t?(h.msie=!0,h.version=parseFloat(t[1])):h.others=!0},Netscape:function(){var t=!1;if(a.exec(o))h.msie=!0,h.version=11,t=!0;else if(s.exec(o))h.edge=!0,h.version=o.match(s)[1],t=!0;else for(n in c)if(c.hasOwnProperty(n)&&(r=o.match(c[n]))&&r.length>1){h[n]=t=!0,h.version=parseFloat(r[1]||0);break}t||(h.others=!0)}})[e]&&f[e]()),t.exports=h},function(t,n,r){r.d(n,"b",(function(){return a})),r.d(n,"d",(function(){return s})),r.d(n,"a",(function(){return c})),r.d(n,"c",(function(){return h}));var i=r(8),e=r.n(i),o=r(43),u=r.n(o),a=/Mac/.test(navigator.platform);function s(){u()("editor","UA-129966929-1")}function c(t,n){return-1!==t.indexOf(n)}var f=["rel","target","contenteditable","hreflang","type"];function h(t){if(!t)return null;var n={};return f.forEach((function(r){e()(t[r])||(n[r]=t[r])})),n}},function(t,n,r){var i=r(14),e=r(3),o=Element.prototype,u=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||function(t){return i(this,e((this.document||this.ownerDocument).querySelectorAll(t)))>-1};t.exports=function(t,n){return u.call(t,n)}},function(t,n,r){var i=r(17);t.exports=function(t,n,r){var e,o;if(r=r||0,!i(n))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(n,t,r);for(o=n.length,e=r;r>=0&&e<o;e+=1)if(n[e]===t)return e;return-1}},function(n){n.exports=t},function(t,n,r){var i=r(14),e=r(33);t.exports=function(t,n){var r;return t.classList?t.classList.contains(n):(r=e(t).split(/\s+/),i(n,r)>-1)}},function(t){t.exports=function(t){return t instanceof Array}},function(t,n,r){r.d(n,"h",(function(){return s})),r.d(n,"b",(function(){return c})),r.d(n,"f",(function(){return f})),r.d(n,"c",(function(){return h})),r.d(n,"e",(function(){return l})),r.d(n,"g",(function(){return v})),r.d(n,"a",(function(){return d})),r.d(n,"d",(function(){return g}));var i=r(12),e=r(2),o=["list","blockQuote"],u=["UL","OL","BLOCKQUOTE"],a=["TR","TH","TBODY","TD"];function s(t){return!Object(i.a)(o,t.type)}function c(t,n,r,i){var e=(t-n)/r;return e<1?e*i:i}function f(t){for(var n=document.querySelector('[data-nodeid="'+t.id+'"]');!n||Object(i.a)(a,t.type)||Object(e.k)(t);)t=t.parent,n=document.querySelector('[data-nodeid="'+t.id+'"]');return function(t){for(var n=t.mdNode,r=t.node;Object(i.a)(o,n.type)&&n.firstChild;)n=n.firstChild,r=r.firstElementChild;return{mdNode:n,node:r}}(function(t){for(var n=t;t&&"document"!==t;){if("item"===t.type){n=t;break}t=t.parent}return{mdNode:n,node:document.querySelector('[data-nodeid="'+n.id+'"]')}}(t))}function h(t,n){var r=Object(e.f)(t),i=Object(e.d)(t),o=n.lineInfo(r-1).handle.height,u=n.heightAtLine(i,"local")-n.heightAtLine(r-1,"local");return u<=0?o:u+l(n,Object(e.d)(t))}function l(t,n,r){void 0===r&&(r=Number.MAX_VALUE);var i=t.lineInfo(n);if(!i)return 0;for(var e=i.handle,o=0;n<=r&&!e.text.trim();)o+=e.height,e=t.lineInfo(n+=1).handle;return o}function v(t,n){for(var r=0;t&&t!==n&&(Object(i.a)(u,t.tagName)||(r+=t.offsetTop),t.offsetParent!==n.offsetParent);)t=t.parentElement;return r}function d(t,n){for(var r=n,i=null;r;){var e=r.firstElementChild;if(!e)break;i=r,r=p(e,t,v(r,n))}var o=r||i;return o===n?null:o}function p(t,n,r){return t&&n>r+t.offsetTop?p(t.nextElementSibling,n,r)||t:null}function g(t){var n=t.latestScrollTop,r=t.targetScrollTop,i=t.sourceScrollTop;return null===n?r:n<t.scrollTop?Math.max(r,i):Math.min(r,i)}},function(t,n,r){var i=r(9),e=r(26),o=r(40);function u(t,n,r,i){function u(n){r.call(i||t,n||window.event)}"addEventListener"in t?t.addEventListener(n,u):"attachEvent"in t&&t.attachEvent("on"+n,u),function(t,n,r,i){var u=o(t,n),a=!1;e(u,(function(t){return t.handler!==r||(a=!0,!1)})),a||u.push({handler:r,wrappedHandler:i})}(t,n,r,u)}t.exports=function(t,n,r,o){i(n)?e(n.split(/\s+/g),(function(n){u(t,n,r,o)})):e(n,(function(n,i){u(t,i,n,r)}))}},function(t,n,r){var i=r(9),e=r(26),o=r(40);function u(t,n,r){var i,u=o(t,n);r?(e(u,(function(e,o){return r!==e.handler||(a(t,n,e.wrappedHandler),i=o,!1)})),u.splice(i,1)):(e(u,(function(r){a(t,n,r.wrappedHandler)})),u.splice(0,u.length))}function a(t,n,r){"removeEventListener"in t?t.removeEventListener(n,r):"detachEvent"in t&&t.detachEvent("on"+n,r)}t.exports=function(t,n,r){i(n)?e(n.split(/\s+/g),(function(n){u(t,n,r)})):e(n,(function(n,r){u(t,r,n)}))}},function(t){t.exports=function(t,n,r){var i=0,e=t.length;for(r=r||null;i<e&&!1!==n.call(r,t[i],i,t);i+=1);}},function(t,n){!function(t,n){for(var r in n)t[r]=n[r]}(n,function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="/dist",r(r.s=11)}([function(t,n,r){r.r(n),r.d(n,"__extends",(function(){return e})),r.d(n,"__assign",(function(){return o})),r.d(n,"__rest",(function(){return u})),r.d(n,"__decorate",(function(){return a})),r.d(n,"__param",(function(){return s})),r.d(n,"__metadata",(function(){return c})),r.d(n,"__awaiter",(function(){return f})),r.d(n,"__generator",(function(){return h})),r.d(n,"__createBinding",(function(){return l})),r.d(n,"__exportStar",(function(){return v})),r.d(n,"__values",(function(){return d})),r.d(n,"__read",(function(){return p})),r.d(n,"__spread",(function(){return g})),r.d(n,"__spreadArrays",(function(){return b})),r.d(n,"__await",(function(){return m})),r.d(n,"__asyncGenerator",(function(){return w})),r.d(n,"__asyncDelegator",(function(){return y})),r.d(n,"__asyncValues",(function(){return k})),r.d(n,"__makeTemplateObject",(function(){return T})),r.d(n,"__importStar",(function(){return A})),r.d(n,"__importDefault",(function(){return E})),r.d(n,"__classPrivateFieldGet",(function(){return L})),r.d(n,"__classPrivateFieldSet",(function(){return x}));
|
|
1
|
+
import{r as t,c as n,f as r,h as i,H as e,d as o}from"./p-b0368f88.js";import{k as u,g as a,s}from"./p-ccc4a1ea.js";import{c}from"./p-635bb4b3.js";import{c as f,g as h}from"./p-1ee561ba.js";var l,v={exports:{}};v.exports=function(){var t=navigator.userAgent,n=navigator.platform,r=/gecko\/\d/i.test(t),i=/MSIE \d/.test(t),e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),u=i||e||o,a=u&&(i?document.documentMode||6:+(o||e)[1]),s=!o&&/WebKit\//.test(t),c=s&&/Qt\/\d+\.\d+/.test(t),f=!o&&/Chrome\/(\d+)/.exec(t),h=f&&+f[1],l=/Opera\//.test(t),v=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=v&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),b=/Android/.test(t),m=g||b||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),w=g||/Mac/.test(n),y=/\bCrOS\b/.test(t),k=/win/i.test(n),T=l&&t.match(/Version\/(\d*\.\d*)/);T&&(T=Number(T[1])),T&&T>=15&&(l=!1,s=!0);var A=w&&(c||l&&(null==T||T<12.11)),E=r||u&&a>=9;function L(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var x,C=function(t,n){var r=t.className,i=L(n).exec(r);if(i){var e=r.slice(i.index+i[0].length);t.className=r.slice(0,i.index)+(e?i[1]+e:"")}};function D(t){for(var n=t.childNodes.length;n>0;--n)t.removeChild(t.firstChild);return t}function O(t,n){return D(t).appendChild(n)}function S(t,n,r,i){var e=document.createElement(t);if(r&&(e.className=r),i&&(e.style.cssText=i),"string"==typeof n)e.appendChild(document.createTextNode(n));else if(n)for(var o=0;o<n.length;++o)e.appendChild(n[o]);return e}function N(t,n,r,i){var e=S(t,n,r,i);return e.setAttribute("role","presentation"),e}function M(t,n){if(3==n.nodeType&&(n=n.parentNode),t.contains)return t.contains(n);do{if(11==n.nodeType&&(n=n.host),n==t)return!0}while(n=n.parentNode)}function R(t){var n,r=t.ownerDocument||t;try{n=t.activeElement}catch(t){n=r.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function B(t,n){var r=t.className;L(n).test(r)||(t.className+=(r?" ":"")+n)}function I(t,n){for(var r=t.split(" "),i=0;i<r.length;i++)r[i]&&!L(r[i]).test(n)&&(n+=" "+r[i]);return n}x=document.createRange?function(t,n,r,i){var e=document.createRange();return e.setEnd(i||t,r),e.setStart(t,n),e}:function(t,n,r){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",n),i};var q=function(t){t.select()};function F(t){return t.display.wrapper.ownerDocument}function P(t){return j(t.display.wrapper)}function j(t){return t.getRootNode?t.getRootNode():t.ownerDocument}function _(t){return F(t).defaultView}function U(t){var n=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,n)}}function H(t,n,r){for(var i in n||(n={}),t)!t.hasOwnProperty(i)||!1===r&&n.hasOwnProperty(i)||(n[i]=t[i]);return n}function z(t,n,r,i,e){null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length);for(var o=i||0,u=e||0;;){var a=t.indexOf("\t",o);if(a<0||a>=n)return u+(n-o);u+=a-o,u+=r-u%r,o=a+1}}g?q=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:u&&(q=function(t){try{t.select()}catch(t){}});var V=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};function $(t,n){for(var r=0;r<t.length;++r)if(t[r]==n)return r;return-1}V.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},V.prototype.set=function(t,n){this.f=n;var r=+new Date+t;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=r)};var G=50,W={toString:function(){return"CodeMirror.Pass"}},Z={scroll:!1},K={origin:"*mouse"},Y={origin:"+move"};function Q(t,n,r){for(var i=0,e=0;;){var o=t.indexOf("\t",i);-1==o&&(o=t.length);var u=o-i;if(o==t.length||e+u>=n)return i+Math.min(u,n-e);if(e+=o-i,i=o+1,(e+=r-e%r)>=n)return i}}var X=[""];function J(t){for(;X.length<=t;)X.push(tt(X)+" ");return X[t]}function tt(t){return t[t.length-1]}function nt(t,n){for(var r=[],i=0;i<t.length;i++)r[i]=n(t[i],i);return r}function rt(){}function it(t,n){var r;return Object.create?r=Object.create(t):(rt.prototype=t,r=new rt),n&&H(n,r),r}var et=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ot(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||et.test(t))}function ut(t,n){return n?!!(n.source.indexOf("\\w")>-1&&ot(t))||n.test(t):ot(t)}function at(t){for(var n in t)if(t.hasOwnProperty(n)&&t[n])return!1;return!0}var st=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ct(t){return t.charCodeAt(0)>=768&&st.test(t)}function ft(t,n,r){for(;(r<0?n>0:n<t.length)&&ct(t.charAt(n));)n+=r;return n}function ht(t,n,r){for(var i=n>r?-1:1;;){if(n==r)return n;var e=(n+r)/2,o=i<0?Math.ceil(e):Math.floor(e);if(o==n)return t(o)?n:r;t(o)?r=o:n=o+i}}var lt=null;function vt(t,n,r){var i;lt=null;for(var e=0;e<t.length;++e){var o=t[e];if(o.from<n&&o.to>n)return e;o.to==n&&(o.from!=o.to&&"before"==r?i=e:lt=e),o.from==n&&(o.from!=o.to&&"before"!=r?i=e:lt=e)}return null!=i?i:lt}var dt=function(){var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,r=/[LRr]/,i=/[Lb1n]/,e=/[1n]/;function o(t,n,r){this.level=t,this.from=n,this.to=r}return function(u,a){var s,c="ltr"==a?"L":"R";if(0==u.length||"ltr"==a&&!t.test(u))return!1;for(var f=u.length,h=[],l=0;l<f;++l)h.push((s=u.charCodeAt(l))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(s):1424<=s&&s<=1524?"R":1536<=s&&s<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(s-1536):1774<=s&&s<=2220?"r":8192<=s&&s<=8203?"w":8204==s?"b":"L");for(var v=0,d=c;v<f;++v){var p=h[v];"m"==p?h[v]=d:d=p}for(var g=0,b=c;g<f;++g){var m=h[g];"1"==m&&"r"==b?h[g]="n":r.test(m)&&(b=m,"r"==m&&(h[g]="R"))}for(var w=1,y=h[0];w<f-1;++w){var k=h[w];"+"==k&&"1"==y&&"1"==h[w+1]?h[w]="1":","!=k||y!=h[w+1]||"1"!=y&&"n"!=y||(h[w]=y),y=k}for(var T=0;T<f;++T){var A=h[T];if(","==A)h[T]="N";else if("%"==A){var E=void 0;for(E=T+1;E<f&&"%"==h[E];++E);for(var L=T&&"!"==h[T-1]||E<f&&"1"==h[E]?"1":"N",x=T;x<E;++x)h[x]=L;T=E-1}}for(var C=0,D=c;C<f;++C){var O=h[C];"L"==D&&"1"==O?h[C]="L":r.test(O)&&(D=O)}for(var S=0;S<f;++S)if(n.test(h[S])){var N=void 0;for(N=S+1;N<f&&n.test(h[N]);++N);for(var M="L"==(S?h[S-1]:c),R=M==("L"==(N<f?h[N]:c))?M?"L":"R":c,B=S;B<N;++B)h[B]=R;S=N-1}for(var I,q=[],F=0;F<f;)if(i.test(h[F])){var P=F;for(++F;F<f&&i.test(h[F]);++F);q.push(new o(0,P,F))}else{var j=F,_=q.length,U="rtl"==a?1:0;for(++F;F<f&&"L"!=h[F];++F);for(var H=j;H<F;)if(e.test(h[H])){j<H&&(q.splice(_,0,new o(1,j,H)),_+=U);var z=H;for(++H;H<F&&e.test(h[H]);++H);q.splice(_,0,new o(2,z,H)),_+=U,j=H}else++H;j<F&&q.splice(_,0,new o(1,j,F))}return"ltr"==a&&(1==q[0].level&&(I=u.match(/^\s+/))&&(q[0].from=I[0].length,q.unshift(new o(0,0,I[0].length))),1==tt(q).level&&(I=u.match(/\s+$/))&&(tt(q).to-=I[0].length,q.push(new o(0,f-I[0].length,f)))),"rtl"==a?q.reverse():q}}();function pt(t,n){var r=t.order;return null==r&&(r=t.order=dt(t.text,n)),r}var gt=[],bt=function(t,n,r){if(t.addEventListener)t.addEventListener(n,r,!1);else if(t.attachEvent)t.attachEvent("on"+n,r);else{var i=t._handlers||(t._handlers={});i[n]=(i[n]||gt).concat(r)}};function mt(t,n){return t._handlers&&t._handlers[n]||gt}function wt(t,n,r){if(t.removeEventListener)t.removeEventListener(n,r,!1);else if(t.detachEvent)t.detachEvent("on"+n,r);else{var i=t._handlers,e=i&&i[n];if(e){var o=$(e,r);o>-1&&(i[n]=e.slice(0,o).concat(e.slice(o+1)))}}}function yt(t,n){var r=mt(t,n);if(r.length)for(var i=Array.prototype.slice.call(arguments,2),e=0;e<r.length;++e)r[e].apply(null,i)}function kt(t,n,r){return"string"==typeof n&&(n={type:n,preventDefault:function(){this.defaultPrevented=!0}}),yt(t,r||n.type,t,n),Ct(n)||n.codemirrorIgnore}function Tt(t){var n=t._handlers&&t._handlers.cursorActivity;if(n)for(var r=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<n.length;++i)-1==$(r,n[i])&&r.push(n[i])}function At(t,n){return mt(t,n).length>0}function Et(t){t.prototype.on=function(t,n){bt(this,t,n)},t.prototype.off=function(t,n){wt(this,t,n)}}function Lt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function xt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Ct(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Dt(t){Lt(t),xt(t)}function Ot(t){return t.target||t.srcElement}function St(t){var n=t.which;return null==n&&(1&t.button?n=1:2&t.button?n=3:4&t.button&&(n=2)),w&&t.ctrlKey&&1==n&&(n=3),n}var Nt,Mt,Rt=function(){if(u&&a<9)return!1;var t=S("div");return"draggable"in t||"dragDrop"in t}();function Bt(t){if(null==Nt){var n=S("span","");O(t,S("span",[n,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Nt=n.offsetWidth<=1&&n.offsetHeight>2&&!(u&&a<8))}var r=Nt?S("span",""):S("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function It(t){if(null!=Mt)return Mt;var n=O(t,document.createTextNode("AخA")),r=x(n,0,1).getBoundingClientRect(),i=x(n,1,2).getBoundingClientRect();return D(t),!(!r||r.left==r.right)&&(Mt=i.right-r.right<3)}var qt,Ft=3!="\n\nb".split(/\n/).length?function(t){for(var n=0,r=[],i=t.length;n<=i;){var e=t.indexOf("\n",n);-1==e&&(e=t.length);var o=t.slice(n,"\r"==t.charAt(e-1)?e-1:e),u=o.indexOf("\r");-1!=u?(r.push(o.slice(0,u)),n+=u+1):(r.push(o),n=e+1)}return r}:function(t){return t.split(/\r\n?|\n/)},Pt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var n;try{n=t.ownerDocument.selection.createRange()}catch(t){}return!(!n||n.parentElement()!=t)&&0!=n.compareEndPoints("StartToEnd",n)},jt="oncopy"in(qt=S("div"))||(qt.setAttribute("oncopy","return;"),"function"==typeof qt.oncopy),_t=null;var Ut={},Ht={};function zt(t,n){arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Ut[t]=n}function Vt(t){if("string"==typeof t&&Ht.hasOwnProperty(t))t=Ht[t];else if(t&&"string"==typeof t.name&&Ht.hasOwnProperty(t.name)){var n=Ht[t.name];"string"==typeof n&&(n={name:n}),(t=it(n,t)).name=n.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Vt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Vt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function $t(t,n){n=Vt(n);var r=Ut[n.name];if(!r)return $t(t,"text/plain");var i=r(t,n);if(Gt.hasOwnProperty(n.name)){var e=Gt[n.name];for(var o in e)e.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=e[o])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var u in n.modeProps)i[u]=n.modeProps[u];return i}var Gt={};function Wt(t,n){H(n,Gt.hasOwnProperty(t)?Gt[t]:Gt[t]={})}function Zt(t,n){if(!0===n)return n;if(t.copyState)return t.copyState(n);var r={};for(var i in n){var e=n[i];e instanceof Array&&(e=e.concat([])),r[i]=e}return r}function Kt(t,n){for(var r;t.innerMode&&(r=t.innerMode(n))&&r.mode!=t;)n=r.state,t=r.mode;return r||{mode:t,state:n}}function Yt(t,n,r){return!t.startState||t.startState(n,r)}var Qt=function(t,n,r){this.pos=this.start=0,this.string=t,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Xt(t,n){if((n-=t.first)<0||n>=t.size)throw new Error("There is no line "+(n+t.first)+" in the document.");for(var r=t;!r.lines;)for(var i=0;;++i){var e=r.children[i],o=e.chunkSize();if(n<o){r=e;break}n-=o}return r.lines[n]}function Jt(t,n,r){var i=[],e=n.line;return t.iter(n.line,r.line+1,(function(t){var o=t.text;e==r.line&&(o=o.slice(0,r.ch)),e==n.line&&(o=o.slice(n.ch)),i.push(o),++e})),i}function tn(t,n,r){var i=[];return t.iter(n,r,(function(t){i.push(t.text)})),i}function nn(t,n){var r=n-t.height;if(r)for(var i=t;i;i=i.parent)i.height+=r}function rn(t){if(null==t.parent)return null;for(var n=t.parent,r=$(n.lines,t),i=n.parent;i;n=i,i=i.parent)for(var e=0;i.children[e]!=n;++e)r+=i.children[e].chunkSize();return r+n.first}function en(t,n){var r=t.first;t:do{for(var i=0;i<t.children.length;++i){var e=t.children[i],o=e.height;if(n<o){t=e;continue t}n-=o,r+=e.chunkSize()}return r}while(!t.lines);for(var u=0;u<t.lines.length;++u){var a=t.lines[u].height;if(n<a)break;n-=a}return r+u}function on(t,n){return n>=t.first&&n<t.first+t.size}function un(t,n){return String(t.lineNumberFormatter(n+t.firstLineNumber))}function an(t,n,r){if(void 0===r&&(r=null),!(this instanceof an))return new an(t,n,r);this.line=t,this.ch=n,this.sticky=r}function sn(t,n){return t.line-n.line||t.ch-n.ch}function cn(t,n){return t.sticky==n.sticky&&0==sn(t,n)}function fn(t){return an(t.line,t.ch)}function hn(t,n){return sn(t,n)<0?n:t}function ln(t,n){return sn(t,n)<0?t:n}function vn(t,n){return Math.max(t.first,Math.min(n,t.first+t.size-1))}function dn(t,n){if(n.line<t.first)return an(t.first,0);var r=t.first+t.size-1;return n.line>r?an(r,Xt(t,r).text.length):function(t,n){var r=t.ch;return null==r||r>n?an(t.line,n):r<0?an(t.line,0):t}(n,Xt(t,n.line).text.length)}function pn(t,n){for(var r=[],i=0;i<n.length;i++)r[i]=dn(t,n[i]);return r}Qt.prototype.eol=function(){return this.pos>=this.string.length},Qt.prototype.sol=function(){return this.pos==this.lineStart},Qt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Qt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Qt.prototype.eat=function(t){var n=this.string.charAt(this.pos);if("string"==typeof t?n==t:n&&(t.test?t.test(n):t(n)))return++this.pos,n},Qt.prototype.eatWhile=function(t){for(var n=this.pos;this.eat(t););return this.pos>n},Qt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Qt.prototype.skipToEnd=function(){this.pos=this.string.length},Qt.prototype.skipTo=function(t){var n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0},Qt.prototype.backUp=function(t){this.pos-=t},Qt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Qt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Qt.prototype.match=function(t,n,r){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==n&&(this.pos+=i[0].length),i)}var e=function(t){return r?t.toLowerCase():t};if(e(this.string.substr(this.pos,t.length))==e(t))return!1!==n&&(this.pos+=t.length),!0},Qt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Qt.prototype.hideFirstChars=function(t,n){this.lineStart+=t;try{return n()}finally{this.lineStart-=t}},Qt.prototype.lookAhead=function(t){var n=this.lineOracle;return n&&n.lookAhead(t)},Qt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var gn=function(t,n){this.state=t,this.lookAhead=n},bn=function(t,n,r,i){this.state=n,this.doc=t,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function mn(t,n,r,i){var e=[t.state.modeGen],o={};Cn(t,n.text,t.doc.mode,r,(function(t,n){return e.push(t,n)}),o,i);for(var u=r.state,a=function(i){r.baseTokens=e;var a=t.state.overlays[i],s=1,c=0;r.state=!0,Cn(t,n.text,a.mode,r,(function(t,n){for(var r=s;c<t;){var i=e[s];i>t&&e.splice(s,1,t,e[s+1],i),s+=2,c=Math.min(t,i)}if(n)if(a.opaque)e.splice(r,s-r,t,"overlay "+n),s=r+2;else for(;r<s;r+=2){var o=e[r+1];e[r+1]=(o?o+" ":"")+"overlay "+n}}),o),r.state=u,r.baseTokens=null,r.baseTokenPos=1},s=0;s<t.state.overlays.length;++s)a(s);return{styles:e,classes:o.bgClass||o.textClass?o:null}}function wn(t,n,r){if(!n.styles||n.styles[0]!=t.state.modeGen){var i=yn(t,rn(n)),e=n.text.length>t.options.maxHighlightLength&&Zt(t.doc.mode,i.state),o=mn(t,n,i);e&&(i.state=e),n.stateAfter=i.save(!e),n.styles=o.styles,o.classes?n.styleClasses=o.classes:n.styleClasses&&(n.styleClasses=null),r===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return n.styles}function yn(t,n,r){var i=t.doc,e=t.display;if(!i.mode.startState)return new bn(i,!0,n);var o=function(t,n,r){for(var i,e,o=t.doc,u=r?-1:n-(t.doc.mode.innerMode?1e3:100),a=n;a>u;--a){if(a<=o.first)return o.first;var s=Xt(o,a-1),c=s.stateAfter;if(c&&(!r||a+(c instanceof gn?c.lookAhead:0)<=o.modeFrontier))return a;var f=z(s.text,null,t.options.tabSize);(null==e||i>f)&&(e=a-1,i=f)}return e}(t,n,r),u=o>i.first&&Xt(i,o-1).stateAfter,a=u?bn.fromSaved(i,u,o):new bn(i,Yt(i.mode),o);return i.iter(o,n,(function(r){kn(t,r.text,a);var i=a.line;r.stateAfter=i==n-1||i%5==0||i>=e.viewFrom&&i<e.viewTo?a.save():null,a.nextLine()})),r&&(i.modeFrontier=a.line),a}function kn(t,n,r,i){var e=t.doc.mode,o=new Qt(n,t.options.tabSize,r);for(o.start=o.pos=i||0,""==n&&Tn(e,r.state);!o.eol();)An(e,o,r.state),o.start=o.pos}function Tn(t,n){if(t.blankLine)return t.blankLine(n);if(t.innerMode){var r=Kt(t,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function An(t,n,r,i){for(var e=0;e<10;e++){i&&(i[0]=Kt(t,r).mode);var o=t.token(n,r);if(n.pos>n.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}bn.prototype.lookAhead=function(t){var n=this.doc.getLine(this.line+t);return null!=n&&t>this.maxLookAhead&&(this.maxLookAhead=t),n},bn.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},bn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},bn.fromSaved=function(t,n,r){return n instanceof gn?new bn(t,Zt(t.mode,n.state),r,n.lookAhead):new bn(t,Zt(t.mode,n),r)},bn.prototype.save=function(t){var n=!1!==t?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new gn(n,this.maxLookAhead):n};var En=function(t,n,r){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=n||null,this.state=r};function Ln(t,n,r,i){var e,o,u=t.doc,a=u.mode,s=Xt(u,(n=dn(u,n)).line),c=yn(t,n.line,r),f=new Qt(s.text,t.options.tabSize,c);for(i&&(o=[]);(i||f.pos<n.ch)&&!f.eol();)f.start=f.pos,e=An(a,f,c.state),i&&o.push(new En(f,e,Zt(u.mode,c.state)));return i?o:new En(f,e,c.state)}function xn(t,n){if(t)for(;;){var r=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;t=t.slice(0,r.index)+t.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";null==n[i]?n[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(n[i])||(n[i]+=" "+r[2])}return t}function Cn(t,n,r,i,e,o,u){var a=r.flattenSpans;null==a&&(a=t.options.flattenSpans);var s,c=0,f=null,h=new Qt(n,t.options.tabSize,i),l=t.options.addModeClass&&[null];for(""==n&&xn(Tn(r,i.state),o);!h.eol();){if(h.pos>t.options.maxHighlightLength?(a=!1,u&&kn(t,n,i,h.pos),h.pos=n.length,s=null):s=xn(An(r,h,i.state,l),o),l){var v=l[0].name;v&&(s="m-"+(s?v+" "+s:v))}if(!a||f!=s){for(;c<h.start;)e(c=Math.min(h.start,c+5e3),f);f=s}h.start=h.pos}for(;c<h.pos;){var d=Math.min(h.pos,c+5e3);e(d,f),c=d}}var Dn=!1,On=!1;function Sn(t,n,r){this.marker=t,this.from=n,this.to=r}function Nn(t,n){if(t)for(var r=0;r<t.length;++r){var i=t[r];if(i.marker==n)return i}}function Mn(t,n){for(var r,i=0;i<t.length;++i)t[i]!=n&&(r||(r=[])).push(t[i]);return r}function Rn(t,n){if(n.full)return null;var r=on(t,n.from.line)&&Xt(t,n.from.line).markedSpans,i=on(t,n.to.line)&&Xt(t,n.to.line).markedSpans;if(!r&&!i)return null;var e=n.from.ch,o=n.to.ch,u=0==sn(n.from,n.to),a=function(t,n,r){var i;if(t)for(var e=0;e<t.length;++e){var o=t[e],u=o.marker;null!=o.from&&!(u.inclusiveLeft?o.from<=n:o.from<n)&&(o.from!=n||"bookmark"!=u.type||r&&o.marker.insertLeft)||(i||(i=[])).push(new Sn(u,o.from,null==o.to||(u.inclusiveRight?o.to>=n:o.to>n)?null:o.to))}return i}(r,e,u),s=function(t,n,r){var i;if(t)for(var e=0;e<t.length;++e){var o=t[e],u=o.marker;(null==o.to||(u.inclusiveRight?o.to>=n:o.to>n)||o.from==n&&"bookmark"==u.type&&(!r||o.marker.insertLeft))&&(i||(i=[])).push(new Sn(u,null==o.from||(u.inclusiveLeft?o.from<=n:o.from<n)?null:o.from-n,null==o.to?null:o.to-n))}return i}(i,o,u),c=1==n.text.length,f=tt(n.text).length+(c?e:0);if(a)for(var h=0;h<a.length;++h){var l=a[h];if(null==l.to){var v=Nn(s,l.marker);v?c&&(l.to=null==v.to?null:v.to+f):l.to=e}}if(s)for(var d=0;d<s.length;++d){var p=s[d];null!=p.to&&(p.to+=f),null==p.from?Nn(a,p.marker)||(p.from=f,c&&(a||(a=[])).push(p)):(p.from+=f,c&&(a||(a=[])).push(p))}a&&(a=Bn(a)),s&&s!=a&&(s=Bn(s));var g=[a];if(!c){var b,m=n.text.length-2;if(m>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(b||(b=[])).push(new Sn(a[w].marker,null,null));for(var y=0;y<m;++y)g.push(b);g.push(s)}return g}function Bn(t){for(var n=0;n<t.length;++n){var r=t[n];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&t.splice(n--,1)}return t.length?t:null}function In(t){var n=t.markedSpans;if(n){for(var r=0;r<n.length;++r)n[r].marker.detachLine(t);t.markedSpans=null}}function qn(t,n){if(n){for(var r=0;r<n.length;++r)n[r].marker.attachLine(t);t.markedSpans=n}}function Fn(t){return t.inclusiveLeft?-1:0}function Pn(t){return t.inclusiveRight?1:0}function jn(t,n){var r=t.lines.length-n.lines.length;if(0!=r)return r;var i=t.find(),e=n.find(),o=sn(i.from,e.from)||Fn(t)-Fn(n);return o?-o:sn(i.to,e.to)||Pn(t)-Pn(n)||n.id-t.id}function _n(t,n){var r,i=On&&t.markedSpans;if(i)for(var e=void 0,o=0;o<i.length;++o)(e=i[o]).marker.collapsed&&null==(n?e.from:e.to)&&(!r||jn(r,e.marker)<0)&&(r=e.marker);return r}function Un(t){return _n(t,!0)}function Hn(t){return _n(t,!1)}function zn(t,n){var r,i=On&&t.markedSpans;if(i)for(var e=0;e<i.length;++e){var o=i[e];o.marker.collapsed&&(null==o.from||o.from<n)&&(null==o.to||o.to>n)&&(!r||jn(r,o.marker)<0)&&(r=o.marker)}return r}function Vn(t,n,r,i,e){var o=Xt(t,n),u=On&&o.markedSpans;if(u)for(var a=0;a<u.length;++a){var s=u[a];if(s.marker.collapsed){var c=s.marker.find(0),f=sn(c.from,r)||Fn(s.marker)-Fn(e),h=sn(c.to,i)||Pn(s.marker)-Pn(e);if(!(f>=0&&h<=0||f<=0&&h>=0)&&(f<=0&&(s.marker.inclusiveRight&&e.inclusiveLeft?sn(c.to,r)>=0:sn(c.to,r)>0)||f>=0&&(s.marker.inclusiveRight&&e.inclusiveLeft?sn(c.from,i)<=0:sn(c.from,i)<0)))return!0}}}function $n(t){for(var n;n=Un(t);)t=n.find(-1,!0).line;return t}function Gn(t,n){var r=Xt(t,n),i=$n(r);return r==i?n:rn(i)}function Wn(t,n){if(n>t.lastLine())return n;var r,i=Xt(t,n);if(!Zn(t,i))return n;for(;r=Hn(i);)i=r.find(1,!0).line;return rn(i)+1}function Zn(t,n){var r=On&&n.markedSpans;if(r)for(var i=void 0,e=0;e<r.length;++e)if((i=r[e]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&Kn(t,n,i))return!0}}function Kn(t,n,r){if(null==r.to){var i=r.marker.find(1,!0);return Kn(t,i.line,Nn(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var e=void 0,o=0;o<n.markedSpans.length;++o)if((e=n.markedSpans[o]).marker.collapsed&&!e.marker.widgetNode&&e.from==r.to&&(null==e.to||e.to!=r.from)&&(e.marker.inclusiveLeft||r.marker.inclusiveRight)&&Kn(t,n,e))return!0}function Yn(t){for(var n=0,r=(t=$n(t)).parent,i=0;i<r.lines.length;++i){var e=r.lines[i];if(e==t)break;n+=e.height}for(var o=r.parent;o;o=(r=o).parent)for(var u=0;u<o.children.length;++u){var a=o.children[u];if(a==r)break;n+=a.height}return n}function Qn(t){if(0==t.height)return 0;for(var n,r=t.text.length,i=t;n=Un(i);){var e=n.find(0,!0);i=e.from.line,r+=e.from.ch-e.to.ch}for(i=t;n=Hn(i);){var o=n.find(0,!0);r-=i.text.length-o.from.ch,r+=(i=o.to.line).text.length-o.to.ch}return r}function Xn(t){var n=t.display,r=t.doc;n.maxLine=Xt(r,r.first),n.maxLineLength=Qn(n.maxLine),n.maxLineChanged=!0,r.iter((function(t){var r=Qn(t);r>n.maxLineLength&&(n.maxLineLength=r,n.maxLine=t)}))}var Jn=function(t,n,r){this.text=t,qn(this,n),this.height=r?r(this):1};function tr(t){t.parent=null,In(t)}Jn.prototype.lineNo=function(){return rn(this)},Et(Jn);var nr={},rr={};function ir(t,n){if(!t||/^\s*$/.test(t))return null;var r=n.addModeClass?rr:nr;return r[t]||(r[t]=t.replace(/\S+/g,"cm-$&"))}function er(t,n){var r=N("span",null,null,s?"padding-right: .1px":null),i={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};n.measure={};for(var e=0;e<=(n.rest?n.rest.length:0);e++){var o=e?n.rest[e-1]:n.line,u=void 0;i.pos=0,i.addToken=ur,It(t.display.measure)&&(u=pt(o,t.doc.direction))&&(i.addToken=ar(i.addToken,u)),i.map=[],cr(o,i,wn(t,o,n!=t.display.externalMeasured&&rn(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=I(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=I(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Bt(t.display.measure))),0==e?(n.measure.map=i.map,n.measure.cache={}):((n.measure.maps||(n.measure.maps=[])).push(i.map),(n.measure.caches||(n.measure.caches=[])).push({}))}if(s){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return yt(t,"renderLine",t,n.line,i.pre),i.pre.className&&(i.textClass=I(i.pre.className,i.textClass||"")),i}function or(t){var n=S("span","•","cm-invalidchar");return n.title="\\u"+t.charCodeAt(0).toString(16),n.setAttribute("aria-label",n.title),n}function ur(t,n,r,i,e,o,s){if(n){var c,f=t.splitSpaces?function(t,n){if(t.length>1&&!/ /.test(t))return t;for(var r=n,i="",e=0;e<t.length;e++){var o=t.charAt(e);" "!=o||!r||e!=t.length-1&&32!=t.charCodeAt(e+1)||(o=" "),i+=o,r=" "==o}return i}(n,t.trailingSpace):n,h=t.cm.state.specialChars,l=!1;if(h.test(n)){c=document.createDocumentFragment();for(var v=0;;){h.lastIndex=v;var d=h.exec(n),p=d?d.index-v:n.length-v;if(p){var g=document.createTextNode(f.slice(v,v+p));c.appendChild(u&&a<9?S("span",[g]):g),t.map.push(t.pos,t.pos+p,g),t.col+=p,t.pos+=p}if(!d)break;v+=p+1;var b=void 0;if("\t"==d[0]){var m=t.cm.options.tabSize,w=m-t.col%m;(b=c.appendChild(S("span",J(w),"cm-tab"))).setAttribute("role","presentation"),b.setAttribute("cm-text","\t"),t.col+=w}else"\r"==d[0]||"\n"==d[0]?((b=c.appendChild(S("span","\r"==d[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",d[0]),t.col+=1):((b=t.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),c.appendChild(u&&a<9?S("span",[b]):b),t.col+=1);t.map.push(t.pos,t.pos+1,b),t.pos++}}else t.col+=n.length,c=document.createTextNode(f),t.map.push(t.pos,t.pos+n.length,c),u&&a<9&&(l=!0),t.pos+=n.length;if(t.trailingSpace=32==f.charCodeAt(n.length-1),r||i||e||l||o||s){var y=r||"";i&&(y+=i),e&&(y+=e);var k=S("span",[c],y,o);if(s)for(var T in s)s.hasOwnProperty(T)&&"style"!=T&&"class"!=T&&k.setAttribute(T,s[T]);return t.content.appendChild(k)}t.content.appendChild(c)}}function ar(t,n){return function(r,i,e,o,u,a,s){e=e?e+" cm-force-border":"cm-force-border";for(var c=r.pos,f=c+i.length;;){for(var h=void 0,l=0;l<n.length&&!((h=n[l]).to>c&&h.from<=c);l++);if(h.to>=f)return t(r,i,e,o,u,a,s);t(r,i.slice(0,h.to-c),e,o,null,a,s),o=null,i=i.slice(h.to-c),c=h.to}}}function sr(t,n,r,i){var e=!i&&r.widgetNode;e&&t.map.push(t.pos,t.pos+n,e),!i&&t.cm.display.input.needsContentAttribute&&(e||(e=t.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",r.id)),e&&(t.cm.display.input.setUneditable(e),t.content.appendChild(e)),t.pos+=n,t.trailingSpace=!1}function cr(t,n,r){var i=t.markedSpans,e=t.text,o=0;if(i)for(var u,a,s,c,f,h,l,v=e.length,d=0,p=1,g="",b=0;;){if(b==d){s=c=f=a="",l=null,h=null,b=1/0;for(var m=[],w=void 0,y=0;y<i.length;++y){var k=i[y],T=k.marker;if("bookmark"==T.type&&k.from==d&&T.widgetNode)m.push(T);else if(k.from<=d&&(null==k.to||k.to>d||T.collapsed&&k.to==d&&k.from==d)){if(null!=k.to&&k.to!=d&&b>k.to&&(b=k.to,c=""),T.className&&(s+=" "+T.className),T.css&&(a=(a?a+";":"")+T.css),T.startStyle&&k.from==d&&(f+=" "+T.startStyle),T.endStyle&&k.to==b&&(w||(w=[])).push(T.endStyle,k.to),T.title&&((l||(l={})).title=T.title),T.attributes)for(var A in T.attributes)(l||(l={}))[A]=T.attributes[A];T.collapsed&&(!h||jn(h.marker,T)<0)&&(h=k)}else k.from>d&&b>k.from&&(b=k.from)}if(w)for(var E=0;E<w.length;E+=2)w[E+1]==b&&(c+=" "+w[E]);if(!h||h.from==d)for(var L=0;L<m.length;++L)sr(n,0,m[L]);if(h&&(h.from||0)==d){if(sr(n,(null==h.to?v+1:h.to)-d,h.marker,null==h.from),null==h.to)return;h.to==d&&(h=!1)}}if(d>=v)break;for(var x=Math.min(v,b);;){if(g){var C=d+g.length;if(!h){var D=C>x?g.slice(0,x-d):g;n.addToken(n,D,u?u+s:s,f,d+D.length==b?c:"",a,l)}if(C>=x){g=g.slice(x-d),d=x;break}d=C,f=""}g=e.slice(o,o=r[p++]),u=ir(r[p++],n.cm.options)}}else for(var O=1;O<r.length;O+=2)n.addToken(n,e.slice(o,o=r[O]),ir(r[O+1],n.cm.options))}function fr(t,n,r){this.line=n,this.rest=function(t){for(var n,r;n=Hn(t);)t=n.find(1,!0).line,(r||(r=[])).push(t);return r}(n),this.size=this.rest?rn(tt(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Zn(t,n)}function hr(t,n,r){for(var i,e=[],o=n;o<r;o=i){var u=new fr(t.doc,Xt(t.doc,o),o);i=o+u.size,e.push(u)}return e}var lr=null;var vr=null;function dr(t,n){var r=mt(t,n);if(r.length){var i,e=Array.prototype.slice.call(arguments,2);lr?i=lr.delayedCallbacks:vr?i=vr:(i=vr=[],setTimeout(pr,0));for(var o=function(t){i.push((function(){return r[t].apply(null,e)}))},u=0;u<r.length;++u)o(u)}}function pr(){var t=vr;vr=null;for(var n=0;n<t.length;++n)t[n]()}function gr(t,n,r,i){for(var e=0;e<n.changes.length;e++){var o=n.changes[e];"text"==o?wr(t,n):"gutter"==o?kr(t,n,r,i):"class"==o?yr(t,n):"widget"==o&&Tr(t,n,i)}n.changes=null}function br(t){return t.node==t.text&&(t.node=S("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),u&&a<8&&(t.node.style.zIndex=2)),t.node}function mr(t,n){var r=t.display.externalMeasured;return r&&r.line==n.line?(t.display.externalMeasured=null,n.measure=r.measure,r.built):er(t,n)}function wr(t,n){var r=n.text.className,i=mr(t,n);n.text==n.node&&(n.node=i.pre),n.text.parentNode.replaceChild(i.pre,n.text),n.text=i.pre,i.bgClass!=n.bgClass||i.textClass!=n.textClass?(n.bgClass=i.bgClass,n.textClass=i.textClass,yr(t,n)):r&&(n.text.className=r)}function yr(t,n){(function(t,n){var r=n.bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),n.background)r?n.background.className=r:(n.background.parentNode.removeChild(n.background),n.background=null);else if(r){var i=br(n);n.background=i.insertBefore(S("div",null,r),i.firstChild),t.display.input.setUneditable(n.background)}})(t,n),n.line.wrapClass?br(n).className=n.line.wrapClass:n.node!=n.text&&(n.node.className=""),n.text.className=(n.textClass?n.textClass+" "+(n.line.textClass||""):n.line.textClass)||""}function kr(t,n,r,i){if(n.gutter&&(n.node.removeChild(n.gutter),n.gutter=null),n.gutterBackground&&(n.node.removeChild(n.gutterBackground),n.gutterBackground=null),n.line.gutterClass){var e=br(n);n.gutterBackground=S("div",null,"CodeMirror-gutter-background "+n.line.gutterClass,"left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),t.display.input.setUneditable(n.gutterBackground),e.insertBefore(n.gutterBackground,n.text)}var o=n.line.gutterMarkers;if(t.options.lineNumbers||o){var u=br(n),a=n.gutter=S("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),t.display.input.setUneditable(a),u.insertBefore(a,n.text),n.line.gutterClass&&(a.className+=" "+n.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(n.lineNumber=a.appendChild(S("div",un(t.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<t.display.gutterSpecs.length;++s){var c=t.display.gutterSpecs[s].className,f=o.hasOwnProperty(c)&&o[c];f&&a.appendChild(S("div",[f],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function Tr(t,n,r){n.alignable&&(n.alignable=null);for(var i=L("CodeMirror-linewidget"),e=n.node.firstChild,o=void 0;e;e=o)o=e.nextSibling,i.test(e.className)&&n.node.removeChild(e);Er(t,n,r)}function Ar(t,n,r,i){var e=mr(t,n);return n.text=n.node=e.pre,e.bgClass&&(n.bgClass=e.bgClass),e.textClass&&(n.textClass=e.textClass),yr(t,n),kr(t,n,r,i),Er(t,n,i),n.node}function Er(t,n,r){if(Lr(t,n.line,n,r,!0),n.rest)for(var i=0;i<n.rest.length;i++)Lr(t,n.rest[i],n,r,!1)}function Lr(t,n,r,i,e){if(n.widgets)for(var o=br(r),u=0,a=n.widgets;u<a.length;++u){var s=a[u],c=S("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),xr(s,c,r,i),t.display.input.setUneditable(c),e&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),dr(s,"redraw")}}function xr(t,n,r,i){if(t.noHScroll){(r.alignable||(r.alignable=[])).push(n);var e=i.wrapperWidth;n.style.left=i.fixedPos+"px",t.coverGutter||(e-=i.gutterTotalWidth,n.style.paddingLeft=i.gutterTotalWidth+"px"),n.style.width=e+"px"}t.coverGutter&&(n.style.zIndex=5,n.style.position="relative",t.noHScroll||(n.style.marginLeft=-i.gutterTotalWidth+"px"))}function Cr(t){if(null!=t.height)return t.height;var n=t.doc.cm;if(!n)return 0;if(!M(document.body,t.node)){var r="position: relative;";t.coverGutter&&(r+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),t.noHScroll&&(r+="width: "+n.display.wrapper.clientWidth+"px;"),O(n.display.measure,S("div",[t.node],null,r))}return t.height=t.node.parentNode.offsetHeight}function Dr(t,n){for(var r=Ot(n);r!=t.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==t.sizer&&r!=t.mover)return!0}function Or(t){return t.lineSpace.offsetTop}function Sr(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Nr(t){if(t.cachedPaddingH)return t.cachedPaddingH;var n=O(t.measure,S("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(n):n.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(t.cachedPaddingH=i),i}function Mr(t){return G-t.display.nativeBarWidth}function Rr(t){return t.display.scroller.clientWidth-Mr(t)-t.display.barWidth}function Br(t){return t.display.scroller.clientHeight-Mr(t)-t.display.barHeight}function Ir(t,n,r){if(t.line==n)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var i=0;i<t.rest.length;i++)if(t.rest[i]==n)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var e=0;e<t.rest.length;e++)if(rn(t.rest[e])>r)return{map:t.measure.maps[e],cache:t.measure.caches[e],before:!0}}}function qr(t,n,r,i){return jr(t,Pr(t,n),r,i)}function Fr(t,n){if(n>=t.display.viewFrom&&n<t.display.viewTo)return t.display.view[gi(t,n)];var r=t.display.externalMeasured;return r&&n>=r.lineN&&n<r.lineN+r.size?r:void 0}function Pr(t,n){var r=rn(n),i=Fr(t,r);i&&!i.text?i=null:i&&i.changes&&(gr(t,i,r,hi(t)),t.curOp.forceUpdate=!0),i||(i=function(t,n){var r=rn(n=$n(n)),i=t.display.externalMeasured=new fr(t.doc,n,r);i.lineN=r;var e=i.built=er(t,i);return i.text=e.pre,O(t.display.lineMeasure,e.pre),i}(t,n));var e=Ir(i,n,r);return{line:n,view:i,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function jr(t,n,r,i,e){n.before&&(r=-1);var o,s=r+(i||"");return n.cache.hasOwnProperty(s)?o=n.cache[s]:(n.rect||(n.rect=n.view.text.getBoundingClientRect()),n.hasHeights||(function(t,n,r){var i=t.options.lineWrapping,e=i&&Rr(t);if(!n.measure.heights||i&&n.measure.width!=e){var o=n.measure.heights=[];if(i){n.measure.width=e;for(var u=n.text.firstChild.getClientRects(),a=0;a<u.length-1;a++){var s=u[a],c=u[a+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(t,n.view,n.rect),n.hasHeights=!0),(o=function(t,n,r,i){var e,o=Hr(n.map,r,i),s=o.node,c=o.start,f=o.end,h=o.collapse;if(3==s.nodeType){for(var l=0;l<4;l++){for(;c&&ct(n.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+f<o.coverEnd&&ct(n.line.text.charAt(o.coverStart+f));)++f;if((e=u&&a<9&&0==c&&f==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():zr(x(s,c,f).getClientRects(),i)).left||e.right||0==c)break;f=c,c-=1,h="right"}u&&a<11&&(e=function(t,n){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(t){if(null!=_t)return _t;var n=O(t,S("span","x")),r=n.getBoundingClientRect(),i=x(n,0,1).getBoundingClientRect();return _t=Math.abs(r.left-i.left)>1}(t))return n;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:n.left*r,right:n.right*r,top:n.top*i,bottom:n.bottom*i}}(t.display.measure,e))}else{var v;c>0&&(h=i="right"),e=t.options.lineWrapping&&(v=s.getClientRects()).length>1?v["right"==i?v.length-1:0]:s.getBoundingClientRect()}if(u&&a<9&&!c&&(!e||!e.left&&!e.right)){var d=s.parentNode.getClientRects()[0];e=d?{left:d.left,right:d.left+fi(t.display),top:d.top,bottom:d.bottom}:Ur}for(var p=e.top-n.rect.top,g=e.bottom-n.rect.top,b=(p+g)/2,m=n.view.measure.heights,w=0;w<m.length-1&&!(b<m[w]);w++);var y={left:("right"==h?e.right:e.left)-n.rect.left,right:("left"==h?e.left:e.right)-n.rect.left,top:w?m[w-1]:0,bottom:m[w]};return e.left||e.right||(y.bogus=!0),t.options.singleCursorHeightPerLine||(y.rtop=p,y.rbottom=g),y}(t,n,r,i)).bogus||(n.cache[s]=o)),{left:o.left,right:o.right,top:e?o.rtop:o.top,bottom:e?o.rbottom:o.bottom}}var _r,Ur={left:0,right:0,top:0,bottom:0};function Hr(t,n,r){for(var i,e,o,u,a,s,c=0;c<t.length;c+=3)if(s=t[c+1],n<(a=t[c])?(e=0,o=1,u="left"):n<s?o=1+(e=n-a):(c==t.length-3||n==s&&t[c+3]>n)&&(e=(o=s-a)-1,n>=s&&(u="right")),null!=e){if(i=t[c+2],a==s&&r==(i.insertLeft?"left":"right")&&(u=r),"left"==r&&0==e)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],u="left";if("right"==r&&e==s-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)i=t[(c+=3)+2],u="right";break}return{node:i,start:e,end:o,collapse:u,coverStart:a,coverEnd:s}}function zr(t,n){var r=Ur;if("left"==n)for(var i=0;i<t.length&&(r=t[i]).left==r.right;i++);else for(var e=t.length-1;e>=0&&(r=t[e]).left==r.right;e--);return r}function Vr(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var n=0;n<t.rest.length;n++)t.measure.caches[n]={}}function $r(t){t.display.externalMeasure=null,D(t.display.lineMeasure);for(var n=0;n<t.display.view.length;n++)Vr(t.display.view[n])}function Gr(t){$r(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Wr(t){return f&&b?-(t.body.getBoundingClientRect().left-parseInt(getComputedStyle(t.body).marginLeft)):t.defaultView.pageXOffset||(t.documentElement||t.body).scrollLeft}function Zr(t){return f&&b?-(t.body.getBoundingClientRect().top-parseInt(getComputedStyle(t.body).marginTop)):t.defaultView.pageYOffset||(t.documentElement||t.body).scrollTop}function Kr(t){var n=$n(t).widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=Cr(n[i]));return r}function Yr(t,n,r,i,e){if(!e){var o=Kr(n);r.top+=o,r.bottom+=o}if("line"==i)return r;i||(i="local");var u=Yn(n);if("local"==i?u+=Or(t.display):u-=t.display.viewOffset,"page"==i||"window"==i){var a=t.display.lineSpace.getBoundingClientRect();u+=a.top+("window"==i?0:Zr(F(t)));var s=a.left+("window"==i?0:Wr(F(t)));r.left+=s,r.right+=s}return r.top+=u,r.bottom+=u,r}function Qr(t,n,r){if("div"==r)return n;var i=n.left,e=n.top;if("page"==r)i-=Wr(F(t)),e-=Zr(F(t));else if("local"==r||!r){var o=t.display.sizer.getBoundingClientRect();i+=o.left,e+=o.top}var u=t.display.lineSpace.getBoundingClientRect();return{left:i-u.left,top:e-u.top}}function Xr(t,n,r,i,e){return i||(i=Xt(t.doc,n.line)),Yr(t,i,qr(t,i,n.ch,e),r)}function Jr(t,n,r,i,e,o){function u(n,u){var a=jr(t,e,n,u?"right":"left",o);return u?a.left=a.right:a.right=a.left,Yr(t,i,a,r)}i=i||Xt(t.doc,n.line),e||(e=Pr(t,i));var a=pt(i,t.doc.direction),s=n.ch,c=n.sticky;if(s>=i.text.length?(s=i.text.length,c="before"):s<=0&&(s=0,c="after"),!a)return u("before"==c?s-1:s,"before"==c);function f(t,n,r){return u(r?t-1:t,1==a[n].level!=r)}var h=vt(a,s,c),l=lt,v=f(s,h,"before"==c);return null!=l&&(v.other=f(s,l,"before"!=c)),v}function ti(t,n){var r=0;n=dn(t.doc,n),t.options.lineWrapping||(r=fi(t.display)*n.ch);var i=Xt(t.doc,n.line),e=Yn(i)+Or(t.display);return{left:r,right:r,top:e,bottom:e+i.height}}function ni(t,n,r,i,e){var o=an(t,n,r);return o.xRel=e,i&&(o.outside=i),o}function ri(t,n,r){var i=t.doc;if((r+=t.display.viewOffset)<0)return ni(i.first,0,null,-1,-1);var e=en(i,r),o=i.first+i.size-1;if(e>o)return ni(i.first+i.size-1,Xt(i,o).text.length,null,1,1);n<0&&(n=0);for(var u=Xt(i,e);;){var a=ui(t,u,e,n,r),s=zn(u,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var c=s.find(1);if(c.line==e)return c;u=Xt(i,e=c.line)}}function ii(t,n,r,i){i-=Kr(n);var e=n.text.length,o=ht((function(n){return jr(t,r,n-1).bottom<=i}),e,0);return{begin:o,end:e=ht((function(n){return jr(t,r,n).top>i}),o,e)}}function ei(t,n,r,i){return r||(r=Pr(t,n)),ii(t,n,r,Yr(t,n,jr(t,r,i),"line").top)}function oi(t,n,r,i){return!(t.bottom<=r)&&(t.top>r||(i?t.left:t.right)>n)}function ui(t,n,r,i,e){e-=Yn(n);var o=Pr(t,n),u=Kr(n),a=0,s=n.text.length,c=!0,f=pt(n,t.doc.direction);if(f){var h=(t.options.lineWrapping?si:ai)(t,n,r,o,f,i,e);a=(c=1!=h.level)?h.from:h.to-1,s=c?h.to:h.from-1}var l,v,d=null,p=null,g=ht((function(n){var r=jr(t,o,n);return r.top+=u,r.bottom+=u,!!oi(r,i,e,!1)&&(r.top<=e&&r.left<=i&&(d=n,p=r),!0)}),a,s),b=!1;if(p){var m=i-p.left<p.right-i,w=m==c;g=d+(w?0:1),v=w?"after":"before",l=m?p.left:p.right}else{c||g!=s&&g!=a||g++,v=0==g?"after":g==n.text.length?"before":jr(t,o,g-(c?1:0)).bottom+u<=e==c?"after":"before";var y=Jr(t,an(r,g,v),"line",n,o);l=y.left,b=e<y.top?-1:e>=y.bottom?1:0}return ni(r,g=ft(n.text,g,1),v,b,i-l)}function ai(t,n,r,i,e,o,u){var a=ht((function(a){var s=e[a],c=1!=s.level;return oi(Jr(t,an(r,c?s.to:s.from,c?"before":"after"),"line",n,i),o,u,!0)}),0,e.length-1),s=e[a];if(a>0){var c=1!=s.level,f=Jr(t,an(r,c?s.from:s.to,c?"after":"before"),"line",n,i);oi(f,o,u,!0)&&f.top>u&&(s=e[a-1])}return s}function si(t,n,r,i,e,o,u){var a=ii(t,n,i,u),s=a.begin,c=a.end;/\s/.test(n.text.charAt(c-1))&&c--;for(var f=null,h=null,l=0;l<e.length;l++){var v=e[l];if(!(v.from>=c||v.to<=s)){var d=jr(t,i,1!=v.level?Math.min(c,v.to)-1:Math.max(s,v.from)).right,p=d<o?o-d+1e9:d-o;(!f||h>p)&&(f=v,h=p)}}return f||(f=e[e.length-1]),f.from<s&&(f={from:s,to:f.to,level:f.level}),f.to>c&&(f={from:f.from,to:c,level:f.level}),f}function ci(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==_r){_r=S("pre",null,"CodeMirror-line-like");for(var n=0;n<49;++n)_r.appendChild(document.createTextNode("x")),_r.appendChild(S("br"));_r.appendChild(document.createTextNode("x"))}O(t.measure,_r);var r=_r.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),D(t.measure),r||1}function fi(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var n=S("span","xxxxxxxxxx"),r=S("pre",[n],"CodeMirror-line-like");O(t.measure,r);var i=n.getBoundingClientRect(),e=(i.right-i.left)/10;return e>2&&(t.cachedCharWidth=e),e||10}function hi(t){for(var n=t.display,r={},i={},e=n.gutters.clientLeft,o=n.gutters.firstChild,u=0;o;o=o.nextSibling,++u){var a=t.display.gutterSpecs[u].className;r[a]=o.offsetLeft+o.clientLeft+e,i[a]=o.clientWidth}return{fixedPos:li(n),gutterTotalWidth:n.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:n.wrapper.clientWidth}}function li(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function vi(t){var n=ci(t.display),r=t.options.lineWrapping,i=r&&Math.max(5,t.display.scroller.clientWidth/fi(t.display)-3);return function(e){if(Zn(t.doc,e))return 0;var o=0;if(e.widgets)for(var u=0;u<e.widgets.length;u++)e.widgets[u].height&&(o+=e.widgets[u].height);return r?o+(Math.ceil(e.text.length/i)||1)*n:o+n}}function di(t){var n=t.doc,r=vi(t);n.iter((function(t){var n=r(t);n!=t.height&&nn(t,n)}))}function pi(t,n,r,i){var e=t.display;if(!r&&"true"==Ot(n).getAttribute("cm-not-content"))return null;var o,u,a=e.lineSpace.getBoundingClientRect();try{o=n.clientX-a.left,u=n.clientY-a.top}catch(t){return null}var s,c=ri(t,o,u);if(i&&c.xRel>0&&(s=Xt(t.doc,c.line).text).length==c.ch){var f=z(s,s.length,t.options.tabSize)-s.length;c=an(c.line,Math.max(0,Math.round((o-Nr(t.display).left)/fi(t.display))-f))}return c}function gi(t,n){if(n>=t.display.viewTo)return null;if((n-=t.display.viewFrom)<0)return null;for(var r=t.display.view,i=0;i<r.length;i++)if((n-=r[i].size)<0)return i}function bi(t,n,r,i){null==n&&(n=t.doc.first),null==r&&(r=t.doc.first+t.doc.size),i||(i=0);var e=t.display;if(i&&r<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>n)&&(e.updateLineNumbers=n),t.curOp.viewChanged=!0,n>=e.viewTo)On&&Gn(t.doc,n)<e.viewTo&&wi(t);else if(r<=e.viewFrom)On&&Wn(t.doc,r+i)>e.viewFrom?wi(t):(e.viewFrom+=i,e.viewTo+=i);else if(n<=e.viewFrom&&r>=e.viewTo)wi(t);else if(n<=e.viewFrom){var o=yi(t,r,r+i,1);o?(e.view=e.view.slice(o.index),e.viewFrom=o.lineN,e.viewTo+=i):wi(t)}else if(r>=e.viewTo){var u=yi(t,n,n,-1);u?(e.view=e.view.slice(0,u.index),e.viewTo=u.lineN):wi(t)}else{var a=yi(t,n,n,-1),s=yi(t,r,r+i,1);a&&s?(e.view=e.view.slice(0,a.index).concat(hr(t,a.lineN,s.lineN)).concat(e.view.slice(s.index)),e.viewTo+=i):wi(t)}var c=e.externalMeasured;c&&(r<c.lineN?c.lineN+=i:n<c.lineN+c.size&&(e.externalMeasured=null))}function mi(t,n,r){t.curOp.viewChanged=!0;var i=t.display,e=t.display.externalMeasured;if(e&&n>=e.lineN&&n<e.lineN+e.size&&(i.externalMeasured=null),!(n<i.viewFrom||n>=i.viewTo)){var o=i.view[gi(t,n)];if(null!=o.node){var u=o.changes||(o.changes=[]);-1==$(u,r)&&u.push(r)}}}function wi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function yi(t,n,r,i){var e,o=gi(t,n),u=t.display.view;if(!On||r==t.doc.first+t.doc.size)return{index:o,lineN:r};for(var a=t.display.viewFrom,s=0;s<o;s++)a+=u[s].size;if(a!=n){if(i>0){if(o==u.length-1)return null;e=a+u[o].size-n,o++}else e=a-n;n+=e,r+=e}for(;Gn(t.doc,r)!=r;){if(o==(i<0?0:u.length-1))return null;r+=i*u[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:r}}function ki(t){for(var n=t.display.view,r=0,i=0;i<n.length;i++){var e=n[i];e.hidden||e.node&&!e.changes||++r}return r}function Ti(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Ai(t,n){void 0===n&&(n=!0);var r=t.doc,i={},e=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),u=t.options.$customCursor;u&&(n=!0);for(var a=0;a<r.sel.ranges.length;a++)if(n||a!=r.sel.primIndex){var s=r.sel.ranges[a];if(!(s.from().line>=t.display.viewTo||s.to().line<t.display.viewFrom)){var c=s.empty();if(u){var f=u(t,s);f&&Ei(t,f,e)}else(c||t.options.showCursorWhenSelecting)&&Ei(t,s.head,e);c||xi(t,s,o)}}return i}function Ei(t,n,r){var i=Jr(t,n,"div",null,null,!t.options.singleCursorHeightPerLine),e=r.appendChild(S("div"," ","CodeMirror-cursor"));if(e.style.left=i.left+"px",e.style.top=i.top+"px",e.style.height=Math.max(0,i.bottom-i.top)*t.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(t.getWrapperElement().className)){var o=Xr(t,n,"div",null,null),u=o.right-o.left;e.style.width=(u>0?u:t.defaultCharWidth())+"px"}if(i.other){var a=r.appendChild(S("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=i.other.left+"px",a.style.top=i.other.top+"px",a.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Li(t,n){return t.top-n.top||t.left-n.left}function xi(t,n,r){var i=t.display,e=t.doc,o=document.createDocumentFragment(),u=Nr(t.display),a=u.left,s=Math.max(i.sizerWidth,Rr(t)-i.sizer.offsetLeft)-u.right,c="ltr"==e.direction;function f(t,n,r,i){n<0&&(n=0),n=Math.round(n),i=Math.round(i),o.appendChild(S("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+n+"px; width: "+(null==r?s-t:r)+"px;\n height: "+(i-n)+"px"))}function h(n,r,i){var o,u,h=Xt(e,n),l=h.text.length;function v(r,i){return Xr(t,an(n,r),"div",h,i)}function d(n,r,i){var e=ei(t,h,null,n),o="ltr"==r==("after"==i)?"left":"right";return v("after"==i?e.begin:e.end-(/\s/.test(h.text.charAt(e.end-1))?2:1),o)[o]}var p=pt(h,e.direction);return function(t,n,r,i){if(!t)return i(n,r,"ltr",0);for(var e=!1,o=0;o<t.length;++o){var u=t[o];(u.from<r&&u.to>n||n==r&&u.to==n)&&(i(Math.max(u.from,n),Math.min(u.to,r),1==u.level?"rtl":"ltr",o),e=!0)}e||i(n,r,"ltr")}(p,r||0,null==i?l:i,(function(t,n,e,h){var g="ltr"==e,b=v(t,g?"left":"right"),m=v(n-1,g?"right":"left"),w=null==r&&0==t,y=null==i&&n==l,k=0==h,T=!p||h==p.length-1;if(m.top-b.top<=3){var A=(c?w:y)&&k?a:(g?b:m).left;f(A,b.top,((c?y:w)&&T?s:(g?m:b).right)-A,b.bottom)}else{var E,L,x,C;g?(E=c&&w&&k?a:b.left,L=c?s:d(t,e,"before"),x=c?a:d(n,e,"after"),C=c&&y&&T?s:m.right):(E=c?d(t,e,"before"):a,L=!c&&w&&k?s:b.right,x=!c&&y&&T?a:m.left,C=c?d(n,e,"after"):s),f(E,b.top,L-E,b.bottom),b.bottom<m.top&&f(a,b.bottom,null,m.top),f(x,m.top,C-x,m.bottom)}(!o||Li(b,o)<0)&&(o=b),Li(m,o)<0&&(o=m),(!u||Li(b,u)<0)&&(u=b),Li(m,u)<0&&(u=m)})),{start:o,end:u}}var l=n.from(),v=n.to();if(l.line==v.line)h(l.line,l.ch,v.ch);else{var d=Xt(e,l.line),p=Xt(e,v.line),g=$n(d)==$n(p),b=h(l.line,l.ch,g?d.text.length+1:null).end,m=h(v.line,g?0:null,v.ch).start;g&&(b.top<m.top-2?(f(b.right,b.top,null,b.bottom),f(a,m.top,m.left,m.bottom)):f(b.right,b.top,m.left-b.right,b.bottom)),b.bottom<m.top&&f(a,b.bottom,null,m.top)}r.appendChild(o)}function Ci(t){if(t.state.focused){var n=t.display;clearInterval(n.blinker);var r=!0;n.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?n.blinker=setInterval((function(){t.hasFocus()||Ni(t),n.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(n.cursorDiv.style.visibility="hidden")}}function Di(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Si(t))}function Oi(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Ni(t))}),100)}function Si(t,n){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(yt(t,"focus",t,n),t.state.focused=!0,B(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),s&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),Ci(t))}function Ni(t,n){t.state.delayingBlurEvent||(t.state.focused&&(yt(t,"blur",t,n),t.state.focused=!1,C(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Mi(t){for(var n=t.display,r=n.lineDiv.offsetTop,i=Math.max(0,n.scroller.getBoundingClientRect().top),e=n.lineDiv.getBoundingClientRect().top,o=0,s=0;s<n.view.length;s++){var c=n.view[s],f=t.options.lineWrapping,h=void 0,l=0;if(!c.hidden){if(e+=c.line.height,u&&a<8){var v=c.node.offsetTop+c.node.offsetHeight;h=v-r,r=v}else{var d=c.node.getBoundingClientRect();h=d.bottom-d.top,!f&&c.text.firstChild&&(l=c.text.firstChild.getBoundingClientRect().right-d.left-1)}var p=c.line.height-h;if((p>.005||p<-.005)&&(e<i&&(o-=p),nn(c.line,h),Ri(c.line),c.rest))for(var g=0;g<c.rest.length;g++)Ri(c.rest[g]);if(l>t.display.sizerWidth){var b=Math.ceil(l/fi(t.display));b>t.display.maxLineLength&&(t.display.maxLineLength=b,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(n.scroller.scrollTop+=o)}function Ri(t){if(t.widgets)for(var n=0;n<t.widgets.length;++n){var r=t.widgets[n],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Bi(t,n,r){var i=r&&null!=r.top?Math.max(0,r.top):t.scroller.scrollTop;i=Math.floor(i-Or(t));var e=r&&null!=r.bottom?r.bottom:i+t.wrapper.clientHeight,o=en(n,i),u=en(n,e);if(r&&r.ensure){var a=r.ensure.from.line,s=r.ensure.to.line;a<o?(o=a,u=en(n,Yn(Xt(n,a))+t.wrapper.clientHeight)):Math.min(s,n.lastLine())>=u&&(o=en(n,Yn(Xt(n,s))-t.wrapper.clientHeight),u=s)}return{from:o,to:Math.max(u,o+1)}}function Ii(t,n){var r=t.display,i=ci(t.display);n.top<0&&(n.top=0);var e=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:r.scroller.scrollTop,o=Br(t),u={};n.bottom-n.top>o&&(n.bottom=n.top+o);var a=t.doc.height+Sr(r),s=n.bottom>a-i;if(n.top<e)u.scrollTop=n.top<i?0:n.top;else if(n.bottom>e+o){var c=Math.min(n.top,(s?a:n.bottom)-o);c!=e&&(u.scrollTop=c)}var f=t.options.fixedGutter?0:r.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:r.scroller.scrollLeft-f,l=Rr(t)-r.gutters.offsetWidth,v=n.right-n.left>l;return v&&(n.right=n.left+l),n.left<10?u.scrollLeft=0:n.left<h?u.scrollLeft=Math.max(0,n.left+f-(v?0:10)):n.right>l+h-3&&(u.scrollLeft=n.right+(v?0:10)-l),u}function qi(t,n){null!=n&&(ji(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+n)}function Fi(t){ji(t);var n=t.getCursor();t.curOp.scrollToPos={from:n,to:n,margin:t.options.cursorScrollMargin}}function Pi(t,n,r){null==n&&null==r||ji(t),null!=n&&(t.curOp.scrollLeft=n),null!=r&&(t.curOp.scrollTop=r)}function ji(t){var n=t.curOp.scrollToPos;n&&(t.curOp.scrollToPos=null,_i(t,ti(t,n.from),ti(t,n.to),n.margin))}function _i(t,n,r,i){var e=Ii(t,{left:Math.min(n.left,r.left),top:Math.min(n.top,r.top)-i,right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)+i});Pi(t,e.scrollLeft,e.scrollTop)}function Ui(t,n){Math.abs(t.doc.scrollTop-n)<2||(r||de(t,{top:n}),Hi(t,n,!0),r&&de(t),ce(t,100))}function Hi(t,n,r){n=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,n)),(t.display.scroller.scrollTop!=n||r)&&(t.doc.scrollTop=n,t.display.scrollbars.setScrollTop(n),t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n))}function zi(t,n,r,i){n=Math.max(0,Math.min(n,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(r?n==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-n)<2)&&!i||(t.doc.scrollLeft=n,be(t),t.display.scroller.scrollLeft!=n&&(t.display.scroller.scrollLeft=n),t.display.scrollbars.setScrollLeft(n))}function Vi(t){var n=t.display,r=n.gutters.offsetWidth,i=Math.round(t.doc.height+Sr(t.display));return{clientHeight:n.scroller.clientHeight,viewHeight:n.wrapper.clientHeight,scrollWidth:n.scroller.scrollWidth,clientWidth:n.scroller.clientWidth,viewWidth:n.wrapper.clientWidth,barLeft:t.options.fixedGutter?r:0,docHeight:i,scrollHeight:i+Mr(t)+n.barHeight,nativeBarWidth:n.nativeBarWidth,gutterWidth:r}}var $i=function(t,n,r){this.cm=r;var i=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=S("div",[S("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=e.tabIndex=-1,t(i),t(e),bt(i,"scroll",(function(){i.clientHeight&&n(i.scrollTop,"vertical")})),bt(e,"scroll",(function(){e.clientWidth&&n(e.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,u&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};$i.prototype.update=function(t){var n=t.scrollWidth>t.clientWidth+1,r=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+(t.viewHeight-(n?i:0)))+"px"):(this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=t.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+(t.viewWidth-t.barLeft-(r?i:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},$i.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},$i.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},$i.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=w&&!d?"12px":"18px",this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new V,this.disableVert=new V},$i.prototype.enableZeroWidthBar=function(t,n,r){t.style.visibility="",n.set(1e3,(function i(){var e=t.getBoundingClientRect();("vert"==r?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=t?t.style.visibility="hidden":n.set(1e3,i)}))},$i.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Gi=function(){};function Wi(t,n){n||(n=Vi(t));var r=t.display.barWidth,i=t.display.barHeight;Zi(t,n);for(var e=0;e<4&&r!=t.display.barWidth||i!=t.display.barHeight;e++)r!=t.display.barWidth&&t.options.lineWrapping&&Mi(t),Zi(t,Vi(t)),r=t.display.barWidth,i=t.display.barHeight}function Zi(t,n){var r=t.display,i=r.scrollbars.update(n);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=n.gutterWidth+"px"):r.gutterFiller.style.display=""}Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};var Ki={native:$i,null:Gi};function Yi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&C(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Ki[t.options.scrollbarStyle]((function(n){t.display.wrapper.insertBefore(n,t.display.scrollbarFiller),bt(n,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),n.setAttribute("cm-not-content","true")}),(function(n,r){"horizontal"==r?zi(t,n):Ui(t,n)}),t),t.display.scrollbars.addClass&&B(t.display.wrapper,t.display.scrollbars.addClass)}var Qi=0;function Xi(t){var n;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qi,markArrays:null},n=t.curOp,lr?lr.ops.push(n):n.ownsGroup=lr={ops:[n],delayedCallbacks:[]}}function Ji(t){var n=t.curOp;n&&function(t,n){var r=t.ownsGroup;if(r)try{!function(t){var n=t.delayedCallbacks,r=0;do{for(;r<n.length;r++)n[r].call(null);for(var i=0;i<t.ops.length;i++){var e=t.ops[i];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(r<n.length)}(r)}finally{lr=null,n(r)}}(n,(function(t){for(var n=0;n<t.ops.length;n++)t.ops[n].cm.curOp=null;!function(t){for(var n=t.ops,r=0;r<n.length;r++)te(n[r]);for(var i=0;i<n.length;i++)ne(n[i]);for(var e=0;e<n.length;e++)re(n[e]);for(var o=0;o<n.length;o++)ie(n[o]);for(var u=0;u<n.length;u++)ee(n[u])}(t)}))}function te(t){var n=t.cm,r=n.display;(function(t){var n=t.display;!n.scrollbarsClipped&&n.scroller.offsetWidth&&(n.nativeBarWidth=n.scroller.offsetWidth-n.scroller.clientWidth,n.heightForcer.style.height=Mr(t)+"px",n.sizer.style.marginBottom=-n.nativeBarWidth+"px",n.sizer.style.borderRightWidth=Mr(t)+"px",n.scrollbarsClipped=!0)})(n),t.updateMaxLine&&Xn(n),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<r.viewFrom||t.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&n.options.lineWrapping,t.update=t.mustUpdate&&new he(n,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function ne(t){t.updatedDisplay=t.mustUpdate&&le(t.cm,t.update)}function re(t){var n=t.cm,r=n.display;t.updatedDisplay&&Mi(n),t.barMeasure=Vi(n),r.maxLineChanged&&!n.options.lineWrapping&&(t.adjustWidthTo=qr(n,r.maxLine,r.maxLine.text.length).left+3,n.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+t.adjustWidthTo+Mr(n)+n.display.barWidth),t.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+t.adjustWidthTo-Rr(n))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=r.input.prepareSelection())}function ie(t){var n=t.cm;null!=t.adjustWidthTo&&(n.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<n.doc.scrollLeft&&zi(n,Math.min(n.display.scroller.scrollLeft,t.maxScrollLeft),!0),n.display.maxLineChanged=!1);var r=t.focus&&t.focus==R(P(n));t.preparedSelection&&n.display.input.showSelection(t.preparedSelection,r),(t.updatedDisplay||t.startHeight!=n.doc.height)&&Wi(n,t.barMeasure),t.updatedDisplay&&ge(n,t.barMeasure),t.selectionChanged&&Ci(n),n.state.focused&&t.updateInput&&n.display.input.reset(t.typing),r&&Di(t.cm)}function ee(t){var n=t.cm,r=n.display,i=n.doc;t.updatedDisplay&&ve(n,t.update),null==r.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=t.scrollTop&&Hi(n,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&zi(n,t.scrollLeft,!0,!0),t.scrollToPos&&function(t,n){if(!kt(t,"scrollCursorIntoView")){var r=t.display,i=r.sizer.getBoundingClientRect(),e=null,o=r.wrapper.ownerDocument;if(n.top+i.top<0?e=!0:n.bottom+i.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(e=!1),null!=e&&!p){var u=S("div","",null,"position: absolute;\n top: "+(n.top-r.viewOffset-Or(t.display))+"px;\n height: "+(n.bottom-n.top+Mr(t)+r.barHeight)+"px;\n left: "+n.left+"px; width: "+Math.max(2,n.right-n.left)+"px;");t.display.lineSpace.appendChild(u),u.scrollIntoView(e),t.display.lineSpace.removeChild(u)}}}(n,function(t,n,r,i){var e;null==i&&(i=0),t.options.lineWrapping||n!=r||(r="before"==n.sticky?an(n.line,n.ch+1,"before"):n,n=n.ch?an(n.line,"before"==n.sticky?n.ch-1:n.ch,"after"):n);for(var o=0;o<5;o++){var u=!1,a=Jr(t,n),s=r&&r!=n?Jr(t,r):a,c=Ii(t,e={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-i,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+i}),f=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(Ui(t,c.scrollTop),Math.abs(t.doc.scrollTop-f)>1&&(u=!0)),null!=c.scrollLeft&&(zi(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(u=!0)),!u)break}return e}(n,dn(i,t.scrollToPos.from),dn(i,t.scrollToPos.to),t.scrollToPos.margin));var e=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(e)for(var u=0;u<e.length;++u)e[u].lines.length||yt(e[u],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&yt(o[a],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=n.display.scroller.scrollTop),t.changeObjs&&yt(n,"changes",n,t.changeObjs),t.update&&t.update.finish()}function oe(t,n){if(t.curOp)return n();Xi(t);try{return n()}finally{Ji(t)}}function ue(t,n){return function(){if(t.curOp)return n.apply(t,arguments);Xi(t);try{return n.apply(t,arguments)}finally{Ji(t)}}}function ae(t){return function(){if(this.curOp)return t.apply(this,arguments);Xi(this);try{return t.apply(this,arguments)}finally{Ji(this)}}}function se(t){return function(){var n=this.cm;if(!n||n.curOp)return t.apply(this,arguments);Xi(n);try{return t.apply(this,arguments)}finally{Ji(n)}}}function ce(t,n){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(n,U(fe,t))}function fe(t){var n=t.doc;if(!(n.highlightFrontier>=t.display.viewTo)){var r=+new Date+t.options.workTime,i=yn(t,n.highlightFrontier),e=[];n.iter(i.line,Math.min(n.first+n.size,t.display.viewTo+500),(function(o){if(i.line>=t.display.viewFrom){var u=o.styles,a=o.text.length>t.options.maxHighlightLength?Zt(n.mode,i.state):null,s=mn(t,o,i,!0);a&&(i.state=a),o.styles=s.styles;var c=o.styleClasses,f=s.classes;f?o.styleClasses=f:c&&(o.styleClasses=null);for(var h=!u||u.length!=o.styles.length||c!=f&&(!c||!f||c.bgClass!=f.bgClass||c.textClass!=f.textClass),l=0;!h&&l<u.length;++l)h=u[l]!=o.styles[l];h&&e.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=t.options.maxHighlightLength&&kn(t,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return ce(t,t.options.workDelay),!0})),n.highlightFrontier=i.line,n.modeFrontier=Math.max(n.modeFrontier,i.line),e.length&&oe(t,(function(){for(var n=0;n<e.length;n++)mi(t,e[n],"text")}))}}var he=function(t,n,r){var i=t.display;this.viewport=n,this.visible=Bi(i,t.doc,n),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Rr(t),this.force=r,this.dims=hi(t),this.events=[]};function le(t,n){var r=t.display,i=t.doc;if(n.editorIsHidden)return wi(t),!1;if(!n.force&&n.visible.from>=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==ki(t))return!1;me(t)&&(wi(t),n.dims=hi(t));var e=i.first+i.size,o=Math.max(n.visible.from-t.options.viewportMargin,i.first),u=Math.min(e,n.visible.to+t.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(i.first,r.viewFrom)),r.viewTo>u&&r.viewTo-u<20&&(u=Math.min(e,r.viewTo)),On&&(o=Gn(t.doc,o),u=Wn(t.doc,u));var a=o!=r.viewFrom||u!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;(function(t,n,r){var i=t.display;0==i.view.length||n>=i.viewTo||r<=i.viewFrom?(i.view=hr(t,n,r),i.viewFrom=n):(i.viewFrom>n?i.view=hr(t,n,i.viewFrom).concat(i.view):i.viewFrom<n&&(i.view=i.view.slice(gi(t,n))),i.viewFrom=n,i.viewTo<r?i.view=i.view.concat(hr(t,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,gi(t,r)))),i.viewTo=r})(t,o,u),r.viewOffset=Yn(Xt(t.doc,r.viewFrom)),t.display.mover.style.top=r.viewOffset+"px";var c=ki(t);if(!a&&0==c&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var f=function(t){if(t.hasFocus())return null;var n=R(P(t));if(!n||!M(t.display.lineDiv,n))return null;var r={activeElt:n};if(window.getSelection){var i=_(t).getSelection();i.anchorNode&&i.extend&&M(t.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}(t);return c>4&&(r.lineDiv.style.display="none"),function(t,n,r){var i=t.display,e=t.options.lineNumbers,o=i.lineDiv,u=o.firstChild;function a(n){var r=n.nextSibling;return s&&w&&t.display.currentWheelTarget==n?n.style.display="none":n.parentNode.removeChild(n),r}for(var c=i.view,f=i.viewFrom,h=0;h<c.length;h++){var l=c[h];if(l.hidden);else if(l.node&&l.node.parentNode==o){for(;u!=l.node;)u=a(u);var v=e&&null!=n&&n<=f&&l.lineNumber;l.changes&&($(l.changes,"gutter")>-1&&(v=!1),gr(t,l,f,r)),v&&(D(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(un(t.options,f)))),u=l.node.nextSibling}else{var d=Ar(t,l,f,r);o.insertBefore(d,u)}f+=l.size}for(;u;)u=a(u)}(t,r.updateLineNumbers,n.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(t){if(t&&t.activeElt&&t.activeElt!=R(j(t.activeElt))&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&M(document.body,t.anchorNode)&&M(document.body,t.focusNode))){var n=t.activeElt.ownerDocument,r=n.defaultView.getSelection(),i=n.createRange();i.setEnd(t.anchorNode,t.anchorOffset),i.collapse(!1),r.removeAllRanges(),r.addRange(i),r.extend(t.focusNode,t.focusOffset)}}(f),D(r.cursorDiv),D(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,ce(t,400)),r.updateLineNumbers=null,!0}function ve(t,n){for(var r=n.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&n.oldDisplayWidth!=Rr(t))i&&(n.visible=Bi(t.display,t.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(t.doc.height+Sr(t.display)-Br(t),r.top)}),n.visible=Bi(t.display,t.doc,r),n.visible.from>=t.display.viewFrom&&n.visible.to<=t.display.viewTo)break;if(!le(t,n))break;Mi(t);var e=Vi(t);Ti(t),Wi(t,e),ge(t,e),n.force=!1}n.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(n.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function de(t,n){var r=new he(t,n);if(le(t,r)){Mi(t),ve(t,r);var i=Vi(t);Ti(t),Wi(t,i),ge(t,i),r.finish()}}function pe(t){t.sizer.style.marginLeft=t.gutters.offsetWidth+"px",dr(t,"gutterChanged",t)}function ge(t,n){t.display.sizer.style.minHeight=n.docHeight+"px",t.display.heightForcer.style.top=n.docHeight+"px",t.display.gutters.style.height=n.docHeight+t.display.barHeight+Mr(t)+"px"}function be(t){var n=t.display,r=n.view;if(n.alignWidgets||n.gutters.firstChild&&t.options.fixedGutter){for(var i=li(n)-n.scroller.scrollLeft+t.doc.scrollLeft,e=n.gutters.offsetWidth,o=i+"px",u=0;u<r.length;u++)if(!r[u].hidden){t.options.fixedGutter&&(r[u].gutter&&(r[u].gutter.style.left=o),r[u].gutterBackground&&(r[u].gutterBackground.style.left=o));var a=r[u].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}t.options.fixedGutter&&(n.gutters.style.left=i+e+"px")}}function me(t){if(!t.options.lineNumbers)return!1;var n=t.doc,r=un(t.options,n.first+n.size-1),i=t.display;if(r.length!=i.lineNumChars){var e=i.measure.appendChild(S("div",[S("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=e.firstChild.offsetWidth,u=e.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-u)+1,i.lineNumWidth=i.lineNumInnerWidth+u,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",pe(t.display),!0}return!1}function we(t,n){for(var r=[],i=!1,e=0;e<t.length;e++){var o=t[e],u=null;if("string"!=typeof o&&(u=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!n)continue;i=!0}r.push({className:o,style:u})}return n&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function ye(t){var n=t.gutters,r=t.gutterSpecs;D(n),t.lineGutter=null;for(var i=0;i<r.length;++i){var e=r[i],o=e.className,u=e.style,a=n.appendChild(S("div",null,"CodeMirror-gutter "+o));u&&(a.style.cssText=u),"CodeMirror-linenumbers"==o&&(t.lineGutter=a,a.style.width=(t.lineNumWidth||1)+"px")}n.style.display=r.length?"":"none",pe(t)}function ke(t){ye(t.display),bi(t),be(t)}function Te(t,n,i,e){var o=this;this.input=i,o.scrollbarFiller=S("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=S("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=N("div",null,"CodeMirror-code"),o.selectionDiv=S("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=S("div",null,"CodeMirror-cursors"),o.measure=S("div",null,"CodeMirror-measure"),o.lineMeasure=S("div",null,"CodeMirror-measure"),o.lineSpace=N("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=N("div",[o.lineSpace],"CodeMirror-lines");o.mover=S("div",[c],null,"position: relative"),o.sizer=S("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=S("div",null,null,"position: absolute; height: "+G+"px; width: 1px;"),o.gutters=S("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=S("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=S("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),f&&h>=105&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),u&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||r&&m||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=n.first,o.reportedViewFrom=o.reportedViewTo=n.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=we(e.gutters,e.lineNumbers),ye(o),i.init(o)}he.prototype.signal=function(t,n){At(t,n)&&this.events.push(arguments)},he.prototype.finish=function(){for(var t=0;t<this.events.length;t++)yt.apply(null,this.events[t])};var Ae=0,Ee=null;function Le(t){var n=t.wheelDeltaX,r=t.wheelDeltaY;return null==n&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(n=t.detail),null==r&&t.detail&&t.axis==t.VERTICAL_AXIS?r=t.detail:null==r&&(r=t.wheelDelta),{x:n,y:r}}function xe(t){var n=Le(t);return n.x*=Ee,n.y*=Ee,n}function Ce(t,n){f&&102==h&&(null==t.display.chromeScrollHack?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout((function(){t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""}),100));var i=Le(n),e=i.x,o=i.y,u=Ee;0===n.deltaMode&&(e=n.deltaX,o=n.deltaY,u=1);var a=t.display,c=a.scroller,v=c.scrollHeight>c.clientHeight;if(e&&c.scrollWidth>c.clientWidth||o&&v){if(o&&w&&s)t:for(var d=n.target,p=a.view;d!=c;d=d.parentNode)for(var g=0;g<p.length;g++)if(p[g].node==d){t.display.currentWheelTarget=d;break t}if(e&&!r&&!l&&null!=u)return o&&v&&Ui(t,Math.max(0,c.scrollTop+o*u)),zi(t,Math.max(0,c.scrollLeft+e*u)),(!o||o&&v)&&Lt(n),void(a.wheelStartX=null);if(o&&null!=u){var b=o*u,m=t.doc.scrollTop,y=m+a.wrapper.clientHeight;b<0?m=Math.max(0,m+b-50):y=Math.min(t.doc.height,y+b+50),de(t,{top:m,bottom:y})}Ae<20&&0!==n.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=c.scrollLeft,a.wheelStartY=c.scrollTop,a.wheelDX=e,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var t=c.scrollLeft-a.wheelStartX,n=c.scrollTop-a.wheelStartY,r=n&&a.wheelDY&&n/a.wheelDY||t&&a.wheelDX&&t/a.wheelDX;a.wheelStartX=a.wheelStartY=null,r&&(Ee=(Ee*Ae+r)/(Ae+1),++Ae)}}),200)):(a.wheelDX+=e,a.wheelDY+=o))}}u?Ee=-.53:r?Ee=15:f?Ee=-.7:v&&(Ee=-1/3);var De=function(t,n){this.ranges=t,this.primIndex=n};De.prototype.primary=function(){return this.ranges[this.primIndex]},De.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n],i=t.ranges[n];if(!cn(r.anchor,i.anchor)||!cn(r.head,i.head))return!1}return!0},De.prototype.deepCopy=function(){for(var t=[],n=0;n<this.ranges.length;n++)t[n]=new Oe(fn(this.ranges[n].anchor),fn(this.ranges[n].head));return new De(t,this.primIndex)},De.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},De.prototype.contains=function(t,n){n||(n=t);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(sn(n,i.from())>=0&&sn(t,i.to())<=0)return r}return-1};var Oe=function(t,n){this.anchor=t,this.head=n};function Se(t,n,r){var i=t&&t.options.selectionsMayTouch,e=n[r];n.sort((function(t,n){return sn(t.from(),n.from())})),r=$(n,e);for(var o=1;o<n.length;o++){var u=n[o],a=n[o-1],s=sn(a.to(),u.from());if(i&&!u.empty()?s>0:s>=0){var c=ln(a.from(),u.from()),f=hn(a.to(),u.to()),h=a.empty()?u.from()==u.head:a.from()==a.head;o<=r&&--r,n.splice(--o,2,new Oe(h?f:c,h?c:f))}}return new De(n,r)}function Ne(t,n){return new De([new Oe(t,n||t)],0)}function Me(t){return t.text?an(t.from.line+t.text.length-1,tt(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Re(t,n){if(sn(t,n.from)<0)return t;if(sn(t,n.to)<=0)return Me(n);var r=t.line+n.text.length-(n.to.line-n.from.line)-1,i=t.ch;return t.line==n.to.line&&(i+=Me(n).ch-n.to.ch),an(r,i)}function Be(t,n){for(var r=[],i=0;i<t.sel.ranges.length;i++){var e=t.sel.ranges[i];r.push(new Oe(Re(e.anchor,n),Re(e.head,n)))}return Se(t.cm,r,t.sel.primIndex)}function Ie(t,n,r){return t.line==n.line?an(r.line,t.ch-n.ch+r.ch):an(r.line+(t.line-n.line),t.ch)}function qe(t){t.doc.mode=$t(t.options,t.doc.modeOption),Fe(t)}function Fe(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,ce(t,100),t.state.modeGen++,t.curOp&&bi(t)}function Pe(t,n){return 0==n.from.ch&&0==n.to.ch&&""==tt(n.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function je(t,n,r,i){function e(t){return r?r[t]:null}function o(t,r,e){(function(t,n,r,i){t.text=n,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),In(t),qn(t,r);var e=i?i(t):1;e!=t.height&&nn(t,e)})(t,r,e,i),dr(t,"change",t,n)}function u(t,n){for(var r=[],o=t;o<n;++o)r.push(new Jn(c[o],e(o),i));return r}var a=n.from,s=n.to,c=n.text,f=Xt(t,a.line),h=Xt(t,s.line),l=tt(c),v=e(c.length-1),d=s.line-a.line;if(n.full)t.insert(0,u(0,c.length)),t.remove(c.length,t.size-c.length);else if(Pe(t,n)){var p=u(0,c.length-1);o(h,h.text,v),d&&t.remove(a.line,d),p.length&&t.insert(a.line,p)}else if(f==h)if(1==c.length)o(f,f.text.slice(0,a.ch)+l+f.text.slice(s.ch),v);else{var g=u(1,c.length-1);g.push(new Jn(l+f.text.slice(s.ch),v,i)),o(f,f.text.slice(0,a.ch)+c[0],e(0)),t.insert(a.line+1,g)}else if(1==c.length)o(f,f.text.slice(0,a.ch)+c[0]+h.text.slice(s.ch),e(0)),t.remove(a.line+1,d);else{o(f,f.text.slice(0,a.ch)+c[0],e(0)),o(h,l+h.text.slice(s.ch),v);var b=u(1,c.length-1);d>1&&t.remove(a.line+1,d-1),t.insert(a.line+1,b)}dr(t,"change",t,n)}function _e(t,n,r){!function t(i,e,o){if(i.linked)for(var u=0;u<i.linked.length;++u){var a=i.linked[u];if(a.doc!=e){var s=o&&a.sharedHist;r&&!s||(n(a.doc,s),t(a.doc,i,s))}}}(t,null,!0)}function Ue(t,n){if(n.cm)throw new Error("This document is already in use.");t.doc=n,n.cm=t,di(t),qe(t),He(t),t.options.direction=n.direction,t.options.lineWrapping||Xn(t),t.options.mode=n.modeOption,bi(t)}function He(t){("rtl"==t.doc.direction?B:C)(t.display.lineDiv,"CodeMirror-rtl")}function ze(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Ve(t,n){var r={from:fn(n.from),to:Me(n),text:Jt(t,n.from,n.to)};return Ke(t,r,n.from.line,n.to.line+1),_e(t,(function(t){return Ke(t,r,n.from.line,n.to.line+1)}),!0),r}function $e(t){for(;t.length&&tt(t).ranges;)t.pop()}function Ge(t,n,r,i){var e=t.history;e.undone.length=0;var o,u,a=+new Date;if((e.lastOp==i||e.lastOrigin==n.origin&&n.origin&&("+"==n.origin.charAt(0)&&e.lastModTime>a-(t.cm?t.cm.options.historyEventDelay:500)||"*"==n.origin.charAt(0)))&&(o=function(t,n){return n?($e(t.done),tt(t.done)):t.done.length&&!tt(t.done).ranges?tt(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),tt(t.done)):void 0}(e,e.lastOp==i)))u=tt(o.changes),0==sn(n.from,n.to)&&0==sn(n.from,u.to)?u.to=Me(n):o.changes.push(Ve(t,n));else{var s=tt(e.done);for(s&&s.ranges||Ze(t.sel,e.done),o={changes:[Ve(t,n)],generation:e.generation},e.done.push(o);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(r),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=a,e.lastOp=e.lastSelOp=i,e.lastOrigin=e.lastSelOrigin=n.origin,u||yt(t,"historyAdded")}function We(t,n,r,i){var e=t.history,o=i&&i.origin;r==e.lastSelOp||o&&e.lastSelOrigin==o&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==o||function(t,n,r,i){var e=n.charAt(0);return"*"==e||"+"==e&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}(t,o,tt(e.done),n))?e.done[e.done.length-1]=n:Ze(n,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=o,e.lastSelOp=r,i&&!1!==i.clearRedo&&$e(e.undone)}function Ze(t,n){var r=tt(n);r&&r.ranges&&r.equals(t)||n.push(t)}function Ke(t,n,r,i){var e=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,r),Math.min(t.first+t.size,i),(function(r){r.markedSpans&&((e||(e=n["spans_"+t.id]={}))[o]=r.markedSpans),++o}))}function Ye(t){if(!t)return null;for(var n,r=0;r<t.length;++r)t[r].marker.explicitlyCleared?n||(n=t.slice(0,r)):n&&n.push(t[r]);return n?n.length?n:null:t}function Qe(t,n){var r=function(t,n){var r=n["spans_"+t.id];if(!r)return null;for(var i=[],e=0;e<n.text.length;++e)i.push(Ye(r[e]));return i}(t,n),i=Rn(t,n);if(!r)return i;if(!i)return r;for(var e=0;e<r.length;++e){var o=r[e],u=i[e];if(o&&u)t:for(var a=0;a<u.length;++a){for(var s=u[a],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue t;o.push(s)}else u&&(r[e]=u)}return r}function Xe(t,n,r){for(var i=[],e=0;e<t.length;++e){var o=t[e];if(o.ranges)i.push(r?De.prototype.deepCopy.call(o):o);else{var u=o.changes,a=[];i.push({changes:a});for(var s=0;s<u.length;++s){var c=u[s],f=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),n)for(var h in c)(f=h.match(/^spans_(\d+)$/))&&$(n,Number(f[1]))>-1&&(tt(a)[h]=c[h],delete c[h])}}}return i}function Je(t,n,r,i){if(i){var e=t.anchor;if(r){var o=sn(n,e)<0;o!=sn(r,e)<0?(e=n,n=r):o!=sn(n,r)<0&&(n=r)}return new Oe(e,n)}return new Oe(r||n,n)}function to(t,n,r,i,e){null==e&&(e=t.cm&&(t.cm.display.shift||t.extend)),oo(t,new De([Je(t.sel.primary(),n,r,e)],0),i)}function no(t,n,r){for(var i=[],e=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)i[o]=Je(t.sel.ranges[o],n[o],null,e);oo(t,Se(t.cm,i,t.sel.primIndex),r)}function ro(t,n,r,i){var e=t.sel.ranges.slice(0);e[n]=r,oo(t,Se(t.cm,e,t.sel.primIndex),i)}function io(t,n,r,i){oo(t,Ne(n,r),i)}function eo(t,n,r){var i=t.history.done,e=tt(i);e&&e.ranges?(i[i.length-1]=n,uo(t,n,r)):oo(t,n,r)}function oo(t,n,r){uo(t,n,r),We(t,t.sel,t.cm?t.cm.curOp.id:NaN,r)}function uo(t,n,r){(At(t,"beforeSelectionChange")||t.cm&&At(t.cm,"beforeSelectionChange"))&&(n=function(t,n,r){var i={ranges:n.ranges,update:function(n){this.ranges=[];for(var r=0;r<n.length;r++)this.ranges[r]=new Oe(dn(t,n[r].anchor),dn(t,n[r].head))},origin:r&&r.origin};return yt(t,"beforeSelectionChange",t,i),t.cm&&yt(t.cm,"beforeSelectionChange",t.cm,i),i.ranges!=n.ranges?Se(t.cm,i.ranges,i.ranges.length-1):n}(t,n,r));var i=r&&r.bias||(sn(n.primary().head,t.sel.primary().head)<0?-1:1);ao(t,co(t,n,i,!0)),r&&!1===r.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||Fi(t.cm)}function ao(t,n){n.equals(t.sel)||(t.sel=n,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,Tt(t.cm)),dr(t,"cursorActivity",t))}function so(t){ao(t,co(t,t.sel,null,!1))}function co(t,n,r,i){for(var e,o=0;o<n.ranges.length;o++){var u=n.ranges[o],a=n.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],s=ho(t,u.anchor,a&&a.anchor,r,i),c=u.head==u.anchor?s:ho(t,u.head,a&&a.head,r,i);(e||s!=u.anchor||c!=u.head)&&(e||(e=n.ranges.slice(0,o)),e[o]=new Oe(s,c))}return e?Se(t.cm,e,n.primIndex):n}function fo(t,n,r,i,e){var o=Xt(t,n.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var a=o.markedSpans[u],s=a.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,f="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==a.from||(c?a.from<=n.ch:a.from<n.ch))&&(null==a.to||(f?a.to>=n.ch:a.to>n.ch))){if(e&&(yt(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--u;continue}break}if(!s.atomic)continue;if(r){var h=s.find(i<0?1:-1),l=void 0;if((i<0?f:c)&&(h=lo(t,h,-i,h&&h.line==n.line?o:null)),h&&h.line==n.line&&(l=sn(h,r))&&(i<0?l<0:l>0))return fo(t,h,n,i,e)}var v=s.find(i<0?-1:1);return(i<0?c:f)&&(v=lo(t,v,i,v.line==n.line?o:null)),v?fo(t,v,n,i,e):null}}return n}function ho(t,n,r,i,e){var o=i||1;return fo(t,n,r,o,e)||!e&&fo(t,n,r,o,!0)||fo(t,n,r,-o,e)||!e&&fo(t,n,r,-o,!0)||(t.cantEdit=!0,an(t.first,0))}function lo(t,n,r,i){return r<0&&0==n.ch?n.line>t.first?dn(t,an(n.line-1)):null:r>0&&n.ch==(i||Xt(t,n.line)).text.length?n.line<t.first+t.size-1?an(n.line+1,0):null:new an(n.line,n.ch+r)}function vo(t){t.setSelection(an(t.firstLine(),0),an(t.lastLine()),Z)}function po(t,n,r){var i={canceled:!1,from:n.from,to:n.to,text:n.text,origin:n.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(n,r,e,o){n&&(i.from=dn(t,n)),r&&(i.to=dn(t,r)),e&&(i.text=e),void 0!==o&&(i.origin=o)}),yt(t,"beforeChange",t,i),t.cm&&yt(t.cm,"beforeChange",t.cm,i),i.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function go(t,n,r){if(t.cm){if(!t.cm.curOp)return ue(t.cm,go)(t,n,r);if(t.cm.state.suppressEdits)return}if(!(At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"))||(n=po(t,n,!0))){var i=Dn&&!r&&function(t,n,r){var i=null;if(t.iter(n.line,r.line+1,(function(t){if(t.markedSpans)for(var n=0;n<t.markedSpans.length;++n){var r=t.markedSpans[n].marker;!r.readOnly||i&&-1!=$(i,r)||(i||(i=[])).push(r)}})),!i)return null;for(var e=[{from:n,to:r}],o=0;o<i.length;++o)for(var u=i[o],a=u.find(0),s=0;s<e.length;++s){var c=e[s];if(!(sn(c.to,a.from)<0||sn(c.from,a.to)>0)){var f=[s,1],h=sn(c.from,a.from),l=sn(c.to,a.to);(h<0||!u.inclusiveLeft&&!h)&&f.push({from:c.from,to:a.from}),(l>0||!u.inclusiveRight&&!l)&&f.push({from:a.to,to:c.to}),e.splice.apply(e,f),s+=f.length-3}}return e}(t,n.from,n.to);if(i)for(var e=i.length-1;e>=0;--e)bo(t,{from:i[e].from,to:i[e].to,text:e?[""]:n.text,origin:n.origin});else bo(t,n)}}function bo(t,n){if(1!=n.text.length||""!=n.text[0]||0!=sn(n.from,n.to)){var r=Be(t,n);Ge(t,n,r,t.cm?t.cm.curOp.id:NaN),yo(t,n,r,Rn(t,n));var i=[];_e(t,(function(t,r){r||-1!=$(i,t.history)||(Eo(t.history,n),i.push(t.history)),yo(t,n,null,Rn(t,n))}))}}function mo(t,n,r){var i=t.cm&&t.cm.state.suppressEdits;if(!i||r){for(var e,o=t.history,u=t.sel,a="undo"==n?o.done:o.undone,s="undo"==n?o.undone:o.done,c=0;c<a.length&&(e=a[c],r?!e.ranges||e.equals(t.sel):e.ranges);c++);if(c!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(e=a.pop()).ranges){if(i)return void a.push(e);break}if(Ze(e,s),r&&!e.equals(t.sel))return void oo(t,e,{clearRedo:!1});u=e}var f=[];Ze(u,s),s.push({changes:f,generation:o.generation}),o.generation=e.generation||++o.maxGeneration;for(var h=At(t,"beforeChange")||t.cm&&At(t.cm,"beforeChange"),l=function(r){var i=e.changes[r];if(i.origin=n,h&&!po(t,i,!1))return a.length=0,{};f.push(Ve(t,i));var o=r?Be(t,i):tt(a);yo(t,i,o,Qe(t,i)),!r&&t.cm&&t.cm.scrollIntoView({from:i.from,to:Me(i)});var u=[];_e(t,(function(t,n){n||-1!=$(u,t.history)||(Eo(t.history,i),u.push(t.history)),yo(t,i,null,Qe(t,i))}))},v=e.changes.length-1;v>=0;--v){var d=l(v);if(d)return d.v}}}}function wo(t,n){if(0!=n&&(t.first+=n,t.sel=new De(nt(t.sel.ranges,(function(t){return new Oe(an(t.anchor.line+n,t.anchor.ch),an(t.head.line+n,t.head.ch))})),t.sel.primIndex),t.cm)){bi(t.cm,t.first,t.first-n,n);for(var r=t.cm.display,i=r.viewFrom;i<r.viewTo;i++)mi(t.cm,i,"gutter")}}function yo(t,n,r,i){if(t.cm&&!t.cm.curOp)return ue(t.cm,yo)(t,n,r,i);if(n.to.line<t.first)wo(t,n.text.length-1-(n.to.line-n.from.line));else if(!(n.from.line>t.lastLine())){if(n.from.line<t.first){var e=n.text.length-1-(t.first-n.from.line);wo(t,e),n={from:an(t.first,0),to:an(n.to.line+e,n.to.ch),text:[tt(n.text)],origin:n.origin}}var o=t.lastLine();n.to.line>o&&(n={from:n.from,to:an(o,Xt(t,o).text.length),text:[n.text[0]],origin:n.origin}),n.removed=Jt(t,n.from,n.to),r||(r=Be(t,n)),t.cm?function(t,n,r){var i=t.doc,e=t.display,o=n.from,u=n.to,a=!1,s=o.line;t.options.lineWrapping||(s=rn($n(Xt(i,o.line))),i.iter(s,u.line+1,(function(t){if(t==e.maxLine)return a=!0,!0}))),i.sel.contains(n.from,n.to)>-1&&Tt(t),je(i,n,r,vi(t)),t.options.lineWrapping||(i.iter(s,o.line+n.text.length,(function(t){var n=Qn(t);n>e.maxLineLength&&(e.maxLine=t,e.maxLineLength=n,e.maxLineChanged=!0,a=!1)})),a&&(t.curOp.updateMaxLine=!0)),function(t,n){if(t.modeFrontier=Math.min(t.modeFrontier,n),!(t.highlightFrontier<n-10)){for(var r=t.first,i=n-1;i>r;i--){var e=Xt(t,i).stateAfter;if(e&&(!(e instanceof gn)||i+e.lookAhead<n)){r=i+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,r)}}(i,o.line),ce(t,400);var c=n.text.length-(u.line-o.line)-1;n.full?bi(t):o.line!=u.line||1!=n.text.length||Pe(t.doc,n)?bi(t,o.line,u.line+1,c):mi(t,o.line,"text");var f=At(t,"changes"),h=At(t,"change");if(h||f){var l={from:o,to:u,text:n.text,removed:n.removed,origin:n.origin};h&&dr(t,"change",t,l),f&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(l)}t.display.selForContextMenu=null}(t.cm,n,i):je(t,n,i),uo(t,r,Z),t.cantEdit&&ho(t,an(t.firstLine(),0))&&(t.cantEdit=!1)}}function ko(t,n,r,i,e){var o;i||(i=r),sn(i,r)<0&&(r=(o=[i,r])[0],i=o[1]),"string"==typeof n&&(n=t.splitLines(n)),go(t,{from:r,to:i,text:n,origin:e})}function To(t,n,r,i){r<t.line?t.line+=i:n<t.line&&(t.line=n,t.ch=0)}function Ao(t,n,r,i){for(var e=0;e<t.length;++e){var o=t[e],u=!0;if(o.ranges){o.copied||((o=t[e]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)To(o.ranges[a].anchor,n,r,i),To(o.ranges[a].head,n,r,i)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=an(c.from.line+i,c.from.ch),c.to=an(c.to.line+i,c.to.ch);else if(n<=c.to.line){u=!1;break}}u||(t.splice(0,e+1),e=0)}}}function Eo(t,n){var r=n.from.line,i=n.to.line,e=n.text.length-(i-r)-1;Ao(t.done,r,i,e),Ao(t.undone,r,i,e)}function Lo(t,n,r,i){var e=n,o=n;return"number"==typeof n?o=Xt(t,vn(t,n)):e=rn(n),null==e?null:(i(o,e)&&t.cm&&mi(t.cm,e,r),o)}function xo(t){this.lines=t,this.parent=null;for(var n=0,r=0;r<t.length;++r)t[r].parent=this,n+=t[r].height;this.height=n}function Co(t){this.children=t;for(var n=0,r=0,i=0;i<t.length;++i){var e=t[i];n+=e.chunkSize(),r+=e.height,e.parent=this}this.size=n,this.height=r,this.parent=null}Oe.prototype.from=function(){return ln(this.anchor,this.head)},Oe.prototype.to=function(){return hn(this.anchor,this.head)},Oe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,n){for(var r=t,i=t+n;r<i;++r){var e=this.lines[r];this.height-=e.height,tr(e),dr(e,"delete")}this.lines.splice(t,n)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,n,r){this.height+=r,this.lines=this.lines.slice(0,t).concat(n).concat(this.lines.slice(t));for(var i=0;i<n.length;++i)n[i].parent=this},iterN:function(t,n,r){for(var i=t+n;t<i;++t)if(r(this.lines[t]))return!0}},Co.prototype={chunkSize:function(){return this.size},removeInner:function(t,n){this.size-=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],e=i.chunkSize();if(t<e){var o=Math.min(n,e-t),u=i.height;if(i.removeInner(t,o),this.height-=u-i.height,e==o&&(this.children.splice(r--,1),i.parent=null),0==(n-=o))break;t=0}else t-=e}if(this.size-n<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var a=[];this.collapse(a),this.children=[new xo(a)],this.children[0].parent=this}},collapse:function(t){for(var n=0;n<this.children.length;++n)this.children[n].collapse(t)},insertInner:function(t,n,r){this.size+=n.length,this.height+=r;for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(t<=o){if(e.insertInner(t,n,r),e.lines&&e.lines.length>50){for(var u=e.lines.length%25+25,a=u;a<e.lines.length;){var s=new xo(e.lines.slice(a,a+=25));e.height-=s.height,this.children.splice(++i,0,s),s.parent=this}e.lines=e.lines.slice(0,u),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var n=new Co(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=n.size,t.height-=n.height;var r=$(t.parent.children,t);t.parent.children.splice(r+1,0,n)}else{var i=new Co(t.children);i.parent=t,t.children=[i,n],t=i}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,n,r){for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(t<o){var u=Math.min(n,o-t);if(e.iterN(t,u,r))return!0;if(0==(n-=u))break;t=0}else t-=o}}};var Do=function(t,n,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=t,this.node=n};function Oo(t,n,r){Yn(n)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&qi(t,r)}Do.prototype.clear=function(){var t=this.doc.cm,n=this.line.widgets,r=this.line,i=rn(r);if(null!=i&&n){for(var e=0;e<n.length;++e)n[e]==this&&n.splice(e--,1);n.length||(r.widgets=null);var o=Cr(this);nn(r,Math.max(0,r.height-o)),t&&(oe(t,(function(){Oo(t,r,-o),mi(t,i,"widget")})),dr(t,"lineWidgetCleared",t,this,i))}},Do.prototype.changed=function(){var t=this,n=this.height,r=this.doc.cm,i=this.line;this.height=null;var e=Cr(this)-n;e&&(Zn(this.doc,i)||nn(i,i.height+e),r&&oe(r,(function(){r.curOp.forceUpdate=!0,Oo(r,i,e),dr(r,"lineWidgetChanged",r,t,rn(i))})))},Et(Do);var So=0,No=function(t,n){this.lines=[],this.type=n,this.doc=t,this.id=++So};function Mo(t,n,r,i,e){if(i&&i.shared)return function(t,n,r,i,e){(i=H(i)).shared=!1;var o=[Mo(t,n,r,i,e)],u=o[0],a=i.widgetNode;return _e(t,(function(t){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Mo(t,dn(t,n),dn(t,r),i,e));for(var s=0;s<t.linked.length;++s)if(t.linked[s].isParent)return;u=tt(o)})),new Ro(o,u)}(t,n,r,i,e);if(t.cm&&!t.cm.curOp)return ue(t.cm,Mo)(t,n,r,i,e);var o=new No(t,e),u=sn(n,r);if(i&&H(i,o,!1),u>0||0==u&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Vn(t,n.line,n,r,o)||n.line!=r.line&&Vn(t,r.line,n,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");On=!0}o.addToHistory&&Ge(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var a,s=n.line,c=t.cm;if(t.iter(s,r.line+1,(function(i){c&&o.collapsed&&!c.options.lineWrapping&&$n(i)==c.display.maxLine&&(a=!0),o.collapsed&&s!=n.line&&nn(i,0),function(t,n,r){var i=r&&window.WeakSet&&(r.markedSpans||(r.markedSpans=new WeakSet));i&&t.markedSpans&&i.has(t.markedSpans)?t.markedSpans.push(n):(t.markedSpans=t.markedSpans?t.markedSpans.concat([n]):[n],i&&i.add(t.markedSpans)),n.marker.attachLine(t)}(i,new Sn(o,s==n.line?n.ch:null,s==r.line?r.ch:null),t.cm&&t.cm.curOp),++s})),o.collapsed&&t.iter(n.line,r.line+1,(function(n){Zn(t,n)&&nn(n,0)})),o.clearOnEnter&&bt(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Dn=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)bi(c,n.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var f=n.line;f<=r.line;f++)mi(c,f,"text");o.atomic&&so(c.doc),dr(c,"markerAdded",c,o)}return o}No.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&Xi(t),At(this,"clear")){var r=this.find();r&&dr(this,"clear",r.from,r.to)}for(var i=null,e=null,o=0;o<this.lines.length;++o){var u=this.lines[o],a=Nn(u.markedSpans,this);t&&!this.collapsed?mi(t,rn(u),"text"):t&&(null!=a.to&&(e=rn(u)),null!=a.from&&(i=rn(u))),u.markedSpans=Mn(u.markedSpans,a),null==a.from&&this.collapsed&&!Zn(this.doc,u)&&t&&nn(u,ci(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=$n(this.lines[s]),f=Qn(c);f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&bi(t,i,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&so(t.doc)),t&&dr(t,"markerCleared",t,this,i,e),n&&Ji(t),this.parent&&this.parent.clear()}},No.prototype.find=function(t,n){var r,i;null==t&&"bookmark"==this.type&&(t=1);for(var e=0;e<this.lines.length;++e){var o=this.lines[e],u=Nn(o.markedSpans,this);if(null!=u.from&&(r=an(n?o:rn(o),u.from),-1==t))return r;if(null!=u.to&&(i=an(n?o:rn(o),u.to),1==t))return i}return r&&{from:r,to:i}},No.prototype.changed=function(){var t=this,n=this.find(-1,!0),r=this,i=this.doc.cm;n&&i&&oe(i,(function(){var e=n.line,o=rn(n.line),u=Fr(i,o);if(u&&(Vr(u),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Zn(r.doc,e)&&null!=r.height){var a=r.height;r.height=null;var s=Cr(r)-a;s&&nn(e,e.height+s)}dr(i,"markerChanged",i,t)}))},No.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;n.maybeHiddenMarkers&&-1!=$(n.maybeHiddenMarkers,this)||(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},No.prototype.detachLine=function(t){if(this.lines.splice($(this.lines,t),1),!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}},Et(No);var Ro=function(t,n){this.markers=t,this.primary=n;for(var r=0;r<t.length;++r)t[r].parent=this};function Bo(t){return t.findMarks(an(t.first,0),t.clipPos(an(t.lastLine())),(function(t){return t.parent}))}function Io(t){for(var n=function(n){var r=t[n],i=[r.primary.doc];_e(r.primary.doc,(function(t){return i.push(t)}));for(var e=0;e<r.markers.length;e++){var o=r.markers[e];-1==$(i,o.doc)&&(o.parent=null,r.markers.splice(e--,1))}},r=0;r<t.length;r++)n(r)}Ro.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();dr(this,"clear")}},Ro.prototype.find=function(t,n){return this.primary.find(t,n)},Et(Ro);var qo=0,Fo=function(t,n,r,i,e){if(!(this instanceof Fo))return new Fo(t,n,r,i,e);null==r&&(r=0),Co.call(this,[new xo([new Jn("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=an(r,0);this.sel=Ne(o),this.history=new ze(null),this.id=++qo,this.modeOption=n,this.lineSep=i,this.direction="rtl"==e?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),je(this,{from:o,to:o,text:t}),oo(this,Ne(o),Z)};Fo.prototype=it(Co.prototype,{constructor:Fo,iter:function(t,n,r){r?this.iterN(t-this.first,n-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,n){for(var r=0,i=0;i<n.length;++i)r+=n[i].height;this.insertInner(t-this.first,n,r)},remove:function(t,n){this.removeInner(t-this.first,n)},getValue:function(t){var n=tn(this,this.first,this.first+this.size);return!1===t?n:n.join(t||this.lineSeparator())},setValue:se((function(t){var n=an(this.first,0),r=this.first+this.size-1;go(this,{from:n,to:an(r,Xt(this,r).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Pi(this.cm,0,0),oo(this,Ne(n),Z)})),replaceRange:function(t,n,r,i){ko(this,t,n=dn(this,n),r=r?dn(this,r):n,i)},getRange:function(t,n,r){var i=Jt(this,dn(this,t),dn(this,n));return!1===r?i:i.join(""===r?"":r||this.lineSeparator())},getLine:function(t){var n=this.getLineHandle(t);return n&&n.text},getLineHandle:function(t){if(on(this,t))return Xt(this,t)},getLineNumber:function(t){return rn(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Xt(this,t)),$n(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return dn(this,t)},getCursor:function(t){var n=this.sel.primary();return null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||!1===t?n.to():n.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:se((function(t,n,r){io(this,dn(this,"number"==typeof t?an(t,n||0):t),null,r)})),setSelection:se((function(t,n,r){io(this,dn(this,t),dn(this,n||t),r)})),extendSelection:se((function(t,n,r){to(this,dn(this,t),n&&dn(this,n),r)})),extendSelections:se((function(t,n){no(this,pn(this,t),n)})),extendSelectionsBy:se((function(t,n){no(this,pn(this,nt(this.sel.ranges,t)),n)})),setSelections:se((function(t,n,r){if(t.length){for(var i=[],e=0;e<t.length;e++)i[e]=new Oe(dn(this,t[e].anchor),dn(this,t[e].head||t[e].anchor));null==n&&(n=Math.min(t.length-1,this.sel.primIndex)),oo(this,Se(this.cm,i,n),r)}})),addSelection:se((function(t,n,r){var i=this.sel.ranges.slice(0);i.push(new Oe(dn(this,t),dn(this,n||t))),oo(this,Se(this.cm,i,i.length-1),r)})),getSelection:function(t){for(var n,r=this.sel.ranges,i=0;i<r.length;i++){var e=Jt(this,r[i].from(),r[i].to());n=n?n.concat(e):e}return!1===t?n:n.join(t||this.lineSeparator())},getSelections:function(t){for(var n=[],r=this.sel.ranges,i=0;i<r.length;i++){var e=Jt(this,r[i].from(),r[i].to());!1!==t&&(e=e.join(t||this.lineSeparator())),n[i]=e}return n},replaceSelection:function(t,n,r){for(var i=[],e=0;e<this.sel.ranges.length;e++)i[e]=t;this.replaceSelections(i,n,r||"+input")},replaceSelections:se((function(t,n,r){for(var i=[],e=this.sel,o=0;o<e.ranges.length;o++){var u=e.ranges[o];i[o]={from:u.from(),to:u.to(),text:this.splitLines(t[o]),origin:r}}for(var a=n&&"end"!=n&&function(t,n,r){for(var i=[],e=an(t.first,0),o=e,u=0;u<n.length;u++){var a=n[u],s=Ie(a.from,e,o),c=Ie(Me(a),e,o);if(e=a.to,o=c,"around"==r){var f=t.sel.ranges[u],h=sn(f.head,f.anchor)<0;i[u]=new Oe(h?c:s,h?s:c)}else i[u]=new Oe(s,s)}return new De(i,t.sel.primIndex)}(this,i,n),s=i.length-1;s>=0;s--)go(this,i[s]);a?eo(this,a):this.cm&&Fi(this.cm)})),undo:se((function(){mo(this,"undo")})),redo:se((function(){mo(this,"redo")})),undoSelection:se((function(){mo(this,"undo",!0)})),redoSelection:se((function(){mo(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,n=0,r=0,i=0;i<t.done.length;i++)t.done[i].ranges||++n;for(var e=0;e<t.undone.length;e++)t.undone[e].ranges||++r;return{undo:n,redo:r}},clearHistory:function(){var t=this;this.history=new ze(this.history),_e(this,(function(n){return n.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Xe(this.history.done),undone:Xe(this.history.undone)}},setHistory:function(t){var n=this.history=new ze(this.history);n.done=Xe(t.done.slice(0),null,!0),n.undone=Xe(t.undone.slice(0),null,!0)},setGutterMarker:se((function(t,n,r){return Lo(this,t,"gutter",(function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[n]=r,!r&&at(i)&&(t.gutterMarkers=null),!0}))})),clearGutter:se((function(t){var n=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[t]&&Lo(n,r,"gutter",(function(){return r.gutterMarkers[t]=null,at(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var n;if("number"==typeof t){if(!on(this,t))return null;if(n=t,!(t=Xt(this,t)))return null}else if(null==(n=rn(t)))return null;return{line:n,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:se((function(t,n,r){return Lo(this,t,"gutter"==n?"gutter":"class",(function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(t[i]){if(L(r).test(t[i]))return!1;t[i]+=" "+r}else t[i]=r;return!0}))})),removeLineClass:se((function(t,n,r){return Lo(this,t,"gutter"==n?"gutter":"class",(function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",e=t[i];if(!e)return!1;if(null==r)t[i]=null;else{var o=e.match(L(r));if(!o)return!1;var u=o.index+o[0].length;t[i]=e.slice(0,o.index)+(o.index&&u!=e.length?" ":"")+e.slice(u)||null}return!0}))})),addLineWidget:se((function(t,n,r){return function(t,n,r,i){var e=new Do(t,r,i),o=t.cm;return o&&e.noHScroll&&(o.display.alignWidgets=!0),Lo(t,n,"widget",(function(n){var r=n.widgets||(n.widgets=[]);if(null==e.insertAt?r.push(e):r.splice(Math.min(r.length,Math.max(0,e.insertAt)),0,e),e.line=n,o&&!Zn(t,n)){var i=Yn(n)<t.scrollTop;nn(n,n.height+Cr(e)),i&&qi(o,e.height),o.curOp.forceUpdate=!0}return!0})),o&&dr(o,"lineWidgetAdded",o,e,"number"==typeof n?n:rn(n)),e}(this,t,n,r)})),removeLineWidget:function(t){t.clear()},markText:function(t,n,r){return Mo(this,dn(this,t),dn(this,n),r,r&&r.type||"range")},setBookmark:function(t,n){var r={replacedWith:n&&(null==n.nodeType?n.widget:n),insertLeft:n&&n.insertLeft,clearWhenEmpty:!1,shared:n&&n.shared,handleMouseEvents:n&&n.handleMouseEvents};return Mo(this,t=dn(this,t),t,r,"bookmark")},findMarksAt:function(t){var n=[],r=Xt(this,(t=dn(this,t)).line).markedSpans;if(r)for(var i=0;i<r.length;++i){var e=r[i];(null==e.from||e.from<=t.ch)&&(null==e.to||e.to>=t.ch)&&n.push(e.marker.parent||e.marker)}return n},findMarks:function(t,n,r){t=dn(this,t),n=dn(this,n);var i=[],e=t.line;return this.iter(t.line,n.line+1,(function(o){var u=o.markedSpans;if(u)for(var a=0;a<u.length;a++){var s=u[a];null!=s.to&&e==t.line&&t.ch>=s.to||null==s.from&&e!=t.line||null!=s.from&&e==n.line&&s.from>=n.ch||r&&!r(s.marker)||i.push(s.marker.parent||s.marker)}++e})),i},getAllMarks:function(){var t=[];return this.iter((function(n){var r=n.markedSpans;if(r)for(var i=0;i<r.length;++i)null!=r[i].from&&t.push(r[i].marker)})),t},posFromIndex:function(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter((function(e){var o=e.text.length+i;if(o>t)return n=t,!0;t-=o,++r})),dn(this,an(r,n))},indexFromPos:function(t){var n=(t=dn(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){n+=t.text.length+r})),n},copy:function(t){var n=new Fo(tn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return n.scrollTop=this.scrollTop,n.scrollLeft=this.scrollLeft,n.sel=this.sel,n.extend=!1,t&&(n.history.undoDepth=this.history.undoDepth,n.setHistory(this.getHistory())),n},linkedDoc:function(t){t||(t={});var n=this.first,r=this.first+this.size;null!=t.from&&t.from>n&&(n=t.from),null!=t.to&&t.to<r&&(r=t.to);var i=new Fo(tn(this,n,r),t.mode||this.modeOption,n,this.lineSep,this.direction);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],function(t,n){for(var r=0;r<n.length;r++){var i=n[r],e=i.find(),o=t.clipPos(e.from),u=t.clipPos(e.to);if(sn(o,u)){var a=Mo(t,o,u,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}(i,Bo(this)),i},unlinkDoc:function(t){if(t instanceof Ru&&(t=t.doc),this.linked)for(var n=0;n<this.linked.length;++n)if(this.linked[n].doc==t){this.linked.splice(n,1),t.unlinkDoc(this),Io(Bo(this));break}if(t.history==this.history){var r=[t.id];_e(t,(function(t){return r.push(t.id)}),!0),t.history=new ze(null),t.history.done=Xe(this.history.done,r),t.history.undone=Xe(this.history.undone,r)}},iterLinkedDocs:function(t){_e(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Ft(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:se((function(t){var n;"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&oe(n=this.cm,(function(){He(n),bi(n)})))}))}),Fo.prototype.eachLine=Fo.prototype.iter;var Po=0;function jo(t){var n=this;if(_o(n),!kt(n,t)&&!Dr(n.display,t)){Lt(t),u&&(Po=+new Date);var r=pi(n,t,!0),i=t.dataTransfer.files;if(r&&!n.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var e=i.length,o=Array(e),a=0,s=function(){++a==e&&ue(n,(function(){var t={from:r=dn(n.doc,r),to:r,text:n.doc.splitLines(o.filter((function(t){return null!=t})).join(n.doc.lineSeparator())),origin:"paste"};go(n.doc,t),eo(n.doc,Ne(dn(n.doc,r),dn(n.doc,Me(t))))}))()},c=function(t,r){if(n.options.allowDropFileTypes&&-1==$(n.options.allowDropFileTypes,t.type))s();else{var i=new FileReader;i.onerror=function(){return s()},i.onload=function(){var t=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(o[r]=t),s()},i.readAsText(t)}},f=0;f<i.length;f++)c(i[f],f);else{if(n.state.draggingText&&n.doc.sel.contains(r)>-1)return n.state.draggingText(t),void setTimeout((function(){return n.display.input.focus()}),20);try{var h=t.dataTransfer.getData("Text");if(h){var l;if(n.state.draggingText&&!n.state.draggingText.copy&&(l=n.listSelections()),uo(n.doc,Ne(r,r)),l)for(var v=0;v<l.length;++v)ko(n.doc,"",l[v].anchor,l[v].head,"drag");n.replaceSelection(h,"around","paste"),n.display.input.focus()}}catch(t){}}}}function _o(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Uo(t){if(document.getElementsByClassName){for(var n=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<n.length;i++){var e=n[i].CodeMirror;e&&r.push(e)}r.length&&r[0].operation((function(){for(var n=0;n<r.length;n++)t(r[n])}))}}var Ho=!1;function zo(){var t;Ho||(bt(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,Uo(Vo)}),100))})),bt(window,"blur",(function(){return Uo(Ni)})),Ho=!0)}function Vo(t){var n=t.display;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.scrollbarsClipped=!1,t.setSize()}for(var $o={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Go=0;Go<10;Go++)$o[Go+48]=$o[Go+96]=String(Go);for(var Wo=65;Wo<=90;Wo++)$o[Wo]=String.fromCharCode(Wo);for(var Zo=1;Zo<=12;Zo++)$o[Zo+111]=$o[Zo+63235]="F"+Zo;var Ko={};function Yo(t){var n,r,i,e,o=t.split(/-(?!$)/);t=o[o.length-1];for(var u=0;u<o.length-1;u++){var a=o[u];if(/^(cmd|meta|m)$/i.test(a))e=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return n&&(t="Alt-"+t),r&&(t="Ctrl-"+t),e&&(t="Cmd-"+t),i&&(t="Shift-"+t),t}function Qo(t){var n={};for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==i){delete t[r];continue}for(var e=nt(r.split(" "),Yo),o=0;o<e.length;o++){var u=void 0,a=void 0;o==e.length-1?(a=e.join(" "),u=i):(a=e.slice(0,o+1).join(" "),u="...");var s=n[a];if(s){if(s!=u)throw new Error("Inconsistent bindings for "+a)}else n[a]=u}delete t[r]}for(var c in n)t[c]=n[c];return t}function Xo(t,n,r,i){var e=(n=ru(n)).call?n.call(t,i):n[t];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&r(e))return"handled";if(n.fallthrough){if("[object Array]"!=Object.prototype.toString.call(n.fallthrough))return Xo(t,n.fallthrough,r,i);for(var o=0;o<n.fallthrough.length;o++){var u=Xo(t,n.fallthrough[o],r,i);if(u)return u}}}function Jo(t){var n="string"==typeof t?t:$o[t.keyCode];return"Ctrl"==n||"Alt"==n||"Shift"==n||"Mod"==n}function tu(t,n,r){var i=t;return n.altKey&&"Alt"!=i&&(t="Alt-"+t),(A?n.metaKey:n.ctrlKey)&&"Ctrl"!=i&&(t="Ctrl-"+t),(A?n.ctrlKey:n.metaKey)&&"Mod"!=i&&(t="Cmd-"+t),!r&&n.shiftKey&&"Shift"!=i&&(t="Shift-"+t),t}function nu(t,n){if(l&&34==t.keyCode&&t.char)return!1;var r=$o[t.keyCode];return null!=r&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(r=t.code),tu(r,t,n))}function ru(t){return"string"==typeof t?Ko[t]:t}function iu(t,n){for(var r=t.doc.sel.ranges,i=[],e=0;e<r.length;e++){for(var o=n(r[e]);i.length&&sn(o.from,tt(i).to)<=0;){var u=i.pop();if(sn(u.from,o.from)<0){o.from=u.from;break}}i.push(o)}oe(t,(function(){for(var n=i.length-1;n>=0;n--)ko(t.doc,"",i[n].from,i[n].to,"+delete");Fi(t)}))}function eu(t,n,r){var i=ft(t.text,n+r,r);return i<0||i>t.text.length?null:i}function ou(t,n,r){var i=eu(t,n.ch,r);return null==i?null:new an(n.line,i,r<0?"after":"before")}function uu(t,n,r,i,e){if(t){"rtl"==n.doc.direction&&(e=-e);var o=pt(r,n.doc.direction);if(o){var u,a=e<0?tt(o):o[0],s=e<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==n.doc.direction){var c=Pr(n,r),f=jr(n,c,u=e<0?r.text.length-1:0).top;u=ht((function(t){return jr(n,c,t).top==f}),e<0==(1==a.level)?a.from:a.to-1,u),"before"==s&&(u=eu(r,u,1))}else u=e<0?a.to:a.from;return new an(i,u,s)}}return new an(i,e<0?r.text.length:0,e<0?"before":"after")}Ko.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ko.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ko.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ko.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ko.default=w?Ko.macDefault:Ko.pcDefault;var au={selectAll:vo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Z)},killLine:function(t){return iu(t,(function(n){if(n.empty()){var r=Xt(t.doc,n.head.line).text.length;return n.head.ch==r&&n.head.line<t.lastLine()?{from:n.head,to:an(n.head.line+1,0)}:{from:n.head,to:an(n.head.line,r)}}return{from:n.from(),to:n.to()}}))},deleteLine:function(t){return iu(t,(function(n){return{from:an(n.from().line,0),to:dn(t.doc,an(n.to().line+1,0))}}))},delLineLeft:function(t){return iu(t,(function(t){return{from:an(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return iu(t,(function(n){var r=t.charCoords(n.head,"div").top+5;return{from:t.coordsChar({left:0,top:r},"div"),to:n.from()}}))},delWrappedLineRight:function(t){return iu(t,(function(n){var r=t.charCoords(n.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:r},"div");return{from:n.from(),to:i}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(an(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(an(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(n){return su(t,n.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(n){return cu(t,n.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(n){return function(t,n){var r=Xt(t.doc,n),i=function(t){for(var n;n=Hn(t);)t=n.find(1,!0).line;return t}(r);return i!=r&&(n=rn(i)),uu(!0,t,r,n,-1)}(t,n.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:r},"div")}),Y)},goLineLeft:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5;return t.coordsChar({left:0,top:r},"div")}),Y)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(n){var r=t.cursorCoords(n.head,"div").top+5,i=t.coordsChar({left:0,top:r},"div");return i.ch<t.getLine(i.line).search(/\S/)?cu(t,n.head):i}),Y)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var n=[],r=t.listSelections(),i=t.options.tabSize,e=0;e<r.length;e++){var o=r[e].from(),u=z(t.getLine(o.line),o.ch,i);n.push(J(i-u%i))}t.replaceSelections(n)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return oe(t,(function(){for(var n=t.listSelections(),r=[],i=0;i<n.length;i++)if(n[i].empty()){var e=n[i].head,o=Xt(t.doc,e.line).text;if(o)if(e.ch==o.length&&(e=new an(e.line,e.ch-1)),e.ch>0)e=new an(e.line,e.ch+1),t.replaceRange(o.charAt(e.ch-1)+o.charAt(e.ch-2),an(e.line,e.ch-2),e,"+transpose");else if(e.line>t.doc.first){var u=Xt(t.doc,e.line-1).text;u&&(e=new an(e.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+u.charAt(u.length-1),an(e.line-1,u.length-1),e,"+transpose"))}r.push(new Oe(e,e))}t.setSelections(r)}))},newlineAndIndent:function(t){return oe(t,(function(){for(var n=t.listSelections(),r=n.length-1;r>=0;r--)t.replaceRange(t.doc.lineSeparator(),n[r].anchor,n[r].head,"+input");n=t.listSelections();for(var i=0;i<n.length;i++)t.indentLine(n[i].from().line,null,!0);Fi(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function su(t,n){var r=Xt(t.doc,n),i=$n(r);return i!=r&&(n=rn(i)),uu(!0,t,i,n,1)}function cu(t,n){var r=su(t,n.line),i=Xt(t.doc,r.line),e=pt(i,t.doc.direction);if(!e||0==e[0].level){var o=Math.max(r.ch,i.text.search(/\S/));return an(r.line,n.line==r.line&&n.ch<=o&&n.ch?0:o,r.sticky)}return r}function fu(t,n,r){if("string"==typeof n&&!(n=au[n]))return!1;t.display.input.ensurePolled();var i=t.display.shift,e=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),r&&(t.display.shift=!1),e=n(t)!=W}finally{t.display.shift=i,t.state.suppressEdits=!1}return e}var hu=new V;function lu(t,n,r,i){var e=t.state.keySeq;if(e){if(Jo(n))return"handled";if(/\'$/.test(n)?t.state.keySeq=null:hu.set(50,(function(){t.state.keySeq==e&&(t.state.keySeq=null,t.display.input.reset())})),vu(t,e+" "+n,r,i))return!0}return vu(t,n,r,i)}function vu(t,n,r,i){var e=function(t,n,r){for(var i=0;i<t.state.keyMaps.length;i++){var e=Xo(n,t.state.keyMaps[i],r,t);if(e)return e}return t.options.extraKeys&&Xo(n,t.options.extraKeys,r,t)||Xo(n,t.options.keyMap,r,t)}(t,n,i);return"multi"==e&&(t.state.keySeq=n),"handled"==e&&dr(t,"keyHandled",t,n,r),"handled"!=e&&"multi"!=e||(Lt(r),Ci(t)),!!e}function du(t,n){var r=nu(n,!0);return!!r&&(n.shiftKey&&!t.state.keySeq?lu(t,"Shift-"+r,n,(function(n){return fu(t,n,!0)}))||lu(t,r,n,(function(n){if("string"==typeof n?/^go[A-Z]/.test(n):n.motion)return fu(t,n)})):lu(t,r,n,(function(n){return fu(t,n)})))}var pu=null;function gu(t){var n=this;if(!(t.target&&t.target!=n.display.input.getField()||(n.curOp.focus=R(P(n)),kt(n,t)))){u&&a<11&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;n.display.shift=16==i||t.shiftKey;var e=du(n,t);l&&(pu=e?i:null,e||88!=i||jt||!(w?t.metaKey:t.ctrlKey)||n.replaceSelection("",null,"cut")),r&&!w&&!e&&46==i&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=i||/\bCodeMirror-crosshair\b/.test(n.display.lineDiv.className)||function(t){var n=t.display.lineDiv;function r(t){18!=t.keyCode&&t.altKey||(C(n,"CodeMirror-crosshair"),wt(document,"keyup",r),wt(document,"mouseover",r))}B(n,"CodeMirror-crosshair"),bt(document,"keyup",r),bt(document,"mouseover",r)}(n)}}function bu(t){16==t.keyCode&&(this.doc.sel.shift=!1),kt(this,t)}function mu(t){var n=this;if(!(t.target&&t.target!=n.display.input.getField()||Dr(n.display,t)||kt(n,t)||t.ctrlKey&&!t.altKey||w&&t.metaKey)){var r=t.keyCode,i=t.charCode;if(l&&r==pu)return pu=null,void Lt(t);if(!l||t.which&&!(t.which<10)||!du(n,t)){var e=String.fromCharCode(null==i?r:i);"\b"!=e&&(function(t,n,r){return lu(t,"'"+r+"'",n,(function(n){return fu(t,n,!0)}))}(n,t,e)||n.display.input.onKeyPress(t))}}}var wu,yu,ku=function(t,n,r){this.time=t,this.pos=n,this.button=r};function Tu(t){var n=this,r=n.display;if(!(kt(n,t)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=t.shiftKey,Dr(r,t))s||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!Lu(n,t)){var i=pi(n,t),e=St(t),o=i?function(t,n){var r=+new Date;return yu&&yu.compare(r,t,n)?(wu=yu=null,"triple"):wu&&wu.compare(r,t,n)?(yu=new ku(r,t,n),wu=null,"double"):(wu=new ku(r,t,n),yu=null,"single")}(i,e):"single";_(n).focus(),1==e&&n.state.selectingText&&n.state.selectingText(t),i&&function(t,n,r,i,e){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),lu(t,tu(o=(1==n?"Left":2==n?"Middle":"Right")+o,e),e,(function(n){if("string"==typeof n&&(n=au[n]),!n)return!1;var i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i=n(t,r)!=W}finally{t.state.suppressEdits=!1}return i}))}(n,e,i,o,t)||(1==e?i?function(t,n,r,i){u?setTimeout(U(Di,t),0):t.curOp.focus=R(P(t));var e,o=function(t,n,r){var i=t.getOption("configureMouse"),e=i?i(t,n,r):{};return null==e.unit&&(e.unit=(y?r.shiftKey&&r.metaKey:r.altKey)?"rectangle":"single"==n?"char":"double"==n?"word":"line"),(null==e.extend||t.doc.extend)&&(e.extend=t.doc.extend||r.shiftKey),null==e.addNew&&(e.addNew=w?r.metaKey:r.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(w?r.altKey:r.ctrlKey)),e}(t,r,i),c=t.doc.sel;t.options.dragDrop&&Rt&&!t.isReadOnly()&&"single"==r&&(e=c.contains(n))>-1&&(sn((e=c.ranges[e]).from(),n)<0||n.xRel>0)&&(sn(e.to(),n)>0||n.xRel<0)?function(t,n,r,i){var e=t.display,o=!1,c=ue(t,(function(n){s&&(e.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Oi(t)),wt(e.wrapper.ownerDocument,"mouseup",c),wt(e.wrapper.ownerDocument,"mousemove",f),wt(e.scroller,"dragstart",h),wt(e.scroller,"drop",c),o||(Lt(n),i.addNew||to(t.doc,r,null,null,i.extend),s&&!v||u&&9==a?setTimeout((function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0}),e.input.focus()}),20):e.input.focus())})),f=function(t){o=o||Math.abs(n.clientX-t.clientX)+Math.abs(n.clientY-t.clientY)>=10},h=function(){return o=!0};s&&(e.scroller.draggable=!0),t.state.draggingText=c,c.copy=!i.moveOnDrag,bt(e.wrapper.ownerDocument,"mouseup",c),bt(e.wrapper.ownerDocument,"mousemove",f),bt(e.scroller,"dragstart",h),bt(e.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout((function(){return e.input.focus()}),20),e.scroller.dragDrop&&e.scroller.dragDrop()}(t,i,n,o):function(t,n,r,i){u&&Oi(t);var e=t.display,o=t.doc;Lt(n);var a,s,c=o.sel,f=c.ranges;if(i.addNew&&!i.extend?(s=o.sel.contains(r),a=s>-1?f[s]:new Oe(r,r)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Oe(r,r)),r=pi(t,n,!0,!0),s=-1;else{var h=Au(t,r,i.unit);a=i.extend?Je(a,h.anchor,h.head,i.extend):h}i.addNew?-1==s?(s=f.length,oo(o,Se(t,f.concat([a]),s),{scroll:!1,origin:"*mouse"})):f.length>1&&f[s].empty()&&"char"==i.unit&&!i.extend?(oo(o,Se(t,f.slice(0,s).concat(f.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):ro(o,s,a,K):(s=0,oo(o,new De([a],0),K),c=o.sel);var l=r;function v(n){if(0!=sn(l,n))if(l=n,"rectangle"==i.unit){for(var e=[],u=t.options.tabSize,f=z(Xt(o,r.line).text,r.ch,u),h=z(Xt(o,n.line).text,n.ch,u),v=Math.min(f,h),d=Math.max(f,h),p=Math.min(r.line,n.line),g=Math.min(t.lastLine(),Math.max(r.line,n.line));p<=g;p++){var b=Xt(o,p).text,m=Q(b,v,u);v==d?e.push(new Oe(an(p,m),an(p,m))):b.length>m&&e.push(new Oe(an(p,m),an(p,Q(b,d,u))))}e.length||e.push(new Oe(r,r)),oo(o,Se(t,c.ranges.slice(0,s).concat(e),s),{origin:"*mouse",scroll:!1}),t.scrollIntoView(n)}else{var w,y=a,k=Au(t,n,i.unit),T=y.anchor;sn(k.anchor,T)>0?(w=k.head,T=ln(y.from(),k.anchor)):(w=k.anchor,T=hn(y.to(),k.head));var A=c.ranges.slice(0);A[s]=function(t,n){var r=n.anchor,i=n.head,e=Xt(t.doc,r.line);if(0==sn(r,i)&&r.sticky==i.sticky)return n;var o=pt(e);if(!o)return n;var u=vt(o,r.ch,r.sticky),a=o[u];if(a.from!=r.ch&&a.to!=r.ch)return n;var s,c=u+(a.from==r.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return n;if(i.line!=r.line)s=(i.line-r.line)*("ltr"==t.doc.direction?1:-1)>0;else{var f=vt(o,i.ch,i.sticky),h=f-u||(i.ch-r.ch)*(1==a.level?-1:1);s=f==c-1||f==c?h<0:h>0}var l=o[c+(s?-1:0)],v=s==(1==l.level),d=v?l.from:l.to,p=v?"after":"before";return r.ch==d&&r.sticky==p?n:new Oe(new an(r.line,d,p),i)}(t,new Oe(dn(o,T),w)),oo(o,Se(t,A,s),K)}}var d=e.wrapper.getBoundingClientRect(),p=0;function g(n){var r=++p,u=pi(t,n,!0,"rectangle"==i.unit);if(u)if(0!=sn(u,l)){t.curOp.focus=R(P(t)),v(u);var a=Bi(e,o);(u.line>=a.to||u.line<a.from)&&setTimeout(ue(t,(function(){p==r&&g(n)})),150)}else{var s=n.clientY<d.top?-20:n.clientY>d.bottom?20:0;s&&setTimeout(ue(t,(function(){p==r&&(e.scroller.scrollTop+=s,g(n))})),50)}}function b(n){t.state.selectingText=!1,p=1/0,n&&(Lt(n),e.input.focus()),wt(e.wrapper.ownerDocument,"mousemove",m),wt(e.wrapper.ownerDocument,"mouseup",w),o.history.lastSelOrigin=null}var m=ue(t,(function(t){0!==t.buttons&&St(t)?g(t):b(t)})),w=ue(t,b);t.state.selectingText=w,bt(e.wrapper.ownerDocument,"mousemove",m),bt(e.wrapper.ownerDocument,"mouseup",w)}(t,i,n,o)}(n,i,o,t):Ot(t)==r.scroller&&Lt(t):2==e?(i&&to(n.doc,i),setTimeout((function(){return r.input.focus()}),20)):3==e&&(E?n.display.input.onContextMenu(t):Oi(n)))}}function Au(t,n,r){if("char"==r)return new Oe(n,n);if("word"==r)return t.findWordAt(n);if("line"==r)return new Oe(an(n.line,0),dn(t.doc,an(n.line+1,0)));var i=r(t,n);return new Oe(i.from,i.to)}function Eu(t,n,r,i){var e,o;if(n.touches)e=n.touches[0].clientX,o=n.touches[0].clientY;else try{e=n.clientX,o=n.clientY}catch(t){return!1}if(e>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&Lt(n);var u=t.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!At(t,r))return Ct(n);o-=a.top-u.viewOffset;for(var s=0;s<t.display.gutterSpecs.length;++s){var c=u.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=e)return yt(t,r,t,en(t.doc,o),t.display.gutterSpecs[s].className,n),Ct(n)}}function Lu(t,n){return Eu(t,n,"gutterClick",!0)}function xu(t,n){Dr(t.display,n)||function(t,n){return!!At(t,"gutterContextMenu")&&Eu(t,n,"gutterContextMenu",!1)}(t,n)||kt(t,n,"contextmenu")||E||t.display.input.onContextMenu(n)}function Cu(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gr(t)}ku.prototype.compare=function(t,n,r){return this.time+400>t&&0==sn(n,this.pos)&&r==this.button};var Du={toString:function(){return"CodeMirror.Init"}},Ou={},Su={};function Nu(t,n,r){if(!n!=!(r&&r!=Du)){var i=t.display.dragFunctions,e=n?bt:wt;e(t.display.scroller,"dragstart",i.start),e(t.display.scroller,"dragenter",i.enter),e(t.display.scroller,"dragover",i.over),e(t.display.scroller,"dragleave",i.leave),e(t.display.scroller,"drop",i.drop)}}function Mu(t){t.options.lineWrapping?(B(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(C(t.display.wrapper,"CodeMirror-wrap"),Xn(t)),di(t),bi(t),Gr(t),setTimeout((function(){return Wi(t)}),100)}function Ru(t,n){var r=this;if(!(this instanceof Ru))return new Ru(t,n);this.options=n=n?H(n):{},H(Ou,n,!1);var i=n.value;"string"==typeof i?i=new Fo(i,n.mode,null,n.lineSeparator,n.direction):n.mode&&(i.modeOption=n.mode),this.doc=i;var e=new Ru.inputStyles[n.inputStyle](this),o=this.display=new Te(t,i,e,n);for(var c in o.wrapper.CodeMirror=this,Cu(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Yi(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 V,keySeq:null,specialChars:null},n.autofocus&&!m&&o.input.focus(),u&&a<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(t){var n=t.display;bt(n.scroller,"mousedown",ue(t,Tu)),bt(n.scroller,"dblclick",u&&a<11?ue(t,(function(n){if(!kt(t,n)){var r=pi(t,n);if(r&&!Lu(t,n)&&!Dr(t.display,n)){Lt(n);var i=t.findWordAt(r);to(t.doc,i.anchor,i.head)}}})):function(n){return kt(t,n)||Lt(n)}),bt(n.scroller,"contextmenu",(function(n){return xu(t,n)})),bt(n.input.getField(),"contextmenu",(function(r){n.scroller.contains(r.target)||xu(t,r)}));var r,i={end:0};function e(){n.activeTouch&&(r=setTimeout((function(){return n.activeTouch=null}),1e3),(i=n.activeTouch).end=+new Date)}function o(t){if(1!=t.touches.length)return!1;var n=t.touches[0];return n.radiusX<=1&&n.radiusY<=1}function s(t,n){if(null==n.left)return!0;var r=n.left-t.left,i=n.top-t.top;return r*r+i*i>400}bt(n.scroller,"touchstart",(function(e){if(!kt(t,e)&&!o(e)&&!Lu(t,e)){n.input.ensurePolled(),clearTimeout(r);var u=+new Date;n.activeTouch={start:u,moved:!1,prev:u-i.end<=300?i:null},1==e.touches.length&&(n.activeTouch.left=e.touches[0].pageX,n.activeTouch.top=e.touches[0].pageY)}})),bt(n.scroller,"touchmove",(function(){n.activeTouch&&(n.activeTouch.moved=!0)})),bt(n.scroller,"touchend",(function(r){var i=n.activeTouch;if(i&&!Dr(n,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,u=t.coordsChar(n.activeTouch,"page");o=!i.prev||s(i,i.prev)?new Oe(u,u):!i.prev.prev||s(i,i.prev.prev)?t.findWordAt(u):new Oe(an(u.line,0),dn(t.doc,an(u.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),Lt(r)}e()})),bt(n.scroller,"touchcancel",e),bt(n.scroller,"scroll",(function(){n.scroller.clientHeight&&(Ui(t,n.scroller.scrollTop),zi(t,n.scroller.scrollLeft,!0),yt(t,"scroll",t))})),bt(n.scroller,"mousewheel",(function(n){return Ce(t,n)})),bt(n.scroller,"DOMMouseScroll",(function(n){return Ce(t,n)})),bt(n.wrapper,"scroll",(function(){return n.wrapper.scrollTop=n.wrapper.scrollLeft=0})),n.dragFunctions={enter:function(n){kt(t,n)||Dt(n)},over:function(n){kt(t,n)||(function(t,n){var r=pi(t,n);if(r){var i=document.createDocumentFragment();Ei(t,r,i),t.display.dragCursor||(t.display.dragCursor=S("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),O(t.display.dragCursor,i)}}(t,n),Dt(n))},start:function(n){return function(t,n){if(u&&(!t.state.draggingText||+new Date-Po<100))Dt(n);else if(!kt(t,n)&&!Dr(t.display,n)&&(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!v)){var r=S("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",l&&(r.width=r.height=1,t.display.wrapper.appendChild(r),r._top=r.offsetTop),n.dataTransfer.setDragImage(r,0,0),l&&r.parentNode.removeChild(r)}}(t,n)},drop:ue(t,jo),leave:function(n){kt(t,n)||_o(t)}};var c=n.input.getField();bt(c,"keyup",(function(n){return bu.call(t,n)})),bt(c,"keydown",ue(t,gu)),bt(c,"keypress",ue(t,mu)),bt(c,"focus",(function(n){return Si(t,n)})),bt(c,"blur",(function(n){return Ni(t,n)}))}(this),zo(),Xi(this),this.curOp.forceUpdate=!0,Ue(this,i),n.autofocus&&!m||this.hasFocus()?setTimeout((function(){r.hasFocus()&&!r.state.focused&&Si(r)}),20):Ni(this),Su)Su.hasOwnProperty(c)&&Su[c](this,n[c],Du);me(this),n.finishInit&&n.finishInit(this);for(var f=0;f<Bu.length;++f)Bu[f](this);Ji(this),s&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ru.defaults=Ou,Ru.optionHandlers=Su;var Bu=[];function Iu(t,n,r,i){var e,o=t.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?e=yn(t,n).state:r="prev");var u=t.options.tabSize,a=Xt(o,n),s=z(a.text,null,u);a.stateAfter&&(a.stateAfter=null);var c,f=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==r&&((c=o.mode.indent(e,a.text.slice(f.length),a.text))==W||c>150)){if(!i)return;r="prev"}}else c=0,r="not";"prev"==r?c=n>o.first?z(Xt(o,n-1).text,null,u):0:"add"==r?c=s+t.options.indentUnit:"subtract"==r?c=s-t.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var h="",l=0;if(t.options.indentWithTabs)for(var v=Math.floor(c/u);v;--v)l+=u,h+="\t";if(l<c&&(h+=J(c-l)),h!=f)return ko(o,h,an(n,0),an(n,f.length),"+input"),a.stateAfter=null,!0;for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==n&&p.head.ch<f.length){var g=an(n,f.length);ro(o,d,new Oe(g,g));break}}}Ru.defineInitHook=function(t){return Bu.push(t)};var qu=null;function Fu(t){qu=t}function Pu(t,n,r,i,e){var o=t.doc;t.display.shift=!1,i||(i=o.sel);var u=+new Date-200,a="paste"==e||t.state.pasteIncoming>u,s=Ft(n),c=null;if(a&&i.ranges.length>1)if(qu&&qu.text.join("\n")==n){if(i.ranges.length%qu.text.length==0){c=[];for(var f=0;f<qu.text.length;f++)c.push(o.splitLines(qu.text[f]))}}else s.length==i.ranges.length&&t.options.pasteLinesPerSelection&&(c=nt(s,(function(t){return[t]})));for(var h=t.curOp.updateInput,l=i.ranges.length-1;l>=0;l--){var v=i.ranges[l],d=v.from(),p=v.to();v.empty()&&(r&&r>0?d=an(d.line,d.ch-r):t.state.overwrite&&!a?p=an(p.line,Math.min(Xt(o,p.line).text.length,p.ch+tt(s).length)):a&&qu&&qu.lineWise&&qu.text.join("\n")==s.join("\n")&&(d=p=an(d.line,0)));var g={from:d,to:p,text:c?c[l%c.length]:s,origin:e||(a?"paste":t.state.cutIncoming>u?"cut":"+input")};go(t.doc,g),dr(t,"inputRead",t,g)}n&&!a&&_u(t,n),Fi(t),t.curOp.updateInput<2&&(t.curOp.updateInput=h),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function ju(t,n){var r=t.clipboardData&&t.clipboardData.getData("Text");if(r)return t.preventDefault(),n.isReadOnly()||n.options.disableInput||!n.hasFocus()||oe(n,(function(){return Pu(n,r,0,null,"paste")})),!0}function _u(t,n){if(t.options.electricChars&&t.options.smartIndent)for(var r=t.doc.sel,i=r.ranges.length-1;i>=0;i--){var e=r.ranges[i];if(!(e.head.ch>100||i&&r.ranges[i-1].head.line==e.head.line)){var o=t.getModeAt(e.head),u=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(n.indexOf(o.electricChars.charAt(a))>-1){u=Iu(t,e.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xt(t.doc,e.head.line).text.slice(0,e.head.ch))&&(u=Iu(t,e.head.line,"smart"));u&&dr(t,"electricInput",t,e.head.line)}}}function Uu(t){for(var n=[],r=[],i=0;i<t.doc.sel.ranges.length;i++){var e=t.doc.sel.ranges[i].head.line,o={anchor:an(e,0),head:an(e+1,0)};r.push(o),n.push(t.getRange(o.anchor,o.head))}return{text:n,ranges:r}}function Hu(t,n,r,i){t.setAttribute("autocorrect",r?"on":"off"),t.setAttribute("autocapitalize",i?"on":"off"),t.setAttribute("spellcheck",!!n)}function zu(){var t=S("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),n=S("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?t.style.width="1000px":t.setAttribute("wrap","off"),g&&(t.style.border="1px solid black"),n}function Vu(t,n,r,i,e){var o=n,u=r,a=Xt(t,n.line),s=e&&"rtl"==t.direction?-r:r;function c(o){var u,c;if("codepoint"==i){var f=a.text.charCodeAt(n.ch+(r>0?0:-1));u=isNaN(f)?null:new an(n.line,Math.max(0,Math.min(a.text.length,n.ch+r*((r>0?f>=55296&&f<56320:f>=56320&&f<57343)?2:1))),-r)}else u=e?function(t,n,r,i){var e=pt(n,t.doc.direction);if(!e)return ou(n,r,i);r.ch>=n.text.length?(r.ch=n.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=vt(e,r.ch,r.sticky),u=e[o];if("ltr"==t.doc.direction&&u.level%2==0&&(i>0?u.to>r.ch:u.from<r.ch))return ou(n,r,i);var a,s=function(t,r){return eu(n,t instanceof an?t.ch:t,r)},c=function(r){return t.options.lineWrapping?(a=a||Pr(t,n),ei(t,n,a,r)):{begin:0,end:n.text.length}},f=c("before"==r.sticky?s(r,-1):r.ch);if("rtl"==t.doc.direction||1==u.level){var h=1==u.level==i<0,l=s(r,h?1:-1);if(null!=l&&(h?l<=u.to&&l<=f.end:l>=u.from&&l>=f.begin))return new an(r.line,l,h?"before":"after")}var v=function(t,n,i){for(var o=function(t,n){return n?new an(r.line,s(t,1),"before"):new an(r.line,t,"after")};t>=0&&t<e.length;t+=n){var u=e[t],a=n>0==(1!=u.level),c=a?i.begin:s(i.end,-1);if(u.from<=c&&c<u.to)return o(c,a);if(c=a?u.from:s(u.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},d=v(o+i,i,f);if(d)return d;var p=i>0?f.end:s(f.begin,-1);return null==p||i>0&&p==n.text.length||!(d=v(i>0?0:e.length-1,i,c(p)))?null:d}(t.cm,a,n,r):ou(a,n,r);if(null==u){if(o||((c=n.line+s)<t.first||c>=t.first+t.size||(n=new an(c,n.ch,n.sticky),!(a=Xt(t,c)))))return!1;n=uu(e,t.cm,a,n.line,s)}else n=u;return!0}if("char"==i||"codepoint"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var f=null,h="group"==i,l=t.cm&&t.cm.getHelper(n,"wordChars"),v=!0;!(r<0)||c(!v);v=!1){var d=a.text.charAt(n.ch)||"\n",p=ut(d,l)?"w":h&&"\n"==d?"n":!h||/\s/.test(d)?null:"p";if(!h||v||p||(p="s"),f&&f!=p){r<0&&(r=1,c(),n.sticky="after");break}if(p&&(f=p),r>0&&!c(!v))break}var g=ho(t,n,o,u,!0);return cn(o,g)&&(g.hitSide=!0),g}function $u(t,n,r,i){var e,o,u=t.doc,a=n.left;if("page"==i){var s=Math.min(t.display.wrapper.clientHeight,_(t).innerHeight||u(t).documentElement.clientHeight),c=Math.max(s-.5*ci(t.display),3);e=(r>0?n.bottom:n.top)+r*c}else"line"==i&&(e=r>0?n.bottom+3:n.top-3);for(;(o=ri(t,a,e)).outside;){if(r<0?e<=0:e>=u.height){o.hitSide=!0;break}e+=5*r}return o}var Gu=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new V,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wu(t,n){var r=Fr(t,n.line);if(!r||r.hidden)return null;var i=Xt(t.doc,n.line),e=Ir(r,i,n.line),o=pt(i,t.doc.direction),u="left";o&&(u=vt(o,n.ch)%2?"right":"left");var a=Hr(e.map,n.ch,u);return a.offset="right"==a.collapse?a.end:a.start,a}function Zu(t,n){return n&&(t.bad=!0),t}function Ku(t,n,r){var i;if(n==t.display.lineDiv){if(!(i=t.display.lineDiv.childNodes[r]))return Zu(t.clipPos(an(t.display.viewTo-1)),!0);n=null,r=0}else for(i=n;;i=i.parentNode){if(!i||i==t.display.lineDiv)return null;if(i.parentNode&&i.parentNode==t.display.lineDiv)break}for(var e=0;e<t.display.view.length;e++){var o=t.display.view[e];if(o.node==i)return Yu(o,n,r)}}function Yu(t,n,r){var i=t.text.firstChild,e=!1;if(!n||!M(i,n))return Zu(an(rn(t.line),0),!0);if(n==i&&(e=!0,n=i.childNodes[r],r=0,!n)){var o=t.rest?tt(t.rest):t.line;return Zu(an(rn(o),o.text.length),e)}var u=3==n.nodeType?n:null,a=n;for(u||1!=n.childNodes.length||3!=n.firstChild.nodeType||(u=n.firstChild,r&&(r=u.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var s=t.measure,c=s.maps;function f(n,r,i){for(var e=-1;e<(c?c.length:0);e++)for(var o=e<0?s.map:c[e],u=0;u<o.length;u+=3){var a=o[u+2];if(a==n||a==r){var f=rn(e<0?t.line:t.rest[e]),h=o[u]+i;return(i<0||a!=n)&&(h=o[u+(i?1:0)]),an(f,h)}}}var h=f(u,a,r);if(h)return Zu(h,e);for(var l=a.nextSibling,v=u?u.nodeValue.length-r:0;l;l=l.nextSibling){if(h=f(l,l.firstChild,0))return Zu(an(h.line,h.ch-v),e);v+=l.textContent.length}for(var d=a.previousSibling,p=r;d;d=d.previousSibling){if(h=f(d,d.firstChild,-1))return Zu(an(h.line,h.ch+p),e);p+=d.textContent.length}}Gu.prototype.init=function(t){var n=this,r=this,i=r.cm,e=r.div=t.lineDiv;function o(t){for(var n=t.target;n;n=n.parentNode){if(n==e)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(n.className))break}return!1}function u(t){if(o(t)&&!kt(i,t)){if(i.somethingSelected())Fu({lineWise:!1,text:i.getSelections()}),"cut"==t.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var n=Uu(i);Fu({lineWise:!0,text:n.text}),"cut"==t.type&&i.operation((function(){i.setSelections(n.ranges,0,Z),i.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var u=qu.text.join("\n");if(t.clipboardData.setData("Text",u),t.clipboardData.getData("Text")==u)return void t.preventDefault()}var a=zu(),s=a.firstChild;Hu(s),i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),s.value=qu.text.join("\n");var c=R(j(e));q(s),setTimeout((function(){i.display.lineSpace.removeChild(a),c.focus(),c==e&&r.showPrimarySelection()}),50)}}e.contentEditable=!0,Hu(e,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),bt(e,"paste",(function(t){!o(t)||kt(i,t)||ju(t,i)||a<=11&&setTimeout(ue(i,(function(){return n.updateFromDOM()})),20)})),bt(e,"compositionstart",(function(t){n.composing={data:t.data,done:!1}})),bt(e,"compositionupdate",(function(t){n.composing||(n.composing={data:t.data,done:!1})})),bt(e,"compositionend",(function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)})),bt(e,"touchstart",(function(){return r.forceCompositionEnd()})),bt(e,"input",(function(){n.composing||n.readFromDOMSoon()})),bt(e,"copy",u),bt(e,"cut",u)},Gu.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},Gu.prototype.prepareSelection=function(){var t=Ai(this.cm,!1);return t.focus=R(j(this.div))==this.div,t},Gu.prototype.showSelection=function(t,n){t&&this.cm.display.view.length&&((t.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Gu.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gu.prototype.showPrimarySelection=function(){var t=this.getSelection(),n=this.cm,i=n.doc.sel.primary(),e=i.from(),o=i.to();if(n.display.viewTo==n.display.viewFrom||e.line>=n.display.viewTo||o.line<n.display.viewFrom)t.removeAllRanges();else{var u=Ku(n,t.anchorNode,t.anchorOffset),a=Ku(n,t.focusNode,t.focusOffset);if(!u||u.bad||!a||a.bad||0!=sn(ln(u,a),e)||0!=sn(hn(u,a),o)){var s=n.display.view,c=e.line>=n.display.viewFrom&&Wu(n,e)||{node:s[0].measure.map[2],offset:0},f=o.line<n.display.viewTo&&Wu(n,o);if(!f){var h=s[s.length-1].measure,l=h.maps?h.maps[h.maps.length-1]:h.map;f={node:l[l.length-1],offset:l[l.length-2]-l[l.length-3]}}if(c&&f){var v,d=t.rangeCount&&t.getRangeAt(0);try{v=x(c.node,c.offset,f.offset,f.node)}catch(t){}v&&(!r&&n.state.focused?(t.collapse(c.node,c.offset),v.collapsed||(t.removeAllRanges(),t.addRange(v))):(t.removeAllRanges(),t.addRange(v)),d&&null==t.anchorNode?t.addRange(d):r&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Gu.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},Gu.prototype.showMultipleSelections=function(t){O(this.cm.display.cursorDiv,t.cursors),O(this.cm.display.selectionDiv,t.selection)},Gu.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Gu.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var n=t.getRangeAt(0).commonAncestorContainer;return M(this.div,n)},Gu.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&R(j(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gu.prototype.blur=function(){this.div.blur()},Gu.prototype.getField=function(){return this.div},Gu.prototype.supportsTouch=function(){return!0},Gu.prototype.receivedFocus=function(){var t=this,n=this;this.selectionInEditor()?setTimeout((function(){return t.pollSelection()}),20):oe(this.cm,(function(){return n.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}))},Gu.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Gu.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),n=this.cm;if(b&&f&&this.cm.display.gutterSpecs.length&&function(t){for(var n=t;n;n=n.parentNode)if(/CodeMirror-gutter-wrapper/.test(n.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Ku(n,t.anchorNode,t.anchorOffset),i=Ku(n,t.focusNode,t.focusOffset);r&&i&&oe(n,(function(){oo(n.doc,Ne(r,i),Z),(r.bad||i.bad)&&(n.curOp.selectionChanged=!0)}))}}},Gu.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,n,r,i=this.cm,e=i.display,o=i.doc.sel.primary(),u=o.from(),a=o.to();if(0==u.ch&&u.line>i.firstLine()&&(u=an(u.line-1,Xt(i.doc,u.line-1).length)),a.ch==Xt(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=an(a.line+1,0)),u.line<e.viewFrom||a.line>e.viewTo-1)return!1;u.line==e.viewFrom||0==(t=gi(i,u.line))?(n=rn(e.view[0].line),r=e.view[0].node):(n=rn(e.view[t].line),r=e.view[t-1].node.nextSibling);var s,c,f=gi(i,a.line);if(f==e.view.length-1?(s=e.viewTo-1,c=e.lineDiv.lastChild):(s=rn(e.view[f+1].line)-1,c=e.view[f+1].node.previousSibling),!r)return!1;for(var h=i.doc.splitLines(function(t,n,r,i,e){var o="",u=!1,a=t.doc.lineSeparator(),s=!1;function c(){u&&(o+=a,s&&(o+=a),u=s=!1)}function f(t){t&&(c(),o+=t)}function h(n){if(1==n.nodeType){var r=n.getAttribute("cm-text");if(r)return void f(r);var o,l=n.getAttribute("cm-marker");if(l){var v=t.findMarks(an(i,0),an(e+1,0),(g=+l,function(t){return t.id==g}));return void(v.length&&(o=v[0].find(0))&&f(Jt(t.doc,o.from,o.to).join(a)))}if("false"==n.getAttribute("contenteditable"))return;var d=/^(pre|div|p|li|table|br)$/i.test(n.nodeName);if(!/^br$/i.test(n.nodeName)&&0==n.textContent.length)return;d&&c();for(var p=0;p<n.childNodes.length;p++)h(n.childNodes[p]);/^(pre|p)$/i.test(n.nodeName)&&(s=!0),d&&(u=!0)}else 3==n.nodeType&&f(n.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var g}for(;h(n),n!=r;)n=n.nextSibling,s=!1;return o}(i,r,c,n,s)),l=Jt(i.doc,an(n,0),an(s,Xt(i.doc,s).text.length));h.length>1&&l.length>1;)if(tt(h)==tt(l))h.pop(),l.pop(),s--;else{if(h[0]!=l[0])break;h.shift(),l.shift(),n++}for(var v=0,d=0,p=h[0],g=l[0],b=Math.min(p.length,g.length);v<b&&p.charCodeAt(v)==g.charCodeAt(v);)++v;for(var m=tt(h),w=tt(l),y=Math.min(m.length-(1==h.length?v:0),w.length-(1==l.length?v:0));d<y&&m.charCodeAt(m.length-d-1)==w.charCodeAt(w.length-d-1);)++d;if(1==h.length&&1==l.length&&n==u.line)for(;v&&v>u.ch&&m.charCodeAt(m.length-d-1)==w.charCodeAt(w.length-d-1);)v--,d++;h[h.length-1]=m.slice(0,m.length-d).replace(/^\u200b+/,""),h[0]=h[0].slice(v).replace(/\u200b+$/,"");var k=an(n,v),T=an(s,l.length?tt(l).length-d:0);return h.length>1||h[0]||sn(k,T)?(ko(i.doc,h,k,T,"+input"),!0):void 0},Gu.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gu.prototype.reset=function(){this.forceCompositionEnd()},Gu.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Gu.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Gu.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||oe(this.cm,(function(){return bi(t.cm)}))},Gu.prototype.setUneditable=function(t){t.contentEditable="false"},Gu.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||ue(this.cm,Pu)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Gu.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Gu.prototype.onContextMenu=function(){},Gu.prototype.resetPosition=function(){},Gu.prototype.needsContentAttribute=!0;var Qu=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new V,this.hasSelection=!1,this.composing=null,this.resetting=!1};Qu.prototype.init=function(t){var n=this,r=this,i=this.cm;this.createField(t);var e=this.textarea;function o(t){if(!kt(i,t)){if(i.somethingSelected())Fu({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var n=Uu(i);Fu({lineWise:!0,text:n.text}),"cut"==t.type?i.setSelections(n.ranges,null,Z):(r.prevInput="",e.value=n.text.join("\n"),q(e))}"cut"==t.type&&(i.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(e.style.width="0px"),bt(e,"input",(function(){u&&a>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()})),bt(e,"paste",(function(t){kt(i,t)||ju(t,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())})),bt(e,"cut",o),bt(e,"copy",o),bt(t.scroller,"paste",(function(n){if(!Dr(t,n)&&!kt(i,n)){if(!e.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=n.clipboardData,e.dispatchEvent(o)}})),bt(t.lineSpace,"selectstart",(function(n){Dr(t,n)||Lt(n)})),bt(e,"compositionstart",(function(){var t=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:t,range:i.markText(t,i.getCursor("to"),{className:"CodeMirror-composing"})}})),bt(e,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Qu.prototype.createField=function(){this.wrapper=zu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Hu(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Qu.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},Qu.prototype.prepareSelection=function(){var t=this.cm,n=t.display,r=t.doc,i=Ai(t);if(t.options.moveInputWithCursor){var e=Jr(t,r.sel.primary().head,"div"),o=n.wrapper.getBoundingClientRect(),u=n.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,e.top+u.top-o.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,e.left+u.left-o.left))}return i},Qu.prototype.showSelection=function(t){var n=this.cm.display;O(n.cursorDiv,t.cursors),O(n.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},Qu.prototype.reset=function(t){if(!(this.contextMenuPending||this.composing&&t)){var n=this.cm;if(this.resetting=!0,n.somethingSelected()){this.prevInput="";var r=n.getSelection();this.textarea.value=r,n.state.focused&&q(this.textarea),u&&a>=9&&(this.hasSelection=r)}else t||(this.prevInput=this.textarea.value="",u&&a>=9&&(this.hasSelection=null));this.resetting=!1}},Qu.prototype.getField=function(){return this.textarea},Qu.prototype.supportsTouch=function(){return!1},Qu.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||R(j(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(t){}},Qu.prototype.blur=function(){this.textarea.blur()},Qu.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Qu.prototype.receivedFocus=function(){this.slowPoll()},Qu.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},Qu.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,(function r(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,r))}))},Qu.prototype.poll=function(){var t=this,n=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!n.state.focused||Pt(r)&&!i&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq)return!1;var e=r.value;if(e==i&&!n.somethingSelected())return!1;if(u&&a>=9&&this.hasSelection===e||w&&/[\uf700-\uf7ff]/.test(e))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu){var o=e.charCodeAt(0);if(8203!=o||i||(i=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(i.length,e.length);s<c&&i.charCodeAt(s)==e.charCodeAt(s);)++s;return oe(n,(function(){Pu(n,e.slice(s),i.length-s,null,t.composing?"*compose":null),e.length>1e3||e.indexOf("\n")>-1?r.value=t.prevInput="":t.prevInput=e,t.composing&&(t.composing.range.clear(),t.composing.range=n.markText(t.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Qu.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Qu.prototype.onKeyPress=function(){u&&a>=9&&(this.hasSelection=null),this.fastPoll()},Qu.prototype.onContextMenu=function(t){var n=this,r=n.cm,i=r.display,e=n.textarea;n.contextMenuPending&&n.contextMenuPending();var o=pi(r,t),c=i.scroller.scrollTop;if(o&&!l){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ue(r,oo)(r.doc,Ne(o),Z);var f,h=e.style.cssText,v=n.wrapper.style.cssText,d=n.wrapper.offsetParent.getBoundingClientRect();if(n.wrapper.style.cssText="position: static",e.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-d.top-5)+"px; left: "+(t.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(u?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(f=e.ownerDocument.defaultView.scrollY),i.input.focus(),s&&e.ownerDocument.defaultView.scrollTo(null,f),i.input.reset(),r.somethingSelected()||(e.value=n.prevInput=" "),n.contextMenuPending=b,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),u&&a>=9&&g(),E){Dt(t);var p=function(){wt(window,"mouseup",p),setTimeout(b,20)};bt(window,"mouseup",p)}else setTimeout(b,50)}function g(){if(null!=e.selectionStart){var t=r.somethingSelected(),o=""+(t?e.value:"");e.value="⇚",e.value=o,n.prevInput=t?"":"",e.selectionStart=1,e.selectionEnd=o.length,i.selForContextMenu=r.doc.sel}}function b(){if(n.contextMenuPending==b&&(n.contextMenuPending=!1,n.wrapper.style.cssText=v,e.style.cssText=h,u&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=c),null!=e.selectionStart)){(!u||u&&a<9)&&g();var t=0,o=function(){i.selForContextMenu==r.doc.sel&&0==e.selectionStart&&e.selectionEnd>0&&""==n.prevInput?ue(r,vo)(r):t++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},Qu.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},Qu.prototype.setUneditable=function(){},Qu.prototype.needsContentAttribute=!1,function(t){var n=t.optionHandlers;function r(r,i,e,o){t.defaults[r]=i,e&&(n[r]=o?function(t,n,r){r!=Du&&e(t,n,r)}:e)}t.defineOption=r,t.Init=Du,r("value","",(function(t,n){return t.setValue(n)}),!0),r("mode",null,(function(t,n){t.doc.modeOption=n,qe(t)}),!0),r("indentUnit",2,qe,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(t){Fe(t),Gr(t),bi(t)}),!0),r("lineSeparator",null,(function(t,n){if(t.doc.lineSep=n,n){var r=[],i=t.doc.first;t.doc.iter((function(t){for(var e=0;;){var o=t.text.indexOf(n,e);if(-1==o)break;e=o+n.length,r.push(an(i,o))}i++}));for(var e=r.length-1;e>=0;e--)ko(t.doc,n,r[e],an(r[e].line,r[e].ch+n.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),r!=Du&&t.refresh()})),r("specialCharPlaceholder",or,(function(t){return t.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(t,n){return t.getInputField().spellcheck=n}),!0),r("autocorrect",!1,(function(t,n){return t.getInputField().autocorrect=n}),!0),r("autocapitalize",!1,(function(t,n){return t.getInputField().autocapitalize=n}),!0),r("rtlMoveVisually",!k),r("wholeLineUpdateBefore",!0),r("theme","default",(function(t){Cu(t),ke(t)}),!0),r("keyMap","default",(function(t,n,r){var i=ru(n),e=r!=Du&&ru(r);e&&e.detach&&e.detach(t,i),i.attach&&i.attach(t,e||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Mu,!0),r("gutters",[],(function(t,n){t.display.gutterSpecs=we(n,t.options.lineNumbers),ke(t)}),!0),r("fixedGutter",!0,(function(t,n){t.display.gutters.style.left=n?li(t.display)+"px":"0",t.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(t){return Wi(t)}),!0),r("scrollbarStyle","native",(function(t){Yi(t),Wi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(t,n){t.display.gutterSpecs=we(t.options.gutters,n),ke(t)}),!0),r("firstLineNumber",1,ke,!0),r("lineNumberFormatter",(function(t){return t}),ke,!0),r("showCursorWhenSelecting",!1,Ti,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(t,n){"nocursor"==n&&(Ni(t),t.display.input.blur()),t.display.input.readOnlyChanged(n)})),r("screenReaderLabel",null,(function(t,n){t.display.input.screenReaderLabelChanged(n=""===n?null:n)})),r("disableInput",!1,(function(t,n){n||t.display.input.reset()}),!0),r("dragDrop",!0,Nu),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Ti,!0),r("singleCursorHeightPerLine",!0,Ti,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Fe,!0),r("addModeClass",!1,Fe,!0),r("pollInterval",100),r("undoDepth",200,(function(t,n){return t.doc.history.undoDepth=n})),r("historyEventDelay",1250),r("viewportMargin",10,(function(t){return t.refresh()}),!0),r("maxHighlightLength",1e4,Fe,!0),r("moveInputWithCursor",!0,(function(t,n){n||t.display.input.resetPosition()})),r("tabindex",null,(function(t,n){return t.display.input.getField().tabIndex=n||""})),r("autofocus",null),r("direction","ltr",(function(t,n){return t.doc.setDirection(n)}),!0),r("phrases",null)}(Ru),function(t){var n=t.optionHandlers,r=t.helpers={};t.prototype={constructor:t,focus:function(){_(this).focus(),this.display.input.focus()},setOption:function(t,r){var i=this.options,e=i[t];i[t]==r&&"mode"!=t||(i[t]=r,n.hasOwnProperty(t)&&ue(this,n[t])(this,r,e),yt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,n){this.state.keyMaps[n?"push":"unshift"](ru(t))},removeKeyMap:function(t){for(var n=this.state.keyMaps,r=0;r<n.length;++r)if(n[r]==t||n[r].name==t)return n.splice(r,1),!0},addOverlay:ae((function(n,r){var i=n.token?n:t.getMode(this.options,n);if(i.startState)throw new Error("Overlays may not be stateful.");(function(t,n,r){for(var i=0,e=r(n);i<t.length&&r(t[i])<=e;)i++;t.splice(i,0,n)})(this.state.overlays,{mode:i,modeSpec:n,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(t){return t.priority})),this.state.modeGen++,bi(this)})),removeOverlay:ae((function(t){for(var n=this.state.overlays,r=0;r<n.length;++r){var i=n[r].modeSpec;if(i==t||"string"==typeof t&&i.name==t)return n.splice(r,1),this.state.modeGen++,void bi(this)}})),indentLine:ae((function(t,n,r){"string"!=typeof n&&"number"!=typeof n&&(n=null==n?this.options.smartIndent?"smart":"prev":n?"add":"subtract"),on(this.doc,t)&&Iu(this,t,n,r)})),indentSelection:ae((function(t){for(var n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var e=n[i];if(e.empty())e.head.line>r&&(Iu(this,e.head.line,t,!0),r=e.head.line,i==this.doc.sel.primIndex&&Fi(this));else{var o=e.from(),u=e.to(),a=Math.max(r,o.line);r=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var s=a;s<r;++s)Iu(this,s,t);var c=this.doc.sel.ranges;0==o.ch&&n.length==c.length&&c[i].from().ch>0&&ro(this.doc,i,new Oe(o,c[i].to()),Z)}}})),getTokenAt:function(t,n){return Ln(this,t,n)},getLineTokens:function(t,n){return Ln(this,an(t),n,!0)},getTokenTypeAt:function(t){t=dn(this.doc,t);var n,r=wn(this,Xt(this.doc,t.line)),i=0,e=(r.length-1)/2,o=t.ch;if(0==o)n=r[2];else for(;;){var u=i+e>>1;if((u?r[2*u-1]:0)>=o)e=u;else{if(!(r[2*u+1]<o)){n=r[2*u+2];break}i=u+1}}var a=n?n.indexOf("overlay "):-1;return a<0?n:0==a?null:n.slice(0,a-1)},getModeAt:function(n){var r=this.doc.mode;return r.innerMode?t.innerMode(r,this.getTokenAt(n).state).mode:r},getHelper:function(t,n){return this.getHelpers(t,n)[0]},getHelpers:function(t,n){var i=[];if(!r.hasOwnProperty(n))return i;var e=r[n],o=this.getModeAt(t);if("string"==typeof o[n])e[o[n]]&&i.push(e[o[n]]);else if(o[n])for(var u=0;u<o[n].length;u++){var a=e[o[n][u]];a&&i.push(a)}else o.helperType&&e[o.helperType]?i.push(e[o.helperType]):e[o.name]&&i.push(e[o.name]);for(var s=0;s<e._global.length;s++){var c=e._global[s];c.pred(o,this)&&-1==$(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(t,n){var r=this.doc;return yn(this,(t=vn(r,null==t?r.first+r.size-1:t))+1,n).state},cursorCoords:function(t,n){var r=this.doc.sel.primary();return Jr(this,null==t?r.head:"object"==typeof t?dn(this.doc,t):t?r.from():r.to(),n||"page")},charCoords:function(t,n){return Xr(this,dn(this.doc,t),n||"page")},coordsChar:function(t,n){return ri(this,(t=Qr(this,t,n||"page")).left,t.top)},lineAtHeight:function(t,n){return t=Qr(this,{top:t,left:0},n||"page").top,en(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,n,r){var i,e=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,e=!0),i=Xt(this.doc,t)}else i=t;return Yr(this,i,{top:0,left:0},n||"page",r||e).top+(e?this.doc.height-Yn(i):0)},defaultTextHeight:function(){return ci(this.display)},defaultCharWidth:function(){return fi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,n,r,i,e){var o,u,a=this.display,s=(t=Jr(this,dn(this.doc,t))).bottom,c=t.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),a.sizer.appendChild(n),"over"==i)s=t.top;else if("above"==i||"near"==i){var f=Math.max(a.wrapper.clientHeight,this.doc.height),h=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==i||t.bottom+n.offsetHeight>f)&&t.top>n.offsetHeight?s=t.top-n.offsetHeight:t.bottom+n.offsetHeight<=f&&(s=t.bottom),c+n.offsetWidth>h&&(c=h-n.offsetWidth)}n.style.top=s+"px",n.style.left=n.style.right="","right"==e?(c=a.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):("left"==e?c=0:"middle"==e&&(c=(a.sizer.clientWidth-n.offsetWidth)/2),n.style.left=c+"px"),r&&(null!=(u=Ii(o=this,{left:c,top:s,right:c+n.offsetWidth,bottom:s+n.offsetHeight})).scrollTop&&Ui(o,u.scrollTop),null!=u.scrollLeft&&zi(o,u.scrollLeft))},triggerOnKeyDown:ae(gu),triggerOnKeyPress:ae(mu),triggerOnKeyUp:bu,triggerOnMouseDown:ae(Tu),execCommand:function(t){if(au.hasOwnProperty(t))return au[t].call(null,this)},triggerElectric:ae((function(t){_u(this,t)})),findPosH:function(t,n,r,i){var e=1;n<0&&(e=-1,n=-n);for(var o=dn(this.doc,t),u=0;u<n&&!(o=Vu(this.doc,o,e,r,i)).hitSide;++u);return o},moveH:ae((function(t,n){var r=this;this.extendSelectionsBy((function(i){return r.display.shift||r.doc.extend||i.empty()?Vu(r.doc,i.head,t,n,r.options.rtlMoveVisually):t<0?i.from():i.to()}),Y)})),deleteH:ae((function(t,n){var r=this.doc;this.doc.sel.somethingSelected()?r.replaceSelection("",null,"+delete"):iu(this,(function(i){var e=Vu(r,i.head,t,n,!1);return t<0?{from:e,to:i.head}:{from:i.head,to:e}}))})),findPosV:function(t,n,r,i){var e=1,o=i;n<0&&(e=-1,n=-n);for(var u=dn(this.doc,t),a=0;a<n;++a){var s=Jr(this,u,"div");if(null==o?o=s.left:s.left=o,(u=$u(this,s,e,r)).hitSide)break}return u},moveV:ae((function(t,n){var r=this,i=this.doc,e=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy((function(u){if(o)return t<0?u.from():u.to();var a=Jr(r,u.head,"div");null!=u.goalColumn&&(a.left=u.goalColumn),e.push(a.left);var s=$u(r,a,t,n);return"page"==n&&u==i.sel.primary()&&qi(r,Xr(r,s,"div").top-a.top),s}),Y),e.length)for(var u=0;u<i.sel.ranges.length;u++)i.sel.ranges[u].goalColumn=e[u]})),findWordAt:function(t){var n=Xt(this.doc,t.line).text,r=t.ch,i=t.ch;if(n){var e=this.getHelper(t,"wordChars");"before"!=t.sticky&&i!=n.length||!r?++i:--r;for(var o=n.charAt(r),u=ut(o,e)?function(t){return ut(t,e)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!ut(t)};r>0&&u(n.charAt(r-1));)--r;for(;i<n.length&&u(n.charAt(i));)++i}return new Oe(an(t.line,r),an(t.line,i))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),yt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R(P(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ae((function(t,n){Pi(this,t,n)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Mr(this)-this.display.barHeight,width:t.scrollWidth-Mr(this)-this.display.barWidth,clientHeight:Br(this),clientWidth:Rr(this)}},scrollIntoView:ae((function(t,n){null==t?(t={from:this.doc.sel.primary().head,to:null},null==n&&(n=this.options.cursorScrollMargin)):"number"==typeof t?t={from:an(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=n||0,null!=t.from.line?function(t,n){ji(t),t.curOp.scrollToPos=n}(this,t):_i(this,t.from,t.to,t.margin)})),setSize:ae((function(t,n){var r=this,i=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=i(t)),null!=n&&(this.display.wrapper.style.height=i(n)),this.options.lineWrapping&&$r(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,(function(t){if(t.widgets)for(var n=0;n<t.widgets.length;n++)if(t.widgets[n].noHScroll){mi(r,e,"widget");break}++e})),this.curOp.forceUpdate=!0,yt(this,"refresh",this)})),operation:function(t){return oe(this,t)},startOperation:function(){return Xi(this)},endOperation:function(){return Ji(this)},refresh:ae((function(){var t=this.display.cachedTextHeight;bi(this),this.curOp.forceUpdate=!0,Gr(this),Pi(this,this.doc.scrollLeft,this.doc.scrollTop),pe(this.display),(null==t||Math.abs(t-ci(this.display))>.5||this.options.lineWrapping)&&di(this),yt(this,"refresh",this)})),swapDoc:ae((function(t){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Ue(this,t),Gr(this),this.display.input.reset(),Pi(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,dr(this,"swapDoc",this,n),n})),phrase:function(t){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,t)?n[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}},Et(t),t.registerHelper=function(n,i,e){r.hasOwnProperty(n)||(r[n]=t[n]={_global:[]}),r[n][i]=e},t.registerGlobalHelper=function(n,i,e,o){t.registerHelper(n,i,o),r[n]._global.push({pred:e,val:o})}}(Ru);var Xu="iter insert remove copy getEditor constructor".split(" ");for(var Ju in Fo.prototype)Fo.prototype.hasOwnProperty(Ju)&&$(Xu,Ju)<0&&(Ru.prototype[Ju]=function(t){return function(){return t.apply(this.doc,arguments)}}(Fo.prototype[Ju]));return Et(Fo),Ru.inputStyles={textarea:Qu,contenteditable:Gu},Ru.defineMode=function(t){Ru.defaults.mode||"null"==t||(Ru.defaults.mode=t),zt.apply(this,arguments)},Ru.defineMIME=function(t,n){Ht[t]=n},Ru.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Ru.defineMIME("text/plain","null"),Ru.defineExtension=function(t,n){Ru.prototype[t]=n},Ru.defineDocExtension=function(t,n){Fo.prototype[t]=n},Ru.fromTextArea=function(t,n){if((n=n?H(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var r=R(j(t));n.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function i(){t.value=a.getValue()}var e;if(t.form&&(bt(t.form,"submit",i),!n.leaveSubmitMethodAlone)){var o=t.form;e=o.submit;try{var u=o.submit=function(){i(),o.submit=e,o.submit(),o.submit=u}}catch(t){}}n.finishInit=function(r){r.save=i,r.getTextArea=function(){return t},r.toTextArea=function(){r.toTextArea=isNaN,i(),t.parentNode.removeChild(r.getWrapperElement()),t.style.display="",t.form&&(wt(t.form,"submit",i),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=e))}},t.style.display="none";var a=Ru((function(n){return t.parentNode.insertBefore(n,t.nextSibling)}),n);return a},function(t){t.off=wt,t.on=bt,t.wheelEventPixels=xe,t.Doc=Fo,t.splitLines=Ft,t.countColumn=z,t.findColumn=Q,t.isWordChar=ot,t.Pass=W,t.signal=yt,t.Line=Jn,t.changeEnd=Me,t.scrollbarModel=Ki,t.Pos=an,t.cmpPos=sn,t.modes=Ut,t.mimeModes=Ht,t.resolveMode=Vt,t.getMode=$t,t.modeExtensions=Gt,t.extendMode=Wt,t.copyState=Zt,t.startState=Yt,t.innerMode=Kt,t.commands=au,t.keyMap=Ko,t.keyName=nu,t.isModifierKey=Jo,t.lookupKey=Xo,t.normalizeKeyMap=Qo,t.StringStream=Qt,t.SharedTextMarker=Ro,t.TextMarker=No,t.LineWidget=Do,t.e_preventDefault=Lt,t.e_stopPropagation=xt,t.e_stop=Dt,t.addClass=B,t.contains=M,t.rmClass=C,t.keyNames=$o}(Ru),Ru.version="5.65.18",Ru}(),window,l=function(t){return function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=65)}([function(t,n,r){var i=r(3),e=r.n(i),o=r(8),u=r.n(o),a=r(9),s=r.n(a),c=r(4),f=r.n(c),h=r(5),l=r.n(h),v=r(6),d=r.n(v),p=r(16),g=r.n(p),b=r(13),m=r.n(b),w=/\u200B/g,y=window.getComputedStyle,k=function(t){return t&&t.nodeType===Node.TEXT_NODE},T=function(t){return t&&t.nodeType===Node.ELEMENT_NODE},A=function(t){return T(t)?t.tagName:"TEXT"},E=function(t){var n;return T(t)?n=t.textContent.replace(w,"").length:k(t)&&(n=t.nodeValue.replace(w,"").length),n},L=function(t){var n,r,i,e=t.parentNode.childNodes;for(n=0,r=e.length;n<r;n+=1)if(e[n]===t){i=n;break}return i},x=function(t,n){var r;return k(t)?r=t:t.childNodes.length&&n>=0&&(r=t.childNodes[n]),r},C=function(t,n,r){for(var i,e,o=t+"Sibling";n&&!n[o]&&(i=A(n.parentNode))!==r&&"BODY"!==i;)n=n.parentNode;return n[o]&&(e=n[o]),e},D=function(t,n,r){for(;t.parentNode&&!n(t.parentNode)&&(t=t.parentNode,!r||!r(t)););return n(t.parentNode)?t:null},O=function(t,n){return s()(n)?D(t,(function(t){return n===A(t)})):D(t,(function(t){return n===t}))},S=function(t,n,r){var i,e=t+"Sibling";return(n=O(n,r))&&n[e]&&(i=n[e]),i},N=function(t){var n={};n.tagName=t.nodeName,t.id&&(n.id=t.id);var r=t.className.trim();return r&&(n.className=r),n},M=function(t,n,r){var i=n;if(i&&t===i.parentNode)for(;i!==r;){var e=i.nextSibling;t.removeChild(i),i=e}},R=function(t){return!!t&&("UL"===t.nodeName||"OL"===t.nodeName)},B=function(t,n){t.hasChildNodes()&&(e()(t.childNodes).forEach((function(){n.appendChild(t.firstChild)})),n.normalize()),t.parentNode&&t.parentNode.removeChild(t)},I=function(t,n){if("SPAN"!==t.nodeName)for(var r=t.parentNode,i=t;i.childNodes&&1===i.childNodes.length&&!k(i.firstChild)&&"SPAN"!==(i=i.firstChild).nodeName;)if(i.nodeName===n){var e=document.createElement(n);return B(i,i.parentNode),r.replaceChild(e,t),e.appendChild(t),e}return t},q=function(t,n,r){var i=I(t,r);if(i.nodeName===r)for(var e=I(n,r),o=i,u=i.nextSibling;u;){var a=u.nextSibling;if((u=I(u,r)).nodeName===r?o?B(u,o):o=u:o=null,u===e)break;u=a}};function F(t,n){var r=e()(t.querySelectorAll(n));return r.length?r:[]}function P(t,n,r){var i;for(r=r||document,i=s()(n)?function(t){return m()(t,n)}:function(t){return t===n};t&&t!==r;){if(T(t)&&i(t))return t;t=t.parentNode}return null}function j(t,n){for(var r=[];t&&t!==document;)(t=P(t.parentNode,n))&&r.push(t);return r}function _(t,n){var r;return r=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.childNodes:t.children,e()(r).filter((function(t){return m()(t,n)}))}function U(t){t.parentNode&&t.parentNode.removeChild(t)}n.a={getNodeName:A,isTextNode:k,isElemNode:T,isBlockNode:function(t){return/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|DETAILS|DIALOG|DD|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H[\d]|HEADER|HGROUP|HR|LI|MAIN|NAV|OL|P|PRE|SECTION|UL)$/gi.test(this.getNodeName(t))},getTextLength:E,getOffsetLength:function(t){var n;return T(t)?n=t.childNodes.length:k(t)&&(n=t.nodeValue.replace(w,"").length),n},getPrevOffsetNodeUntil:function(t,n,r){return n>0?x(t,n-1):C("previous",t,r)},getNodeOffsetOfParent:L,getChildNodeByOffset:x,getNodeWithDirectionUntil:C,containsNode:function(t,n){for(var r=document.createTreeWalker(t,4,null,!1),i=t===n;!i&&r.nextNode();)i=r.currentNode===n;return i},getTopPrevNodeUnder:function(t,n){return S("previous",t,n)},getTopNextNodeUnder:function(t,n){return S("next",t,n)},getParentUntilBy:D,getParentUntil:O,getTopBlockNode:function(t){return O(t,"BODY")},getPrevTextNode:function(t){for(t=t.previousSibling||t.parentNode;!k(t)&&"BODY"!==A(t);)if(t.previousSibling)for(t=t.previousSibling;t.lastChild;)t=t.lastChild;else t=t.parentNode;return"BODY"===A(t)&&(t=null),t},findOffsetNode:function(t,n,r){var i,e=[],o="",a=0;if(!n.length)return e;for(var s=n.shift(),c=document.createTreeWalker(t,4,null,!1);c.nextNode();){for(o=c.currentNode.nodeValue||"",r&&(o=r(o)),i=a+o.length;i>=s;){if(e.push({container:c.currentNode,offsetInContainer:s-a,offset:s}),!n.length)return e;s=n.shift()}a=i}do{e.push({container:c.currentNode,offsetInContainer:o.length,offset:s}),s=n.shift()}while(!u()(s));return e},getPath:function(t,n){for(var r=[];t&&t!==n;)T(t)&&r.unshift(N(t)),t=t.parentNode;return r},getNodeInfo:N,getTableCellByDirection:function(t,n){var r=null;return u()(n)||"next"!==n&&"previous"!==n||(r="next"===n?t.nextElementSibling:t.previousElementSibling),r},getSiblingRowCellByDirection:function(t,n,r){var i,e,o,a,s,c=null;return u()(n)||"next"!==n&&"previous"!==n||t&&("next"===n?(e=t.parentNode&&t.parentNode.nextSibling,s=(a=(o=j(t,"thead"))[0]&&o[0].nextSibling)&&"TBODY"===A(a),i=0):(e=t.parentNode&&t.parentNode.previousSibling,s=(a=(o=j(t,"tbody"))[0]&&o[0].previousSibling)&&"THEAD"===A(a),i=t.parentNode.childNodes.length-1),!u()(r)&&r||(i=L(t)),e?c=_(e,"td,th")[i]:o[0]&&s&&(c=F(a,"td,th")[i])),c},isMDSupportInlineNode:function(t){return/^(A|B|BR|CODE|DEL|EM|I|IMG|S|SPAN|STRONG)$/gi.test(t.nodeName)},isStyledNode:function(t){return/^(A|ABBR|ACRONYM|B|BDI|BDO|BIG|CITE|CODE|DEL|DFN|EM|I|INS|KBD|MARK|Q|S|SAMP|SMALL|SPAN|STRONG|SUB|SUP|U|VAR)$/gi.test(t.nodeName)},removeChildFromStartToEndNode:M,removeNodesByDirection:function(t,n,r){for(var i=n;i!==t;){var e=i.parentNode,o=i.nextSibling,u=i.previousSibling;!r&&o?M(e,o,null):r&&u&&M(e,e.childNodes[0],i),i=e}},getLeafNode:function(t){for(var n=t;n.childNodes&&n.childNodes.length;){var r=n.firstChild;n=k(r)&&!E(r)&&r.nextSibling||r}return n},isInsideButtonBox:function(t,n,r){var i=parseInt(t.left,10),e=parseInt(t.top,10),o=parseInt(t.width,10),u=parseInt(t.height,10);return n>=i&&n<=i+o&&r>=e&&r<=e+u},isListNode:R,isFirstListItem:function(t){return"LI"===t.nodeName&&t===t.parentNode.firstChild},isFirstLevelListItem:function(t){return"LI"===t.nodeName&&!R(t.parentNode.parentNode)},mergeNode:B,createHorizontalRule:function(){var t=document.createElement("div"),n=document.createElement("hr");return t.setAttribute("contenteditable",!1),n.setAttribute("contenteditable",!1),t.appendChild(n),t},createEmptyLine:function(){var t=document.createElement("div");return t.appendChild(document.createElement("br")),t},changeTagOrder:I,mergeSameNodes:q,optimizeRange:function(t,n){var r=t.commonAncestorContainer,i=t.startContainer,e=t.endContainer;if(!t.collapsed){var o=null;if(i!==e){var u=O(i,r),a=O(e,r);u&&a&&q(u,a,n),o=r}else k(i)&&(o=i.parentNode);if(o&&o.nodeName===n){var s,c=o.previousSibling;c&&(s=I(c)).nodeName===n&&B(o,s);var f=o.nextSibling;f&&(s=I(f)).nodeName===n&&B(s,o)}}},getAllTextNode:function(t){for(var n=document.createTreeWalker(t,4,null,!1),r=[];n.nextNode();){var i=n.currentNode;k(i)&&r.push(i)}return r},isCellNode:function(t){return!!t&&("TD"===t.nodeName||"TH"===t.nodeName)},getLastNodeBy:function(t,n){for(var r=t&&t.lastChild;r&&n(r);)r=r.lastChild;return r},getParentNodeBy:function(t,n){for(;t&&n(t.parentNode,t);)t=t.parentNode;return t},getSiblingNodeBy:function(t,n,r){for(var i=n+"Sibling";t&&r(t[i],t);)t=t[i];return t},createElementWith:function(t,n){var r=document.createElement("div");s()(t)?r.innerHTML=t:r.appendChild(t);var i=r.firstChild;return n&&n.appendChild(i),i},findAll:F,isContain:function(t,n){return t!==n&&t.contains(n)},closest:P,parent:function(t,n){var r=t.parentNode;return n?r&&m()(r,n)?r:null:r},parents:j,parentsUntil:function(t,n){for(var r=[];t.parentNode&&!m()(t.parentNode,n);)(t=t.parentNode)&&r.push(t);return r},children:_,append:function(t,n){if(s()(n))t.insertAdjacentHTML("beforeEnd",n);else for(var r=0,i=(n=n.length?e()(n):[n]).length;r<i;r+=1)t.appendChild(n[r])},prepend:function(t,n){if(s()(n))t.insertAdjacentHTML("afterBegin",n);else for(var r=(n=n.length?e()(n):[n]).length-1;r>=0;r-=1)t.insertBefore(n[r],t.firstChild)},insertBefore:function(t,n){var r=n.parentNode;r&&r.insertBefore(t,n)},insertAfter:function(t,n){var r=n.parentNode;r&&r.insertBefore(t,n.nextSibling)},replaceWith:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){t.insertAdjacentHTML("afterEnd",n),t.parentNode.removeChild(t)}))},wrap:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){var r=document.createElement(n);t.parentNode.insertBefore(r,t),r.appendChild(t)}))},wrapInner:function(t,n){(t=t.length?e()(t):[t]).forEach((function(t){var r=document.createElement(n);for(t.appendChild(r);t.firstChild!==r;)r.appendChild(t.firstChild)}))},unwrap:function(t){for(var n=[];t.firstChild;)n.push(t.firstChild),t.parentNode.insertBefore(t.firstChild,t);return U(t),n},remove:U,empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},setOffset:function(t,n){var r=t.parentNode.getBoundingClientRect(),i=r.top,e=r.left;f()(t,{top:n.top-i-document.body.scrollTop+"px"}),f()(t,{left:n.left-e-document.body.scrollLeft+"px"})},getOffset:function(t,n){void 0===n&&(n="document");var r=0,i=0;do{r+=t.offsetTop||0,i+=t.offsetLeft||0,t=t.offsetParent}while(t&&!m()(t,n));return{top:r,left:i}},getOuterWidth:function(t,n){var r=t.offsetWidth;if(n){var i=y(t),e=i.marginRight;r+=parseInt(i.marginLeft,10)+parseInt(e,10)}return r},getOuterHeight:function(t,n){var r=t.offsetHeight;if(n){var i=y(t),e=i.marginBottom;r+=parseInt(i.marginTop,10)+parseInt(e,10)}return r},toggleClass:function(t,n,r){u()(r)&&(r=!g()(t,n)),(r?l.a:d.a)(t,n)},finalizeHtml:function(t,n){var r;if(n)r=t.innerHTML;else{for(var i=document.createDocumentFragment(),o=e()(t.childNodes),u=o.length,a=0;a<u;a+=1)i.appendChild(o[a]);r=i}return r},getFragmentReplacedByNewlineToBr:function(t){var n=document.createDocumentFragment(),r=t.split("\n");return r.forEach((function(t,i){var e=document.createTextNode(t);n.appendChild(e),i<r.length-1&&n.appendChild(document.createElement("br"))})),n}}},function(t,n,r){var i=r(7),e=r.n(i),o=function(){function t(t,n,r){this.name=t,this.type=n,r&&this.setKeyMap(r)}var n=t.prototype;return n.getName=function(){return this.name},n.getType=function(){return this.type},n.isMDType=function(){return this.type===t.TYPE.MD},n.isWWType=function(){return this.type===t.TYPE.WW},n.isGlobalType=function(){return this.type===t.TYPE.GB},n.setKeyMap=function(t,n){this.keyMap=[t,n]},t}();o.factory=function(t,n){var r;"markdown"===t?r=o.TYPE.MD:"wysiwyg"===t?r=o.TYPE.WW:"global"===t&&(r=o.TYPE.GB);var i=new o(n.name,r);return e()(i,n),i},o.TYPE={MD:0,WW:1,GB:2};var u=o,a=r(12),s=r(24),c=a.b?1:0,f=function(){function t(t,n){void 0===n&&(n={}),this._command=new s.a,this._mdCommand=new s.a,this._wwCommand=new s.a,this._options=e()({useCommandShortcut:!0},n),this.base=t,this.keyMapCommand={},this._initEvent()}var n=t.prototype;return n._addCommandBefore=function(t){var n={command:t};return this.base.eventManager.emit("addCommandBefore",n),n.command||t},n.addCommand=function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),e=1;e<r;e++)i[e-1]=arguments[e];i.length&&(n=t.command.apply(t,[n].concat(i)));var o,u=(n=this._addCommandBefore(n)).getName();return n.isMDType()?o=this._mdCommand:n.isWWType()?o=this._wwCommand:n.isGlobalType()&&(o=this._command),o.set(u,n),n.keyMap&&(this.keyMapCommand[n.keyMap[c]]=u),n},n._initEvent=function(){var t=this;this.base.eventManager.listen("command",(function(){t.exec.apply(t,arguments)})),this.base.eventManager.listen("keyMap",(function(n){if(t._options.useCommandShortcut){var r=t.keyMapCommand[n.keyMap];r&&(n.data.preventDefault(),t.exec(r))}}))},n.exec=function(t){var n,r,i=this.base;if((n=this._command.get(t))||(this.base.isMarkdownMode()?(n=this._mdCommand.get(t),i=this.base.mdEditor):(n=this._wwCommand.get(t),i=this.base.wwEditor)),n){for(var e,o=arguments.length,u=new Array(o>1?o-1:0),a=1;a<o;a++)u[a-1]=arguments[a];u.unshift(i),r=(e=n).exec.apply(e,u)}return r},t}();f.command=function(t,n){var r=u.factory(t,n.name,n.keyMap);return e()(r,n),r},n.a=f},function(t,n,r){function i(t){return t.sourcepos[0][0]}function e(t){return t.sourcepos[1][0]}function o(t){return t.sourcepos[0][1]}function u(t){return t.sourcepos[1][1]}function a(t){var n=t.type;return"codeBlock"===n||"paragraph"===n}function s(t){var n=t.type;return"htmlBlock"===n||"htmlInline"===n}function c(t){var n=t.type;return"strike"===n||"strong"===n||"emph"===n}function f(t){return"item"===t.type}function h(t){var n=t.type;return"tableCell"===n||"tableDelimCell"===n}function l(t){switch(t.type){case"code":case"text":case"emph":case"strong":case"strike":case"link":case"image":case"htmlInline":case"linebreak":case"softbreak":return!0;default:return!1}}function v(t,n,r){for(void 0===r&&(r=!0),t=r?t:t.parent;t&&"document"!==t.type;){if(n(t))return t;t=t.parent}return null}function d(t,n,r){for(void 0===r&&(r=!0),t=r?t:t.parent;t&&"document"!==t.type;)n(t),t=t.parent}function p(t,n){return{line:t.line,ch:t.ch+n}}function g(t,n){return{line:t.line,ch:n}}r.d(n,"f",(function(){return i})),r.d(n,"d",(function(){return e})),r.d(n,"e",(function(){return o})),r.d(n,"c",(function(){return u})),r.d(n,"j",(function(){return a})),r.d(n,"g",(function(){return s})),r.d(n,"k",(function(){return c})),r.d(n,"i",(function(){return f})),r.d(n,"l",(function(){return h})),r.d(n,"h",(function(){return l})),r.d(n,"b",(function(){return v})),r.d(n,"n",(function(){return d})),r.d(n,"a",(function(){return p})),r.d(n,"m",(function(){return g})),r(12)},function(t,n,r){var i=r(21);t.exports=function(t){var n;try{n=Array.prototype.slice.call(t)}catch(r){n=[],i(t,(function(t){n.push(t)}))}return n}},function(t,n,r){var i=r(9),e=r(26);t.exports=function(t,n,r){var o=t.style;i(n)?o[n]=r:e(n,(function(t,n){o[n]=t}))}},function(t,n,r){var i=r(26),e=r(14),o=r(33),u=r(39);t.exports=function(t){var n,r=Array.prototype.slice.call(arguments,1),a=[];t.classList?i(r,(function(n){t.classList.add(n)})):((n=o(t))&&(r=[].concat(n.split(/\s+/),r)),i(r,(function(t){e(t,a)<0&&a.push(t)})),u(t,a))}},function(t,n,r){var i=r(21),e=r(14),o=r(33),u=r(39);t.exports=function(t){var n,r,a=Array.prototype.slice.call(arguments,1),s=t.classList;s?i(a,(function(t){s.remove(t)})):(n=o(t).split(/\s+/),r=[],i(n,(function(t){e(t,a)<0&&r.push(t)})),u(t,r))}},function(t){t.exports=function(t,n){var r,i,e,o,u=Object.prototype.hasOwnProperty;for(e=1,o=arguments.length;e<o;e+=1)for(i in r=arguments[e])u.call(r,i)&&(t[i]=r[i]);return t}},function(t){t.exports=function(t){return void 0===t}},function(t){t.exports=function(t){return"string"==typeof t||t instanceof String}},function(t){t.exports=function(t,n,r){var i;for(i in r=r||null,t)if(t.hasOwnProperty(i)&&!1===n.call(r,t[i],i,t))break}},function(t){var n,r,i,e,o,u,a,s,c,f,h={chrome:!1,firefox:!1,safari:!1,msie:!1,edge:!1,others:!1,version:0};"undefined"!=typeof window&&window.navigator&&(e=(i=window.navigator).appName.replace(/\s/g,"_"),o=i.userAgent,u=/MSIE\s([0-9]+[.0-9]*)/,a=/Trident.*rv:11\./,s=/Edge\/(\d+)\./,c={firefox:/Firefox\/(\d+)\./,chrome:/Chrome\/(\d+)\./,safari:/Version\/([\d.]+).*Safari\/(\d+)/},(f={Microsoft_Internet_Explorer:function(){var t=o.match(u);t?(h.msie=!0,h.version=parseFloat(t[1])):h.others=!0},Netscape:function(){var t=!1;if(a.exec(o))h.msie=!0,h.version=11,t=!0;else if(s.exec(o))h.edge=!0,h.version=o.match(s)[1],t=!0;else for(n in c)if(c.hasOwnProperty(n)&&(r=o.match(c[n]))&&r.length>1){h[n]=t=!0,h.version=parseFloat(r[1]||0);break}t||(h.others=!0)}})[e]&&f[e]()),t.exports=h},function(t,n,r){r.d(n,"b",(function(){return a})),r.d(n,"d",(function(){return s})),r.d(n,"a",(function(){return c})),r.d(n,"c",(function(){return h}));var i=r(8),e=r.n(i),o=r(43),u=r.n(o),a=/Mac/.test(navigator.platform);function s(){u()("editor","UA-129966929-1")}function c(t,n){return-1!==t.indexOf(n)}var f=["rel","target","contenteditable","hreflang","type"];function h(t){if(!t)return null;var n={};return f.forEach((function(r){e()(t[r])||(n[r]=t[r])})),n}},function(t,n,r){var i=r(14),e=r(3),o=Element.prototype,u=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||function(t){return i(this,e((this.document||this.ownerDocument).querySelectorAll(t)))>-1};t.exports=function(t,n){return u.call(t,n)}},function(t,n,r){var i=r(17);t.exports=function(t,n,r){var e,o;if(r=r||0,!i(n))return-1;if(Array.prototype.indexOf)return Array.prototype.indexOf.call(n,t,r);for(o=n.length,e=r;r>=0&&e<o;e+=1)if(n[e]===t)return e;return-1}},function(n){n.exports=t},function(t,n,r){var i=r(14),e=r(33);t.exports=function(t,n){var r;return t.classList?t.classList.contains(n):(r=e(t).split(/\s+/),i(n,r)>-1)}},function(t){t.exports=function(t){return t instanceof Array}},function(t,n,r){r.d(n,"h",(function(){return s})),r.d(n,"b",(function(){return c})),r.d(n,"f",(function(){return f})),r.d(n,"c",(function(){return h})),r.d(n,"e",(function(){return l})),r.d(n,"g",(function(){return v})),r.d(n,"a",(function(){return d})),r.d(n,"d",(function(){return g}));var i=r(12),e=r(2),o=["list","blockQuote"],u=["UL","OL","BLOCKQUOTE"],a=["TR","TH","TBODY","TD"];function s(t){return!Object(i.a)(o,t.type)}function c(t,n,r,i){var e=(t-n)/r;return e<1?e*i:i}function f(t){for(var n=document.querySelector('[data-nodeid="'+t.id+'"]');!n||Object(i.a)(a,t.type)||Object(e.k)(t);)t=t.parent,n=document.querySelector('[data-nodeid="'+t.id+'"]');return function(t){for(var n=t.mdNode,r=t.node;Object(i.a)(o,n.type)&&n.firstChild;)n=n.firstChild,r=r.firstElementChild;return{mdNode:n,node:r}}(function(t){for(var n=t;t&&"document"!==t;){if("item"===t.type){n=t;break}t=t.parent}return{mdNode:n,node:document.querySelector('[data-nodeid="'+n.id+'"]')}}(t))}function h(t,n){var r=Object(e.f)(t),i=Object(e.d)(t),o=n.lineInfo(r-1).handle.height,u=n.heightAtLine(i,"local")-n.heightAtLine(r-1,"local");return u<=0?o:u+l(n,Object(e.d)(t))}function l(t,n,r){void 0===r&&(r=Number.MAX_VALUE);var i=t.lineInfo(n);if(!i)return 0;for(var e=i.handle,o=0;n<=r&&!e.text.trim();)o+=e.height,e=t.lineInfo(n+=1).handle;return o}function v(t,n){for(var r=0;t&&t!==n&&(Object(i.a)(u,t.tagName)||(r+=t.offsetTop),t.offsetParent!==n.offsetParent);)t=t.parentElement;return r}function d(t,n){for(var r=n,i=null;r;){var e=r.firstElementChild;if(!e)break;i=r,r=p(e,t,v(r,n))}var o=r||i;return o===n?null:o}function p(t,n,r){return t&&n>r+t.offsetTop?p(t.nextElementSibling,n,r)||t:null}function g(t){var n=t.latestScrollTop,r=t.targetScrollTop,i=t.sourceScrollTop;return null===n?r:n<t.scrollTop?Math.max(r,i):Math.min(r,i)}},function(t,n,r){var i=r(9),e=r(26),o=r(40);function u(t,n,r,i){function u(n){r.call(i||t,n||window.event)}"addEventListener"in t?t.addEventListener(n,u):"attachEvent"in t&&t.attachEvent("on"+n,u),function(t,n,r,i){var u=o(t,n),a=!1;e(u,(function(t){return t.handler!==r||(a=!0,!1)})),a||u.push({handler:r,wrappedHandler:i})}(t,n,r,u)}t.exports=function(t,n,r,o){i(n)?e(n.split(/\s+/g),(function(n){u(t,n,r,o)})):e(n,(function(n,i){u(t,i,n,r)}))}},function(t,n,r){var i=r(9),e=r(26),o=r(40);function u(t,n,r){var i,u=o(t,n);r?(e(u,(function(e,o){return r!==e.handler||(a(t,n,e.wrappedHandler),i=o,!1)})),u.splice(i,1)):(e(u,(function(r){a(t,n,r.wrappedHandler)})),u.splice(0,u.length))}function a(t,n,r){"removeEventListener"in t?t.removeEventListener(n,r):"detachEvent"in t&&t.detachEvent("on"+n,r)}t.exports=function(t,n,r){i(n)?e(n.split(/\s+/g),(function(n){u(t,n,r)})):e(n,(function(n,r){u(t,r,n)}))}},function(t){t.exports=function(t,n,r){var i=0,e=t.length;for(r=r||null;i<e&&!1!==n.call(r,t[i],i,t);i+=1);}},function(t,n){!function(t,n){for(var r in n)t[r]=n[r]}(n,function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="/dist",r(r.s=11)}([function(t,n,r){r.r(n),r.d(n,"__extends",(function(){return e})),r.d(n,"__assign",(function(){return o})),r.d(n,"__rest",(function(){return u})),r.d(n,"__decorate",(function(){return a})),r.d(n,"__param",(function(){return s})),r.d(n,"__metadata",(function(){return c})),r.d(n,"__awaiter",(function(){return f})),r.d(n,"__generator",(function(){return h})),r.d(n,"__createBinding",(function(){return l})),r.d(n,"__exportStar",(function(){return v})),r.d(n,"__values",(function(){return d})),r.d(n,"__read",(function(){return p})),r.d(n,"__spread",(function(){return g})),r.d(n,"__spreadArrays",(function(){return b})),r.d(n,"__await",(function(){return m})),r.d(n,"__asyncGenerator",(function(){return w})),r.d(n,"__asyncDelegator",(function(){return y})),r.d(n,"__asyncValues",(function(){return k})),r.d(n,"__makeTemplateObject",(function(){return T})),r.d(n,"__importStar",(function(){return A})),r.d(n,"__importDefault",(function(){return E})),r.d(n,"__classPrivateFieldGet",(function(){return L})),r.d(n,"__classPrivateFieldSet",(function(){return x}));
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -46,4 +46,4 @@ var r;if(Object.defineProperty(n,"__esModule",{value:!0}),String.fromCodePoint)r
|
|
|
46
46
|
* to-mark
|
|
47
47
|
* @version 1.0.1 | Tue Apr 13 2021
|
|
48
48
|
*/
|
|
49
|
-
!function(n,r){t.exports=r()}(window,(function(){return function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0)}([function(t,n,r){r.r(n);var i,e,o,u={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3},a=function(){function t(t){this._normalizeTextChildren(t),this._root=t,this._current=t}var n=t.prototype;return n.next=function(){var t,n=this._current;if(this._current){for(t=this._getNextNode(n);this._isNeedNextSearch(t,n);)t=(n=n.parentNode).nextSibling;this._current=t}return this._current},n.getNode=function(){return this._normalizeTextChildren(this._current),this._current},n._normalizeTextChildren=function(t){if(t&&!(t.childNodes.length<2))for(var n,r=t.firstChild;r.nextSibling;)n=r.nextSibling,r.nodeType===u.TEXT_NODE&&n.nodeType===u.TEXT_NODE?(r.nodeValue+=n.nodeValue,t.removeChild(n)):r=n},n.getNodeText=function(){var t=this.getNode();return t.nodeType===u.TEXT_NODE?t.nodeValue:t.textContent||t.innerText},n._isNeedNextSearch=function(t,n){return!t&&n!==this._root&&n.parentNode!==this._root},n._getNextNode=function(t){return t.firstChild||t.nextSibling},t}();o=u,(e="NODE_TYPE")in(i=a)?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o;var s=/^[\s\r\n\t]+|[\s\r\n\t]+$/g,c=/>[\r\n\t]+</g,f=/>[ ]+</g;function h(t){var n;return"[object String]"===Object.prototype.toString.call(t)?(n=document.createElement("div")).innerHTML=l(t):n=t,n.__htmlRootByToMark=!0,n}function l(t){return(t=(t=t.replace(s,"")).replace(c,"><")).replace(f,"> <")}function v(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}h.preProcess=l;var d=/^\u0020/,p=/.+\u0020$/,g=/[\n\s\t]+/g,b=/^[\u0020\r\n\t]+|[\u0020\r\n\t]+$/g,m=/[\u0020]+/g,w=/[>(){}[\]+-.!#|]/g,y=/[[\]]/g,k=/!\[.*\]\(.*\)/g;function T(t,n,r){var i;for(i in r=r||null,t)if(t.hasOwnProperty(i)&&!1===n.call(r,t[i],i,t))break}function A(t){var n=t.tagName;return"S"===n||"B"===n||"I"===n||"EM"===n||"STRONG"===n||"A"===n||"IMG"===n||"CODE"===n}function E(t,n){T(n,(function(n,r){"converter"!==r?(t[r]||(t[r]={}),E(t[r],n)):t[r]=n}))}var L=function(){function t(t){this.rules={},this.lineFeedReplacement="",t&&this.addRules(t)}var n=t.prototype;return n.addRule=function(t,n){var r=t.split(", "),i=r.pop();for(n.fname=t;i;)this._setConverterWithSelector(i,n),i=r.pop()},n.addRules=function(t){T(t,(function(t,n){this.addRule(n,t)}),this)},n.getSpaceControlled=function(t,n){var r="",i="";return n.previousSibling&&(3===n.previousSibling.nodeType||A(n.previousSibling))&&(p.test(n.previousSibling.innerHTML||n.previousSibling.nodeValue)||d.test(n.innerHTML||n.nodeValue))&&(r=" "),n.nextSibling&&(3===n.nextSibling.nodeType||A(n.nextSibling))&&(d.test(n.nextSibling.innerHTML||n.nextSibling.nodeValue)||p.test(n.innerHTML||n.nodeValue))&&(i=" "),r+t+i},n.convert=function(t,n){var r,i=this._getConverter(t);return t&&t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("data-tomark-pass")?(t.removeAttribute("data-tomark-pass"),r=function(t,n){var r=t.cloneNode(!1);return r.innerHTML=n,r.outerHTML}(t,n)):i?r=i.call(this,t,n):t&&(r=this.getSpaceControlled(this._getInlineHtml(t,n),t)),r||""},n._getInlineHtml=function(t,n){var r=t.outerHTML,i=t.tagName,e=n.replace(/\$/g,"$$$$");return r.replace(new RegExp("(<"+i+" ?.*?>).*(</"+i+">)","i"),"$1"+e+"$2")},n._getConverter=function(t){for(var n,r=this.rules;t&&r;)r=this._getNextRule(r,this._getRuleNameFromNode(t)),t=this._getPrevNode(t),r&&r.converter&&(n=r.converter);return n},n._getNextRule=function(t,n){return t[n]},n._getRuleNameFromNode=function(t){return t.tagName||"TEXT_NODE"},n._getPrevNode=function(t){var n,r=t.parentNode;return r&&!r.__htmlRootByToMark&&(n=r),n},n._setConverterWithSelector=function(t,n){var r=this.rules;this._eachSelector(t,(function(t){r[t]||(r[t]={}),r=r[t]})),r.converter=n},n._eachSelector=function(t,n){for(var r=t.split(" "),i=r.length-1;i>=0;)n(r[i]),i-=1},n.trim=function(t){return t.replace(b,"")},n.isEmptyText=function(t){return""===t.replace(g,"")},n.getSpaceCollapsedText=function(t){return t.replace(m," ")},n.escapeText=function(t){return t.replace(w,(function(t){return"\\"+t}))},n.escapeTextForLink=function(t){for(var n=[],r=k.exec(t);r;)n.push([r.index,r.index+r[0].length]),r=k.exec(t);return t.replace(y,(function(t,r){return n.some((function(t){return r>t[0]&&r<t[1]}))?t:"\\"+t}))},n.escapeTextHtml=function(n){return n.replace(new RegExp(t.markdownTextToEscapeHtmlRx.source,"g"),(function(t){return"\\"+t}))},n.escapeTextBackSlash=function(n){return n.replace(new RegExp(t.markdownTextToEscapeBackSlashRx.source,"g"),(function(t){return"\\"+t}))},n.escapePairedCharacters=function(n){return n.replace(new RegExp(t.markdownTextToEscapePairedCharsRx.source,"g"),(function(t){return"\\"+t}))},n._isNeedEscape=function(n){var r,i=!1,e=t.markdownTextToEscapeRx;for(r in e)if(e.hasOwnProperty(r)&&e[r].test(n)){i=!0;break}return i},n._isNeedEscapeHtml=function(n){return t.markdownTextToEscapeHtmlRx.test(n)},n._isNeedEscapeBackSlash=function(n){return t.markdownTextToEscapeBackSlashRx.test(n)},n.mix=function(t){E(this.rules,t.rules)},t.factory=function(n,r){var i=new t;return r?i.mix(n):r=n,i.addRules(r),i},t}();v(L,"markdownTextToEscapeRx",{codeblock:/(^ {4}[^\n]+\n*)+/,hr:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,heading:/^(#{1,6}) +[\s\S]+/,lheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,codeblockGfm:/^(`{3,})/,codeblockTildes:/^(~{3,})/}),v(L,"markdownTextToEscapeHtmlRx",/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/),v(L,"markdownTextToEscapeBackSlashRx",/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/),v(L,"markdownTextToEscapePairedCharsRx",/[*_~`]/);var x=/\n$/g,C=/[ \xA0]+\n\n/g,D=/([ \xA0]+\n){2,}/g,O=/href="(.*?)"/,S=/^/gm,N=L.factory({TEXT_NODE:function(t){var n=this.trim(this.getSpaceCollapsedText(t.nodeValue));return this._isNeedEscapeBackSlash(n)&&(n=this.escapeTextBackSlash(n)),n=this.escapePairedCharacters(n),this._isNeedEscapeHtml(n)&&(n=this.escapeTextHtml(n)),this._isNeedEscape(n)&&(n=this.escapeText(n)),this.getSpaceControlled(n,t)},"CODE TEXT_NODE":function(t){return t.nodeValue},"EM, I":function(t,n){var r="";return this.isEmptyText(n)||(r="*"+n+"*"),r},"STRONG, B":function(t,n){var r="";return this.isEmptyText(n)||(r="**"+n+"**"),r},A:function(t,n){var r,i=n,e="",o=O.exec(t.outerHTML);return o&&(r=o[1].replace(/&/g,"&")),t.title&&(e=' "'+t.title+'"'),!this.isEmptyText(n)&&r&&(i="["+this.escapeTextForLink(n)+"]("+r+e+")"),i},IMG:function(t){var n=t.getAttribute("src");return n?"":""},BR:function(){return" \n"},CODE:function(t,n){var r,i,e="";return this.isEmptyText(n)||(i=parseInt(t.getAttribute("data-backticks"),10),e=(r=isNaN(i)?"`":Array(i+1).join("`"))+n+r),e},P:function(t,n){var r="";return n=n.replace(D," \n"),this.isEmptyText(n)||(r="\n\n"+n+"\n\n"),r},"BLOCKQUOTE P":function(t,n){return n},"LI P":function(t,n){var r="";return this.isEmptyText(n)||(r=n),r},"H1, H2, H3, H4, H5, H6":function(t,n){for(var r="",i=parseInt(t.tagName.charAt(1),10);i;)r+="#",i-=1;return r+=" ","\n\n"+(r+=n)+"\n\n"},"LI H1, LI H2, LI H3, LI H4, LI H5, LI H6":function(t,n){var r=parseInt(t.tagName.charAt(1),10);return Array(r+1).join("#")+" "+n},"UL, OL":function(t,n){return"\n\n"+n+"\n\n"},"LI OL, LI UL":function(t,n){return"\n"+n.replace(C,"\n").replace(x,"").replace(S," ")},"UL LI":function(t,n){var r="";return n=n.replace(D," \n"),t.firstChild&&"P"===t.firstChild.tagName&&(r+="\n"),r+"* "+n+"\n"},"OL LI":function(t,n){for(var r="",i=parseInt(t.parentNode.getAttribute("start")||1,10);t.previousSibling;)1===(t=t.previousSibling).nodeType&&"LI"===t.tagName&&(i+=1);return n=n.replace(D," \n"),t.firstChild&&"P"===t.firstChild.tagName&&(r+="\n"),r+(i+". ")+n+"\n"},HR:function(){return"\n\n- - -\n\n"},BLOCKQUOTE:function(t,n){return n=n.replace(D,"\n\n"),"\n\n"+this.trim(n).replace(S,"> ")+"\n\n"},"PRE CODE":function(t,n){return"\n\n"+n.replace(x,"").replace(S," ")+"\n\n"}}),M=L.factory(N,{"DEL, S":function(t,n){return"~~"+n+"~~"},"PRE CODE":function(t,n){var r="",i=t.getAttribute("data-backticks");t.getAttribute("data-language")&&(r=" "+t.getAttribute("data-language")),i=parseInt(i,10);var e=isNaN(i)?"```":Array(i+1).join("`");return"\n\n"+e+r+"\n"+(n=n.replace(/(\r\n)|(\r)|(\n)/g,this.lineFeedReplacement))+"\n"+e+"\n\n"},PRE:function(t,n){return n},"UL LI":function(t,n){return N.convert(t,R(t,n))},"OL LI":function(t,n){return N.convert(t,R(t,n))},TABLE:function(t,n){return"\n\n"+n+"\n\n"},"TBODY, TFOOT":function(t,n){return n},"TR TD, TR TH":function(t,n){return" "+(n=n.replace(/(\r\n)|(\r)|(\n)/g,""))+" |"},"TD BR, TH BR":function(){return"<br>"},TR:function(t,n){return"|"+n+"\n"},THEAD:function(t,n){for(var r="",i=I(I(t,"TR")[0],"TH"),e=0,o=i.length;e<o;e+=1)r+=" "+B(i[e])+" |";return n?n+"|"+r+"\n":""}});function R(t,n){return-1!==t.className.indexOf("task-list-item")&&(n="["+(-1!==t.className.indexOf("checked")?"x":" ")+"] "+n),n}function B(t){var n,r,i,e=t.align;return i=t.textContent?t.textContent.length:t.innerText.length,n="",r="",e&&("left"===e?(n=":",i-=1):"right"===e?(r=":",i-=1):"center"===e&&(r=":",n=":",i-=2)),n+function(t,n){var r=t;for(n=Math.max(n,3);n>1;)r+=t,n-=1;return r}("-",i)+r}function I(t,n){for(var r=t.childNodes,i=[],e=0,o=r.length;e<o;e+=1)r[e].tagName&&r[e].tagName===n&&i.push(r[e]);return i}var q=/[ \xA0]+(\n\n)/g,F=/^[\n]+|[\s\n]+$/g,P=/([ \xA0]+\n){2,}/g,j=/([ \xA0]){2,}\n/g,_=/[ \xA0\n]+/g;function U(t,n){var r,i=!0;return t?(r=M,n&&(!1===(i=n.gfm)&&(r=N),r=n.renderer||r),function(t,n,r){return t=(t=(t=(t=(t=t.replace(q,"\n")).replace(P,"\n\n")).replace(_,(function(t){return(t.match(/\n/g)||[]).length>=3?"\n\n":t>=1?"\n":t}))).replace(F,"")).replace(new RegExp(r,"g"),"\n"),n&&(t=t.replace(j,"\n")),t}(function(t,n){for(var r="";t.next();)r+=H(t,n);return r}(new a(h(t)),r),i,r.lineFeedReplacement)):""}function H(t,n){for(var r="",i=t.getNode(),e=0,o=i.childNodes.length;e<o;e+=1)t.next(),r+=H(t,n);return n.convert(i,r)}U.Renderer=L,U.basicRenderer=N,U.gfmRenderer=M,n.default=U}]).default}))},function(t,n,r){var i=r(8);t.exports=function(t){return t&&t.className?i(t.className.baseVal)?t.className:t.className.baseVal:""}},function(t){t.exports=function(t){return"number"==typeof t||t instanceof Number}},function(t,n,r){var i=r(19),e=r.n(i),o=r(20),u=r.n(o),a=r(5),s=r.n(a),c=r(6),f=r.n(c),h=r(22),l=r(38),v=r(0),d=r(29),p=r(18),g=r(25),b=r(2),m="te-preview-highlight";n.a=function(t){var n,r;function i(n,r,i,e){var o;(o=t.call(this,n,r,i,e.isViewer)||this).lazyRunner.registerLazyRunFunction("invokeCodeBlock",o.invokeCodeBlockPlugins,o.delayCodeBlockTime,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(o));var u=e.linkAttribute,a=e.customHTMLRenderer,s=e.highlight,c=void 0!==s&&s;return o.renderHTML=Object(h.createRenderHTML)({gfm:!0,nodeId:!0,convertors:Object(d.a)(u,a)}),o.cursorNodeId=null,o._initEvent(c),o}r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r;var o=i.prototype;return o._initEvent=function(t){var n=this;this.eventManager.listen("contentChangedFromMarkdown",this.update.bind(this)),t&&(this.eventManager.listen("cursorActivity",(function(t){n._updateCursorNode(t.markdownNode,t.cursor)})),this.eventManager.listen("blur",(function(){n._removeHighlight()}))),e()(this.el,"scroll",(function(t){n.eventManager.emit("scroll",{source:"preview",data:Object(p.a)(t.target.scrollTop,n._previewContent)})}))},o._removeHighlight=function(){if(this.cursorNodeId){var t=this._getElementByNodeId(this.cursorNodeId);t&&f()(t,m)}},o._updateCursorNode=function(t,n){t&&("tableRow"===(t=Object(b.b)(t,(function(t){return!Object(b.h)(t)}))).type?t=function(t,n){for(var r=n.ch,i=t.firstChild;i&&i.next&&!(Object(b.e)(i.next)>r+1);)i=i.next;return i}(t,n):"tableBody"===t.type&&(t=null));var r=t?t.id:null;if(this.cursorNodeId!==r){var i=t&&"frontMatter"===t.customType,e=this._getElementByNodeId(this.cursorNodeId),o=this._getElementByNodeId(r);e&&f()(e,m),o&&!i&&s()(o,m),this.cursorNodeId=r}},o._getElementByNodeId=function(t){return t?this._previewContent.querySelector('[data-nodeid="'+t+'"]'):null},o.update=function(t){var n=this;t.forEach((function(t){return n.replaceRangeNodes(t)})),this.eventManager.emit("previewRenderAfter",this)},o.replaceRangeNodes=function(t){var n=this,r=t.nodes,i=t.removedNodeRange,e=this._previewContent,o=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",r.map((function(t){return n.renderHTML(t)})).join(""));if(i){var u=i.id,a=u[1],s=this._getElementByNodeId(u[0]),c=this._getElementByNodeId(a);if(s){var f;s.insertAdjacentHTML("beforebegin",o);for(var h=s;h&&h!==c;){var l=h.nextElementSibling;h.parentNode.removeChild(h),Object(g.c)(h),h=l}(null==(f=h)?void 0:f.parentNode)&&(v.a.remove(h),Object(g.c)(h))}}else e.insertAdjacentHTML("afterbegin",o);var d=this.getCodeBlockElements(r.map((function(t){return t.id})));d.length&&this.lazyRunner.run("invokeCodeBlock",d)},o.render=function(n){t.prototype.render.call(this,n),this.eventManager.emit("previewRenderAfter",this)},o.remove=function(){u()(this.el,"scroll"),this.el=null},i}(l.a)},function(t,n,r){var i=r(10),e=r.n(i),o=r(8),u=r.n(o),a=r(44),s=r.n(a),c=r(45),f=r.n(c),h=r(24),l=["previewBeforeHook","previewRenderAfter","previewNeedsRefresh","addImageBlobHook","setMarkdownAfter","contentChangedFromWysiwyg","changeFromWysiwyg","contentChangedFromMarkdown","changeFromMarkdown","change","changeModeToWysiwyg","changeModeToMarkdown","changeModeBefore","changeMode","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","openPopupAddLink","openPopupAddImage","openPopupAddTable","openPopupTableUtils","openHeadingSelect","openPopupCodeBlockLanguages","openPopupCodeBlockEditor","openDropdownToolbar","closePopupCodeBlockLanguages","closePopupCodeBlockEditor","closeAllPopup","command","addCommandBefore","htmlUpdate","markdownUpdate","renderedHtmlUpdated","removeEditor","convertorAfterMarkdownToHtmlConverted","convertorBeforeHtmlToMarkdownConverted","convertorAfterHtmlToMarkdownConverted","stateChange","wysiwygSetValueAfter","wysiwygSetValueBefore","wysiwygGetValueBefore","wysiwygProcessHTMLText","wysiwygRangeChangeAfter","wysiwygKeyEvent","scroll","click","mousedown","mouseover","mouseout","mouseup","contextmenu","keydown","keyup","keyMap","load","focus","blur","paste","pasteBefore","willPaste","copy","copyBefore","copyAfter","cut","cutAfter","drop","show","hide","changeLanguage","cursorActivity","requireScrollSync","requireScrollIntoView","setCodeBlockLanguages"],v=function(){function t(){this.events=new h.a,this.TYPE=new f.a(l)}var n=t.prototype;return n.listen=function(t,n){var r=this._getTypeInfo(t),i=this.events.get(r.type)||[];if(!this._hasEventType(r.type))throw new Error("There is no event type "+r.type);r.namespace&&(n.namespace=r.namespace),i.push(n),this.events.set(r.type,i)},n.emit=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i,o=n.shift(),a=this._getTypeInfo(o),s=this.events.get(a.type);return s&&e()(s,(function(t){var r=t.apply(void 0,n);u()(r)||(i=i||[]).push(r)})),i},n.emitReduce=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.shift(),o=this.events.get(i);return o&&e()(o,(function(t){var r=t.apply(void 0,n);s()(r)||(n[0]=r)})),n[0]},n._getTypeInfo=function(t){var n=t.split(".");return{type:n[0],namespace:n[1]}},n._hasEventType=function(t){return!u()(this.TYPE[this._getTypeInfo(t).type])},n.addEventType=function(t){if(this._hasEventType(t))throw new Error("There is already have event type "+t);this.TYPE.set(t)},n.removeEventHandler=function(t,n){var r=this,i=this._getTypeInfo(t),e=i.type,o=i.namespace;e&&n?this._removeEventHandlerWithHandler(e,n):e&&!o?this.events.delete(e):!e&&o?this.events.forEach((function(t,n){r._removeEventHandlerWithTypeInfo(n,o)})):e&&o&&this._removeEventHandlerWithTypeInfo(e,o)},n._removeEventHandlerWithHandler=function(t,n){var r=this.events.get(t)||[],i=r.indexOf(n);i>=0&&r.splice(i,1)},n._removeEventHandlerWithTypeInfo=function(t,n){var r=[],i=this.events.get(t);i&&(i.map((function(t){return t.namespace!==n&&r.push(t),null})),this.events.set(t,r))},t}();n.a=v},function(t,n,r){var i=r(32),e=r.n(i),o=r(22),u=r(29),a=r(0),s=new RegExp("(\\\\<|<)([A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*)(\\/?>)","g"),c=/^\s?\\-\\-\\-([\s\S]+?)\\-\\-\\-/,f=/ /g,h=/^(\s*\*\s+\d+)\./g;n.a=function(){function t(t,n){void 0===n&&(n={});var r=n.linkAttribute,i=n.customHTMLRenderer,e=n.extendedAutolinks,a=n.referenceDefinition,s=n.customParser,c=n.frontMatter,f=n.customProp;this.options=n,this.mdReader=new o.Parser({extendedAutolinks:e,disallowedHtmlBlockTags:["br"],referenceDefinition:a,disallowDeepHeading:!0,customParser:s,frontMatter:c}),this.renderHTML=Object(o.createRenderHTML)({gfm:!0,convertors:Object(u.a)(r,i),customProp:f}),this.eventManager=t}var n=t.prototype;return n._markdownToHtmlWithCodeHighlight=function(t){return this.renderHTML(this.mdReader.parse(t))},n._markdownToHtml=function(t){return t=t.replace(s,(function(t,n,r,i){return"\\"!==t[0]?""+n+r+" data-tomark-pass "+i:t})).replace(h,"$1\\."),this.renderHTML(this.mdReader.parse(t))},n._removeBrToMarkPassAttributeInCode=function(t){var n=a.a.createElementWith("<div>"+t+"</div>");return a.a.findAll(n,"code, pre").forEach((function(t){t.innerHTML=t.innerHTML.replace(/\sdata-tomark-pass\s(\/?)>/g,"$1>")})),n.innerHTML},n.toHTMLWithCodeHighlight=function(t){var n=this._markdownToHtmlWithCodeHighlight(t);return this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",n)},n.toHTML=function(t){var n=this._markdownToHtml(t);return n=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",n),this._removeBrToMarkPassAttributeInCode(n)},n.initHtmlSanitizer=function(t){this.eventManager.listen("convertorAfterMarkdownToHtmlConverted",(function(n){return t(n,!0)}))},n.toMarkdown=function(t,n){var r=[];t=this.eventManager.emitReduce("convertorBeforeHtmlToMarkdownConverted",t),t=this._appendAttributeForLinkIfNeed(t),t=this._appendAttributeForBrIfNeed(t);var i=e()(t,n);return this.options.frontMatter&&(i=i.replace(c,"---$1---")),i=this.eventManager.emitReduce("convertorAfterHtmlToMarkdownConverted",i),(i=this._removeNewlinesBeforeAfterAndBlockElement(i)).split("\n").forEach((function(t,n){/^(<br>)+\||\|[^|]*\|/gi.test(t)?t=t.replace(/^(<br>)+\|/gi,(function(t){return t.replace(/<br>/gi,"<br>\n")})):/`[^`]*<br>[^`]*`/gi.test(t)||(t=t.replace(/<br>/gi,"<br>\n")),r[n]=t})),r.join("\n").replace(f," ")},n._removeNewlinesBeforeAfterAndBlockElement=function(t){return(t=t.replace(/<br>\n\n(#{1,6} .*|```|\||(\*+|-+|\d+\.) .*| *>[^\n]+.*)/g,"<br>$1")).replace(/(#{1,6} .*|```|\|)\n\n<br>/g,"$1\n<br>")},n._appendAttributeForLinkIfNeed=function(t){return t.replace(/!?\[.*\]\(<\s*a[^>]*>(.*?)<\s*\/\s*a>\)/gi,(function(t){return t.replace(/<a /gi,'<a data-tomark-pass="" ')}))},n._appendAttributeForBrIfNeed=function(t){var n=new RegExp(/([^>]|<\/a>|<\/code>|<\/span>|<\/b>|<\/i>|<\/s>|<img [^>]*>)/.source+/<br data-tomark-pass \/><br data-tomark-pass \/>/.source,"g");return(t=(t=(t=(t=(t=(t=t.replace(/<br>/gi,"<br />")).replace(/<br \/><br \/>/gi,"<br data-tomark-pass /><br data-tomark-pass />")).replace(/<br data-tomark-pass="">/gi,"<br data-tomark-pass />")).replace(/<br data-tomark-pass \/><br \/>(.)/gi,"<br data-tomark-pass /><br data-tomark-pass />$1")).replace(n,"$1<br /><br />")).replace(/(.)<br \/><br \/>(<h[1-6]>|<pre>|<table>|<ul>|<ol>|<blockquote>)/g,"$1<br /><br data-tomark-pass />$2")).replace(/(<\/h[1-6]>|<\/pre>|<\/table>|<\/ul>|<\/ol>|<\/blockquote>)<br \/>(.)/g,"$1<br data-tomark-pass />$2")},t}()},function(t,n,r){var i=r(4),e=r.n(i),o=r(9),u=r.n(o),a=function(){function t(){this.globalTOID=null,this.lazyRunFunctions={}}var n=t.prototype;return n.run=function(t,n,r,i){var e;return u()(t)?e=this._runRegisteredRun(t,n,r,i):(e=this._runSingleRun(t,n,r,i,this.globalTOID),this.globalTOID=e),e},n.registerLazyRunFunction=function(t,n,r,i){this.lazyRunFunctions[t]={fn:n,delay:r,context:i=i||this,TOID:null}},n._runSingleRun=function(t,n,r,i,e){return this._clearTOIDIfNeed(e),setTimeout((function(){t.call(r,n)}),i)},n._runRegisteredRun=function(t,n,r,i){var e=this.lazyRunFunctions[t],o=e.TOID;return o=this._runSingleRun(e.fn,n,r=r||e.context,i=i||e.delay,o),e.TOID=o,o},n._clearTOIDIfNeed=function(t){t&&clearTimeout(t)},t}(),s=r(0),c=r(30);n.a=function(){function t(t,n,r,i){this.eventManager=n,this.convertor=r,this.el=t,this.isViewer=!!i,this.delayCodeBlockTime=500,this._initContentSection(),this.lazyRunner=new a}var n=t.prototype;return n._initContentSection=function(){this._previewContent=s.a.createElementWith('<div class="tui-editor-contents"></div>'),this.el.appendChild(this._previewContent)},n.getCodeBlockElements=function(t){var n=this._previewContent,r=[];return(t?t.map((function(t){return n.querySelector('[data-nodeid="'+t+'"]')})).filter(Boolean):[n]).forEach((function(t){r.push.apply(r,s.a.findAll(t,"code[data-language]"))})),r},n.invokeCodeBlockPlugins=function(t){t.forEach((function(t){var n=t.getAttribute("data-language"),r=c.a.createCodeBlockHtml(n,t.textContent);t.innerHTML=r}))},n.refresh=function(t){void 0===t&&(t=""),this.render(this.convertor.toHTMLWithCodeHighlight(t)),this.invokeCodeBlockPlugins(this.getCodeBlockElements())},n.getHTML=function(){return this._previewContent.innerHTML},n.setHTML=function(t){this._previewContent.innerHTML=t},n.render=function(t){var n=this._previewContent;t=this.eventManager.emit("previewBeforeHook",t)||t,s.a.empty(n),n.innerHTML=t},n.setHeight=function(t){e()(this.el,{height:t+"px"})},n.setMinHeight=function(t){e()(this.el,{minHeight:t+"px"})},n.isVisible=function(){return"none"!==this.el.style.display},t}()},function(t,n,r){var i=r(17),e=r(8);t.exports=function(t,n){n=(n=i(n)?n.join(" "):n).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),e(t.className.baseVal)?t.className=n:t.className.baseVal=n}},function(t){var n="_feEventKey";t.exports=function(t,r){var i,e=t[n];return e||(e=t[n]={}),(i=e[r])||(i=e[r]=[]),i}},,function(t,n,r){var i=r(28);t.exports=function(t){return i(t)&&!1!==t}},function(t,n,r){var i=r(8),e=r(49),o=6048e5;t.exports=function(t,n){var r=location.hostname,u="TOAST UI "+t+" for "+r+": Statistics",a=window.localStorage.getItem(u);(i(window.tui)||!1!==window.tui.usageStatistics)&&(a&&!function(t){return(new Date).getTime()-t>o}(a)||(window.localStorage.setItem(u,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||e("https://www.google-analytics.com/collect",{v:1,t:"event",tid:n,cid:r,dp:r,dh:t,el:t,ec:"use"})}),1e3)))}},function(t,n,r){var i=r(42);t.exports=function(t){return!i(t)}},function(t,n,r){var i=r(34),e=r(17),o=r(3),u=r(26),a=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),s=0;function c(t){t&&this.set.apply(this,arguments)}c.prototype.set=function(t){var n=this;e(t)||(t=o(arguments)),u(t,(function(t){n._addItem(t)}))},c.prototype.getName=function(t){var n,r=this;return u(this,(function(i,e){if(r._isEnumItem(e)&&t===i)return n=e,!1})),n},c.prototype._addItem=function(t){var n;this.hasOwnProperty(t)||(n=this._makeEnumValue(),a?Object.defineProperty(this,t,{enumerable:!0,configurable:!1,writable:!1,value:n}):this[t]=n)},c.prototype._makeEnumValue=function(){var t;return t=s,s+=1,t},c.prototype._isEnumItem=function(t){return i(this[t])},t.exports=c},function(t,n,r){var i=r(10),e=r.n(i),o=r(7),u=r.n(o),a=r(19),s=r.n(a),c=r(20),f=r.n(c),h=r(35),l=r(36),v=r(1),d=r(37),p=r(0),g=r(30),b=r(31),m=r(12),w=r(23);function y(){return y=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},y.apply(this,arguments)}var k=function(){function t(t){var n=this;this.options=u()({useDefaultHTMLSanitizer:!0,linkAttribute:null,extendedAutolinks:!1,customConvertor:null,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1},t),this.codeBlockLanguages=[],this.eventManager=new l.a,this.commandManager=new v.a(this);var r=Object(m.c)(this.options.linkAttribute),i=Object(b.a)(this.options.plugins),o=i.parser,a=i.plugins,c=this.options,f=c.customHTMLSanitizer,p=c.extendedAutolinks,g=c.referenceDefinition,k=c.frontMatter,T={linkAttribute:r,customHTMLRenderer:y({},i.renderer,c.customHTMLRenderer),extendedAutolinks:p,referenceDefinition:g,customParser:o,frontMatter:k};this.convertor=this.options.customConvertor?new this.options.customConvertor(this.eventManager,T):new d.a(this.eventManager,T);var A=f||(this.options.useDefaultHTMLSanitizer?w.a:null);A&&this.convertor.initHtmlSanitizer(A),this.options.hooks&&e()(this.options.hooks,(function(t,r){n.addHook(r,t)})),this.options.events&&e()(this.options.events,(function(t,r){n.on(r,t)}));var E=this.options,L=E.el,x=E.initialValue,C=L.innerHTML;L.innerHTML="",this.preview=new h.a(L,this.eventManager,this.convertor,y({},T,{isViewer:!0})),s()(this.preview.el,"mousedown",this._toggleTask.bind(this)),a&&Object(b.b)(a,this),x?this.setMarkdown(x):C&&this.preview.setHTML(C),this.eventManager.emit("load",this)}var n=t.prototype;return n._toggleTask=function(t){var n=getComputedStyle(t.target,":before");!t.target.hasAttribute("data-te-task-disabled")&&t.target.hasAttribute("data-te-task")&&p.a.isInsideButtonBox(n,t.offsetX,t.offsetY)&&(p.a.toggleClass(t.target,"checked"),this.eventManager.emit("change",{source:"viewer",data:t}))},n.setMarkdown=function(t){this.markdownValue=t=t||"",this.preview.refresh(this.markdownValue),this.eventManager.emit("setMarkdownAfter",this.markdownValue)},n.on=function(t,n){this.eventManager.listen(t,n)},n.off=function(t){this.eventManager.removeEventHandler(t)},n.remove=function(){this.eventManager.emit("removeEditor"),f()(this.preview.el,"mousedown",this._toggleTask.bind(this)),this.preview.remove(),this.options=null,this.eventManager=null,this.commandManager=null,this.convertor=null,this.preview=null},n.addHook=function(t,n){this.eventManager.removeEventHandler(t),this.eventManager.listen(t,n)},n.isViewer=function(){return!0},n.isMarkdownMode=function(){return!1},n.isWysiwygMode=function(){return!1},n.setCodeBlockLanguages=function(t){var n=this;void 0===t&&(t=[]),t.forEach((function(t){n.codeBlockLanguages.indexOf(t)<0&&n.codeBlockLanguages.push(t)}))},t}();k.isViewer=!0,k.domUtils=p.a,k.codeBlockManager=g.a,k.WwCodeBlockManager=null,k.WwTableManager=null,k.WwTableSelectionManager=null,n.a=k},,function(t){t.exports=function(t){return null===t}},function(t,n,r){var i=r(10);t.exports=function(t,n){var r=document.createElement("img"),e="";return i(n,(function(t,n){e+="&"+n+"="+t})),e=e.substring(1),r.src=t+"?"+e,r.style.display="none",document.body.appendChild(r),document.body.removeChild(r),r}},,function(){},,,,,,,,,function(t,n,r){r.r(n);var i=r(46);r(51),n.default=i.a}]).default;const b=h(g.exports);var m,w,y,k,T,A,E=function(t,n,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?t!==n||!i:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:n.get(t)},L=function(t,n,r,i,e){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!e)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?t!==n||!e:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?e.call(t,r):e?e.value=r:n.set(t,r),r};const x=class{constructor(r){t(this,r),this.kupAutoSave=n(this,"kup-editor-autosave",6),this.kupReady=n(this,"kup-editor-ready",6),this.kupSave=n(this,"kup-editor-save",6),m.set(this,void 0),w.set(this,!1),y.set(this,""),k.set(this,u()),T.set(this,0),A.set(this,{options:{className:"kup-editor-unsaved-changes",el:this.createUnsavedChanges(),tooltip:"There are unsaved changes."},type:"button"}),this.editor=null,this.editorRef=void 0,this.viewer=null,this.autosaveTimer=void 0,this.editorHeight="auto",this.initialEditType="markdown",this.initialValue="",this.isReadOnly=!1,this.previewStyle="vertical",this.selectedTab="write",this.showSaveButton=!0,this.showToolbar=!0}onEditorRefUpdated(){this.editorRef&&!this.editor&&(this.isReadOnly?this.createViewer():this.createEditor())}onEditorUpdate(){this.editor&&setTimeout((()=>{this.editor&&(this.editor.moveCursorToStart(),"markdown"===this.initialEditType&&"tab"===this.previewStyle&&"preview"===this.selectedTab&&this.updateMarkDownPreviewTab())}),100)}onInitialEditTypeChanged(){"markdown"!=this.initialEditType&&"wysiwyg"!=this.initialEditType||!this.editor||(this.editor.changeMode(this.initialEditType),this.updateToolbarVisiblity())}onIsReadOnlyChanged(){this.isReadOnly?(this.editor.remove(),this.editor=null,this.createViewer()):(this.viewer.remove(),this.viewer=null,this.createEditor())}onPreviewStyleChanged(){"tab"!=this.previewStyle&&"vertical"!=this.previewStyle||!this.editor||(this.editor.changePreviewStyle(this.previewStyle),"vertical"==this.previewStyle&&this.editor.getUI().getToolbar().enableAllButton(),this.updateToolbarVisiblity())}onMarkdownPreviewTabChanged(){"markdown"!=this.initialEditType&&"tab"!=this.previewStyle||!this.editor||this.updateMarkDownPreviewTab()}onShowSaveButtonChanged(){if(this.editor){const t=this.editor.getUI().getToolbar();this.showSaveButton?t.insertItem(0,this.getToolBarWithSaveButton(!1)[0]):t.removeItem(0)}}onShowToolBarChanged(){this.editor&&this.updateToolbarVisiblity()}onAutosaveTimerChanged(){this.editor&&(E(this,m,"f")&&clearInterval(E(this,m,"f")),"number"==typeof this.autosaveTimer&&this.autosaveTimer>0&&this.setAutosaveInterval())}async getProps(t){return a(this,p,t)}async getValueAsHTML(){var t,n;return null!==(n=null===(t=this.editor)||void 0===t?void 0:t.getHtml())&&void 0!==n?n:""}async getValueAsMarkdown(){var t,n;return null!==(n=null===(t=this.editor)||void 0===t?void 0:t.getMarkdown())&&void 0!==n?n:""}async refresh(){r(this)}async setProps(t){s(this,p,t)}createEditor(){var t;const n={el:this.editorRef,events:{change:()=>{E(this,y,"f")!==this.editor.getMarkdown()?(E(this,w,"f")||(L(this,T,this.editor.getUI().getToolbar().getItems().length-1,"f"),this.editor.getUI().getToolbar().insertItem(E(this,T,"f"),E(this,A,"f"))),L(this,w,!0,"f")):(E(this,w,"f")&&this.editor.getUI().getToolbar().removeItem(E(this,T,"f")),L(this,w,!1,"f"))},focus:()=>{this.isReadOnly||this.showToolbar||(this.showToolbar=!0)}},height:null!==(t=this.editorHeight)&&void 0!==t?t:"auto",hideModeSwitch:!0,initialEditType:this.initialEditType,initialValue:this.initialValue,placeholder:"Type your text here...",previewStyle:this.previewStyle,usageStatistics:!1};this.showSaveButton&&(n.toolbarItems=this.getToolBarWithSaveButton()),this.editor=new d(n),L(this,y,this.editor.getMarkdown(),"f"),this.showToolbar||this.updateToolbarVisiblity(),"number"==typeof this.autosaveTimer&&this.autosaveTimer>0&&this.setAutosaveInterval()}createViewer(){this.viewer=new b({el:this.editorRef,initialValue:this.initialValue})}createSaveButton(){const t=document.createElement("button");return t.className="kup-editor-save-button",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#585858" version="1.1" id="Capa_1" width="12px" height="12px" viewBox="0 0 407.096 407.096" xml:space="preserve">\n <g>\n <g>\n <path d="M402.115,84.008L323.088,4.981C319.899,1.792,315.574,0,311.063,0H17.005C7.613,0,0,7.614,0,17.005v373.086 c0,9.392,7.613,17.005,17.005,17.005h373.086c9.392,0,17.005-7.613,17.005-17.005V96.032 C407.096,91.523,405.305,87.197,402.115,84.008z M300.664,163.567H67.129V38.862h233.535V163.567z"/>\n <path d="M214.051,148.16h43.08c3.131,0,5.668-2.538,5.668-5.669V59.584c0-3.13-2.537-5.668-5.668-5.668h-43.08 c-3.131,0-5.668,2.538-5.668,5.668v82.907C208.383,145.622,210.92,148.16,214.051,148.16z"/>\n </g>\n </g>\n </svg>',t.addEventListener("click",this.onEditorSave.bind(this)),t}createDivider(){const t=document.createElement("div");return t.className="kup-editor-divider",{options:{className:"kup-editor-divider",el:t},type:"button"}}createUnsavedChanges(){const t=document.createElement("span");return t.className="kup-editor-unsaved-changes",t.innerText="Unsaved changes.",t}updateToolbarVisiblity(){const t=this.editor.getUI().getToolbar().el,n=t.parentElement;t.style.display="",n.style.display="",this.showToolbar||(t.style.display="none","markdown"==this.initialEditType&&"tab"==this.previewStyle||(n.style.display="none"))}setAutosaveInterval(){L(this,m,setInterval((()=>{this.onEditorAutoSave()}),this.autosaveTimer),"f")}onEditorSave(){this.editor.getUI().getToolbar().removeItem(E(this,T,"f")),L(this,w,!1,"f"),this.kupSave.emit(this.getSaveAndAutoSaveProps())}onEditorAutoSave(){this.kupAutoSave.emit(this.getSaveAndAutoSaveProps())}updateMarkDownPreviewTab(){const t=this.rootElement.querySelector(".te-markdown-tab-section");t&&("preview"===this.selectedTab&&t.querySelector("button:last-child").click(),"write"===this.selectedTab&&t.querySelector("button").click())}getToolBarWithSaveButton(t=!0){return[{options:{el:this.createSaveButton(),tooltip:"Save"},type:"button"},this.createDivider(),...t?this.getDefaultToolBarItems():[]]}getDefaultToolBarItems(){const t=["heading","bold","italic","strike",this.createDivider(),"hr","quote",this.createDivider(),"ul","ol","task","indent","outdent",this.createDivider(),"table","image","link",this.createDivider(),"code","codeblock"];return"markdown"==this.initialEditType&&t.push("scrollSync"),t}getSaveAndAutoSaveProps(){var t,n;return{comp:this,id:this.rootElement.id,htmlValue:null!==(t=this.editor.getHtml())&&void 0!==t?t:"",markdownValue:null!==(n=this.editor.getMarkdown())&&void 0!==n?n:""}}componentWillLoad(){E(this,k,"f").debug.logLoad(this,!1),E(this,k,"f").theme.register(this)}componentDidLoad(){this.kupReady.emit({comp:this,id:this.rootElement.id}),E(this,k,"f").debug.logLoad(this,!0)}componentWillRender(){E(this,k,"f").debug.logRender(this,!1)}componentDidRender(){E(this,k,"f").debug.logRender(this,!0)}render(){return i(e,{key:"7ed151f11e4cf5f6c103514977de8663b7fb8d56"},i("div",{key:"d3b79ea0b460051202bcee6beab12cfd88360913",id:c},i("div",{key:this.rootElement.id,ref:t=>this.editorRef=t,class:"kup-editor"})))}disconnectedCallback(){E(this,k,"f").theme.unregister(this),E(this,m,"f")&&clearInterval(E(this,m,"f"))}get rootElement(){return o(this)}static get watchers(){return{editorRef:["onEditorRefUpdated"],editor:["onEditorUpdate"],initialEditType:["onInitialEditTypeChanged"],isReadOnly:["onIsReadOnlyChanged"],previewStyle:["onPreviewStyleChanged"],selectedTab:["onMarkdownPreviewTabChanged"],showSaveButton:["onShowSaveButtonChanged"],showToolbar:["onShowToolBarChanged"],autosaveTimer:["onAutosaveTimerChanged"]}}};m=new WeakMap,w=new WeakMap,y=new WeakMap,k=new WeakMap,T=new WeakMap,A=new WeakMap;export{x as kup_editor}
|
|
49
|
+
!function(n,r){t.exports=r()}(window,(function(){return function(t){var n={};function r(i){if(n[i])return n[i].exports;var e=n[i]={i,l:!1,exports:{}};return t[i].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=t,r.c=n,r.d=function(t,n,i){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)r.d(i,e,function(n){return t[n]}.bind(null,e));return i},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0)}([function(t,n,r){r.r(n);var i,e,o,u={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3},a=function(){function t(t){this._normalizeTextChildren(t),this._root=t,this._current=t}var n=t.prototype;return n.next=function(){var t,n=this._current;if(this._current){for(t=this._getNextNode(n);this._isNeedNextSearch(t,n);)t=(n=n.parentNode).nextSibling;this._current=t}return this._current},n.getNode=function(){return this._normalizeTextChildren(this._current),this._current},n._normalizeTextChildren=function(t){if(t&&!(t.childNodes.length<2))for(var n,r=t.firstChild;r.nextSibling;)n=r.nextSibling,r.nodeType===u.TEXT_NODE&&n.nodeType===u.TEXT_NODE?(r.nodeValue+=n.nodeValue,t.removeChild(n)):r=n},n.getNodeText=function(){var t=this.getNode();return t.nodeType===u.TEXT_NODE?t.nodeValue:t.textContent||t.innerText},n._isNeedNextSearch=function(t,n){return!t&&n!==this._root&&n.parentNode!==this._root},n._getNextNode=function(t){return t.firstChild||t.nextSibling},t}();o=u,(e="NODE_TYPE")in(i=a)?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o;var s=/^[\s\r\n\t]+|[\s\r\n\t]+$/g,c=/>[\r\n\t]+</g,f=/>[ ]+</g;function h(t){var n;return"[object String]"===Object.prototype.toString.call(t)?(n=document.createElement("div")).innerHTML=l(t):n=t,n.__htmlRootByToMark=!0,n}function l(t){return(t=(t=t.replace(s,"")).replace(c,"><")).replace(f,"> <")}function v(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}h.preProcess=l;var d=/^\u0020/,p=/.+\u0020$/,g=/[\n\s\t]+/g,b=/^[\u0020\r\n\t]+|[\u0020\r\n\t]+$/g,m=/[\u0020]+/g,w=/[>(){}[\]+-.!#|]/g,y=/[[\]]/g,k=/!\[.*\]\(.*\)/g;function T(t,n,r){var i;for(i in r=r||null,t)if(t.hasOwnProperty(i)&&!1===n.call(r,t[i],i,t))break}function A(t){var n=t.tagName;return"S"===n||"B"===n||"I"===n||"EM"===n||"STRONG"===n||"A"===n||"IMG"===n||"CODE"===n}function E(t,n){T(n,(function(n,r){"converter"!==r?(t[r]||(t[r]={}),E(t[r],n)):t[r]=n}))}var L=function(){function t(t){this.rules={},this.lineFeedReplacement="",t&&this.addRules(t)}var n=t.prototype;return n.addRule=function(t,n){var r=t.split(", "),i=r.pop();for(n.fname=t;i;)this._setConverterWithSelector(i,n),i=r.pop()},n.addRules=function(t){T(t,(function(t,n){this.addRule(n,t)}),this)},n.getSpaceControlled=function(t,n){var r="",i="";return n.previousSibling&&(3===n.previousSibling.nodeType||A(n.previousSibling))&&(p.test(n.previousSibling.innerHTML||n.previousSibling.nodeValue)||d.test(n.innerHTML||n.nodeValue))&&(r=" "),n.nextSibling&&(3===n.nextSibling.nodeType||A(n.nextSibling))&&(d.test(n.nextSibling.innerHTML||n.nextSibling.nodeValue)||p.test(n.innerHTML||n.nodeValue))&&(i=" "),r+t+i},n.convert=function(t,n){var r,i=this._getConverter(t);return t&&t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("data-tomark-pass")?(t.removeAttribute("data-tomark-pass"),r=function(t,n){var r=t.cloneNode(!1);return r.innerHTML=n,r.outerHTML}(t,n)):i?r=i.call(this,t,n):t&&(r=this.getSpaceControlled(this._getInlineHtml(t,n),t)),r||""},n._getInlineHtml=function(t,n){var r=t.outerHTML,i=t.tagName,e=n.replace(/\$/g,"$$$$");return r.replace(new RegExp("(<"+i+" ?.*?>).*(</"+i+">)","i"),"$1"+e+"$2")},n._getConverter=function(t){for(var n,r=this.rules;t&&r;)r=this._getNextRule(r,this._getRuleNameFromNode(t)),t=this._getPrevNode(t),r&&r.converter&&(n=r.converter);return n},n._getNextRule=function(t,n){return t[n]},n._getRuleNameFromNode=function(t){return t.tagName||"TEXT_NODE"},n._getPrevNode=function(t){var n,r=t.parentNode;return r&&!r.__htmlRootByToMark&&(n=r),n},n._setConverterWithSelector=function(t,n){var r=this.rules;this._eachSelector(t,(function(t){r[t]||(r[t]={}),r=r[t]})),r.converter=n},n._eachSelector=function(t,n){for(var r=t.split(" "),i=r.length-1;i>=0;)n(r[i]),i-=1},n.trim=function(t){return t.replace(b,"")},n.isEmptyText=function(t){return""===t.replace(g,"")},n.getSpaceCollapsedText=function(t){return t.replace(m," ")},n.escapeText=function(t){return t.replace(w,(function(t){return"\\"+t}))},n.escapeTextForLink=function(t){for(var n=[],r=k.exec(t);r;)n.push([r.index,r.index+r[0].length]),r=k.exec(t);return t.replace(y,(function(t,r){return n.some((function(t){return r>t[0]&&r<t[1]}))?t:"\\"+t}))},n.escapeTextHtml=function(n){return n.replace(new RegExp(t.markdownTextToEscapeHtmlRx.source,"g"),(function(t){return"\\"+t}))},n.escapeTextBackSlash=function(n){return n.replace(new RegExp(t.markdownTextToEscapeBackSlashRx.source,"g"),(function(t){return"\\"+t}))},n.escapePairedCharacters=function(n){return n.replace(new RegExp(t.markdownTextToEscapePairedCharsRx.source,"g"),(function(t){return"\\"+t}))},n._isNeedEscape=function(n){var r,i=!1,e=t.markdownTextToEscapeRx;for(r in e)if(e.hasOwnProperty(r)&&e[r].test(n)){i=!0;break}return i},n._isNeedEscapeHtml=function(n){return t.markdownTextToEscapeHtmlRx.test(n)},n._isNeedEscapeBackSlash=function(n){return t.markdownTextToEscapeBackSlashRx.test(n)},n.mix=function(t){E(this.rules,t.rules)},t.factory=function(n,r){var i=new t;return r?i.mix(n):r=n,i.addRules(r),i},t}();v(L,"markdownTextToEscapeRx",{codeblock:/(^ {4}[^\n]+\n*)+/,hr:/^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,heading:/^(#{1,6}) +[\s\S]+/,lheading:/^([^\n]+)\n *(=|-){2,} */,blockquote:/^( *>[^\n]+.*)+/,list:/^ *(\*+|-+|\d+\.) [\s\S]+/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,link:/!?\[.*\]\(.*\)/,reflink:/!?\[.*\]\s*\[([^\]]*)\]/,verticalBar:/\u007C/,codeblockGfm:/^(`{3,})/,codeblockTildes:/^(~{3,})/}),v(L,"markdownTextToEscapeHtmlRx",/<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\/>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/),v(L,"markdownTextToEscapeBackSlashRx",/\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/),v(L,"markdownTextToEscapePairedCharsRx",/[*_~`]/);var x=/\n$/g,C=/[ \xA0]+\n\n/g,D=/([ \xA0]+\n){2,}/g,O=/href="(.*?)"/,S=/^/gm,N=L.factory({TEXT_NODE:function(t){var n=this.trim(this.getSpaceCollapsedText(t.nodeValue));return this._isNeedEscapeBackSlash(n)&&(n=this.escapeTextBackSlash(n)),n=this.escapePairedCharacters(n),this._isNeedEscapeHtml(n)&&(n=this.escapeTextHtml(n)),this._isNeedEscape(n)&&(n=this.escapeText(n)),this.getSpaceControlled(n,t)},"CODE TEXT_NODE":function(t){return t.nodeValue},"EM, I":function(t,n){var r="";return this.isEmptyText(n)||(r="*"+n+"*"),r},"STRONG, B":function(t,n){var r="";return this.isEmptyText(n)||(r="**"+n+"**"),r},A:function(t,n){var r,i=n,e="",o=O.exec(t.outerHTML);return o&&(r=o[1].replace(/&/g,"&")),t.title&&(e=' "'+t.title+'"'),!this.isEmptyText(n)&&r&&(i="["+this.escapeTextForLink(n)+"]("+r+e+")"),i},IMG:function(t){var n=t.getAttribute("src");return n?"":""},BR:function(){return" \n"},CODE:function(t,n){var r,i,e="";return this.isEmptyText(n)||(i=parseInt(t.getAttribute("data-backticks"),10),e=(r=isNaN(i)?"`":Array(i+1).join("`"))+n+r),e},P:function(t,n){var r="";return n=n.replace(D," \n"),this.isEmptyText(n)||(r="\n\n"+n+"\n\n"),r},"BLOCKQUOTE P":function(t,n){return n},"LI P":function(t,n){var r="";return this.isEmptyText(n)||(r=n),r},"H1, H2, H3, H4, H5, H6":function(t,n){for(var r="",i=parseInt(t.tagName.charAt(1),10);i;)r+="#",i-=1;return r+=" ","\n\n"+(r+=n)+"\n\n"},"LI H1, LI H2, LI H3, LI H4, LI H5, LI H6":function(t,n){var r=parseInt(t.tagName.charAt(1),10);return Array(r+1).join("#")+" "+n},"UL, OL":function(t,n){return"\n\n"+n+"\n\n"},"LI OL, LI UL":function(t,n){return"\n"+n.replace(C,"\n").replace(x,"").replace(S," ")},"UL LI":function(t,n){var r="";return n=n.replace(D," \n"),t.firstChild&&"P"===t.firstChild.tagName&&(r+="\n"),r+"* "+n+"\n"},"OL LI":function(t,n){for(var r="",i=parseInt(t.parentNode.getAttribute("start")||1,10);t.previousSibling;)1===(t=t.previousSibling).nodeType&&"LI"===t.tagName&&(i+=1);return n=n.replace(D," \n"),t.firstChild&&"P"===t.firstChild.tagName&&(r+="\n"),r+(i+". ")+n+"\n"},HR:function(){return"\n\n- - -\n\n"},BLOCKQUOTE:function(t,n){return n=n.replace(D,"\n\n"),"\n\n"+this.trim(n).replace(S,"> ")+"\n\n"},"PRE CODE":function(t,n){return"\n\n"+n.replace(x,"").replace(S," ")+"\n\n"}}),M=L.factory(N,{"DEL, S":function(t,n){return"~~"+n+"~~"},"PRE CODE":function(t,n){var r="",i=t.getAttribute("data-backticks");t.getAttribute("data-language")&&(r=" "+t.getAttribute("data-language")),i=parseInt(i,10);var e=isNaN(i)?"```":Array(i+1).join("`");return"\n\n"+e+r+"\n"+(n=n.replace(/(\r\n)|(\r)|(\n)/g,this.lineFeedReplacement))+"\n"+e+"\n\n"},PRE:function(t,n){return n},"UL LI":function(t,n){return N.convert(t,R(t,n))},"OL LI":function(t,n){return N.convert(t,R(t,n))},TABLE:function(t,n){return"\n\n"+n+"\n\n"},"TBODY, TFOOT":function(t,n){return n},"TR TD, TR TH":function(t,n){return" "+(n=n.replace(/(\r\n)|(\r)|(\n)/g,""))+" |"},"TD BR, TH BR":function(){return"<br>"},TR:function(t,n){return"|"+n+"\n"},THEAD:function(t,n){for(var r="",i=I(I(t,"TR")[0],"TH"),e=0,o=i.length;e<o;e+=1)r+=" "+B(i[e])+" |";return n?n+"|"+r+"\n":""}});function R(t,n){return-1!==t.className.indexOf("task-list-item")&&(n="["+(-1!==t.className.indexOf("checked")?"x":" ")+"] "+n),n}function B(t){var n,r,i,e=t.align;return i=t.textContent?t.textContent.length:t.innerText.length,n="",r="",e&&("left"===e?(n=":",i-=1):"right"===e?(r=":",i-=1):"center"===e&&(r=":",n=":",i-=2)),n+function(t,n){var r=t;for(n=Math.max(n,3);n>1;)r+=t,n-=1;return r}("-",i)+r}function I(t,n){for(var r=t.childNodes,i=[],e=0,o=r.length;e<o;e+=1)r[e].tagName&&r[e].tagName===n&&i.push(r[e]);return i}var q=/[ \xA0]+(\n\n)/g,F=/^[\n]+|[\s\n]+$/g,P=/([ \xA0]+\n){2,}/g,j=/([ \xA0]){2,}\n/g,_=/[ \xA0\n]+/g;function U(t,n){var r,i=!0;return t?(r=M,n&&(!1===(i=n.gfm)&&(r=N),r=n.renderer||r),function(t,n,r){return t=(t=(t=(t=(t=t.replace(q,"\n")).replace(P,"\n\n")).replace(_,(function(t){return(t.match(/\n/g)||[]).length>=3?"\n\n":t>=1?"\n":t}))).replace(F,"")).replace(new RegExp(r,"g"),"\n"),n&&(t=t.replace(j,"\n")),t}(function(t,n){for(var r="";t.next();)r+=H(t,n);return r}(new a(h(t)),r),i,r.lineFeedReplacement)):""}function H(t,n){for(var r="",i=t.getNode(),e=0,o=i.childNodes.length;e<o;e+=1)t.next(),r+=H(t,n);return n.convert(i,r)}U.Renderer=L,U.basicRenderer=N,U.gfmRenderer=M,n.default=U}]).default}))},function(t,n,r){var i=r(8);t.exports=function(t){return t&&t.className?i(t.className.baseVal)?t.className:t.className.baseVal:""}},function(t){t.exports=function(t){return"number"==typeof t||t instanceof Number}},function(t,n,r){var i=r(19),e=r.n(i),o=r(20),u=r.n(o),a=r(5),s=r.n(a),c=r(6),f=r.n(c),h=r(22),l=r(38),v=r(0),d=r(29),p=r(18),g=r(25),b=r(2),m="te-preview-highlight";n.a=function(t){var n,r;function i(n,r,i,e){var o;(o=t.call(this,n,r,i,e.isViewer)||this).lazyRunner.registerLazyRunFunction("invokeCodeBlock",o.invokeCodeBlockPlugins,o.delayCodeBlockTime,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(o));var u=e.linkAttribute,a=e.customHTMLRenderer,s=e.highlight,c=void 0!==s&&s;return o.renderHTML=Object(h.createRenderHTML)({gfm:!0,nodeId:!0,convertors:Object(d.a)(u,a)}),o.cursorNodeId=null,o._initEvent(c),o}r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r;var o=i.prototype;return o._initEvent=function(t){var n=this;this.eventManager.listen("contentChangedFromMarkdown",this.update.bind(this)),t&&(this.eventManager.listen("cursorActivity",(function(t){n._updateCursorNode(t.markdownNode,t.cursor)})),this.eventManager.listen("blur",(function(){n._removeHighlight()}))),e()(this.el,"scroll",(function(t){n.eventManager.emit("scroll",{source:"preview",data:Object(p.a)(t.target.scrollTop,n._previewContent)})}))},o._removeHighlight=function(){if(this.cursorNodeId){var t=this._getElementByNodeId(this.cursorNodeId);t&&f()(t,m)}},o._updateCursorNode=function(t,n){t&&("tableRow"===(t=Object(b.b)(t,(function(t){return!Object(b.h)(t)}))).type?t=function(t,n){for(var r=n.ch,i=t.firstChild;i&&i.next&&!(Object(b.e)(i.next)>r+1);)i=i.next;return i}(t,n):"tableBody"===t.type&&(t=null));var r=t?t.id:null;if(this.cursorNodeId!==r){var i=t&&"frontMatter"===t.customType,e=this._getElementByNodeId(this.cursorNodeId),o=this._getElementByNodeId(r);e&&f()(e,m),o&&!i&&s()(o,m),this.cursorNodeId=r}},o._getElementByNodeId=function(t){return t?this._previewContent.querySelector('[data-nodeid="'+t+'"]'):null},o.update=function(t){var n=this;t.forEach((function(t){return n.replaceRangeNodes(t)})),this.eventManager.emit("previewRenderAfter",this)},o.replaceRangeNodes=function(t){var n=this,r=t.nodes,i=t.removedNodeRange,e=this._previewContent,o=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",r.map((function(t){return n.renderHTML(t)})).join(""));if(i){var u=i.id,a=u[1],s=this._getElementByNodeId(u[0]),c=this._getElementByNodeId(a);if(s){var f;s.insertAdjacentHTML("beforebegin",o);for(var h=s;h&&h!==c;){var l=h.nextElementSibling;h.parentNode.removeChild(h),Object(g.c)(h),h=l}(null==(f=h)?void 0:f.parentNode)&&(v.a.remove(h),Object(g.c)(h))}}else e.insertAdjacentHTML("afterbegin",o);var d=this.getCodeBlockElements(r.map((function(t){return t.id})));d.length&&this.lazyRunner.run("invokeCodeBlock",d)},o.render=function(n){t.prototype.render.call(this,n),this.eventManager.emit("previewRenderAfter",this)},o.remove=function(){u()(this.el,"scroll"),this.el=null},i}(l.a)},function(t,n,r){var i=r(10),e=r.n(i),o=r(8),u=r.n(o),a=r(44),s=r.n(a),c=r(45),f=r.n(c),h=r(24),l=["previewBeforeHook","previewRenderAfter","previewNeedsRefresh","addImageBlobHook","setMarkdownAfter","contentChangedFromWysiwyg","changeFromWysiwyg","contentChangedFromMarkdown","changeFromMarkdown","change","changeModeToWysiwyg","changeModeToMarkdown","changeModeBefore","changeMode","changePreviewStyle","changePreviewTabPreview","changePreviewTabWrite","openPopupAddLink","openPopupAddImage","openPopupAddTable","openPopupTableUtils","openHeadingSelect","openPopupCodeBlockLanguages","openPopupCodeBlockEditor","openDropdownToolbar","closePopupCodeBlockLanguages","closePopupCodeBlockEditor","closeAllPopup","command","addCommandBefore","htmlUpdate","markdownUpdate","renderedHtmlUpdated","removeEditor","convertorAfterMarkdownToHtmlConverted","convertorBeforeHtmlToMarkdownConverted","convertorAfterHtmlToMarkdownConverted","stateChange","wysiwygSetValueAfter","wysiwygSetValueBefore","wysiwygGetValueBefore","wysiwygProcessHTMLText","wysiwygRangeChangeAfter","wysiwygKeyEvent","scroll","click","mousedown","mouseover","mouseout","mouseup","contextmenu","keydown","keyup","keyMap","load","focus","blur","paste","pasteBefore","willPaste","copy","copyBefore","copyAfter","cut","cutAfter","drop","show","hide","changeLanguage","cursorActivity","requireScrollSync","requireScrollIntoView","setCodeBlockLanguages"],v=function(){function t(){this.events=new h.a,this.TYPE=new f.a(l)}var n=t.prototype;return n.listen=function(t,n){var r=this._getTypeInfo(t),i=this.events.get(r.type)||[];if(!this._hasEventType(r.type))throw new Error("There is no event type "+r.type);r.namespace&&(n.namespace=r.namespace),i.push(n),this.events.set(r.type,i)},n.emit=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i,o=n.shift(),a=this._getTypeInfo(o),s=this.events.get(a.type);return s&&e()(s,(function(t){var r=t.apply(void 0,n);u()(r)||(i=i||[]).push(r)})),i},n.emitReduce=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.shift(),o=this.events.get(i);return o&&e()(o,(function(t){var r=t.apply(void 0,n);s()(r)||(n[0]=r)})),n[0]},n._getTypeInfo=function(t){var n=t.split(".");return{type:n[0],namespace:n[1]}},n._hasEventType=function(t){return!u()(this.TYPE[this._getTypeInfo(t).type])},n.addEventType=function(t){if(this._hasEventType(t))throw new Error("There is already have event type "+t);this.TYPE.set(t)},n.removeEventHandler=function(t,n){var r=this,i=this._getTypeInfo(t),e=i.type,o=i.namespace;e&&n?this._removeEventHandlerWithHandler(e,n):e&&!o?this.events.delete(e):!e&&o?this.events.forEach((function(t,n){r._removeEventHandlerWithTypeInfo(n,o)})):e&&o&&this._removeEventHandlerWithTypeInfo(e,o)},n._removeEventHandlerWithHandler=function(t,n){var r=this.events.get(t)||[],i=r.indexOf(n);i>=0&&r.splice(i,1)},n._removeEventHandlerWithTypeInfo=function(t,n){var r=[],i=this.events.get(t);i&&(i.map((function(t){return t.namespace!==n&&r.push(t),null})),this.events.set(t,r))},t}();n.a=v},function(t,n,r){var i=r(32),e=r.n(i),o=r(22),u=r(29),a=r(0),s=new RegExp("(\\\\<|<)([A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*)(\\/?>)","g"),c=/^\s?\\-\\-\\-([\s\S]+?)\\-\\-\\-/,f=/ /g,h=/^(\s*\*\s+\d+)\./g;n.a=function(){function t(t,n){void 0===n&&(n={});var r=n.linkAttribute,i=n.customHTMLRenderer,e=n.extendedAutolinks,a=n.referenceDefinition,s=n.customParser,c=n.frontMatter,f=n.customProp;this.options=n,this.mdReader=new o.Parser({extendedAutolinks:e,disallowedHtmlBlockTags:["br"],referenceDefinition:a,disallowDeepHeading:!0,customParser:s,frontMatter:c}),this.renderHTML=Object(o.createRenderHTML)({gfm:!0,convertors:Object(u.a)(r,i),customProp:f}),this.eventManager=t}var n=t.prototype;return n._markdownToHtmlWithCodeHighlight=function(t){return this.renderHTML(this.mdReader.parse(t))},n._markdownToHtml=function(t){return t=t.replace(s,(function(t,n,r,i){return"\\"!==t[0]?""+n+r+" data-tomark-pass "+i:t})).replace(h,"$1\\."),this.renderHTML(this.mdReader.parse(t))},n._removeBrToMarkPassAttributeInCode=function(t){var n=a.a.createElementWith("<div>"+t+"</div>");return a.a.findAll(n,"code, pre").forEach((function(t){t.innerHTML=t.innerHTML.replace(/\sdata-tomark-pass\s(\/?)>/g,"$1>")})),n.innerHTML},n.toHTMLWithCodeHighlight=function(t){var n=this._markdownToHtmlWithCodeHighlight(t);return this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",n)},n.toHTML=function(t){var n=this._markdownToHtml(t);return n=this.eventManager.emitReduce("convertorAfterMarkdownToHtmlConverted",n),this._removeBrToMarkPassAttributeInCode(n)},n.initHtmlSanitizer=function(t){this.eventManager.listen("convertorAfterMarkdownToHtmlConverted",(function(n){return t(n,!0)}))},n.toMarkdown=function(t,n){var r=[];t=this.eventManager.emitReduce("convertorBeforeHtmlToMarkdownConverted",t),t=this._appendAttributeForLinkIfNeed(t),t=this._appendAttributeForBrIfNeed(t);var i=e()(t,n);return this.options.frontMatter&&(i=i.replace(c,"---$1---")),i=this.eventManager.emitReduce("convertorAfterHtmlToMarkdownConverted",i),(i=this._removeNewlinesBeforeAfterAndBlockElement(i)).split("\n").forEach((function(t,n){/^(<br>)+\||\|[^|]*\|/gi.test(t)?t=t.replace(/^(<br>)+\|/gi,(function(t){return t.replace(/<br>/gi,"<br>\n")})):/`[^`]*<br>[^`]*`/gi.test(t)||(t=t.replace(/<br>/gi,"<br>\n")),r[n]=t})),r.join("\n").replace(f," ")},n._removeNewlinesBeforeAfterAndBlockElement=function(t){return(t=t.replace(/<br>\n\n(#{1,6} .*|```|\||(\*+|-+|\d+\.) .*| *>[^\n]+.*)/g,"<br>$1")).replace(/(#{1,6} .*|```|\|)\n\n<br>/g,"$1\n<br>")},n._appendAttributeForLinkIfNeed=function(t){return t.replace(/!?\[.*\]\(<\s*a[^>]*>(.*?)<\s*\/\s*a>\)/gi,(function(t){return t.replace(/<a /gi,'<a data-tomark-pass="" ')}))},n._appendAttributeForBrIfNeed=function(t){var n=new RegExp(/([^>]|<\/a>|<\/code>|<\/span>|<\/b>|<\/i>|<\/s>|<img [^>]*>)/.source+/<br data-tomark-pass \/><br data-tomark-pass \/>/.source,"g");return(t=(t=(t=(t=(t=(t=t.replace(/<br>/gi,"<br />")).replace(/<br \/><br \/>/gi,"<br data-tomark-pass /><br data-tomark-pass />")).replace(/<br data-tomark-pass="">/gi,"<br data-tomark-pass />")).replace(/<br data-tomark-pass \/><br \/>(.)/gi,"<br data-tomark-pass /><br data-tomark-pass />$1")).replace(n,"$1<br /><br />")).replace(/(.)<br \/><br \/>(<h[1-6]>|<pre>|<table>|<ul>|<ol>|<blockquote>)/g,"$1<br /><br data-tomark-pass />$2")).replace(/(<\/h[1-6]>|<\/pre>|<\/table>|<\/ul>|<\/ol>|<\/blockquote>)<br \/>(.)/g,"$1<br data-tomark-pass />$2")},t}()},function(t,n,r){var i=r(4),e=r.n(i),o=r(9),u=r.n(o),a=function(){function t(){this.globalTOID=null,this.lazyRunFunctions={}}var n=t.prototype;return n.run=function(t,n,r,i){var e;return u()(t)?e=this._runRegisteredRun(t,n,r,i):(e=this._runSingleRun(t,n,r,i,this.globalTOID),this.globalTOID=e),e},n.registerLazyRunFunction=function(t,n,r,i){this.lazyRunFunctions[t]={fn:n,delay:r,context:i=i||this,TOID:null}},n._runSingleRun=function(t,n,r,i,e){return this._clearTOIDIfNeed(e),setTimeout((function(){t.call(r,n)}),i)},n._runRegisteredRun=function(t,n,r,i){var e=this.lazyRunFunctions[t],o=e.TOID;return o=this._runSingleRun(e.fn,n,r=r||e.context,i=i||e.delay,o),e.TOID=o,o},n._clearTOIDIfNeed=function(t){t&&clearTimeout(t)},t}(),s=r(0),c=r(30);n.a=function(){function t(t,n,r,i){this.eventManager=n,this.convertor=r,this.el=t,this.isViewer=!!i,this.delayCodeBlockTime=500,this._initContentSection(),this.lazyRunner=new a}var n=t.prototype;return n._initContentSection=function(){this._previewContent=s.a.createElementWith('<div class="tui-editor-contents"></div>'),this.el.appendChild(this._previewContent)},n.getCodeBlockElements=function(t){var n=this._previewContent,r=[];return(t?t.map((function(t){return n.querySelector('[data-nodeid="'+t+'"]')})).filter(Boolean):[n]).forEach((function(t){r.push.apply(r,s.a.findAll(t,"code[data-language]"))})),r},n.invokeCodeBlockPlugins=function(t){t.forEach((function(t){var n=t.getAttribute("data-language"),r=c.a.createCodeBlockHtml(n,t.textContent);t.innerHTML=r}))},n.refresh=function(t){void 0===t&&(t=""),this.render(this.convertor.toHTMLWithCodeHighlight(t)),this.invokeCodeBlockPlugins(this.getCodeBlockElements())},n.getHTML=function(){return this._previewContent.innerHTML},n.setHTML=function(t){this._previewContent.innerHTML=t},n.render=function(t){var n=this._previewContent;t=this.eventManager.emit("previewBeforeHook",t)||t,s.a.empty(n),n.innerHTML=t},n.setHeight=function(t){e()(this.el,{height:t+"px"})},n.setMinHeight=function(t){e()(this.el,{minHeight:t+"px"})},n.isVisible=function(){return"none"!==this.el.style.display},t}()},function(t,n,r){var i=r(17),e=r(8);t.exports=function(t,n){n=(n=i(n)?n.join(" "):n).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),e(t.className.baseVal)?t.className=n:t.className.baseVal=n}},function(t){var n="_feEventKey";t.exports=function(t,r){var i,e=t[n];return e||(e=t[n]={}),(i=e[r])||(i=e[r]=[]),i}},,function(t,n,r){var i=r(28);t.exports=function(t){return i(t)&&!1!==t}},function(t,n,r){var i=r(8),e=r(49),o=6048e5;t.exports=function(t,n){var r=location.hostname,u="TOAST UI "+t+" for "+r+": Statistics",a=window.localStorage.getItem(u);(i(window.tui)||!1!==window.tui.usageStatistics)&&(a&&!function(t){return(new Date).getTime()-t>o}(a)||(window.localStorage.setItem(u,(new Date).getTime()),setTimeout((function(){"interactive"!==document.readyState&&"complete"!==document.readyState||e("https://www.google-analytics.com/collect",{v:1,t:"event",tid:n,cid:r,dp:r,dh:t,el:t,ec:"use"})}),1e3)))}},function(t,n,r){var i=r(42);t.exports=function(t){return!i(t)}},function(t,n,r){var i=r(34),e=r(17),o=r(3),u=r(26),a=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),s=0;function c(t){t&&this.set.apply(this,arguments)}c.prototype.set=function(t){var n=this;e(t)||(t=o(arguments)),u(t,(function(t){n._addItem(t)}))},c.prototype.getName=function(t){var n,r=this;return u(this,(function(i,e){if(r._isEnumItem(e)&&t===i)return n=e,!1})),n},c.prototype._addItem=function(t){var n;this.hasOwnProperty(t)||(n=this._makeEnumValue(),a?Object.defineProperty(this,t,{enumerable:!0,configurable:!1,writable:!1,value:n}):this[t]=n)},c.prototype._makeEnumValue=function(){var t;return t=s,s+=1,t},c.prototype._isEnumItem=function(t){return i(this[t])},t.exports=c},function(t,n,r){var i=r(10),e=r.n(i),o=r(7),u=r.n(o),a=r(19),s=r.n(a),c=r(20),f=r.n(c),h=r(35),l=r(36),v=r(1),d=r(37),p=r(0),g=r(30),b=r(31),m=r(12),w=r(23);function y(){return y=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},y.apply(this,arguments)}var k=function(){function t(t){var n=this;this.options=u()({useDefaultHTMLSanitizer:!0,linkAttribute:null,extendedAutolinks:!1,customConvertor:null,customHTMLRenderer:null,referenceDefinition:!1,customHTMLSanitizer:null,frontMatter:!1},t),this.codeBlockLanguages=[],this.eventManager=new l.a,this.commandManager=new v.a(this);var r=Object(m.c)(this.options.linkAttribute),i=Object(b.a)(this.options.plugins),o=i.parser,a=i.plugins,c=this.options,f=c.customHTMLSanitizer,p=c.extendedAutolinks,g=c.referenceDefinition,k=c.frontMatter,T={linkAttribute:r,customHTMLRenderer:y({},i.renderer,c.customHTMLRenderer),extendedAutolinks:p,referenceDefinition:g,customParser:o,frontMatter:k};this.convertor=this.options.customConvertor?new this.options.customConvertor(this.eventManager,T):new d.a(this.eventManager,T);var A=f||(this.options.useDefaultHTMLSanitizer?w.a:null);A&&this.convertor.initHtmlSanitizer(A),this.options.hooks&&e()(this.options.hooks,(function(t,r){n.addHook(r,t)})),this.options.events&&e()(this.options.events,(function(t,r){n.on(r,t)}));var E=this.options,L=E.el,x=E.initialValue,C=L.innerHTML;L.innerHTML="",this.preview=new h.a(L,this.eventManager,this.convertor,y({},T,{isViewer:!0})),s()(this.preview.el,"mousedown",this._toggleTask.bind(this)),a&&Object(b.b)(a,this),x?this.setMarkdown(x):C&&this.preview.setHTML(C),this.eventManager.emit("load",this)}var n=t.prototype;return n._toggleTask=function(t){var n=getComputedStyle(t.target,":before");!t.target.hasAttribute("data-te-task-disabled")&&t.target.hasAttribute("data-te-task")&&p.a.isInsideButtonBox(n,t.offsetX,t.offsetY)&&(p.a.toggleClass(t.target,"checked"),this.eventManager.emit("change",{source:"viewer",data:t}))},n.setMarkdown=function(t){this.markdownValue=t=t||"",this.preview.refresh(this.markdownValue),this.eventManager.emit("setMarkdownAfter",this.markdownValue)},n.on=function(t,n){this.eventManager.listen(t,n)},n.off=function(t){this.eventManager.removeEventHandler(t)},n.remove=function(){this.eventManager.emit("removeEditor"),f()(this.preview.el,"mousedown",this._toggleTask.bind(this)),this.preview.remove(),this.options=null,this.eventManager=null,this.commandManager=null,this.convertor=null,this.preview=null},n.addHook=function(t,n){this.eventManager.removeEventHandler(t),this.eventManager.listen(t,n)},n.isViewer=function(){return!0},n.isMarkdownMode=function(){return!1},n.isWysiwygMode=function(){return!1},n.setCodeBlockLanguages=function(t){var n=this;void 0===t&&(t=[]),t.forEach((function(t){n.codeBlockLanguages.indexOf(t)<0&&n.codeBlockLanguages.push(t)}))},t}();k.isViewer=!0,k.domUtils=p.a,k.codeBlockManager=g.a,k.WwCodeBlockManager=null,k.WwTableManager=null,k.WwTableSelectionManager=null,n.a=k},,function(t){t.exports=function(t){return null===t}},function(t,n,r){var i=r(10);t.exports=function(t,n){var r=document.createElement("img"),e="";return i(n,(function(t,n){e+="&"+n+"="+t})),e=e.substring(1),r.src=t+"?"+e,r.style.display="none",document.body.appendChild(r),document.body.removeChild(r),r}},,function(){},,,,,,,,,function(t,n,r){r.r(n);var i=r(46);r(51),n.default=i.a}]).default;const b=h(g.exports);var m,w,y,k,T,A,E=function(t,n,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?t!==n||!i:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:n.get(t)},L=function(t,n,r,i,e){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!e)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?t!==n||!e:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?e.call(t,r):e?e.value=r:n.set(t,r),r};const x=class{constructor(r){t(this,r),this.kupAutoSave=n(this,"kup-editor-autosave",6),this.kupReady=n(this,"kup-editor-ready",6),this.kupSave=n(this,"kup-editor-save",6),m.set(this,void 0),w.set(this,!1),y.set(this,""),k.set(this,u()),T.set(this,0),A.set(this,{options:{className:"kup-editor-unsaved-changes",el:this.createUnsavedChanges(),tooltip:"There are unsaved changes."},type:"button"}),this.editor=null,this.editorRef=void 0,this.viewer=null,this.autosaveTimer=void 0,this.editorHeight="auto",this.initialEditType="markdown",this.initialValue="",this.isReadOnly=!1,this.previewStyle="vertical",this.selectedTab="write",this.showSaveButton=!0,this.showToolbar=!0}onEditorRefUpdated(){this.editorRef&&!this.editor&&(this.isReadOnly?this.createViewer():this.createEditor())}onEditorUpdate(){this.editor&&setTimeout((()=>{this.editor&&(this.editor.moveCursorToStart(),"markdown"===this.initialEditType&&"tab"===this.previewStyle&&"preview"===this.selectedTab&&this.updateMarkDownPreviewTab())}),100)}onInitialEditTypeChanged(){"markdown"!=this.initialEditType&&"wysiwyg"!=this.initialEditType||!this.editor||(this.editor.changeMode(this.initialEditType),this.updateToolbarVisiblity())}onIsReadOnlyChanged(){this.isReadOnly?(this.editor.remove(),this.editor=null,this.createViewer()):(this.viewer.remove(),this.viewer=null,this.createEditor())}onPreviewStyleChanged(){"tab"!=this.previewStyle&&"vertical"!=this.previewStyle||!this.editor||(this.editor.changePreviewStyle(this.previewStyle),"vertical"==this.previewStyle&&this.editor.getUI().getToolbar().enableAllButton(),this.updateToolbarVisiblity())}onMarkdownPreviewTabChanged(){"markdown"!=this.initialEditType&&"tab"!=this.previewStyle||!this.editor||this.updateMarkDownPreviewTab()}onShowSaveButtonChanged(){if(this.editor){const t=this.editor.getUI().getToolbar();this.showSaveButton?t.insertItem(0,this.getToolBarWithSaveButton(!1)[0]):t.removeItem(0)}}onShowToolBarChanged(){this.editor&&this.updateToolbarVisiblity()}onAutosaveTimerChanged(){this.editor&&(E(this,m,"f")&&clearInterval(E(this,m,"f")),"number"==typeof this.autosaveTimer&&this.autosaveTimer>0&&this.setAutosaveInterval())}async getProps(t){return a(this,p,t)}async getValueAsHTML(){var t,n;return null!==(n=null===(t=this.editor)||void 0===t?void 0:t.getHtml())&&void 0!==n?n:""}async getValueAsMarkdown(){var t,n;return null!==(n=null===(t=this.editor)||void 0===t?void 0:t.getMarkdown())&&void 0!==n?n:""}async refresh(){r(this)}async setProps(t){s(this,p,t)}createEditor(){var t;const n={el:this.editorRef,events:{change:()=>{E(this,y,"f")!==this.editor.getMarkdown()?(E(this,w,"f")||(L(this,T,this.editor.getUI().getToolbar().getItems().length-1,"f"),this.editor.getUI().getToolbar().insertItem(E(this,T,"f"),E(this,A,"f"))),L(this,w,!0,"f")):(E(this,w,"f")&&this.editor.getUI().getToolbar().removeItem(E(this,T,"f")),L(this,w,!1,"f"))},focus:()=>{this.isReadOnly||this.showToolbar||(this.showToolbar=!0)}},height:null!==(t=this.editorHeight)&&void 0!==t?t:"auto",hideModeSwitch:!0,initialEditType:this.initialEditType,initialValue:this.initialValue,placeholder:"Type your text here...",previewStyle:this.previewStyle,usageStatistics:!1};this.showSaveButton&&(n.toolbarItems=this.getToolBarWithSaveButton()),this.editor=new d(n),L(this,y,this.editor.getMarkdown(),"f"),this.showToolbar||this.updateToolbarVisiblity(),"number"==typeof this.autosaveTimer&&this.autosaveTimer>0&&this.setAutosaveInterval()}createViewer(){this.viewer=new b({el:this.editorRef,initialValue:this.initialValue})}createSaveButton(){const t=document.createElement("button");return t.className="kup-editor-save-button",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#585858" version="1.1" id="Capa_1" width="12px" height="12px" viewBox="0 0 407.096 407.096" xml:space="preserve">\n <g>\n <g>\n <path d="M402.115,84.008L323.088,4.981C319.899,1.792,315.574,0,311.063,0H17.005C7.613,0,0,7.614,0,17.005v373.086 c0,9.392,7.613,17.005,17.005,17.005h373.086c9.392,0,17.005-7.613,17.005-17.005V96.032 C407.096,91.523,405.305,87.197,402.115,84.008z M300.664,163.567H67.129V38.862h233.535V163.567z"/>\n <path d="M214.051,148.16h43.08c3.131,0,5.668-2.538,5.668-5.669V59.584c0-3.13-2.537-5.668-5.668-5.668h-43.08 c-3.131,0-5.668,2.538-5.668,5.668v82.907C208.383,145.622,210.92,148.16,214.051,148.16z"/>\n </g>\n </g>\n </svg>',t.addEventListener("click",this.onEditorSave.bind(this)),t}createDivider(){const t=document.createElement("div");return t.className="kup-editor-divider",{options:{className:"kup-editor-divider",el:t},type:"button"}}createUnsavedChanges(){const t=document.createElement("span");return t.className="kup-editor-unsaved-changes",t.innerText="Unsaved changes.",t}updateToolbarVisiblity(){const t=this.editor.getUI().getToolbar().el,n=t.parentElement;t.style.display="",n.style.display="",this.showToolbar||(t.style.display="none","markdown"==this.initialEditType&&"tab"==this.previewStyle||(n.style.display="none"))}setAutosaveInterval(){L(this,m,setInterval((()=>{this.onEditorAutoSave()}),this.autosaveTimer),"f")}onEditorSave(){this.editor.getUI().getToolbar().removeItem(E(this,T,"f")),L(this,w,!1,"f"),this.kupSave.emit(this.getSaveAndAutoSaveProps())}onEditorAutoSave(){this.kupAutoSave.emit(this.getSaveAndAutoSaveProps())}updateMarkDownPreviewTab(){const t=this.rootElement.querySelector(".te-markdown-tab-section");t&&("preview"===this.selectedTab&&t.querySelector("button:last-child").click(),"write"===this.selectedTab&&t.querySelector("button").click())}getToolBarWithSaveButton(t=!0){return[{options:{el:this.createSaveButton(),tooltip:"Save"},type:"button"},this.createDivider(),...t?this.getDefaultToolBarItems():[]]}getDefaultToolBarItems(){const t=["heading","bold","italic","strike",this.createDivider(),"hr","quote",this.createDivider(),"ul","ol","task","indent","outdent",this.createDivider(),"table","image","link",this.createDivider(),"code","codeblock"];return"markdown"==this.initialEditType&&t.push("scrollSync"),t}getSaveAndAutoSaveProps(){var t,n;return{comp:this,id:this.rootElement.id,htmlValue:null!==(t=this.editor.getHtml())&&void 0!==t?t:"",markdownValue:null!==(n=this.editor.getMarkdown())&&void 0!==n?n:""}}componentWillLoad(){E(this,k,"f").debug.logLoad(this,!1),E(this,k,"f").theme.register(this)}componentDidLoad(){this.kupReady.emit({comp:this,id:this.rootElement.id}),E(this,k,"f").debug.logLoad(this,!0)}componentWillRender(){E(this,k,"f").debug.logRender(this,!1)}componentDidRender(){E(this,k,"f").debug.logRender(this,!0)}render(){return i(e,{key:"e23dbaf3c6bb6d2f97323300db853eb196637046"},i("div",{key:"9f1586dec11e6c60b45f34d4ae43dd12e6325f43",id:c},i("div",{key:this.rootElement.id,ref:t=>this.editorRef=t,class:"kup-editor"})))}disconnectedCallback(){E(this,k,"f").theme.unregister(this),E(this,m,"f")&&clearInterval(E(this,m,"f"))}get rootElement(){return o(this)}static get watchers(){return{editorRef:["onEditorRefUpdated"],editor:["onEditorUpdate"],initialEditType:["onInitialEditTypeChanged"],isReadOnly:["onIsReadOnlyChanged"],previewStyle:["onPreviewStyleChanged"],selectedTab:["onMarkdownPreviewTabChanged"],showSaveButton:["onShowSaveButtonChanged"],showToolbar:["onShowToolBarChanged"],autosaveTimer:["onAutosaveTimerChanged"]}}};m=new WeakMap,w=new WeakMap,y=new WeakMap,k=new WeakMap,T=new WeakMap,A=new WeakMap;export{x as kup_editor}
|