tiny-markdown-editor 0.1.4 → 0.1.6
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/README.md +2 -2
- package/dist/tiny-mde.css +2 -6
- package/dist/tiny-mde.js +3029 -5066
- package/dist/tiny-mde.min.css +1 -1
- package/dist/tiny-mde.min.js +1 -1
- package/dist/tiny-mde.tiny.js +1 -1
- package/lib/TinyMDE.js +1423 -1850
- package/lib/TinyMDECommandBar.js +144 -301
- package/lib/grammar.js +91 -155
- package/lib/index.js +2 -5
- package/lib/svg/svg.js +15 -16
- package/lib/tiny.js +1 -3
- package/package.json +18 -18
package/dist/tiny-mde.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.TinyMDE{background-color:#fff;color:#000;font-size:16px;line-height:24px;outline:none;padding:5px}.TMBlankLine{height:24px}.TMH1,.TMSetextH1{font-size:22px;line-height:32px;
|
|
1
|
+
.TinyMDE{background-color:#fff;color:#000;font-size:16px;line-height:24px;outline:none;padding:5px}.TMBlankLine{height:24px}.TMH1,.TMSetextH1{font-size:22px;font-weight:700;line-height:32px;margin-bottom:8px}.TMSetextH1{margin-bottom:0}.TMSetextH1Marker{margin-bottom:8px}.TMH2,.TMSetextH2{font-size:20px;font-weight:700;line-height:28px;margin-bottom:4px}.TMMark_TMCode{font-family:monospace;font-size:.9em}.TMCode,.TMFencedCodeBacktick,.TMFencedCodeTilde,.TMIndentedCode{background-color:#e0e0e0;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickOpen,.TMCodeFenceTildeOpen{border-bottom:1px solid silver;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickClose,.TMCodeFenceTildeClose{border-top:1px solid silver;font-family:monospace;font-size:.9em}.TMInfoString{color:#00f}.TMCode{border:1px solid silver;border-radius:2px}.TMBlockquote{border-left:2px solid silver;font-style:italic;margin-left:10px;padding-left:10px}.TMMark{color:#a0a0a0}.TMMark_TMH1,.TMMark_TMH2,.TMMark_TMOL,.TMMark_TMUL{color:#ff8080}.TMImage{text-decoration:underline;text-decoration-color:#0f0}.TMLink{text-decoration:underline;text-decoration-color:#00f}.TMLinkLabel{font-family:monospace;text-decoration:underline}.TMLinkLabel_Definition,.TMLinkLabel_Valid{color:#40c040}.TMLinkLabel_Invalid{color:red}.TMLinkTitle{font-style:italic}.TMAutolink,.TMLinkDestination{color:#00f;text-decoration:underline}.TMHR{position:relative}.TMHR:before{border-bottom:2px solid grey;bottom:50%;content:"";left:40%;position:absolute;width:20%;z-index:0}.TMHTML,.TMHTMLBlock{color:#8000ff;font-family:monospace;font-size:.9em}.TMHTMLBlock{color:#6000c0}.TMCommandBar{-ms-overflow-style:none;background-color:#f8f8f8;border:4px solid #f8f8f8;box-sizing:content-box;display:flex;height:24px;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;-webkit-user-select:none;user-select:none}.TMCommandBar::-webkit-scrollbar{display:none}.TMCommandButton{fill:#404040;box-sizing:border-box;color:#404040;cursor:pointer;display:inline-block;font-family:sans-serif;font-size:20px;height:24px;line-height:18px;margin-right:4px;padding:3px;text-align:center;vertical-align:middle;width:24px}.TMCommandDivider{border-left:1px solid silver;border-right:1px solid #fff;box-sizing:content-box;height:24px;margin-left:4px;margin-right:8px;width:0}.TMCommandButton_Active{fill:navy;background-color:#c0c0ff;color:navy;font-weight:700}.TMCommandButton_Inactive{background-color:#f8f8f8}.TMCommandButton_Disabled{fill:#a0a0a0;color:#a0a0a0}@media (hover:hover){.TMCommandButton_Active:hover,.TMCommandButton_Disabled:hover,.TMCommandButton_Inactive:hover{fill:#000;background-color:#e0e0ff}}
|
package/dist/tiny-mde.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyMDE={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var r=function(e){return e&&e.Math==Math&&e},i=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||Function("return this")(),a=function(e){try{return!!e()}catch(e){return!0}},o=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,l={f:s&&!u.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:u},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},h={}.toString,p=function(e){return h.call(e).slice(8,-1)},f="".split,d=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?f.call(e,""):Object(e)}:Object,g=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},m=function(e){return d(g(e))},v=function(e){return"object"==typeof e?null!==e:"function"==typeof e},y=function(e,t){if(!v(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!v(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!v(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!v(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},M={}.hasOwnProperty,F=function(e,t){return M.call(e,t)},T=i.document,D=v(T)&&v(T.createElement),E=function(e){return D?T.createElement(e):{}},b=!o&&!a((function(){return 7!=Object.defineProperty(E("div"),"a",{get:function(){return 7}}).a})),k=Object.getOwnPropertyDescriptor,C={f:o?k:function(e,t){if(e=m(e),t=y(t,!0),b)try{return k(e,t)}catch(e){}if(F(e,t))return c(!l.f.call(e,t),e[t])}},A=function(e){if(!v(e))throw TypeError(String(e)+" is not an object");return e},x=Object.defineProperty,w={f:o?x:function(e,t,n){if(A(e),t=y(t,!0),A(n),b)try{return x(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},S=o?function(e,t,n){return w.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},$=function(e,t){try{S(i,e,t)}catch(n){i[e]=t}return t},L="__core-js_shared__",O=i[L]||$(L,{}),B=Function.toString;"function"!=typeof O.inspectSource&&(O.inspectSource=function(e){return B.call(e)});var _,I,N,P=O.inspectSource,H=i.WeakMap,R="function"==typeof H&&/native code/.test(P(H)),j=n((function(e){(e.exports=function(e,t){return O[e]||(O[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),z=0,U=Math.random(),q=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++z+U).toString(36)},K=j("keys"),V=function(e){return K[e]||(K[e]=q(e))},Z={},W=i.WeakMap;if(R){var X=new W,Y=X.get,G=X.has,Q=X.set;_=function(e,t){return Q.call(X,e,t),t},I=function(e){return Y.call(X,e)||{}},N=function(e){return G.call(X,e)}}else{var J=V("state");Z[J]=!0,_=function(e,t){return S(e,J,t),t},I=function(e){return F(e,J)?e[J]:{}},N=function(e){return F(e,J)}}var ee,te,ne={set:_,get:I,has:N,enforce:function(e){return N(e)?I(e):_(e,{})},getterFor:function(e){return function(t){var n;if(!v(t)||(n=I(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},re=n((function(e){var t=ne.get,n=ne.enforce,r=String(String).split("String");(e.exports=function(e,t,a,o){var u=!!o&&!!o.unsafe,s=!!o&&!!o.enumerable,l=!!o&&!!o.noTargetGet;"function"==typeof a&&("string"!=typeof t||F(a,"name")||S(a,"name",t),n(a).source=r.join("string"==typeof t?t:"")),e!==i?(u?!l&&e[t]&&(s=!0):delete e[t],s?e[t]=a:S(e,t,a)):s?e[t]=a:$(t,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||P(this)}))})),ie=i,ae=function(e){return"function"==typeof e?e:void 0},oe=function(e,t){return arguments.length<2?ae(ie[e])||ae(i[e]):ie[e]&&ie[e][t]||i[e]&&i[e][t]},ue=Math.ceil,se=Math.floor,le=function(e){return isNaN(e=+e)?0:(e>0?se:ue)(e)},ce=Math.min,he=function(e){return e>0?ce(le(e),9007199254740991):0},pe=Math.max,fe=Math.min,de=function(e,t){var n=le(e);return n<0?pe(n+t,0):fe(n,t)},ge=function(e){return function(t,n,r){var i,a=m(t),o=he(a.length),u=de(r,o);if(e&&n!=n){for(;o>u;)if((i=a[u++])!=i)return!0}else for(;o>u;u++)if((e||u in a)&&a[u]===n)return e||u||0;return!e&&-1}},me={includes:ge(!0),indexOf:ge(!1)},ve=me.indexOf,ye=function(e,t){var n,r=m(e),i=0,a=[];for(n in r)!F(Z,n)&&F(r,n)&&a.push(n);for(;t.length>i;)F(r,n=t[i++])&&(~ve(a,n)||a.push(n));return a},Me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Fe=Me.concat("length","prototype"),Te={f:Object.getOwnPropertyNames||function(e){return ye(e,Fe)}},De={f:Object.getOwnPropertySymbols},Ee=oe("Reflect","ownKeys")||function(e){var t=Te.f(A(e)),n=De.f;return n?t.concat(n(e)):t},be=function(e,t){for(var n=Ee(t),r=w.f,i=C.f,a=0;a<n.length;a++){var o=n[a];F(e,o)||r(e,o,i(t,o))}},ke=/#|\.prototype\./,Ce=function(e,t){var n=xe[Ae(e)];return n==Se||n!=we&&("function"==typeof t?a(t):!!t)},Ae=Ce.normalize=function(e){return String(e).replace(ke,".").toLowerCase()},xe=Ce.data={},we=Ce.NATIVE="N",Se=Ce.POLYFILL="P",$e=Ce,Le=C.f,Oe=function(e,t){var n,r,a,o,u,s=e.target,l=e.global,c=e.stat;if(n=l?i:c?i[s]||$(s,{}):(i[s]||{}).prototype)for(r in t){if(o=t[r],a=e.noTargetGet?(u=Le(n,r))&&u.value:n[r],!$e(l?r:s+(c?".":"#")+r,e.forced)&&void 0!==a){if(typeof o==typeof a)continue;be(o,a)}(e.sham||a&&a.sham)&&S(o,"sham",!0),re(n,r,o,e)}},Be=Array.isArray||function(e){return"Array"==p(e)},_e=function(e){return Object(g(e))},Ie=function(e,t,n){var r=y(t);r in e?w.f(e,r,c(0,n)):e[r]=n},Ne=!!Object.getOwnPropertySymbols&&!a((function(){return!String(Symbol())})),Pe=Ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,He=j("wks"),Re=i.Symbol,je=Pe?Re:Re&&Re.withoutSetter||q,ze=function(e){return F(He,e)||(Ne&&F(Re,e)?He[e]=Re[e]:He[e]=je("Symbol."+e)),He[e]},Ue=ze("species"),qe=function(e,t){var n;return Be(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Be(n.prototype)?v(n)&&null===(n=n[Ue])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Ke=oe("navigator","userAgent")||"",Ve=i.process,Ze=Ve&&Ve.versions,We=Ze&&Ze.v8;We?te=(ee=We.split("."))[0]+ee[1]:Ke&&(!(ee=Ke.match(/Edge\/(\d+)/))||ee[1]>=74)&&(ee=Ke.match(/Chrome\/(\d+)/))&&(te=ee[1]);var Xe=te&&+te,Ye=ze("species"),Ge=function(e){return Xe>=51||!a((function(){var t=[];return(t.constructor={})[Ye]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Qe=ze("isConcatSpreadable"),Je=9007199254740991,et="Maximum allowed index exceeded",tt=Xe>=51||!a((function(){var e=[];return e[Qe]=!1,e.concat()[0]!==e})),nt=Ge("concat"),rt=function(e){if(!v(e))return!1;var t=e[Qe];return void 0!==t?!!t:Be(e)};Oe({target:"Array",proto:!0,forced:!tt||!nt},{concat:function(e){var t,n,r,i,a,o=_e(this),u=qe(o,0),s=0;for(t=-1,r=arguments.length;t<r;t++)if(rt(a=-1===t?o:arguments[t])){if(s+(i=he(a.length))>Je)throw TypeError(et);for(n=0;n<i;n++,s++)n in a&&Ie(u,s,a[n])}else{if(s>=Je)throw TypeError(et);Ie(u,s++,a)}return u.length=s,u}});var it,at,ot=[].join,ut=d!=Object,st=(it=",",!!(at=[]["join"])&&a((function(){at.call(null,it||function(){throw 1},1)})));Oe({target:"Array",proto:!0,forced:ut||!st},{join:function(e){return ot.call(m(this),void 0===e?",":e)}});var lt=w.f,ct=Function.prototype,ht=ct.toString,pt=/^\s*function ([^ (]*)/,ft="name";o&&!(ft in ct)&<(ct,ft,{configurable:!0,get:function(){try{return ht.call(this).match(pt)[1]}catch(e){return""}}});var dt=Object.keys||function(e){return ye(e,Me)},gt=Object.assign,mt=Object.defineProperty,vt=!gt||a((function(){if(o&&1!==gt({b:1},gt(mt({},"a",{enumerable:!0,get:function(){mt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=gt({},e)[n]||dt(gt({},t)).join("")!=r}))?function(e,t){for(var n=_e(e),r=arguments.length,i=1,a=De.f,u=l.f;r>i;)for(var s,c=d(arguments[i++]),h=a?dt(c).concat(a(c)):dt(c),p=h.length,f=0;p>f;)s=h[f++],o&&!u.call(c,s)||(n[s]=c[s]);return n}:gt;Oe({target:"Object",stat:!0,forced:Object.assign!==vt},{assign:vt});var yt=function(){var e=A(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function Mt(e,t){return RegExp(e,t)}var Ft={UNSUPPORTED_Y:a((function(){var e=Mt("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:a((function(){var e=Mt("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Tt=RegExp.prototype.exec,Dt=String.prototype.replace,Et=Tt,bt=function(){var e=/a/,t=/b*/g;return Tt.call(e,"a"),Tt.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),kt=Ft.UNSUPPORTED_Y||Ft.BROKEN_CARET,Ct=void 0!==/()??/.exec("")[1];(bt||Ct||kt)&&(Et=function(e){var t,n,r,i,a=this,o=kt&&a.sticky,u=yt.call(a),s=a.source,l=0,c=e;return o&&(-1===(u=u.replace("y","")).indexOf("g")&&(u+="g"),c=String(e).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(s="(?: "+s+")",c=" "+c,l++),n=new RegExp("^(?:"+s+")",u)),Ct&&(n=new RegExp("^"+s+"$(?!\\s)",u)),bt&&(t=a.lastIndex),r=Tt.call(o?n:a,c),o?r?(r.input=r.input.slice(l),r[0]=r[0].slice(l),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:bt&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),Ct&&r&&r.length>1&&Dt.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var At=Et;Oe({target:"RegExp",proto:!0,forced:/./.exec!==At},{exec:At});var xt=ze("species"),wt=!a((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),St="$0"==="a".replace(/./,"$0"),$t=ze("replace"),Lt=!!/./[$t]&&""===/./[$t]("a","$0"),Ot=!a((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Bt=function(e,t,n,r){var i=ze(e),o=!a((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),u=o&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[xt]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!o||!u||"replace"===e&&(!wt||!St||Lt)||"split"===e&&!Ot){var s=/./[i],l=n(i,""[e],(function(e,t,n,r,i){return t.exec===At?o&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:St,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Lt}),c=l[0],h=l[1];re(String.prototype,e,c),re(RegExp.prototype,i,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)})}r&&S(RegExp.prototype[i],"sham",!0)},_t=function(e){return function(t,n){var r,i,a=String(g(t)),o=le(n),u=a.length;return o<0||o>=u?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===u||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},It={codeAt:_t(!1),charAt:_t(!0)}.charAt,Nt=function(e,t,n){return t+(n?It(e,t).length:1)},Pt=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return At.call(e,t)};Bt("match",1,(function(e,t,n){return[function(t){var n=g(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=A(e),a=String(this);if(!i.global)return Pt(i,a);var o=i.unicode;i.lastIndex=0;for(var u,s=[],l=0;null!==(u=Pt(i,a));){var c=String(u[0]);s[l]=c,""===c&&(i.lastIndex=Nt(a,he(i.lastIndex),o)),l++}return 0===l?null:s}]}));var Ht=ze("match"),Rt=function(e){var t;return v(e)&&(void 0!==(t=e[Ht])?!!t:"RegExp"==p(e))},jt=ze("species"),zt=function(e,t){var n,r=A(e).constructor;return void 0===r||null==(n=A(r)[jt])?t:function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}(n)},Ut=[].push,qt=Math.min,Kt=4294967295,Vt=!a((function(){return!RegExp(Kt,"y")}));Bt("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(g(this)),i=void 0===n?Kt:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!Rt(e))return t.call(r,e,i);for(var a,o,u,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,h=new RegExp(e.source,l+"g");(a=At.call(h,r))&&!((o=h.lastIndex)>c&&(s.push(r.slice(c,a.index)),a.length>1&&a.index<r.length&&Ut.apply(s,a.slice(1)),u=a[0].length,c=o,s.length>=i));)h.lastIndex===a.index&&h.lastIndex++;return c===r.length?!u&&h.test("")||s.push(""):s.push(r.slice(c)),s.length>i?s.slice(0,i):s}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=g(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,i,n):r.call(String(i),t,n)},function(e,i){var a=n(r,e,this,i,r!==t);if(a.done)return a.value;var o=A(e),u=String(this),s=zt(o,RegExp),l=o.unicode,c=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(Vt?"y":"g"),h=new s(Vt?o:"^(?:"+o.source+")",c),p=void 0===i?Kt:i>>>0;if(0===p)return[];if(0===u.length)return null===Pt(h,u)?[u]:[];for(var f=0,d=0,g=[];d<u.length;){h.lastIndex=Vt?d:0;var m,v=Pt(h,Vt?u:u.slice(d));if(null===v||(m=qt(he(h.lastIndex+(Vt?0:d)),u.length))===f)d=Nt(u,d,l);else{if(g.push(u.slice(f,d)),g.length===p)return g;for(var y=1;y<=v.length-1;y++)if(g.push(v[y]),g.length===p)return g;d=f=m}}return g.push(u.slice(f)),g}]}),!Vt);var Zt=/"/g,Wt=function(e,t,n,r){var i=String(g(e)),a="<"+t;return""!==n&&(a+=" "+n+'="'+String(r).replace(Zt,""")+'"'),a+">"+i+"</"+t+">"},Xt=function(e){return a((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))};function Yt(e){return(Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Jt(e,t,n){return t&&Qt(e.prototype,t),n&&Qt(e,n),e}function en(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nn(e,t)}function tn(e){return(tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nn(e,t){return(nn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rn(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function an(e,t,n){return(an=rn()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&nn(i,n.prototype),i}).apply(null,arguments)}function on(e){var t="function"==typeof Map?new Map:void 0;return(on=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return an(e,arguments,tn(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),nn(r,e)})(e)}function un(e){return function(e){if(Array.isArray(e))return ln(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||sn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(e,t){if(e){if("string"==typeof e)return ln(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ln(e,t):void 0}}function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cn(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=sn(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function hn(e,t){hn=function(e,t){return new a(e,void 0,t)};var n=on(RegExp),r=RegExp.prototype,i=new WeakMap;function a(e,t,r){var a=n.call(this,e,t);return i.set(a,r||i.get(e)),a}function o(e,t){var n=i.get(t);return Object.keys(n).reduce((function(t,r){return t[r]=e[n[r]],t}),Object.create(null))}return en(a,n),a.prototype.exec=function(e){var t=r.exec.call(this,e);return t&&(t.groups=o(t,this)),t},a.prototype[Symbol.replace]=function(e,t){if("string"==typeof t){var n=i.get(this);return r[Symbol.replace].call(this,e,t.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+n[t]})))}if("function"==typeof t){var a=this;return r[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!=typeof e[e.length-1]&&e.push(o(e,a)),t.apply(this,e)}))}return r[Symbol.replace].call(this,e,t)},hn.apply(this,arguments)}Oe({target:"String",proto:!0,forced:Xt("anchor")},{anchor:function(e){return Wt(this,"a","name",e)}}),Oe({target:"String",proto:!0,forced:Xt("bold")},{bold:function(){return Wt(this,"b","","")}}),Oe({target:"String",proto:!0,forced:Xt("link")},{link:function(e){return Wt(this,"a","href",e)}});var pn,fn='<svg height="18" width="18"><rect width="5" height="5" x="3" y="4" ry="1"/><rect ry="1" y="4" x="10" height="5" width="5"/><path d="M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z"/></svg>',dn='<svg height="18" width="18"><path d="M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z"/></svg>',gn='<svg height="18" width="18"><path d="M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z"/></svg>',mn='<svg height="18" width="18"><path d="M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z"/></svg>',vn='<svg height="18" width="18"><path d="M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z"/></svg>',yn='<svg height="18" width="18"><rect ry="1" y="8" height="2" width="18" style="font-variation-settings:normal;marker:none"/></svg>',Mn='<svg height="18" width="18"><path d="M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z"/><circle r="1.5" cy="6.5" cx="5.5"/></svg>',Fn='<svg height="18" width="18"><path d="M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z"/></svg>',Tn='<svg height="18" width="18"><path d="M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z"/><path d="M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z"/></svg>',Dn='<svg height="18" width="18"><path d="M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z"/><path d="M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z"/><rect y="13" x="6" height="2" width="12" ry="1"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="3" x="6" height="2" width="12" ry="1"/><path d="M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z"/></svg>',En='<svg width="18" height="18"><path d="M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z"/><rect ry="1" y="8" x="1" height="2" width="16"/></svg>',bn='<svg height="18" width="18"><circle cx="2" cy="9" r="2"/><circle cy="4" cx="2" r="2"/><rect y="3" x="6" height="2" width="12" ry="1"/><circle cx="2" cy="14" r="2"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="13" x="6" height="2" width="12" ry="1"/></svg>',kn=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),Cn={bold:{name:"bold",action:"bold",innerHTML:dn,title:"Bold",hotkey:"Mod-B"},italic:{name:"italic",action:"italic",innerHTML:Fn,title:"Italic",hotkey:"Mod-I"},strikethrough:{name:"strikethrough",action:"strikethrough",innerHTML:En,title:"Strikethrough",hotkey:"Mod2-Shift-5"},code:{name:"code",action:"code",innerHTML:gn,title:"Format as code"},h1:{name:"h1",action:"h1",innerHTML:mn,title:"Level 1 heading",hotkey:"Mod-Shift-1"},h2:{name:"h2",action:"h2",innerHTML:vn,title:"Level 2 heading",hotkey:"Mod-Shift-2"},ul:{name:"ul",action:"ul",innerHTML:bn,title:"Bulleted list"},ol:{name:"ol",action:"ol",innerHTML:Dn,title:"Numbered list"},blockquote:{name:"blockquote",action:"blockquote",innerHTML:fn,title:"Quote",hotkey:"Mod2-Shift-Q"},insertLink:{name:"insertLink",action:function(e){e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:function(e,t,n){return!e.isInlineFormattingAllowed(t,n)&&null},innerHTML:Tn,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:function(e){e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:function(e,t,n){return!e.isInlineFormattingAllowed(t,n)&&null},innerHTML:Mn,title:"Insert image",hotkey:"Mod2-Shift-I"},hr:{name:"hr",action:function(e){return e.paste("\n***\n")},enabled:function(){return!1},innerHTML:yn,title:"Insert horizontal line",hotkey:"Mod2-Shift-L"}},An=function(){function e(t){var n=this;Gt(this,e),this.e=null,this.editor=null,this.commands=[],this.buttons={},this.state={},this.hotkeys=[];var r=t.element;r&&!r.tagName&&(r=document.getElementById(t.element)),r||(r=document.body),this.createCommandBarElement(r,t.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","|","blockquote","hr","|","insertLink","insertImage"]),document.addEventListener("keydown",(function(e){return n.handleKeydown(e)})),t.editor&&this.setEditor(t.editor)}return Jt(e,[{key:"createCommandBarElement",value:function(e,t){var n=this;this.e=document.createElement("div"),this.e.className="TMCommandBar";var r,i=cn(t);try{for(i.s();!(r=i.n()).done;){var a=r.value;if("|"==a){var o=document.createElement("div");o.className="TMCommandDivider",this.e.appendChild(o)}else{if("continue"===function(){var e=void 0;if("string"==typeof a){if(!Cn[a])return"continue";e=a,n.commands[e]=Cn[e]}else{if("object"!=Yt(a)||!a.name)return"continue";e=a.name,n.commands[e]={},Cn[e]&&Object.assign(n.commands[e],Cn[e]),Object.assign(n.commands[e],a)}var t=n.commands[e].title||e;if(n.commands[e].hotkey){for(var r=n.commands[e].hotkey.split("-"),i=[],o=[],u=0;u<r.length-1;u++)switch(r[u]){case"Ctrl":i.push("ctrlKey"),o.push("Ctrl");break;case"Cmd":i.push("metaKey"),o.push("⌘");break;case"Alt":i.push("altKey"),o.push("Alt");break;case"Option":i.push("altKey"),o.push("⌥");break;case"Win":i.push("metaKey"),o.push("⊞ Win");break;case"Shift":i.push("shiftKey"),o.push("⇧");break;case"Mod":kn?(i.push("metaKey"),o.push("⌘")):(i.push("ctrlKey"),o.push("Ctrl"));break;case"Mod2":i.push("altKey"),kn?o.push("⌥"):o.push("Alt")}o.push(r[r.length-1]);var s={modifiers:i,command:e};r[r.length-1].match(/^[0-9]$/)?s.code="Digit".concat(r[r.length-1]):s.key=r[r.length-1].toLowerCase(),n.hotkeys.push(s),t=t.concat(" (".concat(o.join("+"),")"))}n.buttons[e]=document.createElement("div"),n.buttons[e].className="TMCommandButton TMCommandButton_Disabled",n.buttons[e].title=t,n.buttons[e].innerHTML=n.commands[e].innerHTML,n.buttons[e].addEventListener("mousedown",(function(t){return n.handleClick(e,t)})),n.e.appendChild(n.buttons[e])}())continue}}}catch(e){i.e(e)}finally{i.f()}e.appendChild(this.e)}},{key:"handleClick",value:function(e,t){this.editor&&(t.preventDefault(),"string"==typeof this.commands[e].action?!1===this.state[e]?this.editor.setCommandState(e,!0):this.editor.setCommandState(e,!1):"function"==typeof this.commands[e].action&&this.commands[e].action(this.editor))}},{key:"setEditor",value:function(e){var t=this;this.editor=e,e.addEventListener("selection",(function(e){return t.handleSelection(e)}))}},{key:"handleSelection",value:function(e){if(e.commandState)for(var t in this.commands)void 0===e.commandState[t]?this.commands[t].enabled?this.state[t]=this.commands[t].enabled(this.editor,e.focus,e.anchor):this.state[t]=!e.focus&&null:this.state[t]=e.commandState[t],!0===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Active":!1===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Inactive":this.buttons[t].className="TMCommandButton TMCommandButton_Disabled"}},{key:"handleKeydown",value:function(e){var t,n=cn(this.hotkeys);try{e:for(n.s();!(t=n.n()).done;){var r=t.value;if(r.key&&e.key.toLowerCase()==r.key||r.code&&e.code==r.code){var i,a=cn(r.modifiers);try{for(a.s();!(i=a.n()).done;){if(!e[i.value])continue e}}catch(e){a.e(e)}finally{a.f()}return void this.handleClick(r.command,e)}}}catch(e){n.e(e)}finally{n.f()}}}]),e}(),xn=o?Object.defineProperties:function(e,t){A(e);for(var n,r=dt(t),i=r.length,a=0;i>a;)w.f(e,n=r[a++],t[n]);return e},wn=oe("document","documentElement"),Sn=V("IE_PROTO"),$n=function(){},Ln=function(e){return"<script>"+e+"</"+"script>"},On=function(){try{pn=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;On=pn?function(e){e.write(Ln("")),e.close();var t=e.parentWindow.Object;return e=null,t}(pn):((t=E("iframe")).style.display="none",wn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Ln("document.F=Object")),e.close(),e.F);for(var n=Me.length;n--;)delete On.prototype[Me[n]];return On()};Z[Sn]=!0;var Bn=Object.create||function(e,t){var n;return null!==e?($n.prototype=A(e),n=new $n,$n.prototype=null,n[Sn]=e):n=On(),void 0===t?n:xn(n,t)},_n=ze("unscopables"),In=Array.prototype;null==In[_n]&&w.f(In,_n,{configurable:!0,value:Bn(null)});var Nn,Pn=Object.defineProperty,Hn={},Rn=function(e){throw e},jn=function(e,t){if(F(Hn,e))return Hn[e];t||(t={});var n=[][e],r=!!F(t,"ACCESSORS")&&t.ACCESSORS,i=F(t,0)?t[0]:Rn,u=F(t,1)?t[1]:void 0;return Hn[e]=!!n&&!a((function(){if(r&&!o)return!0;var e={length:-1};r?Pn(e,1,{enumerable:!0,get:Rn}):e[1]=1,n.call(e,i,u)}))},zn=me.includes;Oe({target:"Array",proto:!0,forced:!jn("indexOf",{ACCESSORS:!0,1:0})},{includes:function(e){return zn(this,e,arguments.length>1?arguments[1]:void 0)}}),Nn="includes",In[_n][Nn]=!0;var Un=Ge("splice"),qn=jn("splice",{ACCESSORS:!0,0:0,1:2}),Kn=Math.max,Vn=Math.min,Zn=9007199254740991,Wn="Maximum allowed length exceeded";Oe({target:"Array",proto:!0,forced:!Un||!qn},{splice:function(e,t){var n,r,i,a,o,u,s=_e(this),l=he(s.length),c=de(e,l),h=arguments.length;if(0===h?n=r=0:1===h?(n=0,r=l-c):(n=h-2,r=Vn(Kn(le(t),0),l-c)),l+n-r>Zn)throw TypeError(Wn);for(i=qe(s,r),a=0;a<r;a++)(o=c+a)in s&&Ie(i,a,s[o]);if(i.length=r,n<r){for(a=c;a<l-r;a++)u=a+n,(o=a+r)in s?s[u]=s[o]:delete s[u];for(a=l;a>l-r+n;a--)delete s[a-1]}else if(n>r)for(a=l-r;a>c;a--)u=a+n-1,(o=a+r-1)in s?s[u]=s[o]:delete s[u];for(a=0;a<n;a++)s[a+c]=arguments[a+2];return s.length=l-r+n,i}});var Xn=function(e){if(Rt(e))throw TypeError("The method doesn't accept regular expressions");return e},Yn=ze("match");Oe({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[Yn]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~String(g(this)).indexOf(Xn(e),arguments.length>1?arguments[1]:void 0)}});var Gn=Math.max,Qn=Math.min,Jn=Math.floor,er=/\$([$&'`]|\d\d?|<[^>]*>)/g,tr=/\$([$&'`]|\d\d?)/g;Bt("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,a=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=g(this),a=null==n?void 0:n[e];return void 0!==a?a.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&a||"string"==typeof r&&-1===r.indexOf(o)){var s=n(t,e,this,r);if(s.done)return s.value}var l=A(e),c=String(this),h="function"==typeof r;h||(r=String(r));var p=l.global;if(p){var f=l.unicode;l.lastIndex=0}for(var d=[];;){var g=Pt(l,c);if(null===g)break;if(d.push(g),!p)break;""===String(g[0])&&(l.lastIndex=Nt(c,he(l.lastIndex),f))}for(var m,v="",y=0,M=0;M<d.length;M++){g=d[M];for(var F=String(g[0]),T=Gn(Qn(le(g.index),c.length),0),D=[],E=1;E<g.length;E++)D.push(void 0===(m=g[E])?m:String(m));var b=g.groups;if(h){var k=[F].concat(D,T,c);void 0!==b&&k.push(b);var C=String(r.apply(void 0,k))}else C=u(F,c,T,D,b,r);T>=y&&(v+=c.slice(y,T)+C,y=T+F.length)}return v+c.slice(y)}];function u(e,n,r,i,a,o){var u=r+e.length,s=i.length,l=tr;return void 0!==a&&(a=_e(a),l=er),t.call(o,l,(function(t,o){var l;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(u);case"<":l=a[o.slice(1,-1)];break;default:var c=+o;if(0===c)return t;if(c>s){var h=Jn(c/10);return 0===h?t:h<=s?void 0===i[h-1]?o.charAt(1):i[h-1]+o.charAt(1):t}l=i[c-1]}return void 0===l?"":l}))}}));var nr="\t\n\v\f\r \u2028\u2029\ufeff",rr="["+nr+"]",ir=RegExp("^"+rr+rr+"*"),ar=RegExp(rr+rr+"*$"),or=function(e){return function(t){var n=String(g(t));return 1&e&&(n=n.replace(ir,"")),2&e&&(n=n.replace(ar,"")),n}},ur={start:or(1),end:or(2),trim:or(3)},sr=ur.trim;Oe({target:"String",proto:!0,forced:function(e){return a((function(){return!!nr[e]()||"
"!="
"[e]()||nr[e].name!==e}))}("trim")},{trim:function(){return sr(this)}}),Oe({target:"Object",stat:!0,forced:a((function(){dt(1)}))},{keys:function(e){return dt(_e(e))}});var lr=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return A(n),function(e){if(!v(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),cr=ze("species"),hr=w.f,pr=Te.f,fr=ne.set,dr=ze("match"),gr=i.RegExp,mr=gr.prototype,vr=/a/g,yr=/a/g,Mr=new gr(vr)!==vr,Fr=Ft.UNSUPPORTED_Y;if(o&&$e("RegExp",!Mr||Fr||a((function(){return yr[dr]=!1,gr(vr)!=vr||gr(yr)==yr||"/a/i"!=gr(vr,"i")})))){for(var Tr=function(e,t){var n,r=this instanceof Tr,i=Rt(e),a=void 0===t;if(!r&&i&&e.constructor===Tr&&a)return e;Mr?i&&!a&&(e=e.source):e instanceof Tr&&(a&&(t=yt.call(e)),e=e.source),Fr&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o,u,s,l,c,h=(o=Mr?new gr(e,t):gr(e,t),u=r?this:mr,s=Tr,lr&&"function"==typeof(l=u.constructor)&&l!==s&&v(c=l.prototype)&&c!==s.prototype&&lr(o,c),o);return Fr&&n&&fr(h,{sticky:n}),h},Dr=function(e){e in Tr||hr(Tr,e,{configurable:!0,get:function(){return gr[e]},set:function(t){gr[e]=t}})},Er=pr(gr),br=0;Er.length>br;)Dr(Er[br++]);mr.constructor=Tr,Tr.prototype=mr,re(i,"RegExp",Tr)}!function(e){var t=oe(e),n=w.f;o&&t&&!t[cr]&&n(t,cr,{configurable:!0,get:function(){return this}})}("RegExp"),o&&("g"!=/./g.flags||Ft.UNSUPPORTED_Y)&&w.f(RegExp.prototype,"flags",{configurable:!0,get:yt});var kr="toString",Cr=RegExp.prototype,Ar=Cr.toString,xr=a((function(){return"/a/b"!=Ar.call({source:"a",flags:"b"})})),wr=Ar.name!=kr;(xr||wr)&&re(RegExp.prototype,kr,(function(){var e=A(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in Cr)?yt.call(e):n)}),{unsafe:!0});var Sr,$r={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,Scheme:/[A-Za-z][A-Za-z0-9+.-]{1,31}/,Email:/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/,HTMLOpenTag:/<HTMLTagName(?:HTMLAttribute)*\s*\/?>/,HTMLCloseTag:/<\/HTMLTagName\s*>/,HTMLTagName:/[A-Za-z][A-Za-z0-9-]*/,HTMLComment:/<!--(?:[^>-]|(?:[^>-](?:[^-]|-[^-])*[^-]))-->/,HTMLPI:/<\?(?:|.|(?:[^?]|\?[^>])*)\?>/,HTMLDeclaration:/<![A-Z]+\s[^>]*>/,HTMLCDATA:/<!\[CDATA\[.*?\]\]>/,HTMLAttribute:/\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,HTMLAttValue:/\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,KnownTag:/address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/},Lr=new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/),Or=new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/),Br={TMH1:{regexp:/^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'},TMH2:{regexp:/^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH2">$1</span>$$2<span class="TMMark TMMark_TMH2">$3</span>'},TMH3:{regexp:/^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH3">$1</span>$$2<span class="TMMark TMMark_TMH3">$3</span>'},TMH4:{regexp:/^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH4">$1</span>$$2<span class="TMMark TMMark_TMH4">$3</span>'},TMH5:{regexp:/^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH5">$1</span>$$2<span class="TMMark TMMark_TMH5">$3</span>'},TMH6:{regexp:/^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH6">$1</span>$$2<span class="TMMark TMMark_TMH6">$3</span>'},TMBlockquote:{regexp:/^( {0,3}>[ ]?)(.*)$/,replacement:'<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'},TMCodeFenceBacktickOpen:{regexp:hn(/^( {0,3}(````*)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)([\0-_a-\uFFFF]*?)([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceTildeOpen:{regexp:hn(/^( {0,3}(~~~~*)[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)(.*?)([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceBacktickClose:{regexp:hn(/^( {0,3}(````*))([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'},TMCodeFenceTildeClose:{regexp:hn(/^( {0,3}(~~~~*))([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'},TMBlankLine:{regexp:/^([ \t]*)$/,replacement:"$0"},TMSetextH1Marker:{regexp:/^ {0,3}=+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMSetextH2Marker:{regexp:/^ {0,3}-+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMHR:{regexp:/^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/,replacement:'<span class="TMMark TMMark_TMHR">$0</span>'},TMUL:{regexp:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMUL">$1</span>$$2'},TMOL:{regexp:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMOL">$1</span>$$2'},TMIndentedCode:{regexp:/^( {4}|\t)(.*)$/,replacement:'<span class="TMMark TMMark_TMIndentedCode">$1</span>$2'},TMLinkReferenceDefinition:{regexp:/^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,replacement:'<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',labelPlaceholder:2}},_r=[{start:/^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i,end:/(?:<\/script>|<\/pre>|<\/style>)/i,paraInterrupt:!0},{start:/^ {0,3}<!--/,end:/-->/,paraInterrupt:!0},{start:/^ {0,3}<\?/,end:/\?>/,paraInterrupt:!0},{start:/^ {0,3}<![A-Z]/,end:/>/,paraInterrupt:!0},{start:/^ {0,3}<!\[CDATA\[/,end:/\]\]>/,paraInterrupt:!0},{start:/^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i,end:!1,paraInterrupt:!0},{start:/^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/,end:!1,paraInterrupt:!1}],Ir={escape:{regexp:/^\\(ASCIIPunctuation)/,replacement:'<span class="TMMark TMMark_TMEscape">\\</span>$1'},code:{regexp:/^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/,replacement:'<span class="TMMark TMMark_TMCode">$1</span><code class="TMCode">$2</code><span class="TMMark TMMark_TMCode">$3</span>'},autolink:{regexp:/^<((?:Scheme:[^\s<>]*)|(?:Email))>/,replacement:'<span class="TMMark TMMark_TMAutolink"><</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">></span>'},html:{regexp:/^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/,replacement:'<span class="TMHTML">$1</span>'},linkOpen:{regexp:/^\[/,replacement:""},imageOpen:{regexp:/^!\[/,replacement:""},linkLabel:{regexp:/^(\[\s*)([^\]]*?)(\s*\])/,replacement:"",labelPlaceholder:2},default:{regexp:/^(.|(?:NotTriggerChar+))/,replacement:"$1"}},Nr=new RegExp(Object.keys($r).join("|")),Pr=cn(un(Object.keys(Ir)));try{for(Pr.s();!(Sr=Pr.n()).done;){for(var Hr=Sr.value,Rr=Ir[Hr].regexp.source;Rr.match(Nr);)Rr=Rr.replace(Nr,(function(e){return $r[e].source}));Ir[Hr].regexp=new RegExp(Rr,Ir[Hr].regexp.flags)}}catch(e){Pr.e(e)}finally{Pr.f()}for(var jr=0,zr=_r;jr<zr.length;jr++){for(var Ur=zr[jr],qr=Ur.start.source;qr.match(Nr);)qr=qr.replace(Nr,(function(e){return $r[e].source}));Ur.start=new RegExp(qr,Ur.start.flags)}function Kr(e){return(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var Vr={bold:{type:"inline",className:"TMStrong",set:{pre:"**",post:"**"},unset:{prePattern:/(?:\*\*|__)$/,postPattern:/^(?:\*\*|__)/}},italic:{type:"inline",className:"TMEm",set:{pre:"*",post:"*"},unset:{prePattern:/(?:\*|_)$/,postPattern:/^(?:\*|_)/}},code:{type:"inline",className:"TMCode",set:{pre:"`",post:"`"},unset:{prePattern:/`+$/,postPattern:/^`+/}},strikethrough:{type:"inline",className:"TMStrikethrough",set:{pre:"~~",post:"~~"},unset:{prePattern:/~~$/,postPattern:/^~~/}},h1:{type:"line",className:"TMH1",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"# $2"},unset:{pattern:/^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h2:{type:"line",className:"TMH2",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"## $2"},unset:{pattern:/^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},ul:{type:"line",className:"TMUL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"- $2"},unset:{pattern:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:"$2"}},ol:{type:"line",className:"TMOL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"$#. $2"},unset:{pattern:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:"$2"}},blockquote:{type:"line",className:"TMBlockquote",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"> $2"},unset:{pattern:/^( {0,3}>[ ]?)(.*)$/,replacement:"$2"}}},Zr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Gt(this,e),this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[]};var n=t.element;this.textarea=t.textarea,this.textarea&&!this.textarea.tagName&&(this.textarea=document.getElementById(this.textarea),n||(n=this.textarea)),n&&!n.tagName&&(n=document.getElementById(t.element)),n||(n=document.getElementsByTagName("body")[0]),"TEXTAREA"==n.tagName&&(this.textarea=n,n=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.createEditorElement(n),this.setContent(t.content||!!this.textarea&&this.textarea.value||"# Hello TinyMDE!\nEdit **here**")}return Jt(e,[{key:"createEditorElement",value:function(e){var t=this;this.e=document.createElement("div"),this.e.className="TinyMDE",this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",this.textarea&&this.textarea.parentNode==e&&this.textarea.nextSibling?e.insertBefore(this.e,this.textarea.nextSibling):e.appendChild(this.e),this.e.addEventListener("input",(function(e){return t.handleInputEvent(e)})),document.addEventListener("selectionchange",(function(e){return t.handleSelectionChangeEvent(e)})),this.e.addEventListener("paste",(function(e){return t.handlePaste(e)})),this.lineElements=this.e.childNodes}},{key:"setContent",value:function(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),this.lineDirty=[];for(var t=0;t<this.lines.length;t++){var n=document.createElement("div");this.e.appendChild(n),this.lineDirty.push(!0)}this.lineTypes=new Array(this.lines.length),this.updateFormatting(),this.fireChange()}},{key:"getContent",value:function(){return this.lines.join("\n")}},{key:"updateFormatting",value:function(){this.updateLineTypes(),this.updateLinkLabels(),this.applyLineTypes()}},{key:"updateLinkLabels",value:function(){this.linkLabels=[];for(var e=0;e<this.lines.length;e++)"TMLinkReferenceDefinition"==this.lineTypes[e]&&this.linkLabels.push(this.lineCaptures[e][Br.TMLinkReferenceDefinition.labelPlaceholder])}},{key:"replace",value:function(e,t){var n=this;return e.replace(/\$\$([0-9])/g,(function(e,r){return'<span class="TMInlineFormatted">'.concat(n.processInlineStyles(t[r]),"</span>")})).replace(/\$([0-9])/g,(function(e,n){return Kr(t[n])}))}},{key:"applyLineTypes",value:function(){for(var e=0;e<this.lines.length;e++){if(this.lineDirty[e]){var t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}},{key:"updateLineTypes",value:function(){for(var e=!1,t=0,n=!1,r=0;r<this.lines.length;r++){var i="TMPara",a=[this.lines[r]],o="$$0";if("TMCodeFenceBacktickOpen"==e){var u=Br.TMCodeFenceBacktickClose.regexp.exec(this.lines[r]);u&&u.groups.seq.length>=t?(i="TMCodeFenceBacktickClose",o=Br.TMCodeFenceBacktickClose.replacement,a=u,e=!1):(i="TMFencedCodeBacktick",o="$0",a=[this.lines[r]])}else if("TMCodeFenceTildeOpen"==e){var s=Br.TMCodeFenceTildeClose.regexp.exec(this.lines[r]);s&&s.groups.seq.length>=t?(i="TMCodeFenceTildeClose",o=Br.TMCodeFenceTildeClose.replacement,a=s,e=!1):(i="TMFencedCodeTilde",o="$0",a=[this.lines[r]])}if("TMPara"==i&&!1===n){var l,c=cn(_r);try{for(c.s();!(l=c.n()).done;){var h=l.value;if(this.lines[r].match(h.start)&&(h.paraInterrupt||0==r||"TMPara"!=this.lineTypes[r-1]&&"TMUL"!=this.lineTypes[r-1]&&"TMOL"!=this.lineTypes[r-1]&&"TMBlockquote"!=this.lineTypes[r-1])){n=h;break}}}catch(e){c.e(e)}finally{c.f()}}if(!1!==n&&(i="TMHTMLBlock",o="$0",a=[this.lines[r]],n.end?this.lines[r].match(n.end)&&(n=!1):(r==this.lines.length-1||this.lines[r+1].match(Br.TMBlankLine.regexp))&&(n=!1)),"TMPara"==i)for(var p in Br)if(Br[p].regexp){var f=Br[p].regexp.exec(this.lines[r]);if(f){i=p,o=Br[p].replacement,a=f;break}}if("TMCodeFenceBacktickOpen"!=i&&"TMCodeFenceTildeOpen"!=i||(e=i,t=a.groups.seq.length),"TMIndentedCode"!=i&&"TMLinkReferenceDefinition"!=i||!(r>0)||"TMPara"!=this.lineTypes[r-1]&&"TMUL"!=this.lineTypes[r-1]&&"TMOL"!=this.lineTypes[r-1]&&"TMBlockquote"!=this.lineTypes[r-1]||(i="TMPara",a=[this.lines[r]],o="$$0"),"TMSetextH2Marker"==i){var d=Br.TMUL.regexp.exec(this.lines[r]);d&&(i="TMUL",o=Br.TMUL.replacement,a=d)}if("TMSetextH1Marker"==i||"TMSetextH2Marker"==i)if(0==r||"TMPara"!=this.lineTypes[r-1]){var g=Br.TMHR.regexp.exec(this.lines[r]);g?(i="TMHR",a=g,o=Br.TMHR.replacement):(i="TMPara",a=[this.lines[r]],o="$$0")}else{var m=r-1,v="TMSetextH1Marker"==i?"TMSetextH1":"TMSetextH2";do{this.lineTypes[v]!=v&&(this.lineTypes[m]=v,this.lineDirty[v]=!0),this.lineReplacements[m]="$$0",this.lineCaptures[m]=[this.lines[m]],m--}while(m>=0&&"TMPara"==this.lineTypes[m])}this.lineTypes[r]!=i&&(this.lineTypes[r]=i,this.lineDirty[r]=!0),this.lineReplacements[r]=o,this.lineCaptures[r]=a}}},{key:"updateLineContentsAndFormatting",value:function(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}},{key:"parseLinkOrImage",value:function(e,t){var n=t?2:1,r=e.substr(0,n),i=t?"TMImage":"TMLink",a=n,o=1,u=!1,s=!1,l=[],c=[];e:for(;a<e.length&&!1===u;){for(var h=e.substr(a),p=0,f=["escape","code","autolink","html"];p<f.length;p++){var d=Ir[f[p]].regexp.exec(h);if(d){a+=d[0].length;continue e}}if(h.match(Ir.imageOpen.regexp))o++,a+=2;else if(h.match(Ir.linkOpen.regexp)){if(o++,!t&&this.parseLinkOrImage(h,!1))return!1;a+=1}else h.match(/^\]/)&&0==--o?(u=e.substr(n,a-n),a++):a++}if(!1===u)return!1;var g=a<e.length?e.substr(a,1):"";if("["==g){var m=e.substr(a),v=Ir.linkLabel.regexp.exec(m);if(!v)return!1;a+=v[0].length,l.push(v[1],v[2],v[3]),s=v[Ir.linkLabel.labelPlaceholder]?v[Ir.linkLabel.labelPlaceholder]:u.trim()}else if("("!=g)s=u.trim();else{a++;for(var y=1;a<e.length&&y>0;){var M=e.substr(a),F=/^\s+/.exec(M);if(F){switch(c.length){case 0:case 1:c.push(F[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(F[0]);else{if(1!=y)return!1;c.push(""),c.push(F[0])}break;case 3:c.push(F[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(F[0]);break;case 7:c[6]=c[6].concat(F[0]);break;default:return!1}a+=F[0].length}else if(F=Ir.escape.regexp.exec(M)){switch(c.length){case 0:c.push("");case 1:c.push(F[0]);break;case 2:c[1]=c[1].concat(F[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(F[0]);break;default:return!1}a+=F[0].length}else if(c.length<2&&M.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),a++;else if(1!=c.length&&2!=c.length||!M.match(/^>/))if(!(F=/^["']/.exec(M))||0!=c.length&&1!=c.length&&4!=c.length)if(!F||5!=c.length&&6!=c.length||c[4]!=F[0])if(M.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||y++;break;case 3:c.push("");case 4:c.push("(");break;case 5:c.push("");case 6:if("("==c[4])return!1;c[5]=c[5].concat("(");break;default:return!1}a++}else if(M.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||y--,y>0&&(c[1]=c[1].concat(")"))}else 5==c.length||6==c.length?"("==c[4]?(5==c.length&&c.push(""),c.push(")")):5==c.length?c.push(")"):c[5]=c[5].concat(")"):y--;if(0==y)for(;c.length<7;)c.push("");a++}else{if(!(F=/^./.exec(M)))throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(F[0]);break;case 2:c[1]=c[1].concat(F[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(F[0]);break;default:return!1}a+=F[0].length}else 5==c.length&&c.push(""),c.push(F[0]),a++;else{for(;c.length<4;)c.push("");c.push(F[0]),a++}else 1==c.length&&c.push(""),c.push(">"),a++}if(y>0)return!1}if(!1!==s){var T,D=!1,E=cn(this.linkLabels);try{for(E.s();!(T=E.n()).done;){if(T.value==s){D=!0;break}}}catch(e){E.e(e)}finally{E.f()}var b=D?"TMLinkLabel TMLinkLabel_Valid":"TMLinkLabel TMLinkLabel_Invalid",k='<span class="TMMark TMMark_'.concat(i,'">').concat(r,'</span><span class="').concat(i," ").concat(l.length<3||!l[1]?b:"",'">').concat(this.processInlineStyles(u),'</span><span class="TMMark TMMark_').concat(i,'">]</span>');return l.length>=3&&(k=k.concat('<span class="TMMark TMMark_'.concat(i,'">').concat(l[0],"</span>"),'<span class="'.concat(b,'">').concat(l[1],"</span>"),'<span class="TMMark TMMark_'.concat(i,'">').concat(l[2],"</span>"))),{output:k,charCount:a}}if(c){for(;c.length<7;)c.push("");return{output:'<span class="TMMark TMMark_'.concat(i,'">').concat(r,'</span><span class="').concat(i,'">').concat(this.processInlineStyles(u),'</span><span class="TMMark TMMark_').concat(i,'">](').concat(c[0],'</span><span class="').concat(i,'Destination">').concat(c[1],'</span><span class="TMMark TMMark_').concat(i,'">').concat(c[2]).concat(c[3]).concat(c[4],'</span><span class="').concat(i,'Title">').concat(c[5],'</span><span class="TMMark TMMark_').concat(i,'">').concat(c[6],")</span>"),charCount:a}}return!1}},{key:"processInlineStyles",value:function(e){for(var t=this,n="",r=[],i=0,a=e,o=function(){for(var o=function(){var e=s[u],t=Ir[e].regexp.exec(a);if(t)return a=a.substr(t[0].length),i+=t[0].length,n+=Ir[e].replacement.replace(/\$([1-9])/g,(function(e,n){return Kr(t[n])})),{v:"continue|outer"}},u=0,s=["escape","code","autolink","html"];u<s.length;u++){var l=o();if("object"===Yt(l))return l.v}var c=a.match(Ir.linkOpen.regexp),h=a.match(Ir.imageOpen.regexp);if(h||c){var p=t.parseLinkOrImage(a,h);if(p)return n="".concat(n).concat(p.output),a=a.substr(p.charCount),i+=p.charCount,"continue|outer"}var f=/(^\*+)|(^_+)/.exec(a);if(f){var d=f[0].length,g=f[0],m=f[0][0];a=a.substr(f[0].length);var v=i>0?e.substr(0,i):" ",y=i+f[0].length<e.length?a:" ",M=y.match(Lr),F=v.match(Or),T=y.match(/^\s/),D=v.match(/\s$/),E=!(T||M&&!D&&!F),b=!(D||F&&!T&&!M);if("_"==m&&E&&b&&(E=F,b=M),b)for(var k=r.length-1;d&&k>=0;)if(r[k].delimiter==m){for(;k<r.length-1;){var C=r.pop();n="".concat(C.output).concat(C.delimString.substr(0,C.count)).concat(n)}if(d>=2&&r[k].count>=2?(n='<span class="TMMark">'.concat(m).concat(m,'</span><strong class="TMStrong">').concat(n,'</strong><span class="TMMark">').concat(m).concat(m,"</span>"),d-=2,r[k].count-=2):(n='<span class="TMMark">'.concat(m,'</span><em class="TMEm">').concat(n,'</em><span class="TMMark">').concat(m,"</span>"),d-=1,r[k].count-=1),0==r[k].count){var A=r.pop();n="".concat(A.output).concat(n),k--}}else k--;return d&&E&&(r.push({delimiter:m,delimString:g,count:d,output:n}),n="",d=0),d&&(n="".concat(n).concat(g.substr(0,d))),i+=f[0].length,"continue|outer"}if(f=/^~~/.exec(a)){for(var x=!1,w=r.length-1;!x&&w>=0;)if("~"==r[w].delimiter){for(;w<r.length-1;){var S=r.pop();n="".concat(S.output).concat(S.delimString.substr(0,S.count)).concat(n)}n='<span class="TMMark">~~</span><del class="TMStrikethrough">'.concat(n,'</del><span class="TMMark">~~</span>');var $=r.pop();n="".concat($.output).concat(n),x=!0}else w--;return x||(r.push({delimiter:"~",delimString:"~~",count:2,output:n}),n=""),i+=f[0].length,a=a.substr(f[0].length),"continue|outer"}if(f=Ir.default.regexp.exec(a))return a=a.substr(f[0].length),i+=f[0].length,n+=Ir.default.replacement.replace(/\$([1-9])/g,(function(e,t){return Kr(f[t])})),"continue|outer";throw"Infinite loop!"};a;)o();for(;r.length;){var u=r.pop();n="".concat(u.output).concat(u.delimString.substr(0,u.count)).concat(n)}return n}},{key:"clearDirtyFlag",value:function(){this.lineDirty=new Array(this.lines.length);for(var e=0;e<this.lineDirty.length;e++)this.lineDirty[e]=!1}},{key:"updateLineContents",value:function(){var e=this.e.childElementCount-this.lines.length;if(e){for(var t=0;t<=this.lines.length&&t<=this.lineElements.length&&this.lineElements[t]&&this.lines[t]==this.lineElements[t].textContent;)t++;for(var n=-1;-n<this.lines.length&&-n<this.lineElements.length&&this.lines[this.lines.length+n]==this.lineElements[this.lineElements.length+n].textContent;)n--;var r=this.lines.length+n+1-t;r<-e&&(r=-e),r<0&&(r=0);for(var i=[],a=0;a<r+e;a++)i.push(this.lineElements[t+a].textContent);this.spliceLines(t,r,i,!1)}else for(var o=0;o<this.lineElements.length;o++){var u=this.lineElements[o].textContent;this.lines[o]!==u&&(this.lines[o]=u,this.lineDirty[o]=!0)}}},{key:"processNewParagraph",value:function(e){if(e){this.updateLineContents();var t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}var r=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(1!=r.length){if(this.spliceLines(e.row,1,r,!0),e.row++,e.col=0,t){var i=Br[t].regexp.exec(this.lines[e.row-1]);i&&(i[2]?("TMOL"==t&&(i[1]=i[1].replace(/\d{1,9}/,(function(e){return parseInt(e[0])+1}))),this.lines[e.row]="".concat(i[1]).concat(this.lines[e.row]),this.lineDirty[e.row]=!0,e.col=i[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}else this.updateFormatting()}}},{key:"getSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=window.getSelection(),n=e?t.anchorNode:t.focusNode;if(!n)return null;var r=n.nodeType===Node.TEXT_NODE?e?t.anchorOffset:t.focusOffset:0;if(n==this.e)return{row:0,col:r};var i=this.computeColumn(n,r);if(null===i)return null;for(var a=n;a.parentElement!=this.e;)a=a.parentElement;var o=0;if(!a.dataset||!a.dataset.lineNum||a.previousSibling&&a.previousSibling.dataset.lineNum==a.dataset.lineNum)for(;a.previousSibling;)o++,a=a.previousSibling;else o=parseInt(a.dataset.lineNum);return{row:o,col:i,node:n}}},{key:"computeColumn",value:function(e,t){for(var n=e,r=t;n&&n.parentNode!=this.e;)n=n.parentNode;if(null==n)return null;for(n=e;n.parentNode!=this.e;)n.previousSibling?r+=(n=n.previousSibling).textContent.length:n=n.parentNode;return r}},{key:"computeNodeAndOffset",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e>=this.lineElements.length&&(e=this.lineElements.length-1,t=this.lines[e].length),t>this.lines[e].length&&(t=this.lines[e].length);for(var r=this.lineElements[e],i=r.firstChild,a=!1,o={node:r.firstChild?r.firstChild:r,offset:0};i!=r;){if(!a&&i.nodeType===Node.TEXT_NODE)if(i.nodeValue.length>=t){if(!n||i.nodeValue.length!=t)return{node:i,offset:t};o={node:i,offset:t},t=0}else t-=i.nodeValue.length;!a&&i.firstChild?i=i.firstChild:i.nextSibling?(a=!1,i=i.nextSibling):(a=!0,i=i.parentNode)}return o}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){var n=document.createRange(),r=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),i=r.node,a=r.offset,o=null,u=null;if(t&&(t.row!=e.row||t.col!=e.col)){var s=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col),l=s.node,c=s.offset;o=l,u=c}o?n.setStart(o,u):n.setStart(i,a),n.setEnd(i,a);var h=window.getSelection();h.removeAllRanges(),h.addRange(n)}}},{key:"handleInputEvent",value:function(e){var t=this.getSelection();if("insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t){if(this.e.firstChild){for(var n=this.e.firstChild;n;n=n.nextSibling)if(3!=n.nodeType||"DIV"!=n.tagName){var r=document.createElement("div");this.e.insertBefore(r,n),this.e.removeChild(n),r.appendChild(n)}}else this.e.innerHTML='<div class="TMBlankLine"><br></div>';this.updateLineContentsAndFormatting()}else this.clearDirtyFlag(),this.processNewParagraph(t);t&&this.setSelection(t),this.fireChange()}},{key:"handleSelectionChangeEvent",value:function(){this.fireSelection()}},{key:"spliceLines",value:function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o)for(var u=0;u<i;u++)this.e.removeChild(this.e.childNodes[e]);for(var s=[],l=[],c=0;c<a.length;c++)s.push(""),l.push(!0),o&&(this.e.childNodes[e]?this.e.insertBefore(document.createElement("div"),this.e.childNodes[e]):this.e.appendChild(document.createElement("div")));(t=this.lines).splice.apply(t,[e,i].concat(un(a))),(n=this.lineTypes).splice.apply(n,[e,i].concat(s)),(r=this.lineDirty).splice.apply(r,[e,i].concat(l))}},{key:"handlePaste",value:function(e){e.preventDefault();var t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}},{key:"paste",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r||(r=this.getSelection(!0)),i||(i=this.getSelection(!1)),i||(i={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),r||(r=i),r.row<i.row||r.row==i.row&&r.col<=i.col?(t=r,n=i):(t=i,n=r);var a=e.split(/(?:\r\n|\r|\n)/),o=this.lines[t.row].substr(0,t.col),u=this.lines[n.row].substr(n.col);a[0]=o.concat(a[0]);var s=a[a.length-1].length;a[a.length-1]=a[a.length-1].concat(u),this.spliceLines(t.row,1+n.row-t.row,a),i.row=t.row+a.length-1,i.col=s,this.updateFormatting(),this.setSelection(i),this.fireChange()}},{key:"computeCommonAncestor",value:function(e,t){if(!e||!t)return null;if(e==t)return e;var n,r=function(e){for(var t=[];e;)t.unshift(e),e=e.parentNode;return t},i=r(e),a=r(t);if(i[0]!=a[0])return null;for(n=0;i[n]==a[n];n++);return i[n-1]}},{key:"computeEnclosingMarkupNode",value:function(e,t,n){var r=null;if(!e)return null;if(t){if(e.row!=t.row)return null;r=this.computeCommonAncestor(e.node,t.node)}else r=e.node;if(!r)return null;for(;r!=this.e;){if(r.className&&r.className.includes(n))return r;r=r.parentNode}return null}},{key:"getCommandState",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={};if(n||(n=this.getSelection(!1)),r||(r=this.getSelection(!0)),!n){for(var a in Vr)i[a]=null;return i}for(var o in r||(r=n),r.row<n.row||r.row==n.row&&r.col<n.col?(e=r,t=n):(e=n,t=r),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length),Vr)if("inline"==Vr[o].type&&(n&&n.row==r.row&&this.isInlineFormattingAllowed(n,r)?i[o]=!!this.computeEnclosingMarkupNode(n,r,Vr[o].className)||n.col==r.col&&!!this.lines[n.row].substr(0,n.col).match(Vr[o].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(Vr[o].unset.postPattern):i[o]=null),"line"==Vr[o].type)if(n){for(var u=this.lineTypes[e.row]==Vr[o].className,s=e.row;s<=t.row;s++)if(this.lineTypes[s]==Vr[o].className!=u){u=null;break}i[o]=u}else i[o]=null;return i}},{key:"setCommandState",value:function(e,t){if("inline"==Vr[e].type){var n=this.getSelection(!0),r=this.getSelection(!1);if(n||(n=r),!n)return;if(n.row!=r.row)return;if(!this.isInlineFormattingAllowed(r,n))return;var i=this.computeEnclosingMarkupNode(r,n,Vr[e].className);if(this.clearDirtyFlag(),i){this.lineDirty[r.row]=!0;var a=this.computeColumn(i,0),o=i.textContent.length,u=this.lines[r.row].substr(0,a).replace(Vr[e].unset.prePattern,""),s=this.lines[r.row].substr(a,o),l=this.lines[r.row].substr(a+o).replace(Vr[e].unset.postPattern,"");this.lines[r.row]=u.concat(s,l),n.col=u.length,r.col=n.col+o,this.updateFormatting(),this.setSelection(r,n)}else if(r.col==n.col&&this.lines[r.row].substr(0,r.col).match(Vr[e].unset.prePattern)&&this.lines[r.row].substr(r.col).match(Vr[e].unset.postPattern)){this.lineDirty[r.row]=!0;var c=this.lines[r.row].substr(0,r.col).replace(Vr[e].unset.prePattern,""),h=this.lines[r.row].substr(r.col).replace(Vr[e].unset.postPattern,"");this.lines[r.row]=c.concat(h),r.col=n.col=c.length,this.updateFormatting(),this.setSelection(r,n)}else{var p=r.col<n.col?{startCol:r.col,endCol:n.col}:{startCol:n.col,endCol:r.col},f=p.startCol,d=p.endCol,g=this.lines[r.row].substr(f,d-f).match(hn(/^([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*).*[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uFEFE\uFF00-\uFFFF]([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)$/,{leading:1,trailing:2}));g&&(f+=g.groups.leading.length,d-=g.groups.trailing.length),r.col=f,n.col=d,this.wrapSelection(Vr[e].set.pre,Vr[e].set.post,r,n)}}else if("line"==Vr[e].type){var m=this.getSelection(!0),v=this.getSelection(!1);if(m||(m=v),!v)return;this.clearDirtyFlag();var y=m.row>v.row?v:m,M=m.row>v.row?m:v;M.row>y.row&&0==M.col&&M.row--;for(var F=y.row;F<=M.row;F++)t&&this.lineTypes[F]!=Vr[e].className&&(this.lines[F]=this.lines[F].replace(Vr[e].set.pattern,Vr[e].set.replacement.replace("$#",F-y.row+1)),this.lineDirty[F]=!0),t||this.lineTypes[F]!=Vr[e].className||(this.lines[F]=this.lines[F].replace(Vr[e].unset.pattern,Vr[e].unset.replacement),this.lineDirty[F]=!0);this.updateFormatting(),this.setSelection({row:M.row,col:this.lines[M.row].length},{row:y.row,col:0})}}},{key:"isInlineFormattingAllowed",value:function(){var e=window.getSelection();if(!e)return!1;if(e.isCollapsed&&3==e.focusNode.nodeType&&e.focusOffset==e.focusNode.nodeValue.length){var t;for(t=e.focusNode;t&&null==t.nextSibling;t=t.parentNode);if(t&&t.nextSibling.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}var n=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!n)return!1;for(;n&&n!=this.e;){if(n.className&&(n.className.includes("TMInlineFormatted")||n.className.includes("TMBlankLine")))return!0;n=n.parentNode}return!1}},{key:"wrapSelection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(n||(n=this.getSelection(!1)),r||(r=this.getSelection(!0)),n&&r&&n.row==r.row){this.lineDirty[n.row]=!0;var i=n.col<r.col?n.col:r.col,a=n.col<r.col?r.col:n.col,o=this.lines[n.row].substr(0,i).concat(e),u=a==i?"":this.lines[n.row].substr(i,a-i),s=t.concat(this.lines[n.row].substr(a));this.lines[n.row]=o.concat(u,s),r.col=o.length,n.col=r.col+u.length,this.updateFormatting(),this.setSelection(n,r)}}},{key:"toggleCommandState",value:function(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}},{key:"fireChange",value:function(){if(this.textarea||this.listeners.change.length){var e=this.getContent();this.textarea&&(this.textarea.value=e);var t,n=cn(this.listeners.change);try{for(n.s();!(t=n.n()).done;){(0,t.value)({content:e,linesDirty:this.linesDirty})}}catch(e){n.e(e)}finally{n.f()}}}},{key:"fireSelection",value:function(){if(this.listeners.selection&&this.listeners.selection.length){var e=this.getSelection(!1),t=this.getSelection(!0),n=this.getCommandState(e,t);this.lastCommandState?Object.assign(this.lastCommandState,n):this.lastCommandState=Object.assign({},n);var r,i=cn(this.listeners.selection);try{for(i.s();!(r=i.n()).done;){(0,r.value)({focus:e,anchor:t,commandState:this.lastCommandState})}}catch(e){i.e(e)}finally{i.f()}}}},{key:"addEventListener",value:function(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t)}}]),e}();e.CommandBar=An,e.Editor=Zr,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyMDE={})}(this,(function(e){"use strict";const t={blockquote:'<svg height="18" width="18"><rect width="5" height="5" x="3" y="4" ry="1"/><rect ry="1" y="4" x="10" height="5" width="5"/><path d="M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z"/></svg>',bold:'<svg height="18" width="18"><path d="M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z"/></svg>',clear_formatting:'<svg height="18" width="18"><path d="M11.03 1a1 1 0 00-.74.3l-9 9a1 1 0 000 1.4l4 4A1 1 0 006 16h2a1 1 0 00.7-.3l8-8a1 1 0 000-1.4l-5-5a1 1 0 00-.67-.3zM8.7 5.7l3.58 3.6L7.6 14H6.4l-3-3 5.3-5.3z"/><rect ry=".8" rx=".8" y="14" x="16" height="2" width="2"/><rect width="2" height="2" x="13" y="14" rx=".8" ry=".8"/><rect ry=".8" rx=".8" y="14" x="10" height="2" width="2"/></svg>',code:'<svg height="18" width="18"><path d="M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z"/></svg>',h1:'<svg height="18" width="18"><path d="M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z"/></svg>',h2:'<svg height="18" width="18"><path d="M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z"/></svg>',hr:'<svg height="18" width="18"><rect ry="1" y="8" height="2" width="18" style="font-variation-settings:normal;marker:none"/></svg>',image:'<svg height="18" width="18"><path d="M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z"/><circle r="1.5" cy="6.5" cx="5.5"/></svg>',italic:'<svg height="18" width="18"><path d="M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z"/></svg>',link:'<svg height="18" width="18"><path d="M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z"/><path d="M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z"/></svg>',ol:'<svg height="18" width="18"><path d="M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z"/><path d="M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z"/><rect y="13" x="6" height="2" width="12" ry="1"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="3" x="6" height="2" width="12" ry="1"/><path d="M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z"/></svg>',strikethrough:'<svg width="18" height="18"><path d="M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z"/><rect ry="1" y="8" x="1" height="2" width="16"/></svg>',ul:'<svg height="18" width="18"><circle cx="2" cy="9" r="2"/><circle cy="4" cx="2" r="2"/><rect y="3" x="6" height="2" width="12" ry="1"/><circle cx="2" cy="14" r="2"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="13" x="6" height="2" width="12" ry="1"/></svg>'},n=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),s={bold:{name:"bold",action:"bold",innerHTML:t.bold,title:"Bold",hotkey:"Mod-B"},italic:{name:"italic",action:"italic",innerHTML:t.italic,title:"Italic",hotkey:"Mod-I"},strikethrough:{name:"strikethrough",action:"strikethrough",innerHTML:t.strikethrough,title:"Strikethrough",hotkey:"Mod2-Shift-5"},code:{name:"code",action:"code",innerHTML:t.code,title:"Format as code"},h1:{name:"h1",action:"h1",innerHTML:t.h1,title:"Level 1 heading",hotkey:"Mod-Shift-1"},h2:{name:"h2",action:"h2",innerHTML:t.h2,title:"Level 2 heading",hotkey:"Mod-Shift-2"},ul:{name:"ul",action:"ul",innerHTML:t.ul,title:"Bulleted list"},ol:{name:"ol",action:"ol",innerHTML:t.ol,title:"Numbered list"},blockquote:{name:"blockquote",action:"blockquote",innerHTML:t.blockquote,title:"Quote",hotkey:"Mod2-Shift-Q"},insertLink:{name:"insertLink",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&null,innerHTML:t.link,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&null,innerHTML:t.image,title:"Insert image",hotkey:"Mod2-Shift-I"},hr:{name:"hr",action:e=>e.paste("\n***\n"),enabled:()=>!1,innerHTML:t.hr,title:"Insert horizontal line",hotkey:"Mod2-Shift-L"}};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math===Math&&e},a=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i&&i)||function(){return this}()||i||Function("return this")(),l=function(e){try{return!!e()}catch(e){return!0}},o=!l((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={},c={get exports(){return u},set exports(e){u=e}},h=!l((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),p=h,d=Function.prototype,g=d.call,m=p&&d.bind.bind(g,g),f=p?m:function(e){return function(){return g.apply(e,arguments)}},M="object"==typeof document&&document.all,T={all:M,IS_HTMLDDA:void 0===M&&void 0!==M},F=T.all,D=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},y=function(e){return null==e},C=y,k=TypeError,b=function(e){if(C(e))throw new k("Can't call method on "+e);return e},E=Object,$=function(e){return E(b(e))},A=f({}.hasOwnProperty),w=Object.hasOwn||function(e,t){return A($(e),t)},v=o,x=w,S=Function.prototype,L=v&&Object.getOwnPropertyDescriptor,B=x(S,"name"),H={EXISTS:B,PROPER:B&&"something"===function(){}.name,CONFIGURABLE:B&&(!v||v&&L(S,"name").configurable)},N=a,_=Object.defineProperty,O=function(e,t){try{_(N,e,{value:t,configurable:!0,writable:!0})}catch(n){N[e]=t}return t},I="__core-js_shared__",P=a[I]||O(I,{}),j=D,z=P,R=f(Function.toString);j(z.inspectSource)||(z.inspectSource=function(e){return R(e)});var q,V,Z=z.inspectSource,K=D,U=a.WeakMap,W=K(U)&&/native code/.test(String(U)),X=D,G=T.all,Q=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:X(e)||e===G}:function(e){return"object"==typeof e?null!==e:X(e)},J={},Y=Q,ee=a.document,te=Y(ee)&&Y(ee.createElement),ne=function(e){return te?ee.createElement(e):{}},se=!o&&!l((function(){return 7!==Object.defineProperty(ne("div"),"a",{get:function(){return 7}}).a})),ie=o&&l((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),re=Q,ae=String,le=TypeError,oe=function(e){if(re(e))return e;throw new le(ae(e)+" is not an object")},ue=h,ce=Function.prototype.call,he=ue?ce.bind(ce):function(){return ce.apply(ce,arguments)},pe=a,de=D,ge=f({}.isPrototypeOf),me=a,fe="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Me=me.process,Te=me.Deno,Fe=Me&&Me.versions||Te&&Te.version,De=Fe&&Fe.v8;De&&(V=(q=De.split("."))[0]>0&&q[0]<4?1:+(q[0]+q[1])),!V&&fe&&(!(q=fe.match(/Edge\/(\d+)/))||q[1]>=74)&&(q=fe.match(/Chrome\/(\d+)/))&&(V=+q[1]);var ye=V,Ce=l,ke=a.String,be=!!Object.getOwnPropertySymbols&&!Ce((function(){var e=Symbol("symbol detection");return!ke(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ye&&ye<41})),Ee=be&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,$e=function(e,t){return arguments.length<2?(n=pe[e],de(n)?n:void 0):pe[e]&&pe[e][t];var n},Ae=D,we=ge,ve=Object,xe=Ee?function(e){return"symbol"==typeof e}:function(e){var t=$e("Symbol");return Ae(t)&&we(t.prototype,ve(e))},Se=String,Le=D,Be=function(e){try{return Se(e)}catch(e){return"Object"}},He=TypeError,Ne=function(e){if(Le(e))return e;throw new He(Be(e)+" is not a function")},_e=y,Oe=he,Ie=D,Pe=Q,je=TypeError,ze={},Re=P;({get exports(){return ze},set exports(e){ze=e}}.exports=function(e,t){return Re[e]||(Re[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var qe=f,Ve=0,Ze=Math.random(),Ke=qe(1..toString),Ue=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ke(++Ve+Ze,36)},We=ze,Xe=w,Ge=Ue,Qe=be,Je=Ee,Ye=a.Symbol,et=We("wks"),tt=Je?Ye.for||Ye:Ye&&Ye.withoutSetter||Ge,nt=he,st=Q,it=xe,rt=function(e,t){var n=e[t];return _e(n)?void 0:Ne(n)},at=function(e,t){var n,s;if("string"===t&&Ie(n=e.toString)&&!Pe(s=Oe(n,e)))return s;if(Ie(n=e.valueOf)&&!Pe(s=Oe(n,e)))return s;if("string"!==t&&Ie(n=e.toString)&&!Pe(s=Oe(n,e)))return s;throw new je("Can't convert object to primitive value")},lt=TypeError,ot=function(e){return Xe(et,e)||(et[e]=Qe&&Xe(Ye,e)?Ye[e]:tt("Symbol."+e)),et[e]}("toPrimitive"),ut=function(e,t){if(!st(e)||it(e))return e;var n,s=rt(e,ot);if(s){if(void 0===t&&(t="default"),n=nt(s,e,t),!st(n)||it(n))return n;throw new lt("Can't convert object to primitive value")}return void 0===t&&(t="number"),at(e,t)},ct=xe,ht=o,pt=se,dt=ie,gt=oe,mt=function(e){var t=ut(e,"string");return ct(t)?t:t+""},ft=TypeError,Mt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,Ft="enumerable",Dt="configurable",yt="writable";J.f=ht?dt?function(e,t,n){if(gt(e),t=mt(t),gt(n),"function"==typeof e&&"prototype"===t&&"value"in n&&yt in n&&!n[yt]){var s=Tt(e,t);s&&s[yt]&&(e[t]=n.value,n={configurable:Dt in n?n[Dt]:s[Dt],enumerable:Ft in n?n[Ft]:s[Ft],writable:!1})}return Mt(e,t,n)}:Mt:function(e,t,n){if(gt(e),t=mt(t),gt(n),pt)try{return Mt(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new ft("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Ct,kt,bt,Et=J,$t=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},At=o?function(e,t,n){return Et.f(e,t,$t(1,n))}:function(e,t,n){return e[t]=n,e},wt=Ue,vt=ze("keys"),xt=W,St=a,Lt=Q,Bt=At,Ht=w,Nt=P,_t=function(e){return vt[e]||(vt[e]=wt(e))},Ot="Object already initialized",It=St.TypeError,Pt=St.WeakMap;if(xt||Nt.state){var jt=Nt.state||(Nt.state=new Pt);jt.get=jt.get,jt.has=jt.has,jt.set=jt.set,Ct=function(e,t){if(jt.has(e))throw new It(Ot);return t.facade=e,jt.set(e,t),t},kt=function(e){return jt.get(e)||{}},bt=function(e){return jt.has(e)}}else{var zt=_t("state");Ct=function(e,t){if(Ht(e,zt))throw new It(Ot);return t.facade=e,Bt(e,zt,t),t},kt=function(e){return Ht(e,zt)?e[zt]:{}},bt=function(e){return Ht(e,zt)}}var Rt={set:Ct,get:kt,has:bt,enforce:function(e){return bt(e)?kt(e):Ct(e,{})},getterFor:function(e){return function(t){var n;if(!Lt(t)||(n=kt(t)).type!==e)throw new It("Incompatible receiver, "+e+" required");return n}}},qt=f,Vt=l,Zt=D,Kt=w,Ut=o,Wt=H.CONFIGURABLE,Xt=Z,Gt=Rt.enforce,Qt=Rt.get,Jt=String,Yt=Object.defineProperty,en=qt("".slice),tn=qt("".replace),nn=qt([].join),sn=Ut&&!Vt((function(){return 8!==Yt((function(){}),"length",{value:8}).length})),rn=String(String).split("String"),an=c.exports=function(e,t,n){"Symbol("===en(Jt(t),0,7)&&(t="["+tn(Jt(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Kt(e,"name")||Wt&&e.name!==t)&&(Ut?Yt(e,"name",{value:t,configurable:!0}):e.name=t),sn&&n&&Kt(n,"arity")&&e.length!==n.arity&&Yt(e,"length",{value:n.arity});try{n&&Kt(n,"constructor")&&n.constructor?Ut&&Yt(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var s=Gt(e);return Kt(s,"source")||(s.source=nn(rn,"string"==typeof t?t:"")),e};Function.prototype.toString=an((function(){return Zt(this)&&Qt(this).source||Xt(this)}),"toString");var ln=u,on=J,un=oe,cn=o,hn=function(e,t,n){return n.get&&ln(n.get,t,{getter:!0}),n.set&&ln(n.set,t,{setter:!0}),on.f(e,t,n)},pn=function(){var e=un(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},dn=l,gn=a.RegExp,mn=gn.prototype;cn&&dn((function(){var e=!0;try{gn(".","d")}catch(t){e=!1}var t={},n="",s=e?"dgimsy":"gimsy",i=function(e,s){Object.defineProperty(t,e,{get:function(){return n+=s,!0}})},r={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(r.hasIndices="d"),r)i(a,r[a]);return Object.getOwnPropertyDescriptor(mn,"flags").get.call(t)!==s||n!==s}))&&hn(mn,"flags",{configurable:!0,get:pn});const fn={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,Scheme:/[A-Za-z][A-Za-z0-9+.-]{1,31}/,Email:/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/,HTMLOpenTag:/<HTMLTagName(?:HTMLAttribute)*\s*\/?>/,HTMLCloseTag:/<\/HTMLTagName\s*>/,HTMLTagName:/[A-Za-z][A-Za-z0-9-]*/,HTMLComment:/<!--(?:[^>-]|(?:[^>-](?:[^-]|-[^-])*[^-]))-->/,HTMLPI:/<\?(?:|.|(?:[^?]|\?[^>])*)\?>/,HTMLDeclaration:/<![A-Z]+\s[^>]*>/,HTMLCDATA:/<!\[CDATA\[.*?\]\]>/,HTMLAttribute:/\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,HTMLAttValue:/\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,KnownTag:/address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/},Mn=new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/),Tn=new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/),Fn={TMH1:{regexp:/^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'},TMH2:{regexp:/^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH2">$1</span>$$2<span class="TMMark TMMark_TMH2">$3</span>'},TMH3:{regexp:/^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH3">$1</span>$$2<span class="TMMark TMMark_TMH3">$3</span>'},TMH4:{regexp:/^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH4">$1</span>$$2<span class="TMMark TMMark_TMH4">$3</span>'},TMH5:{regexp:/^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH5">$1</span>$$2<span class="TMMark TMMark_TMH5">$3</span>'},TMH6:{regexp:/^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH6">$1</span>$$2<span class="TMMark TMMark_TMH6">$3</span>'},TMBlockquote:{regexp:/^( {0,3}>[ ]?)(.*)$/,replacement:'<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'},TMCodeFenceBacktickOpen:{regexp:/^( {0,3}(?<seq>````*)\s*)([^`]*?)(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceTildeOpen:{regexp:/^( {0,3}(?<seq>~~~~*)\s*)(.*?)(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceBacktickClose:{regexp:/^( {0,3}(?<seq>````*))(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'},TMCodeFenceTildeClose:{regexp:/^( {0,3}(?<seq>~~~~*))(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'},TMBlankLine:{regexp:/^([ \t]*)$/,replacement:"$0"},TMSetextH1Marker:{regexp:/^ {0,3}=+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMSetextH2Marker:{regexp:/^ {0,3}-+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMHR:{regexp:/^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/,replacement:'<span class="TMMark TMMark_TMHR">$0</span>'},TMUL:{regexp:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMUL">$1</span>$$2'},TMOL:{regexp:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMOL">$1</span>$$2'},TMIndentedCode:{regexp:/^( {4}|\t)(.*)$/,replacement:'<span class="TMMark TMMark_TMIndentedCode">$1</span>$2'},TMLinkReferenceDefinition:{regexp:/^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,replacement:'<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',labelPlaceholder:2}};var Dn=[{start:/^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i,end:/(?:<\/script>|<\/pre>|<\/style>)/i,paraInterrupt:!0},{start:/^ {0,3}<!--/,end:/-->/,paraInterrupt:!0},{start:/^ {0,3}<\?/,end:/\?>/,paraInterrupt:!0},{start:/^ {0,3}<![A-Z]/,end:/>/,paraInterrupt:!0},{start:/^ {0,3}<!\[CDATA\[/,end:/\]\]>/,paraInterrupt:!0},{start:/^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i,end:!1,paraInterrupt:!0},{start:/^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/,end:!1,paraInterrupt:!1}],yn={escape:{regexp:/^\\(ASCIIPunctuation)/,replacement:'<span class="TMMark TMMark_TMEscape">\\</span>$1'},code:{regexp:/^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/,replacement:'<span class="TMMark TMMark_TMCode">$1</span><code class="TMCode">$2</code><span class="TMMark TMMark_TMCode">$3</span>'},autolink:{regexp:/^<((?:Scheme:[^\s<>]*)|(?:Email))>/,replacement:'<span class="TMMark TMMark_TMAutolink"><</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">></span>'},html:{regexp:/^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/,replacement:'<span class="TMHTML">$1</span>'},linkOpen:{regexp:/^\[/,replacement:""},imageOpen:{regexp:/^!\[/,replacement:""},linkLabel:{regexp:/^(\[\s*)([^\]]*?)(\s*\])/,replacement:"",labelPlaceholder:2},default:{regexp:/^(.|(?:NotTriggerChar+))/,replacement:"$1"}};const Cn=new RegExp(Object.keys(fn).join("|")),kn=[...Object.keys(yn)];for(let e of kn){let t=yn[e].regexp.source;for(;t.match(Cn);)t=t.replace(Cn,(e=>fn[e].source));yn[e].regexp=new RegExp(t,yn[e].regexp.flags)}for(let e of Dn){let t=e.start.source;for(;t.match(Cn);)t=t.replace(Cn,(e=>fn[e].source));e.start=new RegExp(t,e.start.flags)}function bn(e){return(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const En={bold:{type:"inline",className:"TMStrong",set:{pre:"**",post:"**"},unset:{prePattern:/(?:\*\*|__)$/,postPattern:/^(?:\*\*|__)/}},italic:{type:"inline",className:"TMEm",set:{pre:"*",post:"*"},unset:{prePattern:/(?:\*|_)$/,postPattern:/^(?:\*|_)/}},code:{type:"inline",className:"TMCode",set:{pre:"`",post:"`"},unset:{prePattern:/`+$/,postPattern:/^`+/}},strikethrough:{type:"inline",className:"TMStrikethrough",set:{pre:"~~",post:"~~"},unset:{prePattern:/~~$/,postPattern:/^~~/}},h1:{type:"line",className:"TMH1",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"# $2"},unset:{pattern:/^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h2:{type:"line",className:"TMH2",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"## $2"},unset:{pattern:/^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h3:{type:"line",className:"TMH3",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"### $2"},unset:{pattern:/^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h4:{type:"line",className:"TMH4",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"#### $2"},unset:{pattern:/^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h5:{type:"line",className:"TMH5",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"##### $2"},unset:{pattern:/^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h6:{type:"line",className:"TMH6",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"###### $2"},unset:{pattern:/^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},ul:{type:"line",className:"TMUL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"- $2"},unset:{pattern:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:"$2"}},ol:{type:"line",className:"TMOL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"$#. $2"},unset:{pattern:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:"$2"}},blockquote:{type:"line",className:"TMBlockquote",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"> $2"},unset:{pattern:/^( {0,3}>[ ]?)(.*)$/,replacement:"$2"}}};e.CommandBar=class{constructor(e){this.e=null,this.editor=null,this.commands=[],this.buttons={},this.state={},this.hotkeys=[];let t=e.element;t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.body),this.createCommandBarElement(t,e.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","|","blockquote","hr","|","insertLink","insertImage"]),document.addEventListener("keydown",(e=>this.handleKeydown(e))),e.editor&&this.setEditor(e.editor)}createCommandBarElement(e,t){this.e=document.createElement("div"),this.e.className="TMCommandBar";for(let e of t)if("|"==e){let e=document.createElement("div");e.className="TMCommandDivider",this.e.appendChild(e)}else{let t;if("string"==typeof e){if(!s[e])continue;t=e,this.commands[t]=s[t]}else{if("object"!=typeof e||!e.name)continue;t=e.name,this.commands[t]={},s[t]&&Object.assign(this.commands[t],s[t]),Object.assign(this.commands[t],e)}let i=this.commands[t].title||t;if(this.commands[t].hotkey){const e=this.commands[t].hotkey.split("-");let s=[],r=[];for(let t=0;t<e.length-1;t++)switch(e[t]){case"Ctrl":s.push("ctrlKey"),r.push("Ctrl");break;case"Cmd":s.push("metaKey"),r.push("⌘");break;case"Alt":s.push("altKey"),r.push("Alt");break;case"Option":s.push("altKey"),r.push("⌥");break;case"Win":s.push("metaKey"),r.push("⊞ Win");break;case"Shift":s.push("shiftKey"),r.push("⇧");break;case"Mod":n?(s.push("metaKey"),r.push("⌘")):(s.push("ctrlKey"),r.push("Ctrl"));break;case"Mod2":s.push("altKey"),n?r.push("⌥"):r.push("Alt")}r.push(e[e.length-1]);let a={modifiers:s,command:t};e[e.length-1].match(/^[0-9]$/)?a.code=`Digit${e[e.length-1]}`:a.key=e[e.length-1].toLowerCase(),this.hotkeys.push(a),i=i.concat(` (${r.join("+")})`)}this.buttons[t]=document.createElement("div"),this.buttons[t].className="TMCommandButton TMCommandButton_Disabled",this.buttons[t].title=i,this.buttons[t].innerHTML=this.commands[t].innerHTML,this.buttons[t].addEventListener("mousedown",(e=>this.handleClick(t,e))),this.e.appendChild(this.buttons[t])}e.appendChild(this.e)}handleClick(e,t){this.editor&&(t.preventDefault(),"string"==typeof this.commands[e].action?!1===this.state[e]?this.editor.setCommandState(e,!0):this.editor.setCommandState(e,!1):"function"==typeof this.commands[e].action&&this.commands[e].action(this.editor))}setEditor(e){this.editor=e,e.addEventListener("selection",(e=>this.handleSelection(e)))}handleSelection(e){if(e.commandState)for(let t in this.commands)void 0===e.commandState[t]?this.commands[t].enabled?this.state[t]=this.commands[t].enabled(this.editor,e.focus,e.anchor):this.state[t]=!e.focus&&null:this.state[t]=e.commandState[t],!0===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Active":!1===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Inactive":this.buttons[t].className="TMCommandButton TMCommandButton_Disabled"}handleKeydown(e){e:for(let t of this.hotkeys)if(t.key&&e.key.toLowerCase()==t.key||t.code&&e.code==t.code){for(let n of t.modifiers)if(!e[n])continue e;return void this.handleClick(t.command,e)}}},e.Editor=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[]};let t=e.element;this.textarea=e.textarea,this.textarea&&!this.textarea.tagName&&(this.textarea=document.getElementById(this.textarea),t||(t=this.textarea)),t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.getElementsByTagName("body")[0]),"TEXTAREA"==t.tagName&&(this.textarea=t,t=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.createEditorElement(t),this.setContent(e.content||!!this.textarea&&this.textarea.value||"# Hello TinyMDE!\nEdit **here**")}createEditorElement(e){this.e=document.createElement("div"),this.e.className="TinyMDE",this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",this.textarea&&this.textarea.parentNode==e&&this.textarea.nextSibling?e.insertBefore(this.e,this.textarea.nextSibling):e.appendChild(this.e),this.e.addEventListener("input",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>this.handleSelectionChangeEvent(e))),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),this.lineDirty=[];for(let e=0;e<this.lines.length;e++){let e=document.createElement("div");this.e.appendChild(e),this.lineDirty.push(!0)}this.lineTypes=new Array(this.lines.length),this.updateFormatting(),this.fireChange()}getContent(){return this.lines.join("\n")}updateFormatting(){this.updateLineTypes(),this.updateLinkLabels(),this.applyLineTypes()}updateLinkLabels(){this.linkLabels=[];for(let e=0;e<this.lines.length;e++)"TMLinkReferenceDefinition"==this.lineTypes[e]&&this.linkLabels.push(this.lineCaptures[e][Fn.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(/(\${1,2})([0-9])/g,((e,n,s)=>"$"==n?bn(t[s]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[s])}</span>`))}applyLineTypes(){for(let e=0;e<this.lines.length;e++){if(this.lineDirty[e]){let t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}updateLineTypes(){let e=!1,t=0,n=!1;for(let s=0;s<this.lines.length;s++){let i="TMPara",r=[this.lines[s]],a="$$0";if("TMCodeFenceBacktickOpen"==e){let n=Fn.TMCodeFenceBacktickClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceBacktickClose",a=Fn.TMCodeFenceBacktickClose.replacement,r=n,e=!1):(i="TMFencedCodeBacktick",a="$0",r=[this.lines[s]])}else if("TMCodeFenceTildeOpen"==e){let n=Fn.TMCodeFenceTildeClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceTildeClose",a=Fn.TMCodeFenceTildeClose.replacement,r=n,e=!1):(i="TMFencedCodeTilde",a="$0",r=[this.lines[s]])}if("TMPara"==i&&!1===n)for(let e of Dn)if(this.lines[s].match(e.start)&&(e.paraInterrupt||0==s||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1])){n=e;break}if(!1!==n&&(i="TMHTMLBlock",a="$0",r=[this.lines[s]],n.end?this.lines[s].match(n.end)&&(n=!1):(s==this.lines.length-1||this.lines[s+1].match(Fn.TMBlankLine.regexp))&&(n=!1)),"TMPara"==i)for(let e in Fn)if(Fn[e].regexp){let t=Fn[e].regexp.exec(this.lines[s]);if(t){i=e,a=Fn[e].replacement,r=t;break}}if("TMCodeFenceBacktickOpen"!=i&&"TMCodeFenceTildeOpen"!=i||(e=i,t=r.groups.seq.length),"TMIndentedCode"!=i&&"TMLinkReferenceDefinition"!=i||!(s>0)||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1]||(i="TMPara",r=[this.lines[s]],a="$$0"),"TMSetextH2Marker"==i){let e=Fn.TMUL.regexp.exec(this.lines[s]);e&&(i="TMUL",a=Fn.TMUL.replacement,r=e)}if("TMSetextH1Marker"==i||"TMSetextH2Marker"==i)if(0==s||"TMPara"!=this.lineTypes[s-1]){let e=Fn.TMHR.regexp.exec(this.lines[s]);e?(i="TMHR",r=e,a=Fn.TMHR.replacement):(i="TMPara",r=[this.lines[s]],a="$$0")}else{let e=s-1;const t="TMSetextH1Marker"==i?"TMSetextH1":"TMSetextH2";do{this.lineTypes[t]!=t&&(this.lineTypes[e]=t,this.lineDirty[t]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"==this.lineTypes[e])}this.lineTypes[s]!=i&&(this.lineTypes[s]=i,this.lineDirty[s]=!0),this.lineReplacements[s]=a,this.lineCaptures[s]=r}}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}parseLinkOrImage(e,t){let n=t?2:1,s=e.substr(0,n),i=t?"TMImage":"TMLink",r=n,a=1,l=!1,o=!1,u=[],c=[];e:for(;r<e.length&&!1===l;){let s=e.substr(r);for(let e of["escape","code","autolink","html"]){let t=yn[e].regexp.exec(s);if(t){r+=t[0].length;continue e}}if(s.match(yn.imageOpen.regexp))a++,r+=2;else if(s.match(yn.linkOpen.regexp)){if(a++,!t&&this.parseLinkOrImage(s,!1))return!1;r+=1}else s.match(/^\]/)&&(a--,0==a)?(l=e.substr(n,r-n),r++):r++}if(!1===l)return!1;let h=r<e.length?e.substr(r,1):"";if("["==h){let t=e.substr(r),n=yn.linkLabel.regexp.exec(t);if(!n)return!1;r+=n[0].length,u.push(n[1],n[2],n[3]),o=n[yn.linkLabel.labelPlaceholder]?n[yn.linkLabel.labelPlaceholder]:l.trim()}else if("("!=h)o=l.trim();else{r++;let t=1;for(;r<e.length&&t>0;){let n=e.substr(r),s=/^\s+/.exec(n);if(s){switch(c.length){case 0:case 1:c.push(s[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(s[0]);else{if(1!=t)return!1;c.push(""),c.push(s[0])}break;case 3:c.push(s[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;case 7:c[6]=c[6].concat(s[0]);break;default:return!1}r+=s[0].length}else if(s=yn.escape.regexp.exec(n),s){switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else if(c.length<2&&n.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),r++;else if(1!=c.length&&2!=c.length||!n.match(/^>/))if(s=/^["']/.exec(n),!s||0!=c.length&&1!=c.length&&4!=c.length)if(!s||5!=c.length&&6!=c.length||c[4]!=s[0])if(n.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||t++;break;case 3:c.push("");case 4:c.push("(");break;case 5:c.push("");case 6:if("("==c[4])return!1;c[5]=c[5].concat("(");break;default:return!1}r++}else if(n.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||t--,t>0&&(c[1]=c[1].concat(")"))}else 5==c.length||6==c.length?"("==c[4]?(5==c.length&&c.push(""),c.push(")")):5==c.length?c.push(")"):c[5]=c[5].concat(")"):t--;if(0==t)for(;c.length<7;)c.push("");r++}else{if(s=/^./.exec(n),!s)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else 5==c.length&&c.push(""),c.push(s[0]),r++;else{for(;c.length<4;)c.push("");c.push(s[0]),r++}else 1==c.length&&c.push(""),c.push(">"),r++}if(t>0)return!1}if(!1!==o){let e=!1;for(let t of this.linkLabels)if(t==o){e=!0;break}let t=e?"TMLinkLabel TMLinkLabel_Valid":"TMLinkLabel TMLinkLabel_Invalid",n=`<span class="TMMark TMMark_${i}">${s}</span><span class="${i} ${u.length<3||!u[1]?t:""}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">]</span>`;return u.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${i}">${u[0]}</span>`,`<span class="${t}">${u[1]}</span>`,`<span class="TMMark TMMark_${i}">${u[2]}</span>`)),{output:n,charCount:r}}if(c){for(;c.length<7;)c.push("");return{output:`<span class="TMMark TMMark_${i}">${s}</span><span class="${i}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">](${c[0]}</span><span class="${i}Destination">${c[1]}</span><span class="TMMark TMMark_${i}">${c[2]}${c[3]}${c[4]}</span><span class="${i}Title">${c[5]}</span><span class="TMMark TMMark_${i}">${c[6]})</span>`,charCount:r}}return!1}processInlineStyles(e){let t="",n=[],s=0,i=e;e:for(;i;){for(let e of["escape","code","autolink","html"]){let n=yn[e].regexp.exec(i);if(n){i=i.substr(n[0].length),s+=n[0].length,t+=yn[e].replacement.replace(/\$([1-9])/g,((e,t)=>bn(n[t])));continue e}}let r=i.match(yn.linkOpen.regexp),a=i.match(yn.imageOpen.regexp);if(a||r){let e=this.parseLinkOrImage(i,a);if(e){t=`${t}${e.output}`,i=i.substr(e.charCount),s+=e.charCount;continue e}}let l=/(^\*+)|(^_+)/.exec(i);if(l){let r=l[0].length;const a=l[0],o=l[0][0];i=i.substr(l[0].length);const u=s>0?e.substr(0,s):" ",c=s+l[0].length<e.length?i:" ",h=c.match(Mn),p=u.match(Tn),d=c.match(/^\s/),g=u.match(/\s$/);let m=!(d||h&&!g&&!p),f=!(g||p&&!d&&!h);if("_"==o&&m&&f&&(m=p,f=h),f){let e=n.length-1;for(;r&&e>=0;)if(n[e].delimiter==o){for(;e<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}if(r>=2&&n[e].count>=2?(t=`<span class="TMMark">${o}${o}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${o}${o}</span>`,r-=2,n[e].count-=2):(t=`<span class="TMMark">${o}</span><em class="TMEm">${t}</em><span class="TMMark">${o}</span>`,r-=1,n[e].count-=1),0==n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}r&&m&&(n.push({delimiter:o,delimString:a,count:r,output:t}),t="",r=0),r&&(t=`${t}${a.substr(0,r)}`),s+=l[0].length}else if(l=/^~~/.exec(i),l){let e=!1,r=n.length-1;for(;!e&&r>=0;)if("~"==n[r].delimiter){for(;r<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}t=`<span class="TMMark">~~</span><del class="TMStrikethrough">${t}</del><span class="TMMark">~~</span>`,t=`${n.pop().output}${t}`,e=!0}else r--;e||(n.push({delimiter:"~",delimString:"~~",count:2,output:t}),t=""),s+=l[0].length,i=i.substr(l[0].length)}else{if(l=yn.default.regexp.exec(i),!l)throw"Infinite loop!";i=i.substr(l[0].length),s+=l[0].length,t+=yn.default.replacement.replace(/\$([1-9])/g,((e,t)=>bn(l[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}clearDirtyFlag(){this.lineDirty=new Array(this.lines.length);for(let e=0;e<this.lineDirty.length;e++)this.lineDirty[e]=!1}updateLineContents(){let e=this.e.childElementCount-this.lines.length;if(e){let t=0;for(;t<=this.lines.length&&t<=this.lineElements.length&&this.lineElements[t]&&this.lines[t]==this.lineElements[t].textContent;)t++;let n=-1;for(;-n<this.lines.length&&-n<this.lineElements.length&&this.lines[this.lines.length+n]==this.lineElements[this.lineElements.length+n].textContent;)n--;let s=this.lines.length+n+1-t;s<-e&&(s=-e),s<0&&(s=0);let i=[];for(let n=0;n<s+e;n++)i.push(this.lineElements[t+n].textContent);this.spliceLines(t,s,i,!1)}else for(let e=0;e<this.lineElements.length;e++){let t=this.lineElements[e].textContent;this.lines[e]!==t&&(this.lines[e]=t,this.lineDirty[e]=!0)}}processNewParagraph(e){if(!e)return;this.updateLineContents();let t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}let s=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(1!=s.length){if(this.spliceLines(e.row,1,s,!0),e.row++,e.col=0,t){let n=Fn[t].regexp.exec(this.lines[e.row-1]);n&&(n[2]?("TMOL"==t&&(n[1]=n[1].replace(/\d{1,9}/,(e=>parseInt(e[0])+1))),this.lines[e.row]=`${n[1]}${this.lines[e.row]}`,this.lineDirty[e.row]=!0,e.col=n[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}else this.updateFormatting()}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=window.getSelection();let n=e?t.anchorNode:t.focusNode;if(!n)return null;let s=n.nodeType===Node.TEXT_NODE?e?t.anchorOffset:t.focusOffset:0;if(n==this.e)return{row:0,col:s};let i=this.computeColumn(n,s);if(null===i)return null;let r=n;for(;r.parentElement!=this.e;)r=r.parentElement;let a=0;if(!r.dataset||!r.dataset.lineNum||r.previousSibling&&r.previousSibling.dataset.lineNum==r.dataset.lineNum)for(;r.previousSibling;)a++,r=r.previousSibling;else a=parseInt(r.dataset.lineNum);return{row:a,col:i,node:n}}computeColumn(e,t){let n=e,s=t;for(;n&&n.parentNode!=this.e;)n=n.parentNode;if(null==n)return null;for(n=e;n.parentNode!=this.e;)n.previousSibling?(n=n.previousSibling,s+=n.textContent.length):n=n.parentNode;return s}computeNodeAndOffset(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e>=this.lineElements.length&&(e=this.lineElements.length-1,t=this.lines[e].length),t>this.lines[e].length&&(t=this.lines[e].length);const s=this.lineElements[e];let i=s.firstChild,r=!1,a={node:s.firstChild?s.firstChild:s,offset:0};for(;i!=s;){if(!r&&i.nodeType===Node.TEXT_NODE)if(i.nodeValue.length>=t){if(!n||i.nodeValue.length!=t)return{node:i,offset:t};a={node:i,offset:t},t=0}else t-=i.nodeValue.length;!r&&i.firstChild?i=i.firstChild:i.nextSibling?(r=!1,i=i.nextSibling):(r=!0,i=i.parentNode)}return a}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let n=document.createRange(),{node:s,offset:i}=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),r=null,a=null;if(t&&(t.row!=e.row||t.col!=e.col)){let{node:n,offset:s}=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col);r=n,a=s}r?n.setStart(r,a):n.setStart(s,i),n.setEnd(s,i);let l=window.getSelection();l.removeAllRanges(),l.addRange(n)}handleInputEvent(e){let t=this.getSelection();if("insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t){if(this.e.firstChild){for(let e=this.e.firstChild;e;e=e.nextSibling)if(3!=e.nodeType||"DIV"!=e.tagName){let t=document.createElement("div");this.e.insertBefore(t,e),this.e.removeChild(e),t.appendChild(e)}}else this.e.innerHTML='<div class="TMBlankLine"><br></div>';this.updateLineContentsAndFormatting()}else this.clearDirtyFlag(),this.processNewParagraph(t);t&&this.setSelection(t),this.fireChange()}handleSelectionChangeEvent(){this.fireSelection()}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(s)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let i=[],r=[];for(let t=0;t<n.length;t++)i.push(""),r.push(!0),s&&(this.e.childNodes[e]?this.e.insertBefore(document.createElement("div"),this.e.childNodes[e]):this.e.appendChild(document.createElement("div")));this.lines.splice(e,t,...n),this.lineTypes.splice(e,t,...i),this.lineDirty.splice(e,t,...r)}handlePaste(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}paste(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s||(s=this.getSelection(!0)),i||(i=this.getSelection(!1)),i||(i={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),s||(s=i),s.row<i.row||s.row==i.row&&s.col<=i.col?(t=s,n=i):(t=i,n=s);let r=e.split(/(?:\r\n|\r|\n)/),a=this.lines[t.row].substr(0,t.col),l=this.lines[n.row].substr(n.col);r[0]=a.concat(r[0]);let o=r[r.length-1].length;r[r.length-1]=r[r.length-1].concat(l),this.spliceLines(t.row,1+n.row-t.row,r),i.row=t.row+r.length-1,i.col=o,this.updateFormatting(),this.setSelection(i),this.fireChange()}computeCommonAncestor(e,t){if(!e||!t)return null;if(e==t)return e;const n=e=>{let t=[];for(;e;)t.unshift(e),e=e.parentNode;return t},s=n(e),i=n(t);if(s[0]!=i[0])return null;let r;for(r=0;s[r]==i[r];r++);return s[r-1]}computeEnclosingMarkupNode(e,t,n){let s=null;if(!e)return null;if(t){if(e.row!=t.row)return null;s=this.computeCommonAncestor(e.node,t.node)}else s=e.node;if(!s)return null;for(;s!=this.e;){if(s.className&&s.className.includes(n))return s;s=s.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={};if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n){for(let e in En)i[e]=null;return i}s||(s=n),s.row<n.row||s.row==n.row&&s.col<n.col?(e=s,t=n):(e=n,t=s),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length);for(let r in En)if("inline"==En[r].type&&(n&&n.row==s.row&&this.isInlineFormattingAllowed(n,s)?i[r]=!!this.computeEnclosingMarkupNode(n,s,En[r].className)||n.col==s.col&&!!this.lines[n.row].substr(0,n.col).match(En[r].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(En[r].unset.postPattern):i[r]=null),"line"==En[r].type)if(n){let n=this.lineTypes[e.row]==En[r].className;for(let s=e.row;s<=t.row;s++)if(this.lineTypes[s]==En[r].className!=n){n=null;break}i[r]=n}else i[r]=null;return i}setCommandState(e,t){if("inline"==En[e].type){let t=this.getSelection(!0),n=this.getSelection(!1);if(t||(t=n),!t)return;if(t.row!=n.row)return;if(!this.isInlineFormattingAllowed(n,t))return;let s=this.computeEnclosingMarkupNode(n,t,En[e].className);if(this.clearDirtyFlag(),s){this.lineDirty[n.row]=!0;const i=this.computeColumn(s,0),r=s.textContent.length,a=this.lines[n.row].substr(0,i).replace(En[e].unset.prePattern,""),l=this.lines[n.row].substr(i,r),o=this.lines[n.row].substr(i+r).replace(En[e].unset.postPattern,"");this.lines[n.row]=a.concat(l,o),t.col=a.length,n.col=t.col+r,this.updateFormatting(),this.setSelection(n,t)}else if(n.col==t.col&&this.lines[n.row].substr(0,n.col).match(En[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(En[e].unset.postPattern)){this.lineDirty[n.row]=!0;const s=this.lines[n.row].substr(0,n.col).replace(En[e].unset.prePattern,""),i=this.lines[n.row].substr(n.col).replace(En[e].unset.postPattern,"");this.lines[n.row]=s.concat(i),n.col=t.col=s.length,this.updateFormatting(),this.setSelection(n,t)}else{let{startCol:s,endCol:i}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},r=this.lines[n.row].substr(s,i-s).match(/^(?<leading>\s*).*\S(?<trailing>\s*)$/);r&&(s+=r.groups.leading.length,i-=r.groups.trailing.length),n.col=s,t.col=i,this.wrapSelection(En[e].set.pre,En[e].set.post,n,t)}}else if("line"==En[e].type){let n=this.getSelection(!0),s=this.getSelection(!1);if(n||(n=s),!s)return;this.clearDirtyFlag();let i=n.row>s.row?s:n,r=n.row>s.row?n:s;r.row>i.row&&0==r.col&&r.row--;for(let n=i.row;n<=r.row;n++)t&&this.lineTypes[n]!=En[e].className&&(this.lines[n]=this.lines[n].replace(En[e].set.pattern,En[e].set.replacement.replace("$#",n-i.row+1)),this.lineDirty[n]=!0),t||this.lineTypes[n]!=En[e].className||(this.lines[n]=this.lines[n].replace(En[e].unset.pattern,En[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:r.row,col:this.lines[r.row].length},{row:i.row,col:0})}}isInlineFormattingAllowed(){const e=window.getSelection();if(!e)return!1;if(e.isCollapsed&&3==e.focusNode.nodeType&&e.focusOffset==e.focusNode.nodeValue.length){let t;for(t=e.focusNode;t&&null==t.nextSibling;t=t.parentNode);if(t&&t.nextSibling.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!=this.e;){if(t.className&&(t.className.includes("TMInlineFormatted")||t.className.includes("TMBlankLine")))return!0;t=t.parentNode}return!1}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n||!s||n.row!=s.row)return;this.lineDirty[n.row]=!0;const i=n.col<s.col?n.col:s.col,r=n.col<s.col?s.col:n.col,a=this.lines[n.row].substr(0,i).concat(e),l=r==i?"":this.lines[n.row].substr(i,r-i),o=t.concat(this.lines[n.row].substr(r));this.lines[n.row]=a.concat(l,o),s.col=a.length,n.col=s.col+l.length,this.updateFormatting(),this.setSelection(n,s)}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireChange(){if(!this.textarea&&!this.listeners.change.length)return;const e=this.getContent();this.textarea&&(this.textarea.value=e);for(let t of this.listeners.change)t({content:e,linesDirty:this.linesDirty})}fireSelection(){if(this.listeners.selection&&this.listeners.selection.length){let e=this.getSelection(!1),t=this.getSelection(!0),n=this.getCommandState(e,t);this.lastCommandState?Object.assign(this.lastCommandState,n):this.lastCommandState=Object.assign({},n);for(let n of this.listeners.selection)n({focus:e,anchor:t,commandState:this.lastCommandState})}}addEventListener(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t)}},Object.defineProperty(e,"__esModule",{value:!0})}));
|