diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f716a45..523700d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: echo echo 'Updates to the webapp were not bundled to webapp/dist/.' echo 'Please run:' - echo ' rm -r node_modules .package-lock.json && npm install && npm run build' + echo ' rm -r node_modules package-lock.json && npm install && npm run build' exit 1 fi clippy: diff --git a/webapp/dist/assets/index-B6VXl2sj.js b/webapp/dist/assets/index-yvpKRxqu.js similarity index 72% rename from webapp/dist/assets/index-B6VXl2sj.js rename to webapp/dist/assets/index-yvpKRxqu.js index 4c64e7e..676be32 100644 --- a/webapp/dist/assets/index-B6VXl2sj.js +++ b/webapp/dist/assets/index-yvpKRxqu.js @@ -1,27 +1,27 @@ -var af=Object.defineProperty;var of=(O,b,T)=>b in O?af(O,b,{enumerable:!0,configurable:!0,writable:!0,value:T}):O[b]=T;var Do=(O,b,T)=>(of(O,typeof b!="symbol"?b+"":b,T),T);(function(){const b=document.createElement("link").relList;if(b&&b.supports&&b.supports("modulepreload"))return;for(const M of document.querySelectorAll('link[rel="modulepreload"]'))N(M);new MutationObserver(M=>{for(const G of M)if(G.type==="childList")for(const h of G.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&N(h)}).observe(document,{childList:!0,subtree:!0});function T(M){const G={};return M.integrity&&(G.integrity=M.integrity),M.referrerPolicy&&(G.referrerPolicy=M.referrerPolicy),M.crossOrigin==="use-credentials"?G.credentials="include":M.crossOrigin==="anonymous"?G.credentials="omit":G.credentials="same-origin",G}function N(M){if(M.ep)return;M.ep=!0;const G=T(M);fetch(M.href,G)}})();var sf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uf(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var Ro={exports:{}};(function(O,b){(function(T,N){O.exports=N()})(sf,function(){var T=navigator.userAgent,N=navigator.platform,M=/gecko\/\d/i.test(T),G=/MSIE \d/.test(T),h=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(T),d=/Edge\/(\d+)/.exec(T),g=G||h||d,v=g&&(G?document.documentMode||6:+(d||h)[1]),m=!d&&/WebKit\//.test(T),w=m&&/Qt\/\d+\.\d+/.test(T),x=!d&&/Chrome\/(\d+)/.exec(T),_=x&&+x[1],I=/Opera\//.test(T),K=/Apple Computer/.test(navigator.vendor),$=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(T),q=/PhantomJS/.test(T),Z=K&&(/Mobile\/\w+/.test(T)||navigator.maxTouchPoints>2),le=/Android/.test(T),ie=Z||le||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(T),ne=Z||/Mac/.test(N),he=/\bCrOS\b/.test(T),re=/win/i.test(N),J=I&&T.match(/Version\/(\d*\.\d*)/);J&&(J=Number(J[1])),J&&J>=15&&(I=!1,m=!0);var ye=ne&&(w||I&&(J==null||J<12.11)),Ie=M||g&&v>=9;function Ke(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Me=function(e,t){var i=e.className,r=Ke(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function qe(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function De(e,t){return qe(e).appendChild(t)}function Q(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var l=0;l=t)return a+(t-l);a+=o-l,a+=i-a%i,l=o+1}}var gt=function(){this.id=null,this.f=null,this.time=0,this.handler=gr(this.onTimeout,this)};gt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},gt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(a,t-n);if(n+=l-r,n+=i-n%i,r=l+1,n>=t)return r}}var pr=[""];function vr(e){for(;pr.length<=e;)pr.push(f(pr)+" ");return pr[e]}function f(e){return e[e.length-1]}function y(e,t){for(var i=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||D.test(e))}function H(e,t){return t?t.source.indexOf("\\w")>-1&&F(e)?!0:t.test(e):F(e)}function R(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ae=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ue(e){return e.charCodeAt(0)>=768&&ae.test(e)}function ce(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,l=r<0?Math.ceil(n):Math.floor(n);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function Ce(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,l=0;lt||t==i&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,i),a.level==1?"rtl":"ltr",l),n=!0)}n||r(t,i,"ltr")}var be=null;function Ne(e,t,i){var r;be=null;for(var n=0;nt)return n;l.to==t&&(l.from!=l.to&&i=="before"?r=n:be=n),l.from==t&&(l.from!=l.to&&i!="before"?r=n:be=n)}return r??be}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,l=/[LRr]/,a=/[Lb1n]/,o=/[1n]/;function s(u,c,p){this.level=u,this.from=c,this.to=p}return function(u,c){var p=c=="ltr"?"L":"R";if(u.length==0||c=="ltr"&&!r.test(u))return!1;for(var L=u.length,C=[],E=0;E-1&&(r[t]=n.slice(0,l).concat(n.slice(l+1)))}}}function Te(e,t){var i=yr(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Mt(e){e.prototype.on=function(t,i){te(this,t,i)},e.prototype.off=function(t,i){je(this,t,i)}}function Oe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Al(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function gn(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Xr(e){Oe(e),Al(e)}function pn(e){return e.target||e.srcElement}function Ml(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var Jo=function(){if(g&&v<9)return!1;var e=Q("div");return"draggable"in e||"dragDrop"in e}(),vn;function jo(e){if(vn==null){var t=Q("span","​");De(e,Q("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(vn=t.offsetWidth<=1&&t.offsetHeight>2&&!(g&&v<8))}var i=vn?Q("span","​"):Q("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var yn;function Vo(e){if(yn!=null)return yn;var t=De(e,document.createTextNode("AخA")),i=bt(t,0,1).getBoundingClientRect(),r=bt(t,1,2).getBoundingClientRect();return qe(e),!i||i.left==i.right?!1:yn=r.right-i.right<3}var mn=` +var of=Object.defineProperty;var sf=(O,b,T)=>b in O?of(O,b,{enumerable:!0,configurable:!0,writable:!0,value:T}):O[b]=T;var No=(O,b,T)=>(sf(O,typeof b!="symbol"?b+"":b,T),T);(function(){const b=document.createElement("link").relList;if(b&&b.supports&&b.supports("modulepreload"))return;for(const M of document.querySelectorAll('link[rel="modulepreload"]'))N(M);new MutationObserver(M=>{for(const G of M)if(G.type==="childList")for(const h of G.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&N(h)}).observe(document,{childList:!0,subtree:!0});function T(M){const G={};return M.integrity&&(G.integrity=M.integrity),M.referrerPolicy&&(G.referrerPolicy=M.referrerPolicy),M.crossOrigin==="use-credentials"?G.credentials="include":M.crossOrigin==="anonymous"?G.credentials="omit":G.credentials="same-origin",G}function N(M){if(M.ep)return;M.ep=!0;const G=T(M);fetch(M.href,G)}})();var uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ff(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var wl={exports:{}},Oo;function Uo(){return Oo||(Oo=1,function(O,b){(function(T,N){O.exports=N()})(uf,function(){var T=navigator.userAgent,N=navigator.platform,M=/gecko\/\d/i.test(T),G=/MSIE \d/.test(T),h=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(T),d=/Edge\/(\d+)/.exec(T),g=G||h||d,v=g&&(G?document.documentMode||6:+(d||h)[1]),m=!d&&/WebKit\//.test(T),w=m&&/Qt\/\d+\.\d+/.test(T),x=!d&&/Chrome\/(\d+)/.exec(T),_=x&&+x[1],I=/Opera\//.test(T),K=/Apple Computer/.test(navigator.vendor),$=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(T),q=/PhantomJS/.test(T),Z=K&&(/Mobile\/\w+/.test(T)||navigator.maxTouchPoints>2),le=/Android/.test(T),ie=Z||le||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(T),ne=Z||/Mac/.test(N),he=/\bCrOS\b/.test(T),re=/win/i.test(N),J=I&&T.match(/Version\/(\d*\.\d*)/);J&&(J=Number(J[1])),J&&J>=15&&(I=!1,m=!0);var ye=ne&&(w||I&&(J==null||J<12.11)),Ie=M||g&&v>=9;function Ke(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Me=function(e,t){var i=e.className,r=Ke(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function qe(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function De(e,t){return qe(e).appendChild(t)}function Q(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var l=0;l=t)return a+(t-l);a+=o-l,a+=i-a%i,l=o+1}}var gt=function(){this.id=null,this.f=null,this.time=0,this.handler=gr(this.onTimeout,this)};gt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},gt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(a,t-n);if(n+=l-r,n+=i-n%i,r=l+1,n>=t)return r}}var pr=[""];function vr(e){for(;pr.length<=e;)pr.push(f(pr)+" ");return pr[e]}function f(e){return e[e.length-1]}function y(e,t){for(var i=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||D.test(e))}function H(e,t){return t?t.source.indexOf("\\w")>-1&&F(e)?!0:t.test(e):F(e)}function R(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ae=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ue(e){return e.charCodeAt(0)>=768&&ae.test(e)}function ce(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,l=r<0?Math.ceil(n):Math.floor(n);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function Ce(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,l=0;lt||t==i&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,i),a.level==1?"rtl":"ltr",l),n=!0)}n||r(t,i,"ltr")}var be=null;function Ne(e,t,i){var r;be=null;for(var n=0;nt)return n;l.to==t&&(l.from!=l.to&&i=="before"?r=n:be=n),l.from==t&&(l.from!=l.to&&i!="before"?r=n:be=n)}return r??be}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,l=/[LRr]/,a=/[Lb1n]/,o=/[1n]/;function s(u,c,p){this.level=u,this.from=c,this.to=p}return function(u,c){var p=c=="ltr"?"L":"R";if(u.length==0||c=="ltr"&&!r.test(u))return!1;for(var L=u.length,C=[],E=0;E-1&&(r[t]=n.slice(0,l).concat(n.slice(l+1)))}}}function Te(e,t){var i=yr(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Mt(e){e.prototype.on=function(t,i){te(this,t,i)},e.prototype.off=function(t,i){je(this,t,i)}}function Oe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ml(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function gn(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Xr(e){Oe(e),Ml(e)}function pn(e){return e.target||e.srcElement}function _l(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var jo=function(){if(g&&v<9)return!1;var e=Q("div");return"draggable"in e||"dragDrop"in e}(),vn;function Vo(e){if(vn==null){var t=Q("span","​");De(e,Q("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(vn=t.offsetWidth<=1&&t.offsetHeight>2&&!(g&&v<8))}var i=vn?Q("span","​"):Q("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var yn;function es(e){if(yn!=null)return yn;var t=De(e,document.createTextNode("AخA")),i=bt(t,0,1).getBoundingClientRect(),r=bt(t,1,2).getBoundingClientRect();return qe(e),!i||i.left==i.right?!1:yn=r.right-i.right<3}var mn=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var l=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),a=l.indexOf("\r");a!=-1?(i.push(l.slice(0,a)),t+=a+1):(i.push(l),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},es=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},ts=function(){var e=Q("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bn=null;function rs(e){if(bn!=null)return bn;var t=De(e,Q("span","x")),i=t.getBoundingClientRect(),r=bt(t,0,1).getBoundingClientRect();return bn=Math.abs(i.left-r.left)>1}var wn={},mr={};function is(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),wn[e]=t}function ns(e,t){mr[e]=t}function Di(e){if(typeof e=="string"&&mr.hasOwnProperty(e))e=mr[e];else if(e&&typeof e.name=="string"&&mr.hasOwnProperty(e.name)){var t=mr[e.name];typeof t=="string"&&(t={name:t}),e=A(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Di("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Di("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Cn(e,t){t=Di(t);var i=wn[t.name];if(!i)return Cn(e,"text/plain");var r=i(e,t);if(br.hasOwnProperty(t.name)){var n=br[t.name];for(var l in n)n.hasOwnProperty(l)&&(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=n[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var br={};function ls(e,t){var i=br.hasOwnProperty(e)?br[e]:br[e]={};dt(t,i)}function jt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Sn(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function _l(e,t,i){return e.startState?e.startState(t,i):!0}var Ee=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ee.prototype.eol=function(){return this.pos>=this.string.length},Ee.prototype.sol=function(){return this.pos==this.lineStart},Ee.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ee.prototype.next=function(){if(this.post},Ee.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ee.prototype.skipToEnd=function(){this.pos=this.string.length},Ee.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ee.prototype.backUp=function(e){this.pos-=e},Ee.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},Ee.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ee.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ee.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ee.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function j(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],l=n.chunkSize();if(t=e.first&&ti?P(i,j(e,i).text.length):as(t,j(e,t.line).text.length)}function as(e,t){var i=e.ch;return i==null||i>t?P(e.line,t):i<0?P(e.line,0):e}function Nl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ct.fromSaved=function(e,t,i){return t instanceof Ei?new Ct(e,jt(e.mode,t.state),i,t.lookAhead):new Ct(e,jt(e.mode,t),i)},Ct.prototype.save=function(e){var t=e!==!1?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ei(t,this.maxLookAhead):t};function Ol(e,t,i,r){var n=[e.state.modeGen],l={};Pl(e,t.text,e.doc.mode,i,function(u,c){return n.push(u,c)},l,r);for(var a=i.state,o=function(u){i.baseTokens=n;var c=e.state.overlays[u],p=1,L=0;i.state=!0,Pl(e,t.text,c.mode,i,function(C,E){for(var W=p;LC&&n.splice(p,1,C,n[p+1],B),p+=2,L=Math.min(C,B)}if(E)if(c.opaque)n.splice(W,p-W,C,"overlay "+E),p=W+2;else for(;We.options.maxHighlightLength&&jt(e.doc.mode,r.state),l=Ol(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function $r(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Ct(r,!0,t);var l=os(e,t,i),a=l>r.first&&j(r,l-1).stateAfter,o=a?Ct.fromSaved(r,a,l):new Ct(r,_l(r.mode),l);return r.iter(l,t,function(s){An(e,s.text,o);var u=o.line;s.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&ut.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var Fl=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Il(e,t,i,r){var n=e.doc,l=n.mode,a;t=se(n,t);var o=j(n,t.line),s=$r(e,t.line,i),u=new Ee(o.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||u.pose.options.maxHighlightLength?(o=!1,a&&An(e,t,r,c.pos),c.pos=t.length,p=null):p=Hl(Mn(i,c,r.state,L),l),L){var C=L[0].name;C&&(p="m-"+(p?C+" "+p:C))}if(!o||u!=p){for(;sa;--o){if(o<=l.first)return l.first;var s=j(l,o-1),u=s.stateAfter;if(u&&(!i||o+(u instanceof Ei?u.lookAhead:0)<=l.modeFrontier))return o;var c=Ze(s.text,null,e.options.tabSize);(n==null||r>c)&&(n=o-1,r=c)}return n}function ss(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=j(e,r).stateAfter;if(n&&(!(n instanceof Ei)||r+n.lookAhead=t:l.to>t);(r||(r=[])).push(new Wi(a,l.from,s?null:l.to))}}return r}function gs(e,t,i){var r;if(e)for(var n=0;n=t:l.to>t);if(o||l.from==t&&a.type=="bookmark"&&(!i||l.marker.insertLeft)){var s=l.from==null||(a.inclusiveLeft?l.from<=t:l.from0&&o)for(var Y=0;Y0)){var c=[s,1],p=oe(u.from,o.from),L=oe(u.to,o.to);(p<0||!a.inclusiveLeft&&!p)&&c.push({from:u.from,to:o.from}),(L>0||!a.inclusiveRight&&!L)&&c.push({from:o.to,to:u.to}),n.splice.apply(n,c),s+=c.length-3}}return n}function zl(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||Dn(r,l.marker)<0)&&(r=l.marker)}return r}function Xl(e,t,i,r,n){var l=j(e,t),a=_t&&l.markedSpans;if(a)for(var o=0;o=0&&p<=0||c<=0&&p>=0)&&(c<=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?oe(u.to,i)>=0:oe(u.to,i)>0)||c>=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?oe(u.from,r)<=0:oe(u.from,r)<0)))return!0}}}function pt(e){for(var t;t=Kl(e);)e=t.find(-1,!0).line;return e}function ys(e){for(var t;t=Hi(e);)e=t.find(1,!0).line;return e}function ms(e){for(var t,i;t=Hi(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Nn(e,t){var i=j(e,t),r=pt(i);return i==r?t:pe(r)}function Yl(e,t){if(t>e.lastLine())return t;var i=j(e,t),r;if(!Bt(e,i))return t;for(;r=Hi(i);)i=r.find(1,!0).line;return pe(i)+1}function Bt(e,t){var i=_t&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var wr=function(e,t,i){this.text=e,Ul(this,t),this.height=i?i(this):1};wr.prototype.lineNo=function(){return pe(this)},Mt(wr);function bs(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),zl(e),Ul(e,i);var n=r?r(e):1;n!=e.height&&wt(e,n)}function ws(e){e.parent=null,zl(e)}var Cs={},Ss={};function $l(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ss:Cs;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ql(e,t){var i=kt("span",null,null,m?"padding-right: .1px":null),r={pre:kt("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var l=n?t.rest[n-1]:t.line,a=void 0;r.pos=0,r.addToken=Ts,Vo(e.display.measure)&&(a=ge(l,e.doc.direction))&&(r.addToken=xs(r.addToken,a)),r.map=[];var o=t!=e.display.externalMeasured&&pe(l);As(l,r,El(e,l,o)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=zr(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=zr(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jo(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(m){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Te(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=zr(r.pre.className,r.textClass||"")),r}function Ls(e){var t=Q("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ts(e,t,i,r,n,l,a){if(t){var o=e.splitSpaces?ks(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(o),e.map.push(e.pos,e.pos+t.length,c),g&&v<9&&(u=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var p=0;;){s.lastIndex=p;var L=s.exec(t),C=L?L.index-p:t.length-p;if(C){var E=document.createTextNode(o.slice(p,p+C));g&&v<9?c.appendChild(Q("span",[E])):c.appendChild(E),e.map.push(e.pos,e.pos+C,E),e.col+=C,e.pos+=C}if(!L)break;p+=C+1;var W=void 0;if(L[0]==" "){var B=e.cm.options.tabSize,z=B-e.col%B;W=c.appendChild(Q("span",vr(z),"cm-tab")),W.setAttribute("role","presentation"),W.setAttribute("cm-text"," "),e.col+=z}else L[0]=="\r"||L[0]==` -`?(W=c.appendChild(Q("span",L[0]=="\r"?"␍":"␤","cm-invalidchar")),W.setAttribute("cm-text",L[0]),e.col+=1):(W=e.cm.options.specialCharPlaceholder(L[0]),W.setAttribute("cm-text",L[0]),g&&v<9?c.appendChild(Q("span",[W])):c.appendChild(W),e.col+=1);e.map.push(e.pos,e.pos+1,W),e.pos++}}if(e.trailingSpace=o.charCodeAt(t.length-1)==32,i||r||n||u||l||a){var X=i||"";r&&(X+=r),n&&(X+=n);var U=Q("span",[c],X,l);if(a)for(var Y in a)a.hasOwnProperty(Y)&&Y!="style"&&Y!="class"&&U.setAttribute(Y,a[Y]);return e.content.appendChild(U)}e.content.appendChild(c)}}function ks(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nu&&p.from<=u));L++);if(p.to>=c)return e(i,r,n,l,a,o,s);e(i,r.slice(0,p.to-u),n,l,null,o,s),l=null,r=r.slice(p.to-u),u=p.to}}}function Zl(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function As(e,t,i){var r=e.markedSpans,n=e.text,l=0;if(!r){for(var a=1;as||fe.collapsed&&V.to==s&&V.from==s)){if(V.to!=null&&V.to!=s&&C>V.to&&(C=V.to,W=""),fe.className&&(E+=" "+fe.className),fe.css&&(L=(L?L+";":"")+fe.css),fe.startStyle&&V.from==s&&(B+=" "+fe.startStyle),fe.endStyle&&V.to==C&&(Y||(Y=[])).push(fe.endStyle,V.to),fe.title&&((X||(X={})).title=fe.title),fe.attributes)for(var we in fe.attributes)(X||(X={}))[we]=fe.attributes[we];fe.collapsed&&(!z||Dn(z.marker,fe)<0)&&(z=V)}else V.from>s&&C>V.from&&(C=V.from)}if(Y)for(var Ue=0;Ue=o)break;for(var st=Math.min(o,C);;){if(c){var nt=s+c.length;if(!z){var We=nt>st?c.slice(0,st-s):c;t.addToken(t,We,p?p+E:E,B,s+We.length==C?W:"",L,X)}if(nt>=st){c=c.slice(st-s),s=st;break}s=nt,B=""}c=n.slice(l,l=i[u++]),p=$l(i[u++],t.cm.options)}}}function Ql(e,t,i){this.line=t,this.rest=ms(t),this.size=this.rest?pe(f(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Bt(e,t)}function Bi(e,t,i){for(var r=[],n,l=t;l2&&l.push((s.bottom+u.top)/2-i.top)}}l.push(i.bottom-i.top)}}function ia(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ps(e,t){t=pt(t);var i=pe(t),r=e.display.externalMeasured=new Ql(e.doc,t,i);r.lineN=i;var n=r.built=ql(e,r);return r.text=n.pre,De(e.display.lineMeasure,n.pre),r}function na(e,t,i,r){return Lt(e,Sr(e,t),i,r)}function Hn(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(l=s-o,n=l-1,t>=s&&(a="right")),n!=null){if(r=e[u+2],o==s&&i==(r.insertLeft?"left":"right")&&(a=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if(i=="right"&&n==s-o)for(;u=0&&(i=e[n]).left==i.right;n--);return i}function Rs(e,t,i,r){var n=aa(t.map,i,r),l=n.node,a=n.start,o=n.end,s=n.collapse,u;if(l.nodeType==3){for(var c=0;c<4;c++){for(;a&&ue(t.line.text.charAt(n.coverStart+a));)--a;for(;n.coverStart+o0&&(s=r="right");var p;e.options.lineWrapping&&(p=l.getClientRects()).length>1?u=p[r=="right"?p.length-1:0]:u=l.getBoundingClientRect()}if(g&&v<9&&!a&&(!u||!u.left&&!u.right)){var L=l.parentNode.getClientRects()[0];L?u={left:L.left,right:L.left+Tr(e.display),top:L.top,bottom:L.bottom}:u=la}for(var C=u.top-t.rect.top,E=u.bottom-t.rect.top,W=(C+E)/2,B=t.view.measure.heights,z=0;z=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!o)return a(u=="before"?s-1:s,u=="before");function c(E,W,B){var z=o[W],X=z.level==1;return a(B?E-1:E,X!=B)}var p=Ne(o,s,u),L=be,C=c(s,p,u=="before");return L!=null&&(C.other=c(s,L,u!="before")),C}function ca(e,t){var i=0;t=se(e.doc,t),e.options.lineWrapping||(i=Tr(e.display)*t.ch);var r=j(e.doc,t.line),n=Dt(r)+Ri(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Bn(e,t,i,r,n){var l=P(e,t,i);return l.xRel=n,r&&(l.outside=r),l}function Rn(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Bn(r.first,0,null,-1,-1);var n=er(r,i),l=r.first+r.size-1;if(n>l)return Bn(r.first+r.size-1,j(r,l).text.length,null,1,1);t<0&&(t=0);for(var a=j(r,n);;){var o=Us(e,a,n,t,i),s=vs(a,o.ch+(o.xRel>0||o.outside>0?1:0));if(!s)return o;var u=s.find(1);if(u.line==n)return u;a=j(r,n=u.line)}}function da(e,t,i,r){r-=Pn(t);var n=t.text.length,l=me(function(a){return Lt(e,i,a-1).bottom<=r},n,0);return n=me(function(a){return Lt(e,i,a).top>r},l,n),{begin:l,end:n}}function ga(e,t,i,r){i||(i=Sr(e,t));var n=zi(e,t,Lt(e,i,r),"line").top;return da(e,t,i,n)}function zn(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Us(e,t,i,r,n){n-=Dt(t);var l=Sr(e,t),a=Pn(t),o=0,s=t.text.length,u=!0,c=ge(t,e.doc.direction);if(c){var p=(e.options.lineWrapping?Ks:Gs)(e,t,i,l,c,r,n);u=p.level!=1,o=u?p.from:p.to-1,s=u?p.to:p.from-1}var L=null,C=null,E=me(function(ee){var V=Lt(e,l,ee);return V.top+=a,V.bottom+=a,zn(V,r,n,!1)?(V.top<=n&&V.left<=r&&(L=ee,C=V),!0):!1},o,s),W,B,z=!1;if(C){var X=r-C.left=Y.bottom?1:0}return E=ce(t.text,E,1),Bn(i,E,B,z,r-W)}function Gs(e,t,i,r,n,l,a){var o=me(function(p){var L=n[p],C=L.level!=1;return zn(vt(e,P(i,C?L.to:L.from,C?"before":"after"),"line",t,r),l,a,!0)},0,n.length-1),s=n[o];if(o>0){var u=s.level!=1,c=vt(e,P(i,u?s.from:s.to,u?"after":"before"),"line",t,r);zn(c,l,a,!0)&&c.top>a&&(s=n[o-1])}return s}function Ks(e,t,i,r,n,l,a){var o=da(e,t,r,a),s=o.begin,u=o.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,p=null,L=0;L=u||C.to<=s)){var E=C.level!=1,W=Lt(e,r,E?Math.min(u,C.to)-1:Math.max(s,C.from)).right,B=WB)&&(c=C,p=B)}}return c||(c=n[n.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}var rr;function Lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=Q("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(Q("br"));rr.appendChild(document.createTextNode("x"))}De(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),qe(e.measure),i||1}function Tr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=Q("span","xxxxxxxxxx"),i=Q("pre",[t],"CodeMirror-line-like");De(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Un(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,l=t.gutters.firstChild,a=0;l;l=l.nextSibling,++a){var o=e.display.gutterSpecs[a].className;i[o]=l.offsetLeft+l.clientLeft+n,r[o]=l.clientWidth}return{fixedPos:Gn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Gn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function pa(e){var t=Lr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Tr(e.display)-3);return function(n){if(Bt(e.doc,n))return 0;var l=0;if(n.widgets)for(var a=0;a0&&(u=j(e.doc,s.line).text).length==s.ch){var c=Ze(u,u.length,e.options.tabSize)-u.length;s=P(s.line,Math.max(0,Math.round((l-ra(e.display).left)/Tr(e.display))-c))}return s}function nr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)_t&&Nn(e.doc,t)n.viewFrom?zt(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)zt(e);else if(t<=n.viewFrom){var l=Gi(e,i,i+r,1);l?(n.view=n.view.slice(l.index),n.viewFrom=l.lineN,n.viewTo+=r):zt(e)}else if(i>=n.viewTo){var a=Gi(e,t,t,-1);a?(n.view=n.view.slice(0,a.index),n.viewTo=a.lineN):zt(e)}else{var o=Gi(e,t,t,-1),s=Gi(e,i,i+r,1);o&&s?(n.view=n.view.slice(0,o.index).concat(Bi(e,o.lineN,s.lineN)).concat(n.view.slice(s.index)),n.viewTo+=r):zt(e)}var u=n.externalMeasured;u&&(i=n.lineN&&t=r.viewTo)){var l=r.view[nr(e,t)];if(l.node!=null){var a=l.changes||(l.changes=[]);Se(a,i)==-1&&a.push(i)}}}function zt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gi(e,t,i,r){var n=nr(e,t),l,a=e.display.view;if(!_t||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var o=e.display.viewFrom,s=0;s0){if(n==a.length-1)return null;l=o+a[n].size-t,n++}else l=o-t;t+=l,i+=l}for(;Nn(e.doc,i)!=i;){if(n==(r<0?0:a.length-1))return null;i+=r*a[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Xs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Bi(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Bi(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,nr(e,i)))),r.viewTo=i}function va(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var o=i.appendChild(Q("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Ys(e,t,i){var r=e.display,n=e.doc,l=document.createDocumentFragment(),a=ra(e.display),o=a.left,s=Math.max(r.sizerWidth,tr(e)-r.sizer.offsetLeft)-a.right,u=n.direction=="ltr";function c(U,Y,ee,V){Y<0&&(Y=0),Y=Math.round(Y),V=Math.round(V),l.appendChild(Q("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px; +`,t);n==-1&&(n=e.length);var l=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),a=l.indexOf("\r");a!=-1?(i.push(l.slice(0,a)),t+=a+1):(i.push(l),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ts=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},rs=function(){var e=Q("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bn=null;function is(e){if(bn!=null)return bn;var t=De(e,Q("span","x")),i=t.getBoundingClientRect(),r=bt(t,0,1).getBoundingClientRect();return bn=Math.abs(i.left-r.left)>1}var wn={},mr={};function ns(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),wn[e]=t}function ls(e,t){mr[e]=t}function Di(e){if(typeof e=="string"&&mr.hasOwnProperty(e))e=mr[e];else if(e&&typeof e.name=="string"&&mr.hasOwnProperty(e.name)){var t=mr[e.name];typeof t=="string"&&(t={name:t}),e=A(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Di("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Di("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Cn(e,t){t=Di(t);var i=wn[t.name];if(!i)return Cn(e,"text/plain");var r=i(e,t);if(br.hasOwnProperty(t.name)){var n=br[t.name];for(var l in n)n.hasOwnProperty(l)&&(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=n[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var br={};function as(e,t){var i=br.hasOwnProperty(e)?br[e]:br[e]={};dt(t,i)}function jt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Sn(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Dl(e,t,i){return e.startState?e.startState(t,i):!0}var Ee=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ee.prototype.eol=function(){return this.pos>=this.string.length},Ee.prototype.sol=function(){return this.pos==this.lineStart},Ee.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ee.prototype.next=function(){if(this.post},Ee.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ee.prototype.skipToEnd=function(){this.pos=this.string.length},Ee.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ee.prototype.backUp=function(e){this.pos-=e},Ee.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},Ee.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ee.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ee.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ee.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function j(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],l=n.chunkSize();if(t=e.first&&ti?P(i,j(e,i).text.length):os(t,j(e,t.line).text.length)}function os(e,t){var i=e.ch;return i==null||i>t?P(e.line,t):i<0?P(e.line,0):e}function Ol(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ct.fromSaved=function(e,t,i){return t instanceof Ei?new Ct(e,jt(e.mode,t.state),i,t.lookAhead):new Ct(e,jt(e.mode,t),i)},Ct.prototype.save=function(e){var t=e!==!1?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ei(t,this.maxLookAhead):t};function El(e,t,i,r){var n=[e.state.modeGen],l={};Bl(e,t.text,e.doc.mode,i,function(u,c){return n.push(u,c)},l,r);for(var a=i.state,o=function(u){i.baseTokens=n;var c=e.state.overlays[u],p=1,L=0;i.state=!0,Bl(e,t.text,c.mode,i,function(C,E){for(var W=p;LC&&n.splice(p,1,C,n[p+1],B),p+=2,L=Math.min(C,B)}if(E)if(c.opaque)n.splice(W,p-W,C,"overlay "+E),p=W+2;else for(;We.options.maxHighlightLength&&jt(e.doc.mode,r.state),l=El(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function $r(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Ct(r,!0,t);var l=ss(e,t,i),a=l>r.first&&j(r,l-1).stateAfter,o=a?Ct.fromSaved(r,a,l):new Ct(r,Dl(r.mode),l);return r.iter(l,t,function(s){An(e,s.text,o);var u=o.line;s.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&ut.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var Il=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Hl(e,t,i,r){var n=e.doc,l=n.mode,a;t=se(n,t);var o=j(n,t.line),s=$r(e,t.line,i),u=new Ee(o.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||u.pose.options.maxHighlightLength?(o=!1,a&&An(e,t,r,c.pos),c.pos=t.length,p=null):p=Pl(Mn(i,c,r.state,L),l),L){var C=L[0].name;C&&(p="m-"+(p?C+" "+p:C))}if(!o||u!=p){for(;sa;--o){if(o<=l.first)return l.first;var s=j(l,o-1),u=s.stateAfter;if(u&&(!i||o+(u instanceof Ei?u.lookAhead:0)<=l.modeFrontier))return o;var c=Ze(s.text,null,e.options.tabSize);(n==null||r>c)&&(n=o-1,r=c)}return n}function us(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=j(e,r).stateAfter;if(n&&(!(n instanceof Ei)||r+n.lookAhead=t:l.to>t);(r||(r=[])).push(new Wi(a,l.from,s?null:l.to))}}return r}function ps(e,t,i){var r;if(e)for(var n=0;n=t:l.to>t);if(o||l.from==t&&a.type=="bookmark"&&(!i||l.marker.insertLeft)){var s=l.from==null||(a.inclusiveLeft?l.from<=t:l.from0&&o)for(var Y=0;Y0)){var c=[s,1],p=oe(u.from,o.from),L=oe(u.to,o.to);(p<0||!a.inclusiveLeft&&!p)&&c.push({from:u.from,to:o.from}),(L>0||!a.inclusiveRight&&!L)&&c.push({from:o.to,to:u.to}),n.splice.apply(n,c),s+=c.length-3}}return n}function Ul(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||Dn(r,l.marker)<0)&&(r=l.marker)}return r}function Yl(e,t,i,r,n){var l=j(e,t),a=_t&&l.markedSpans;if(a)for(var o=0;o=0&&p<=0||c<=0&&p>=0)&&(c<=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?oe(u.to,i)>=0:oe(u.to,i)>0)||c>=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?oe(u.from,r)<=0:oe(u.from,r)<0)))return!0}}}function pt(e){for(var t;t=Xl(e);)e=t.find(-1,!0).line;return e}function ms(e){for(var t;t=Hi(e);)e=t.find(1,!0).line;return e}function bs(e){for(var t,i;t=Hi(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Nn(e,t){var i=j(e,t),r=pt(i);return i==r?t:pe(r)}function $l(e,t){if(t>e.lastLine())return t;var i=j(e,t),r;if(!Bt(e,i))return t;for(;r=Hi(i);)i=r.find(1,!0).line;return pe(i)+1}function Bt(e,t){var i=_t&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var wr=function(e,t,i){this.text=e,Gl(this,t),this.height=i?i(this):1};wr.prototype.lineNo=function(){return pe(this)},Mt(wr);function ws(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ul(e),Gl(e,i);var n=r?r(e):1;n!=e.height&&wt(e,n)}function Cs(e){e.parent=null,Ul(e)}var Ss={},Ls={};function ql(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ls:Ss;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Zl(e,t){var i=kt("span",null,null,m?"padding-right: .1px":null),r={pre:kt("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var l=n?t.rest[n-1]:t.line,a=void 0;r.pos=0,r.addToken=ks,es(e.display.measure)&&(a=ge(l,e.doc.direction))&&(r.addToken=As(r.addToken,a)),r.map=[];var o=t!=e.display.externalMeasured&&pe(l);Ms(l,r,Wl(e,l,o)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=zr(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=zr(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Vo(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(m){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Te(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=zr(r.pre.className,r.textClass||"")),r}function Ts(e){var t=Q("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ks(e,t,i,r,n,l,a){if(t){var o=e.splitSpaces?xs(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(o),e.map.push(e.pos,e.pos+t.length,c),g&&v<9&&(u=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var p=0;;){s.lastIndex=p;var L=s.exec(t),C=L?L.index-p:t.length-p;if(C){var E=document.createTextNode(o.slice(p,p+C));g&&v<9?c.appendChild(Q("span",[E])):c.appendChild(E),e.map.push(e.pos,e.pos+C,E),e.col+=C,e.pos+=C}if(!L)break;p+=C+1;var W=void 0;if(L[0]==" "){var B=e.cm.options.tabSize,z=B-e.col%B;W=c.appendChild(Q("span",vr(z),"cm-tab")),W.setAttribute("role","presentation"),W.setAttribute("cm-text"," "),e.col+=z}else L[0]=="\r"||L[0]==` +`?(W=c.appendChild(Q("span",L[0]=="\r"?"␍":"␤","cm-invalidchar")),W.setAttribute("cm-text",L[0]),e.col+=1):(W=e.cm.options.specialCharPlaceholder(L[0]),W.setAttribute("cm-text",L[0]),g&&v<9?c.appendChild(Q("span",[W])):c.appendChild(W),e.col+=1);e.map.push(e.pos,e.pos+1,W),e.pos++}}if(e.trailingSpace=o.charCodeAt(t.length-1)==32,i||r||n||u||l||a){var X=i||"";r&&(X+=r),n&&(X+=n);var U=Q("span",[c],X,l);if(a)for(var Y in a)a.hasOwnProperty(Y)&&Y!="style"&&Y!="class"&&U.setAttribute(Y,a[Y]);return e.content.appendChild(U)}e.content.appendChild(c)}}function xs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nu&&p.from<=u));L++);if(p.to>=c)return e(i,r,n,l,a,o,s);e(i,r.slice(0,p.to-u),n,l,null,o,s),l=null,r=r.slice(p.to-u),u=p.to}}}function Ql(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Ms(e,t,i){var r=e.markedSpans,n=e.text,l=0;if(!r){for(var a=1;as||fe.collapsed&&V.to==s&&V.from==s)){if(V.to!=null&&V.to!=s&&C>V.to&&(C=V.to,W=""),fe.className&&(E+=" "+fe.className),fe.css&&(L=(L?L+";":"")+fe.css),fe.startStyle&&V.from==s&&(B+=" "+fe.startStyle),fe.endStyle&&V.to==C&&(Y||(Y=[])).push(fe.endStyle,V.to),fe.title&&((X||(X={})).title=fe.title),fe.attributes)for(var we in fe.attributes)(X||(X={}))[we]=fe.attributes[we];fe.collapsed&&(!z||Dn(z.marker,fe)<0)&&(z=V)}else V.from>s&&C>V.from&&(C=V.from)}if(Y)for(var Ue=0;Ue=o)break;for(var st=Math.min(o,C);;){if(c){var nt=s+c.length;if(!z){var We=nt>st?c.slice(0,st-s):c;t.addToken(t,We,p?p+E:E,B,s+We.length==C?W:"",L,X)}if(nt>=st){c=c.slice(st-s),s=st;break}s=nt,B=""}c=n.slice(l,l=i[u++]),p=ql(i[u++],t.cm.options)}}}function Jl(e,t,i){this.line=t,this.rest=bs(t),this.size=this.rest?pe(f(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Bt(e,t)}function Bi(e,t,i){for(var r=[],n,l=t;l2&&l.push((s.bottom+u.top)/2-i.top)}}l.push(i.bottom-i.top)}}function na(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Bs(e,t){t=pt(t);var i=pe(t),r=e.display.externalMeasured=new Jl(e.doc,t,i);r.lineN=i;var n=r.built=Zl(e,r);return r.text=n.pre,De(e.display.lineMeasure,n.pre),r}function la(e,t,i,r){return Lt(e,Sr(e,t),i,r)}function Hn(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(l=s-o,n=l-1,t>=s&&(a="right")),n!=null){if(r=e[u+2],o==s&&i==(r.insertLeft?"left":"right")&&(a=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if(i=="right"&&n==s-o)for(;u=0&&(i=e[n]).left==i.right;n--);return i}function zs(e,t,i,r){var n=oa(t.map,i,r),l=n.node,a=n.start,o=n.end,s=n.collapse,u;if(l.nodeType==3){for(var c=0;c<4;c++){for(;a&&ue(t.line.text.charAt(n.coverStart+a));)--a;for(;n.coverStart+o0&&(s=r="right");var p;e.options.lineWrapping&&(p=l.getClientRects()).length>1?u=p[r=="right"?p.length-1:0]:u=l.getBoundingClientRect()}if(g&&v<9&&!a&&(!u||!u.left&&!u.right)){var L=l.parentNode.getClientRects()[0];L?u={left:L.left,right:L.left+Tr(e.display),top:L.top,bottom:L.bottom}:u=aa}for(var C=u.top-t.rect.top,E=u.bottom-t.rect.top,W=(C+E)/2,B=t.view.measure.heights,z=0;z=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!o)return a(u=="before"?s-1:s,u=="before");function c(E,W,B){var z=o[W],X=z.level==1;return a(B?E-1:E,X!=B)}var p=Ne(o,s,u),L=be,C=c(s,p,u=="before");return L!=null&&(C.other=c(s,L,u!="before")),C}function da(e,t){var i=0;t=se(e.doc,t),e.options.lineWrapping||(i=Tr(e.display)*t.ch);var r=j(e.doc,t.line),n=Dt(r)+Ri(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Bn(e,t,i,r,n){var l=P(e,t,i);return l.xRel=n,r&&(l.outside=r),l}function Rn(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Bn(r.first,0,null,-1,-1);var n=er(r,i),l=r.first+r.size-1;if(n>l)return Bn(r.first+r.size-1,j(r,l).text.length,null,1,1);t<0&&(t=0);for(var a=j(r,n);;){var o=Gs(e,a,n,t,i),s=ys(a,o.ch+(o.xRel>0||o.outside>0?1:0));if(!s)return o;var u=s.find(1);if(u.line==n)return u;a=j(r,n=u.line)}}function ga(e,t,i,r){r-=Pn(t);var n=t.text.length,l=me(function(a){return Lt(e,i,a-1).bottom<=r},n,0);return n=me(function(a){return Lt(e,i,a).top>r},l,n),{begin:l,end:n}}function pa(e,t,i,r){i||(i=Sr(e,t));var n=zi(e,t,Lt(e,i,r),"line").top;return ga(e,t,i,n)}function zn(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Dt(t);var l=Sr(e,t),a=Pn(t),o=0,s=t.text.length,u=!0,c=ge(t,e.doc.direction);if(c){var p=(e.options.lineWrapping?Xs:Ks)(e,t,i,l,c,r,n);u=p.level!=1,o=u?p.from:p.to-1,s=u?p.to:p.from-1}var L=null,C=null,E=me(function(ee){var V=Lt(e,l,ee);return V.top+=a,V.bottom+=a,zn(V,r,n,!1)?(V.top<=n&&V.left<=r&&(L=ee,C=V),!0):!1},o,s),W,B,z=!1;if(C){var X=r-C.left=Y.bottom?1:0}return E=ce(t.text,E,1),Bn(i,E,B,z,r-W)}function Ks(e,t,i,r,n,l,a){var o=me(function(p){var L=n[p],C=L.level!=1;return zn(vt(e,P(i,C?L.to:L.from,C?"before":"after"),"line",t,r),l,a,!0)},0,n.length-1),s=n[o];if(o>0){var u=s.level!=1,c=vt(e,P(i,u?s.from:s.to,u?"after":"before"),"line",t,r);zn(c,l,a,!0)&&c.top>a&&(s=n[o-1])}return s}function Xs(e,t,i,r,n,l,a){var o=ga(e,t,r,a),s=o.begin,u=o.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,p=null,L=0;L=u||C.to<=s)){var E=C.level!=1,W=Lt(e,r,E?Math.min(u,C.to)-1:Math.max(s,C.from)).right,B=WB)&&(c=C,p=B)}}return c||(c=n[n.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}var rr;function Lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=Q("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(Q("br"));rr.appendChild(document.createTextNode("x"))}De(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),qe(e.measure),i||1}function Tr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=Q("span","xxxxxxxxxx"),i=Q("pre",[t],"CodeMirror-line-like");De(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Un(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,l=t.gutters.firstChild,a=0;l;l=l.nextSibling,++a){var o=e.display.gutterSpecs[a].className;i[o]=l.offsetLeft+l.clientLeft+n,r[o]=l.clientWidth}return{fixedPos:Gn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Gn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function va(e){var t=Lr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Tr(e.display)-3);return function(n){if(Bt(e.doc,n))return 0;var l=0;if(n.widgets)for(var a=0;a0&&(u=j(e.doc,s.line).text).length==s.ch){var c=Ze(u,u.length,e.options.tabSize)-u.length;s=P(s.line,Math.max(0,Math.round((l-ia(e.display).left)/Tr(e.display))-c))}return s}function nr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)_t&&Nn(e.doc,t)n.viewFrom?zt(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)zt(e);else if(t<=n.viewFrom){var l=Gi(e,i,i+r,1);l?(n.view=n.view.slice(l.index),n.viewFrom=l.lineN,n.viewTo+=r):zt(e)}else if(i>=n.viewTo){var a=Gi(e,t,t,-1);a?(n.view=n.view.slice(0,a.index),n.viewTo=a.lineN):zt(e)}else{var o=Gi(e,t,t,-1),s=Gi(e,i,i+r,1);o&&s?(n.view=n.view.slice(0,o.index).concat(Bi(e,o.lineN,s.lineN)).concat(n.view.slice(s.index)),n.viewTo+=r):zt(e)}var u=n.externalMeasured;u&&(i=n.lineN&&t=r.viewTo)){var l=r.view[nr(e,t)];if(l.node!=null){var a=l.changes||(l.changes=[]);Se(a,i)==-1&&a.push(i)}}}function zt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gi(e,t,i,r){var n=nr(e,t),l,a=e.display.view;if(!_t||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var o=e.display.viewFrom,s=0;s0){if(n==a.length-1)return null;l=o+a[n].size-t,n++}else l=o-t;t+=l,i+=l}for(;Nn(e.doc,i)!=i;){if(n==(r<0?0:a.length-1))return null;i+=r*a[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Ys(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Bi(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Bi(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,nr(e,i)))),r.viewTo=i}function ya(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var o=i.appendChild(Q("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function $s(e,t,i){var r=e.display,n=e.doc,l=document.createDocumentFragment(),a=ia(e.display),o=a.left,s=Math.max(r.sizerWidth,tr(e)-r.sizer.offsetLeft)-a.right,u=n.direction=="ltr";function c(U,Y,ee,V){Y<0&&(Y=0),Y=Math.round(Y),V=Math.round(V),l.appendChild(Q("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px; top: `+Y+"px; width: "+(ee??s-U)+`px; - height: `+(V-Y)+"px"))}function p(U,Y,ee){var V=j(n,U),fe=V.text.length,we,Ue;function ke(We,lt){return Ui(e,P(U,We),"div",V,lt)}function st(We,lt,Ye){var He=ga(e,V,null,We),Fe=lt=="ltr"==(Ye=="after")?"left":"right",Ae=Ye=="after"?He.begin:He.end-(/\s/.test(V.text.charAt(He.end-1))?2:1);return ke(Ae,Fe)[Fe]}var nt=ge(V,n.direction);return Ce(nt,Y||0,ee??fe,function(We,lt,Ye,He){var Fe=Ye=="ltr",Ae=ke(We,Fe?"left":"right"),at=ke(lt-1,Fe?"right":"left"),Hr=Y==null&&We==0,$t=ee==null&<==fe,Je=He==0,Tt=!nt||He==nt.length-1;if(at.top-Ae.top<=3){var Ge=(u?Hr:$t)&&Je,ml=(u?$t:Hr)&&Tt,Wt=Ge?o:(Fe?Ae:at).left,ur=ml?s:(Fe?at:Ae).right;c(Wt,Ae.top,ur-Wt,Ae.bottom)}else{var fr,et,Pr,bl;Fe?(fr=u&&Hr&&Je?o:Ae.left,et=u?s:st(We,Ye,"before"),Pr=u?o:st(lt,Ye,"after"),bl=u&&$t&&Tt?s:at.right):(fr=u?st(We,Ye,"before"):o,et=!u&&Hr&&Je?s:Ae.right,Pr=!u&&$t&&Tt?o:at.left,bl=u?st(lt,Ye,"after"):s),c(fr,Ae.top,et-fr,Ae.bottom),Ae.bottom0?t.blinker=setInterval(function(){e.hasFocus()||kr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ma(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||qn(e))}function $n(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&kr(e))},100)}function qn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Te(e,"focus",e,t),e.state.focused=!0,xt(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),m&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Yn(e))}function kr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Te(e,"blur",e,t),e.state.focused=!1,Me(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Xi(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,l=0,a=0;a.005||C<-.005)&&(ne.display.sizerWidth){var W=Math.ceil(c/Tr(e.display));W>e.display.maxLineLength&&(e.display.maxLineLength=W,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function ba(e){if(e.widgets)for(var t=0;t=a&&(l=er(t,Dt(j(t,s))-e.wrapper.clientHeight),a=s)}return{from:l,to:Math.max(a,l+1)}}function $s(e,t){if(!xe(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,l=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(n=!1),n!=null&&!q){var a=Q("div","​",null,`position: absolute; + height: `+(V-Y)+"px"))}function p(U,Y,ee){var V=j(n,U),fe=V.text.length,we,Ue;function ke(We,lt){return Ui(e,P(U,We),"div",V,lt)}function st(We,lt,Ye){var He=pa(e,V,null,We),Fe=lt=="ltr"==(Ye=="after")?"left":"right",Ae=Ye=="after"?He.begin:He.end-(/\s/.test(V.text.charAt(He.end-1))?2:1);return ke(Ae,Fe)[Fe]}var nt=ge(V,n.direction);return Ce(nt,Y||0,ee??fe,function(We,lt,Ye,He){var Fe=Ye=="ltr",Ae=ke(We,Fe?"left":"right"),at=ke(lt-1,Fe?"right":"left"),Hr=Y==null&&We==0,$t=ee==null&<==fe,Je=He==0,Tt=!nt||He==nt.length-1;if(at.top-Ae.top<=3){var Ge=(u?Hr:$t)&&Je,ml=(u?$t:Hr)&&Tt,Wt=Ge?o:(Fe?Ae:at).left,ur=ml?s:(Fe?at:Ae).right;c(Wt,Ae.top,ur-Wt,Ae.bottom)}else{var fr,et,Pr,bl;Fe?(fr=u&&Hr&&Je?o:Ae.left,et=u?s:st(We,Ye,"before"),Pr=u?o:st(lt,Ye,"after"),bl=u&&$t&&Tt?s:at.right):(fr=u?st(We,Ye,"before"):o,et=!u&&Hr&&Je?s:Ae.right,Pr=!u&&$t&&Tt?o:at.left,bl=u?st(lt,Ye,"after"):s),c(fr,Ae.top,et-fr,Ae.bottom),Ae.bottom0?t.blinker=setInterval(function(){e.hasFocus()||kr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ba(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||qn(e))}function $n(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&kr(e))},100)}function qn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Te(e,"focus",e,t),e.state.focused=!0,xt(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),m&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Yn(e))}function kr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Te(e,"blur",e,t),e.state.focused=!1,Me(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Xi(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,l=0,a=0;a.005||C<-.005)&&(ne.display.sizerWidth){var W=Math.ceil(c/Tr(e.display));W>e.display.maxLineLength&&(e.display.maxLineLength=W,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function wa(e){if(e.widgets)for(var t=0;t=a&&(l=er(t,Dt(j(t,s))-e.wrapper.clientHeight),a=s)}return{from:l,to:Math.max(a,l+1)}}function qs(e,t){if(!xe(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,l=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(n=!1),n!=null&&!q){var a=Q("div","​",null,`position: absolute; top: `+(t.top-i.viewOffset-Ri(e.display))+`px; height: `+(t.bottom-t.top+St(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(n),e.display.lineSpace.removeChild(a)}}}function qs(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?P(t.line,t.ch+1,"before"):t,t=t.ch?P(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var l=0;l<5;l++){var a=!1,o=vt(e,t),s=!i||i==t?o:vt(e,i);n={left:Math.min(o.left,s.left),top:Math.min(o.top,s.top)-r,right:Math.max(o.left,s.left),bottom:Math.max(o.bottom,s.bottom)+r};var u=Zn(e,n),c=e.doc.scrollTop,p=e.doc.scrollLeft;if(u.scrollTop!=null&&(ti(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),u.scrollLeft!=null&&(lr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(a=!0)),!a)break}return n}function Zs(e,t){var i=Zn(e,t);i.scrollTop!=null&&ti(e,i.scrollTop),i.scrollLeft!=null&&lr(e,i.scrollLeft)}function Zn(e,t){var i=e.display,r=Lr(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=In(e),a={};t.bottom-t.top>l&&(t.bottom=t.top+l);var o=e.doc.height+Fn(i),s=t.topo-r;if(t.topn+l){var c=Math.min(t.top,(u?o:t.bottom)-l);c!=n&&(a.scrollTop=c)}var p=e.options.fixedGutter?0:i.gutters.offsetWidth,L=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-p,C=tr(e)-i.gutters.offsetWidth,E=t.right-t.left>C;return E&&(t.right=t.left+C),t.left<10?a.scrollLeft=0:t.leftC+L-3&&(a.scrollLeft=t.right+(E?0:10)-C),a}function Qn(e,t){t!=null&&($i(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function xr(e){$i(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ei(e,t,i){(t!=null||i!=null)&&$i(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Qs(e,t){$i(e),e.curOp.scrollToPos=t}function $i(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=ca(e,t.from),r=ca(e,t.to);wa(e,i,r,t.margin)}}function wa(e,t,i,r){var n=Zn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});ei(e,n.scrollLeft,n.scrollTop)}function ti(e,t){Math.abs(e.doc.scrollTop-t)<2||(M||jn(e,{top:t}),Ca(e,t,!0),M&&jn(e),ni(e,100))}function Ca(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function lr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,xa(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ri(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+Fn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+St(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ar=function(e,t,i){this.cm=i;var r=this.vert=Q("div",[Q("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=Q("div",[Q("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,g&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ar.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},ar.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ar.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ar.prototype.zeroWidthHack=function(){var e=ne&&!$?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new gt,this.disableVert=new gt},ar.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);l!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},ar.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ii=function(){};ii.prototype.update=function(){return{bottom:0,right:0}},ii.prototype.setScrollLeft=function(){},ii.prototype.setScrollTop=function(){},ii.prototype.clear=function(){};function Ar(e,t){t||(t=ri(e));var i=e.display.barWidth,r=e.display.barHeight;Sa(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Xi(e),Sa(e,ri(e)),i=e.display.barWidth,r=e.display.barHeight}function Sa(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var La={native:ar,null:ii};function Ta(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Me(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new La[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?lr(e,t):ti(e,t)},e),e.display.scrollbars.addClass&&xt(e.display.wrapper,e.display.scrollbars.addClass)}var Js=0;function or(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Js,markArrays:null},Ms(e.curOp)}function sr(e){var t=e.curOp;t&&Ds(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new qi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function eu(e){e.updatedDisplay=e.mustUpdate&&Jn(e.cm,e.update)}function tu(e){var t=e.cm,i=t.display;e.updatedDisplay&&Xi(t),e.barMeasure=ri(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=na(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+St(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function ru(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=$r(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var a=l.styles,o=l.text.length>e.options.maxHighlightLength?jt(t.mode,r.state):null,s=Ol(e,l,r,!0);o&&(r.state=o),l.styles=s.styles;var u=l.styleClasses,c=s.classes;c?l.styleClasses=c:u&&(l.styleClasses=null);for(var p=!a||a.length!=l.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),L=0;!p&&Li)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&ot(e,function(){for(var l=0;l=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&va(e)==0)return!1;Aa(e)&&(zt(e),t.dims=Un(e));var n=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFroma&&i.viewTo-a<20&&(a=Math.min(n,i.viewTo)),_t&&(l=Nn(e.doc,l),a=Yl(e.doc,a));var o=l!=i.viewFrom||a!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Xs(e,l,a),i.viewOffset=Dt(j(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var s=va(e);if(!o&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var u=au(e);return s>4&&(i.lineDiv.style.display="none"),su(e,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ou(u),qe(i.cursorDiv),qe(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,o&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,ni(e,400)),i.updateLineNumbers=null,!0}function ka(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==tr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+Fn(e.display)-In(e),i.top)}),t.visible=Yi(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Yi(e.display,e.doc,i));if(!Jn(e,t))break;Xi(e);var n=ri(e);Vr(e),Ar(e,n),el(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function jn(e,t){var i=new qi(e,t);if(Jn(e,i)){Xi(e),ka(e,i);var r=ri(e);Vr(e),Ar(e,r),el(e,r),i.finish()}}function su(e,t,i){var r=e.display,n=e.options.lineNumbers,l=r.lineDiv,a=l.firstChild;function o(E){var W=E.nextSibling;return m&&ne&&e.display.currentWheelTarget==E?E.style.display="none":E.parentNode.removeChild(E),W}for(var s=r.view,u=r.viewFrom,c=0;c-1&&(C=!1),Jl(e,p,u,i)),C&&(qe(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(Tn(e.options,u)))),a=p.node.nextSibling}u+=p.size}for(;a;)a=o(a)}function Vn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Be(e,"gutterChanged",e)}function el(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+St(e)+"px"}function xa(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Gn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,l=r+"px",a=0;a=105&&(n.wrapper.style.clipPath="inset(0px)"),n.wrapper.setAttribute("translate","no"),g&&v<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!m&&!(M&&ie)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=tl(r.gutters,r.lineNumbers),Ma(n),i.init(n)}var Zi=0,Ot=null;g?Ot=-.53:M?Ot=15:x?Ot=-.7:K&&(Ot=-1/3);function _a(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function fu(e){var t=_a(e);return t.x*=Ot,t.y*=Ot,t}function Da(e,t){x&&_==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var i=_a(t),r=i.x,n=i.y,l=Ot;t.deltaMode===0&&(r=t.deltaX,n=t.deltaY,l=1);var a=e.display,o=a.scroller,s=o.scrollWidth>o.clientWidth,u=o.scrollHeight>o.clientHeight;if(r&&s||n&&u){if(n&&ne&&m){e:for(var c=t.target,p=a.view;c!=o;c=c.parentNode)for(var L=0;L=0&&oe(e,r.to())<=0)return i}return-1};var de=function(e,t){this.anchor=e,this.head=t};de.prototype.from=function(){return Oi(this.anchor,this.head)},de.prototype.to=function(){return Ni(this.anchor,this.head)},de.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function yt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(L,C){return oe(L.from(),C.from())}),i=Se(t,n);for(var l=1;l0:s>=0){var u=Oi(o.from(),a.from()),c=Ni(o.to(),a.to()),p=o.empty()?a.from()==a.head:o.from()==o.head;l<=i&&--i,t.splice(--l,2,new de(p?c:u,p?u:c))}}return new ft(t,i)}function Ut(e,t){return new ft([new de(e,t||e)],0)}function Gt(e){return e.text?P(e.from.line+e.text.length-1,f(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Na(e,t){if(oe(e,t.from)<0)return e;if(oe(e,t.to)<=0)return Gt(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Gt(t).ch-t.to.ch),P(i,r)}function rl(e,t){for(var i=[],r=0;r1&&e.remove(o.line+1,E-1),e.insert(o.line+1,z)}Be(e,"change",e,t)}function Kt(e,t,i){function r(n,l,a){if(n.linked)for(var o=0;o1&&!e.done[e.done.length-2].ranges)return e.done.pop(),f(e.done)}function Ha(e,t,i,r){var n=e.history;n.undone.length=0;var l=+new Date,a,o;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=du(n,n.lastOp==r)))o=f(a.changes),oe(t.from,t.to)==0&&oe(t.from,o.to)==0?o.to=Gt(t):a.changes.push(ll(e,t));else{var s=f(n.done);for((!s||!s.ranges)&&Ji(e.sel,n.done),a={changes:[ll(e,t)],generation:n.generation},n.done.push(a);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=l,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,o||Te(e,"historyAdded")}function gu(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function pu(e,t,i,r){var n=e.history,l=r&&r.origin;i==n.lastSelOp||l&&n.lastSelOrigin==l&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==l||gu(e,l,f(n.done),t))?n.done[n.done.length-1]=t:Ji(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=l,n.lastSelOp=i,r&&r.clearRedo!==!1&&Ia(n.undone)}function Ji(e,t){var i=f(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Pa(e,t,i,r){var n=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((n||(n=t["spans_"+e.id]={}))[l]=a.markedSpans),++l})}function vu(e){if(!e)return null;for(var t,i=0;i-1&&(f(o)[p]=u[p],delete u[p])}}return r}function al(e,t,i,r){if(r){var n=e.anchor;if(i){var l=oe(t,n)<0;l!=oe(i,n)<0?(n=t,t=i):l!=oe(t,i)<0&&(t=i)}return new de(n,t)}else return new de(i||t,t)}function ji(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Qe(e,new ft([al(e.sel.primary(),t,i,n)],0),r)}function Ra(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),l=0;l=t.ch:o.to>t.ch))){if(n&&(Te(s,"beforeCursorEnter"),s.explicitlyCleared))if(l.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(i){var p=s.find(r<0?1:-1),L=void 0;if((r<0?c:u)&&(p=Ya(e,p,-r,p&&p.line==t.line?l:null)),p&&p.line==t.line&&(L=oe(p,i))&&(r<0?L<0:L>0))return _r(e,p,t,r,n)}var C=s.find(r<0?-1:1);return(r<0?u:c)&&(C=Ya(e,C,r,C.line==t.line?l:null)),C?_r(e,C,t,r,n):null}}return t}function en(e,t,i,r,n){var l=r||1,a=_r(e,t,i,l,n)||!n&&_r(e,t,i,l,!0)||_r(e,t,i,-l,n)||!n&&_r(e,t,i,-l,!0);return a||(e.cantEdit=!0,P(e.first,0))}function Ya(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?se(e,P(t.line-1)):null:i>0&&t.ch==(r||j(e,t.line)).text.length?t.line=0;--n)Za(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Za(e,t)}}function Za(e,t){if(!(t.text.length==1&&t.text[0]==""&&oe(t.from,t.to)==0)){var i=rl(e,t);Ha(e,t,i,e.cm?e.cm.curOp.id:NaN),oi(e,t,i,_n(e,t));var r=[];Kt(e,function(n,l){!l&&Se(r,n.history)==-1&&(Va(n.history,t),r.push(n.history)),oi(n,t,null,_n(n,t))})}}function tn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,l,a=e.sel,o=t=="undo"?n.done:n.undone,s=t=="undo"?n.undone:n.done,u=0;u=0;--C){var E=L(C);if(E)return E.v}}}}function Qa(e,t){if(t!=0&&(e.first+=t,e.sel=new ft(y(e.sel.ranges,function(n){return new de(P(n.anchor.line+t,n.anchor.ch),P(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){rt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.linel&&(t={from:t.from,to:P(l,j(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vt(e,t.from,t.to),i||(i=rl(e,t)),e.cm?bu(e.cm,t,r):nl(e,t,r),Vi(e,i,ht),e.cantEdit&&en(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function bu(e,t,i){var r=e.doc,n=e.display,l=t.from,a=t.to,o=!1,s=l.line;e.options.lineWrapping||(s=pe(pt(j(r,l.line))),r.iter(s,a.line+1,function(C){if(C==n.maxLine)return o=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Pt(e),nl(r,t,i,pa(e)),e.options.lineWrapping||(r.iter(s,l.line+t.text.length,function(C){var E=Pi(C);E>n.maxLineLength&&(n.maxLine=C,n.maxLineLength=E,n.maxLineChanged=!0,o=!1)}),o&&(e.curOp.updateMaxLine=!0)),ss(r,l.line),ni(e,400);var u=t.text.length-(a.line-l.line)-1;t.full?rt(e):l.line==a.line&&t.text.length==1&&!Ea(e.doc,t)?Rt(e,l.line,"text"):rt(e,l.line,a.line+1,u);var c=Xe(e,"changes"),p=Xe(e,"change");if(p||c){var L={from:l,to:a,text:t.text,removed:t.removed,origin:t.origin};p&&Be(e,"change",e,L),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(L)}e.display.selForContextMenu=null}function Nr(e,t,i,r,n){var l;r||(r=i),oe(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),Dr(e,{from:i,to:r,text:t,origin:n})}function Ja(e,t,i,r){i1||!(this.children[0]instanceof ui))){var o=[];this.collapse(o),this.children=[new ui(o)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=n.lines.length%25+25,o=a;o10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ka(e.doc)),e&&Be(e,"markerCleared",e,this,r,n),t&&sr(e),this.parent&&this.parent.clear()}},Xt.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||a==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=kt("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(Xl(e,t.line,t,i,l)||t.line!=i.line&&Xl(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");fs()}l.addToHistory&&Ha(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var o=t.line,s=e.cm,u;if(e.iter(o,i.line+1,function(p){s&&l.collapsed&&!s.options.lineWrapping&&pt(p)==s.display.maxLine&&(u=!0),l.collapsed&&o!=t.line&&wt(p,0),cs(p,new Wi(l,o==t.line?t.ch:null,o==i.line?i.ch:null),e.cm&&e.cm.curOp),++o}),l.collapsed&&e.iter(t.line,i.line+1,function(p){Bt(e,p)&&wt(p,0)}),l.clearOnEnter&&te(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(us(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++to,l.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),l.collapsed)rt(s,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var c=t.line;c<=i.line;c++)Rt(s,c,"text");l.atomic&&Ka(s.doc),Be(s,"markerAdded",s,l)}return l}var ci=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;s--)Dr(this,r[s]);o?Ua(this,o):this.cm&&xr(this.cm)}),undo:ze(function(){tn(this,"undo")}),redo:ze(function(){tn(this,"redo")}),undoSelection:ze(function(){tn(this,"undo",!0)}),redoSelection:ze(function(){tn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=se(this,e),t=se(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(l){var a=l.markedSpans;if(a)for(var o=0;o=s.to||s.from==null&&n!=e.line||s.from!=null&&n==t.line&&s.from>=t.ch)&&(!i||i(s.marker))&&r.push(s.marker.parent||s.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=l,++i}),se(this,P(i,t))},indexFromPos:function(e){e=se(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var p;if(t.state.draggingText&&!t.state.draggingText.copy&&(p=t.listSelections()),Vi(t.doc,Ut(i,i)),p)for(var L=0;L=0;o--)Nr(e.doc,"",r[o].from,r[o].to,"+delete");xr(e)})}function sl(e,t,i){var r=ce(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ul(e,t,i){var r=sl(e,t.ch,i);return r==null?null:new P(t.line,r,i<0?"after":"before")}function fl(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var l=ge(i,t.doc.direction);if(l){var a=n<0?f(l):l[0],o=n<0==(a.level==1),s=o?"after":"before",u;if(a.level>0||t.doc.direction=="rtl"){var c=Sr(t,i);u=n<0?i.text.length-1:0;var p=Lt(t,c,u).top;u=me(function(L){return Lt(t,c,L).top==p},n<0==(a.level==1)?a.from:a.to-1,u),s=="before"&&(u=sl(i,u,1))}else u=n<0?a.to:a.from;return new P(r,u,s)}}return new P(r,n<0?i.text.length:0,n<0?"before":"after")}function Eu(e,t,i,r){var n=ge(t,e.doc.direction);if(!n)return ul(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Ne(n,i.ch,i.sticky),a=n[l];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>i.ch:a.from=a.from&&L>=c.begin)){var C=p?"before":"after";return new P(i.line,L,C)}}var E=function(z,X,U){for(var Y=function(we,Ue){return Ue?new P(i.line,o(we,1),"before"):new P(i.line,we,"after")};z>=0&&z0==(ee.level!=1),fe=V?U.begin:o(U.end,-1);if(ee.from<=fe&&fe0?c.end:o(c.begin,-1);return B!=null&&!(r>0&&B==t.text.length)&&(W=E(r>0?0:n.length-1,r,u(B)),W)?W:null}var pi={selectAll:$a,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return Wr(e,function(t){if(t.empty()){var i=j(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new P(n.line,n.ch+1),e.replaceRange(l.charAt(n.ch-1)+l.charAt(n.ch-2),P(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var a=j(e.doc,n.line-1).text;a&&(n=new P(n.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),P(n.line-1,a.length-1),n,"+transpose"))}}i.push(new de(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return ot(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&oe(t,this.pos)==0&&i==this.button};var yi,mi;function Ru(e,t){var i=+new Date;return mi&&mi.compare(i,e,t)?(yi=mi=null,"triple"):yi&&yi.compare(i,e,t)?(mi=new cl(i,e,t),yi=null,"double"):(yi=new cl(i,e,t),mi=null,"single")}function mo(e){var t=this,i=t.display;if(!(xe(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Nt(i,e)){m||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!dl(t,e)){var r=ir(t,e),n=Ml(e),l=r?Ru(r,n):"single";At(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&zu(t,n,r,l,e))&&(n==1?r?Gu(t,r,l,e):pn(e)==i.scroller&&Oe(e):n==2?(r&&ji(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(Ie?t.display.input.onContextMenu(e):$n(t)))}}}function zu(e,t,i,r,n){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,vi(e,so(l,n),n,function(a){if(typeof a=="string"&&(a=pi[a]),!a)return!1;var o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o=a(e,i)!=Ht}finally{e.state.suppressEdits=!1}return o})}function Uu(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var l=he?i.shiftKey&&i.metaKey:i.altKey;n.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=ne?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),n}function Gu(e,t,i,r){g?setTimeout(gr(ma,e),0):e.curOp.focus=tt(It(e));var n=Uu(e,i,r),l=e.doc.sel,a;e.options.dragDrop&&Jo&&!e.isReadOnly()&&i=="single"&&(a=l.contains(t))>-1&&(oe((a=l.ranges[a]).from(),t)<0||t.xRel>0)&&(oe(a.to(),t)>0||t.xRel<0)?Ku(e,r,t,n):Xu(e,r,t,n)}function Ku(e,t,i,r){var n=e.display,l=!1,a=Re(e,function(u){m&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:$n(e)),je(n.wrapper.ownerDocument,"mouseup",a),je(n.wrapper.ownerDocument,"mousemove",o),je(n.scroller,"dragstart",s),je(n.scroller,"drop",a),l||(Oe(u),r.addNew||ji(e.doc,i,null,null,r.extend),m&&!K||g&&v==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),o=function(u){l=l||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return l=!0};m&&(n.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,te(n.wrapper.ownerDocument,"mouseup",a),te(n.wrapper.ownerDocument,"mousemove",o),te(n.scroller,"dragstart",s),te(n.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function bo(e,t,i){if(i=="char")return new de(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new de(P(t.line,0),se(e.doc,P(t.line+1,0)));var r=i(e,t);return new de(r.from,r.to)}function Xu(e,t,i,r){g&&$n(e);var n=e.display,l=e.doc;Oe(t);var a,o,s=l.sel,u=s.ranges;if(r.addNew&&!r.extend?(o=l.sel.contains(i),o>-1?a=u[o]:a=new de(i,i)):(a=l.sel.primary(),o=l.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new de(i,i)),i=ir(e,t,!0,!0),o=-1;else{var c=bo(e,i,r.unit);r.extend?a=al(a,c.anchor,c.head,r.extend):a=c}r.addNew?o==-1?(o=u.length,Qe(l,yt(e,u.concat([a]),o),{scroll:!1,origin:"*mouse"})):u.length>1&&u[o].empty()&&r.unit=="char"&&!r.extend?(Qe(l,yt(e,u.slice(0,o).concat(u.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),s=l.sel):ol(l,o,a,Ur):(o=0,Qe(l,new ft([a],0),Ur),s=l.sel);var p=i;function L(U){if(oe(p,U)!=0)if(p=U,r.unit=="rectangle"){for(var Y=[],ee=e.options.tabSize,V=Ze(j(l,i.line).text,i.ch,ee),fe=Ze(j(l,U.line).text,U.ch,ee),we=Math.min(V,fe),Ue=Math.max(V,fe),ke=Math.min(i.line,U.line),st=Math.min(e.lastLine(),Math.max(i.line,U.line));ke<=st;ke++){var nt=j(l,ke).text,We=Gr(nt,we,ee);we==Ue?Y.push(new de(P(ke,We),P(ke,We))):nt.length>We&&Y.push(new de(P(ke,We),P(ke,Gr(nt,Ue,ee))))}Y.length||Y.push(new de(i,i)),Qe(l,yt(e,s.ranges.slice(0,o).concat(Y),o),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var lt=a,Ye=bo(e,U,r.unit),He=lt.anchor,Fe;oe(Ye.anchor,He)>0?(Fe=Ye.head,He=Oi(lt.from(),Ye.anchor)):(Fe=Ye.anchor,He=Ni(lt.to(),Ye.head));var Ae=s.ranges.slice(0);Ae[o]=Yu(e,new de(se(l,He),Fe)),Qe(l,yt(e,Ae,o),Ur)}}var C=n.wrapper.getBoundingClientRect(),E=0;function W(U){var Y=++E,ee=ir(e,U,!0,r.unit=="rectangle");if(ee)if(oe(ee,p)!=0){e.curOp.focus=tt(It(e)),L(ee);var V=Yi(n,l);(ee.line>=V.to||ee.lineC.bottom?20:0;fe&&setTimeout(Re(e,function(){E==Y&&(n.scroller.scrollTop+=fe,W(U))}),50)}}function B(U){e.state.selectingText=!1,E=1/0,U&&(Oe(U),n.input.focus()),je(n.wrapper.ownerDocument,"mousemove",z),je(n.wrapper.ownerDocument,"mouseup",X),l.history.lastSelOrigin=null}var z=Re(e,function(U){U.buttons===0||!Ml(U)?B(U):W(U)}),X=Re(e,B);e.state.selectingText=X,te(n.wrapper.ownerDocument,"mousemove",z),te(n.wrapper.ownerDocument,"mouseup",X)}function Yu(e,t){var i=t.anchor,r=t.head,n=j(e.doc,i.line);if(oe(i,r)==0&&i.sticky==r.sticky)return t;var l=ge(n);if(!l)return t;var a=Ne(l,i.ch,i.sticky),o=l[a];if(o.from!=i.ch&&o.to!=i.ch)return t;var s=a+(o.from==i.ch==(o.level!=1)?0:1);if(s==0||s==l.length)return t;var u;if(r.line!=i.line)u=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=Ne(l,r.ch,r.sticky),p=c-a||(r.ch-i.ch)*(o.level==1?-1:1);c==s-1||c==s?u=p<0:u=p>0}var L=l[s+(u?-1:0)],C=u==(L.level==1),E=C?L.from:L.to,W=C?"after":"before";return i.ch==E&&i.sticky==W?t:new de(new P(i.line,E,W),r)}function wo(e,t,i,r){var n,l;if(t.touches)n=t.touches[0].clientX,l=t.touches[0].clientY;else try{n=t.clientX,l=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Oe(t);var a=e.display,o=a.lineDiv.getBoundingClientRect();if(l>o.bottom||!Xe(e,i))return gn(t);l-=o.top-a.viewOffset;for(var s=0;s=n){var c=er(e.doc,l),p=e.display.gutterSpecs[s];return Te(e,i,e,c,p.className,t),gn(t)}}}function dl(e,t){return wo(e,t,"gutterClick",!0)}function Co(e,t){Nt(e.display,t)||$u(e,t)||xe(e,t,"contextmenu")||Ie||e.display.input.onContextMenu(t)}function $u(e,t){return Xe(e,"gutterContextMenu")?wo(e,t,"gutterContextMenu",!1):!1}function So(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),jr(e)}var Fr={toString:function(){return"CodeMirror.Init"}},Lo={},an={};function qu(e){var t=e.optionHandlers;function i(r,n,l,a){e.defaults[r]=n,l&&(t[r]=a?function(o,s,u){u!=Fr&&l(o,s,u)}:l)}e.defineOption=i,e.Init=Fr,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,il(r)},!0),i("indentUnit",2,il,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){ai(r),jr(r),rt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var l=[],a=r.doc.first;r.doc.iter(function(s){for(var u=0;;){var c=s.text.indexOf(n,u);if(c==-1)break;u=c+n.length,l.push(P(a,c))}a++});for(var o=l.length-1;o>=0;o--)Nr(r.doc,n,l[o],P(l[o].line,l[o].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,l){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),l!=Fr&&r.refresh()}),i("specialCharPlaceholder",Ls,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",ie?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!re),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){So(r),li(r)},!0),i("keyMap","default",function(r,n,l){var a=nn(n),o=l!=Fr&&nn(l);o&&o.detach&&o.detach(r,a),a.attach&&a.attach(r,o||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Qu,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=tl(n,r.options.lineNumbers),li(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Gn(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Ar(r)},!0),i("scrollbarStyle","native",function(r){Ta(r),Ar(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=tl(r.options.gutters,n),li(r)},!0),i("firstLineNumber",1,li,!0),i("lineNumberFormatter",function(r){return r},li,!0),i("showCursorWhenSelecting",!1,Vr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(kr(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zu),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Vr,!0),i("singleCursorHeightPerLine",!0,Vr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,ai,!0),i("addModeClass",!1,ai,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,ai,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zu(e,t,i){var r=i&&i!=Fr;if(!t!=!r){var n=e.display.dragFunctions,l=t?te:je;l(e.display.scroller,"dragstart",n.start),l(e.display.scroller,"dragenter",n.enter),l(e.display.scroller,"dragover",n.over),l(e.display.scroller,"dragleave",n.leave),l(e.display.scroller,"drop",n.drop)}}function Qu(e){e.options.lineWrapping?(xt(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Me(e.display.wrapper,"CodeMirror-wrap"),En(e)),Kn(e),rt(e),jr(e),setTimeout(function(){return Ar(e)},100)}function Le(e,t){var i=this;if(!(this instanceof Le))return new Le(e,t);this.options=t=t?dt(t):{},dt(Lo,t,!1);var r=t.value;typeof r=="string"?r=new it(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Le.inputStyles[t.inputStyle](this),l=this.display=new uu(e,r,n,t);l.wrapper.CodeMirror=this,So(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ta(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new gt,keySeq:null,specialChars:null},t.autofocus&&!ie&&l.input.focus(),g&&v<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ju(this),Mu(),or(this),this.curOp.forceUpdate=!0,Wa(this,r),t.autofocus&&!ie||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&qn(i)},20):kr(this);for(var a in an)an.hasOwnProperty(a)&&an[a](this,t[a],Fr);Aa(this),t.finishInit&&t.finishInit(this);for(var o=0;o20*20}te(t.scroller,"touchstart",function(s){if(!xe(e,s)&&!l(s)&&!dl(e,s)){t.input.ensurePolled(),clearTimeout(i);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!Nt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var c=e.coordsChar(t.activeTouch,"page"),p;!u.prev||a(u,u.prev)?p=new de(c,c):!u.prev.prev||a(u,u.prev.prev)?p=e.findWordAt(c):p=new de(P(c.line,0),se(e.doc,P(c.line+1,0))),e.setSelection(p.anchor,p.head),e.focus(),Oe(s)}n()}),te(t.scroller,"touchcancel",n),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ti(e,t.scroller.scrollTop),lr(e,t.scroller.scrollLeft,!0),Te(e,"scroll",e))}),te(t.scroller,"mousewheel",function(s){return Da(e,s)}),te(t.scroller,"DOMMouseScroll",function(s){return Da(e,s)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){xe(e,s)||Xr(s)},over:function(s){xe(e,s)||(Au(e,s),Xr(s))},start:function(s){return xu(e,s)},drop:Re(e,ku),leave:function(s){xe(e,s)||no(e)}};var o=t.input.getField();te(o,"keyup",function(s){return vo.call(e,s)}),te(o,"keydown",Re(e,po)),te(o,"keypress",Re(e,yo)),te(o,"focus",function(s){return qn(e,s)}),te(o,"blur",function(s){return kr(e,s)})}var gl=[];Le.defineInitHook=function(e){return gl.push(e)};function bi(e,t,i,r){var n=e.doc,l;i==null&&(i="add"),i=="smart"&&(n.mode.indent?l=$r(e,t).state:i="prev");var a=e.options.tabSize,o=j(n,t),s=Ze(o.text,null,a);o.stateAfter&&(o.stateAfter=null);var u=o.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(o.text))c=0,i="not";else if(i=="smart"&&(c=n.mode.indent(l,o.text.slice(u.length),o.text),c==Ht||c>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?c=Ze(j(n,t-1).text,null,a):c=0:i=="add"?c=s+e.options.indentUnit:i=="subtract"?c=s-e.options.indentUnit:typeof i=="number"&&(c=s+i),c=Math.max(0,c);var p="",L=0;if(e.options.indentWithTabs)for(var C=Math.floor(c/a);C;--C)L+=a,p+=" ";if(La,s=mn(t),u=null;if(o&&r.ranges.length>1)if(mt&&mt.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(n),e.display.lineSpace.removeChild(a)}}}function Zs(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?P(t.line,t.ch+1,"before"):t,t=t.ch?P(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var l=0;l<5;l++){var a=!1,o=vt(e,t),s=!i||i==t?o:vt(e,i);n={left:Math.min(o.left,s.left),top:Math.min(o.top,s.top)-r,right:Math.max(o.left,s.left),bottom:Math.max(o.bottom,s.bottom)+r};var u=Zn(e,n),c=e.doc.scrollTop,p=e.doc.scrollLeft;if(u.scrollTop!=null&&(ti(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),u.scrollLeft!=null&&(lr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(a=!0)),!a)break}return n}function Qs(e,t){var i=Zn(e,t);i.scrollTop!=null&&ti(e,i.scrollTop),i.scrollLeft!=null&&lr(e,i.scrollLeft)}function Zn(e,t){var i=e.display,r=Lr(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=In(e),a={};t.bottom-t.top>l&&(t.bottom=t.top+l);var o=e.doc.height+Fn(i),s=t.topo-r;if(t.topn+l){var c=Math.min(t.top,(u?o:t.bottom)-l);c!=n&&(a.scrollTop=c)}var p=e.options.fixedGutter?0:i.gutters.offsetWidth,L=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-p,C=tr(e)-i.gutters.offsetWidth,E=t.right-t.left>C;return E&&(t.right=t.left+C),t.left<10?a.scrollLeft=0:t.leftC+L-3&&(a.scrollLeft=t.right+(E?0:10)-C),a}function Qn(e,t){t!=null&&($i(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function xr(e){$i(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ei(e,t,i){(t!=null||i!=null)&&$i(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){$i(e),e.curOp.scrollToPos=t}function $i(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=da(e,t.from),r=da(e,t.to);Ca(e,i,r,t.margin)}}function Ca(e,t,i,r){var n=Zn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});ei(e,n.scrollLeft,n.scrollTop)}function ti(e,t){Math.abs(e.doc.scrollTop-t)<2||(M||jn(e,{top:t}),Sa(e,t,!0),M&&jn(e),ni(e,100))}function Sa(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function lr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Aa(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ri(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+Fn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+St(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ar=function(e,t,i){this.cm=i;var r=this.vert=Q("div",[Q("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=Q("div",[Q("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,g&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ar.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},ar.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ar.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ar.prototype.zeroWidthHack=function(){var e=ne&&!$?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new gt,this.disableVert=new gt},ar.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);l!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},ar.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ii=function(){};ii.prototype.update=function(){return{bottom:0,right:0}},ii.prototype.setScrollLeft=function(){},ii.prototype.setScrollTop=function(){},ii.prototype.clear=function(){};function Ar(e,t){t||(t=ri(e));var i=e.display.barWidth,r=e.display.barHeight;La(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Xi(e),La(e,ri(e)),i=e.display.barWidth,r=e.display.barHeight}function La(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Ta={native:ar,null:ii};function ka(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Me(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ta[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?lr(e,t):ti(e,t)},e),e.display.scrollbars.addClass&&xt(e.display.wrapper,e.display.scrollbars.addClass)}var js=0;function or(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++js,markArrays:null},_s(e.curOp)}function sr(e){var t=e.curOp;t&&Ns(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new qi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tu(e){e.updatedDisplay=e.mustUpdate&&Jn(e.cm,e.update)}function ru(e){var t=e.cm,i=t.display;e.updatedDisplay&&Xi(t),e.barMeasure=ri(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=la(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+St(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function iu(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=$r(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var a=l.styles,o=l.text.length>e.options.maxHighlightLength?jt(t.mode,r.state):null,s=El(e,l,r,!0);o&&(r.state=o),l.styles=s.styles;var u=l.styleClasses,c=s.classes;c?l.styleClasses=c:u&&(l.styleClasses=null);for(var p=!a||a.length!=l.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),L=0;!p&&Li)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&ot(e,function(){for(var l=0;l=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&ya(e)==0)return!1;Ma(e)&&(zt(e),t.dims=Un(e));var n=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFroma&&i.viewTo-a<20&&(a=Math.min(n,i.viewTo)),_t&&(l=Nn(e.doc,l),a=$l(e.doc,a));var o=l!=i.viewFrom||a!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Ys(e,l,a),i.viewOffset=Dt(j(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var s=ya(e);if(!o&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var u=ou(e);return s>4&&(i.lineDiv.style.display="none"),uu(e,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,su(u),qe(i.cursorDiv),qe(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,o&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,ni(e,400)),i.updateLineNumbers=null,!0}function xa(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==tr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+Fn(e.display)-In(e),i.top)}),t.visible=Yi(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Yi(e.display,e.doc,i));if(!Jn(e,t))break;Xi(e);var n=ri(e);Vr(e),Ar(e,n),el(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function jn(e,t){var i=new qi(e,t);if(Jn(e,i)){Xi(e),xa(e,i);var r=ri(e);Vr(e),Ar(e,r),el(e,r),i.finish()}}function uu(e,t,i){var r=e.display,n=e.options.lineNumbers,l=r.lineDiv,a=l.firstChild;function o(E){var W=E.nextSibling;return m&&ne&&e.display.currentWheelTarget==E?E.style.display="none":E.parentNode.removeChild(E),W}for(var s=r.view,u=r.viewFrom,c=0;c-1&&(C=!1),jl(e,p,u,i)),C&&(qe(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(Tn(e.options,u)))),a=p.node.nextSibling}u+=p.size}for(;a;)a=o(a)}function Vn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Be(e,"gutterChanged",e)}function el(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+St(e)+"px"}function Aa(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Gn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,l=r+"px",a=0;a=105&&(n.wrapper.style.clipPath="inset(0px)"),n.wrapper.setAttribute("translate","no"),g&&v<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!m&&!(M&&ie)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=tl(r.gutters,r.lineNumbers),_a(n),i.init(n)}var Zi=0,Ot=null;g?Ot=-.53:M?Ot=15:x?Ot=-.7:K&&(Ot=-1/3);function Da(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hu(e){var t=Da(e);return t.x*=Ot,t.y*=Ot,t}function Na(e,t){x&&_==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var i=Da(t),r=i.x,n=i.y,l=Ot;t.deltaMode===0&&(r=t.deltaX,n=t.deltaY,l=1);var a=e.display,o=a.scroller,s=o.scrollWidth>o.clientWidth,u=o.scrollHeight>o.clientHeight;if(r&&s||n&&u){if(n&&ne&&m){e:for(var c=t.target,p=a.view;c!=o;c=c.parentNode)for(var L=0;L=0&&oe(e,r.to())<=0)return i}return-1};var de=function(e,t){this.anchor=e,this.head=t};de.prototype.from=function(){return Oi(this.anchor,this.head)},de.prototype.to=function(){return Ni(this.anchor,this.head)},de.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function yt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(L,C){return oe(L.from(),C.from())}),i=Se(t,n);for(var l=1;l0:s>=0){var u=Oi(o.from(),a.from()),c=Ni(o.to(),a.to()),p=o.empty()?a.from()==a.head:o.from()==o.head;l<=i&&--i,t.splice(--l,2,new de(p?c:u,p?u:c))}}return new ft(t,i)}function Ut(e,t){return new ft([new de(e,t||e)],0)}function Gt(e){return e.text?P(e.from.line+e.text.length-1,f(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Oa(e,t){if(oe(e,t.from)<0)return e;if(oe(e,t.to)<=0)return Gt(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Gt(t).ch-t.to.ch),P(i,r)}function rl(e,t){for(var i=[],r=0;r1&&e.remove(o.line+1,E-1),e.insert(o.line+1,z)}Be(e,"change",e,t)}function Kt(e,t,i){function r(n,l,a){if(n.linked)for(var o=0;o1&&!e.done[e.done.length-2].ranges)return e.done.pop(),f(e.done)}function Pa(e,t,i,r){var n=e.history;n.undone.length=0;var l=+new Date,a,o;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=gu(n,n.lastOp==r)))o=f(a.changes),oe(t.from,t.to)==0&&oe(t.from,o.to)==0?o.to=Gt(t):a.changes.push(ll(e,t));else{var s=f(n.done);for((!s||!s.ranges)&&Ji(e.sel,n.done),a={changes:[ll(e,t)],generation:n.generation},n.done.push(a);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=l,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,o||Te(e,"historyAdded")}function pu(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function vu(e,t,i,r){var n=e.history,l=r&&r.origin;i==n.lastSelOp||l&&n.lastSelOrigin==l&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==l||pu(e,l,f(n.done),t))?n.done[n.done.length-1]=t:Ji(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=l,n.lastSelOp=i,r&&r.clearRedo!==!1&&Ha(n.undone)}function Ji(e,t){var i=f(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Ba(e,t,i,r){var n=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((n||(n=t["spans_"+e.id]={}))[l]=a.markedSpans),++l})}function yu(e){if(!e)return null;for(var t,i=0;i-1&&(f(o)[p]=u[p],delete u[p])}}return r}function al(e,t,i,r){if(r){var n=e.anchor;if(i){var l=oe(t,n)<0;l!=oe(i,n)<0?(n=t,t=i):l!=oe(t,i)<0&&(t=i)}return new de(n,t)}else return new de(i||t,t)}function ji(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Qe(e,new ft([al(e.sel.primary(),t,i,n)],0),r)}function za(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),l=0;l=t.ch:o.to>t.ch))){if(n&&(Te(s,"beforeCursorEnter"),s.explicitlyCleared))if(l.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(i){var p=s.find(r<0?1:-1),L=void 0;if((r<0?c:u)&&(p=$a(e,p,-r,p&&p.line==t.line?l:null)),p&&p.line==t.line&&(L=oe(p,i))&&(r<0?L<0:L>0))return _r(e,p,t,r,n)}var C=s.find(r<0?-1:1);return(r<0?u:c)&&(C=$a(e,C,r,C.line==t.line?l:null)),C?_r(e,C,t,r,n):null}}return t}function en(e,t,i,r,n){var l=r||1,a=_r(e,t,i,l,n)||!n&&_r(e,t,i,l,!0)||_r(e,t,i,-l,n)||!n&&_r(e,t,i,-l,!0);return a||(e.cantEdit=!0,P(e.first,0))}function $a(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?se(e,P(t.line-1)):null:i>0&&t.ch==(r||j(e,t.line)).text.length?t.line=0;--n)Qa(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Qa(e,t)}}function Qa(e,t){if(!(t.text.length==1&&t.text[0]==""&&oe(t.from,t.to)==0)){var i=rl(e,t);Pa(e,t,i,e.cm?e.cm.curOp.id:NaN),oi(e,t,i,_n(e,t));var r=[];Kt(e,function(n,l){!l&&Se(r,n.history)==-1&&(eo(n.history,t),r.push(n.history)),oi(n,t,null,_n(n,t))})}}function tn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,l,a=e.sel,o=t=="undo"?n.done:n.undone,s=t=="undo"?n.undone:n.done,u=0;u=0;--C){var E=L(C);if(E)return E.v}}}}function Ja(e,t){if(t!=0&&(e.first+=t,e.sel=new ft(y(e.sel.ranges,function(n){return new de(P(n.anchor.line+t,n.anchor.ch),P(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){rt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.linel&&(t={from:t.from,to:P(l,j(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vt(e,t.from,t.to),i||(i=rl(e,t)),e.cm?wu(e.cm,t,r):nl(e,t,r),Vi(e,i,ht),e.cantEdit&&en(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function wu(e,t,i){var r=e.doc,n=e.display,l=t.from,a=t.to,o=!1,s=l.line;e.options.lineWrapping||(s=pe(pt(j(r,l.line))),r.iter(s,a.line+1,function(C){if(C==n.maxLine)return o=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Pt(e),nl(r,t,i,va(e)),e.options.lineWrapping||(r.iter(s,l.line+t.text.length,function(C){var E=Pi(C);E>n.maxLineLength&&(n.maxLine=C,n.maxLineLength=E,n.maxLineChanged=!0,o=!1)}),o&&(e.curOp.updateMaxLine=!0)),us(r,l.line),ni(e,400);var u=t.text.length-(a.line-l.line)-1;t.full?rt(e):l.line==a.line&&t.text.length==1&&!Wa(e.doc,t)?Rt(e,l.line,"text"):rt(e,l.line,a.line+1,u);var c=Xe(e,"changes"),p=Xe(e,"change");if(p||c){var L={from:l,to:a,text:t.text,removed:t.removed,origin:t.origin};p&&Be(e,"change",e,L),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(L)}e.display.selForContextMenu=null}function Nr(e,t,i,r,n){var l;r||(r=i),oe(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),Dr(e,{from:i,to:r,text:t,origin:n})}function ja(e,t,i,r){i1||!(this.children[0]instanceof ui))){var o=[];this.collapse(o),this.children=[new ui(o)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=n.lines.length%25+25,o=a;o10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xa(e.doc)),e&&Be(e,"markerCleared",e,this,r,n),t&&sr(e),this.parent&&this.parent.clear()}},Xt.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||a==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=kt("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(Yl(e,t.line,t,i,l)||t.line!=i.line&&Yl(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");hs()}l.addToHistory&&Pa(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var o=t.line,s=e.cm,u;if(e.iter(o,i.line+1,function(p){s&&l.collapsed&&!s.options.lineWrapping&&pt(p)==s.display.maxLine&&(u=!0),l.collapsed&&o!=t.line&&wt(p,0),ds(p,new Wi(l,o==t.line?t.ch:null,o==i.line?i.ch:null),e.cm&&e.cm.curOp),++o}),l.collapsed&&e.iter(t.line,i.line+1,function(p){Bt(e,p)&&wt(p,0)}),l.clearOnEnter&&te(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(fs(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++ro,l.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),l.collapsed)rt(s,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var c=t.line;c<=i.line;c++)Rt(s,c,"text");l.atomic&&Xa(s.doc),Be(s,"markerAdded",s,l)}return l}var ci=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;s--)Dr(this,r[s]);o?Ga(this,o):this.cm&&xr(this.cm)}),undo:ze(function(){tn(this,"undo")}),redo:ze(function(){tn(this,"redo")}),undoSelection:ze(function(){tn(this,"undo",!0)}),redoSelection:ze(function(){tn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=se(this,e),t=se(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(l){var a=l.markedSpans;if(a)for(var o=0;o=s.to||s.from==null&&n!=e.line||s.from!=null&&n==t.line&&s.from>=t.ch)&&(!i||i(s.marker))&&r.push(s.marker.parent||s.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=l,++i}),se(this,P(i,t))},indexFromPos:function(e){e=se(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c=e.dataTransfer.getData("Text");if(c){var p;if(t.state.draggingText&&!t.state.draggingText.copy&&(p=t.listSelections()),Vi(t.doc,Ut(i,i)),p)for(var L=0;L=0;o--)Nr(e.doc,"",r[o].from,r[o].to,"+delete");xr(e)})}function sl(e,t,i){var r=ce(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ul(e,t,i){var r=sl(e,t.ch,i);return r==null?null:new P(t.line,r,i<0?"after":"before")}function fl(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var l=ge(i,t.doc.direction);if(l){var a=n<0?f(l):l[0],o=n<0==(a.level==1),s=o?"after":"before",u;if(a.level>0||t.doc.direction=="rtl"){var c=Sr(t,i);u=n<0?i.text.length-1:0;var p=Lt(t,c,u).top;u=me(function(L){return Lt(t,c,L).top==p},n<0==(a.level==1)?a.from:a.to-1,u),s=="before"&&(u=sl(i,u,1))}else u=n<0?a.to:a.from;return new P(r,u,s)}}return new P(r,n<0?i.text.length:0,n<0?"before":"after")}function Wu(e,t,i,r){var n=ge(t,e.doc.direction);if(!n)return ul(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Ne(n,i.ch,i.sticky),a=n[l];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>i.ch:a.from=a.from&&L>=c.begin)){var C=p?"before":"after";return new P(i.line,L,C)}}var E=function(z,X,U){for(var Y=function(we,Ue){return Ue?new P(i.line,o(we,1),"before"):new P(i.line,we,"after")};z>=0&&z0==(ee.level!=1),fe=V?U.begin:o(U.end,-1);if(ee.from<=fe&&fe0?c.end:o(c.begin,-1);return B!=null&&!(r>0&&B==t.text.length)&&(W=E(r>0?0:n.length-1,r,u(B)),W)?W:null}var pi={selectAll:qa,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return Wr(e,function(t){if(t.empty()){var i=j(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new P(n.line,n.ch+1),e.replaceRange(l.charAt(n.ch-1)+l.charAt(n.ch-2),P(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var a=j(e.doc,n.line-1).text;a&&(n=new P(n.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),P(n.line-1,a.length-1),n,"+transpose"))}}i.push(new de(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return ot(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&oe(t,this.pos)==0&&i==this.button};var yi,mi;function zu(e,t){var i=+new Date;return mi&&mi.compare(i,e,t)?(yi=mi=null,"triple"):yi&&yi.compare(i,e,t)?(mi=new cl(i,e,t),yi=null,"double"):(yi=new cl(i,e,t),mi=null,"single")}function bo(e){var t=this,i=t.display;if(!(xe(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Nt(i,e)){m||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!dl(t,e)){var r=ir(t,e),n=_l(e),l=r?zu(r,n):"single";At(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Uu(t,n,r,l,e))&&(n==1?r?Ku(t,r,l,e):pn(e)==i.scroller&&Oe(e):n==2?(r&&ji(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(Ie?t.display.input.onContextMenu(e):$n(t)))}}}function Uu(e,t,i,r,n){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,vi(e,uo(l,n),n,function(a){if(typeof a=="string"&&(a=pi[a]),!a)return!1;var o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o=a(e,i)!=Ht}finally{e.state.suppressEdits=!1}return o})}function Gu(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var l=he?i.shiftKey&&i.metaKey:i.altKey;n.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=ne?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),n}function Ku(e,t,i,r){g?setTimeout(gr(ba,e),0):e.curOp.focus=tt(It(e));var n=Gu(e,i,r),l=e.doc.sel,a;e.options.dragDrop&&jo&&!e.isReadOnly()&&i=="single"&&(a=l.contains(t))>-1&&(oe((a=l.ranges[a]).from(),t)<0||t.xRel>0)&&(oe(a.to(),t)>0||t.xRel<0)?Xu(e,r,t,n):Yu(e,r,t,n)}function Xu(e,t,i,r){var n=e.display,l=!1,a=Re(e,function(u){m&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:$n(e)),je(n.wrapper.ownerDocument,"mouseup",a),je(n.wrapper.ownerDocument,"mousemove",o),je(n.scroller,"dragstart",s),je(n.scroller,"drop",a),l||(Oe(u),r.addNew||ji(e.doc,i,null,null,r.extend),m&&!K||g&&v==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),o=function(u){l=l||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return l=!0};m&&(n.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,te(n.wrapper.ownerDocument,"mouseup",a),te(n.wrapper.ownerDocument,"mousemove",o),te(n.scroller,"dragstart",s),te(n.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function wo(e,t,i){if(i=="char")return new de(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new de(P(t.line,0),se(e.doc,P(t.line+1,0)));var r=i(e,t);return new de(r.from,r.to)}function Yu(e,t,i,r){g&&$n(e);var n=e.display,l=e.doc;Oe(t);var a,o,s=l.sel,u=s.ranges;if(r.addNew&&!r.extend?(o=l.sel.contains(i),o>-1?a=u[o]:a=new de(i,i)):(a=l.sel.primary(),o=l.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new de(i,i)),i=ir(e,t,!0,!0),o=-1;else{var c=wo(e,i,r.unit);r.extend?a=al(a,c.anchor,c.head,r.extend):a=c}r.addNew?o==-1?(o=u.length,Qe(l,yt(e,u.concat([a]),o),{scroll:!1,origin:"*mouse"})):u.length>1&&u[o].empty()&&r.unit=="char"&&!r.extend?(Qe(l,yt(e,u.slice(0,o).concat(u.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),s=l.sel):ol(l,o,a,Ur):(o=0,Qe(l,new ft([a],0),Ur),s=l.sel);var p=i;function L(U){if(oe(p,U)!=0)if(p=U,r.unit=="rectangle"){for(var Y=[],ee=e.options.tabSize,V=Ze(j(l,i.line).text,i.ch,ee),fe=Ze(j(l,U.line).text,U.ch,ee),we=Math.min(V,fe),Ue=Math.max(V,fe),ke=Math.min(i.line,U.line),st=Math.min(e.lastLine(),Math.max(i.line,U.line));ke<=st;ke++){var nt=j(l,ke).text,We=Gr(nt,we,ee);we==Ue?Y.push(new de(P(ke,We),P(ke,We))):nt.length>We&&Y.push(new de(P(ke,We),P(ke,Gr(nt,Ue,ee))))}Y.length||Y.push(new de(i,i)),Qe(l,yt(e,s.ranges.slice(0,o).concat(Y),o),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var lt=a,Ye=wo(e,U,r.unit),He=lt.anchor,Fe;oe(Ye.anchor,He)>0?(Fe=Ye.head,He=Oi(lt.from(),Ye.anchor)):(Fe=Ye.anchor,He=Ni(lt.to(),Ye.head));var Ae=s.ranges.slice(0);Ae[o]=$u(e,new de(se(l,He),Fe)),Qe(l,yt(e,Ae,o),Ur)}}var C=n.wrapper.getBoundingClientRect(),E=0;function W(U){var Y=++E,ee=ir(e,U,!0,r.unit=="rectangle");if(ee)if(oe(ee,p)!=0){e.curOp.focus=tt(It(e)),L(ee);var V=Yi(n,l);(ee.line>=V.to||ee.lineC.bottom?20:0;fe&&setTimeout(Re(e,function(){E==Y&&(n.scroller.scrollTop+=fe,W(U))}),50)}}function B(U){e.state.selectingText=!1,E=1/0,U&&(Oe(U),n.input.focus()),je(n.wrapper.ownerDocument,"mousemove",z),je(n.wrapper.ownerDocument,"mouseup",X),l.history.lastSelOrigin=null}var z=Re(e,function(U){U.buttons===0||!_l(U)?B(U):W(U)}),X=Re(e,B);e.state.selectingText=X,te(n.wrapper.ownerDocument,"mousemove",z),te(n.wrapper.ownerDocument,"mouseup",X)}function $u(e,t){var i=t.anchor,r=t.head,n=j(e.doc,i.line);if(oe(i,r)==0&&i.sticky==r.sticky)return t;var l=ge(n);if(!l)return t;var a=Ne(l,i.ch,i.sticky),o=l[a];if(o.from!=i.ch&&o.to!=i.ch)return t;var s=a+(o.from==i.ch==(o.level!=1)?0:1);if(s==0||s==l.length)return t;var u;if(r.line!=i.line)u=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var c=Ne(l,r.ch,r.sticky),p=c-a||(r.ch-i.ch)*(o.level==1?-1:1);c==s-1||c==s?u=p<0:u=p>0}var L=l[s+(u?-1:0)],C=u==(L.level==1),E=C?L.from:L.to,W=C?"after":"before";return i.ch==E&&i.sticky==W?t:new de(new P(i.line,E,W),r)}function Co(e,t,i,r){var n,l;if(t.touches)n=t.touches[0].clientX,l=t.touches[0].clientY;else try{n=t.clientX,l=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Oe(t);var a=e.display,o=a.lineDiv.getBoundingClientRect();if(l>o.bottom||!Xe(e,i))return gn(t);l-=o.top-a.viewOffset;for(var s=0;s=n){var c=er(e.doc,l),p=e.display.gutterSpecs[s];return Te(e,i,e,c,p.className,t),gn(t)}}}function dl(e,t){return Co(e,t,"gutterClick",!0)}function So(e,t){Nt(e.display,t)||qu(e,t)||xe(e,t,"contextmenu")||Ie||e.display.input.onContextMenu(t)}function qu(e,t){return Xe(e,"gutterContextMenu")?Co(e,t,"gutterContextMenu",!1):!1}function Lo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),jr(e)}var Fr={toString:function(){return"CodeMirror.Init"}},To={},an={};function Zu(e){var t=e.optionHandlers;function i(r,n,l,a){e.defaults[r]=n,l&&(t[r]=a?function(o,s,u){u!=Fr&&l(o,s,u)}:l)}e.defineOption=i,e.Init=Fr,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,il(r)},!0),i("indentUnit",2,il,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){ai(r),jr(r),rt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var l=[],a=r.doc.first;r.doc.iter(function(s){for(var u=0;;){var c=s.text.indexOf(n,u);if(c==-1)break;u=c+n.length,l.push(P(a,c))}a++});for(var o=l.length-1;o>=0;o--)Nr(r.doc,n,l[o],P(l[o].line,l[o].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,l){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),l!=Fr&&r.refresh()}),i("specialCharPlaceholder",Ts,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",ie?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!re),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Lo(r),li(r)},!0),i("keyMap","default",function(r,n,l){var a=nn(n),o=l!=Fr&&nn(l);o&&o.detach&&o.detach(r,a),a.attach&&a.attach(r,o||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ju,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=tl(n,r.options.lineNumbers),li(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Gn(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Ar(r)},!0),i("scrollbarStyle","native",function(r){ka(r),Ar(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=tl(r.options.gutters,n),li(r)},!0),i("firstLineNumber",1,li,!0),i("lineNumberFormatter",function(r){return r},li,!0),i("showCursorWhenSelecting",!1,Vr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(kr(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Qu),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Vr,!0),i("singleCursorHeightPerLine",!0,Vr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,ai,!0),i("addModeClass",!1,ai,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,ai,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Qu(e,t,i){var r=i&&i!=Fr;if(!t!=!r){var n=e.display.dragFunctions,l=t?te:je;l(e.display.scroller,"dragstart",n.start),l(e.display.scroller,"dragenter",n.enter),l(e.display.scroller,"dragover",n.over),l(e.display.scroller,"dragleave",n.leave),l(e.display.scroller,"drop",n.drop)}}function Ju(e){e.options.lineWrapping?(xt(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Me(e.display.wrapper,"CodeMirror-wrap"),En(e)),Kn(e),rt(e),jr(e),setTimeout(function(){return Ar(e)},100)}function Le(e,t){var i=this;if(!(this instanceof Le))return new Le(e,t);this.options=t=t?dt(t):{},dt(To,t,!1);var r=t.value;typeof r=="string"?r=new it(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Le.inputStyles[t.inputStyle](this),l=this.display=new fu(e,r,n,t);l.wrapper.CodeMirror=this,Lo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ka(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new gt,keySeq:null,specialChars:null},t.autofocus&&!ie&&l.input.focus(),g&&v<11&&setTimeout(function(){return i.display.input.reset(!0)},20),ju(this),_u(),or(this),this.curOp.forceUpdate=!0,Fa(this,r),t.autofocus&&!ie||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&qn(i)},20):kr(this);for(var a in an)an.hasOwnProperty(a)&&an[a](this,t[a],Fr);Ma(this),t.finishInit&&t.finishInit(this);for(var o=0;o20*20}te(t.scroller,"touchstart",function(s){if(!xe(e,s)&&!l(s)&&!dl(e,s)){t.input.ensurePolled(),clearTimeout(i);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!Nt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var c=e.coordsChar(t.activeTouch,"page"),p;!u.prev||a(u,u.prev)?p=new de(c,c):!u.prev.prev||a(u,u.prev.prev)?p=e.findWordAt(c):p=new de(P(c.line,0),se(e.doc,P(c.line+1,0))),e.setSelection(p.anchor,p.head),e.focus(),Oe(s)}n()}),te(t.scroller,"touchcancel",n),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ti(e,t.scroller.scrollTop),lr(e,t.scroller.scrollLeft,!0),Te(e,"scroll",e))}),te(t.scroller,"mousewheel",function(s){return Na(e,s)}),te(t.scroller,"DOMMouseScroll",function(s){return Na(e,s)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){xe(e,s)||Xr(s)},over:function(s){xe(e,s)||(Mu(e,s),Xr(s))},start:function(s){return Au(e,s)},drop:Re(e,xu),leave:function(s){xe(e,s)||lo(e)}};var o=t.input.getField();te(o,"keyup",function(s){return yo.call(e,s)}),te(o,"keydown",Re(e,vo)),te(o,"keypress",Re(e,mo)),te(o,"focus",function(s){return qn(e,s)}),te(o,"blur",function(s){return kr(e,s)})}var gl=[];Le.defineInitHook=function(e){return gl.push(e)};function bi(e,t,i,r){var n=e.doc,l;i==null&&(i="add"),i=="smart"&&(n.mode.indent?l=$r(e,t).state:i="prev");var a=e.options.tabSize,o=j(n,t),s=Ze(o.text,null,a);o.stateAfter&&(o.stateAfter=null);var u=o.text.match(/^\s*/)[0],c;if(!r&&!/\S/.test(o.text))c=0,i="not";else if(i=="smart"&&(c=n.mode.indent(l,o.text.slice(u.length),o.text),c==Ht||c>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?c=Ze(j(n,t-1).text,null,a):c=0:i=="add"?c=s+e.options.indentUnit:i=="subtract"?c=s-e.options.indentUnit:typeof i=="number"&&(c=s+i),c=Math.max(0,c);var p="",L=0;if(e.options.indentWithTabs)for(var C=Math.floor(c/a);C;--C)L+=a,p+=" ";if(La,s=mn(t),u=null;if(o&&r.ranges.length>1)if(mt&&mt.text.join(` `)==t){if(r.ranges.length%mt.text.length==0){u=[];for(var c=0;c=0;L--){var C=r.ranges[L],E=C.from(),W=C.to();C.empty()&&(i&&i>0?E=P(E.line,E.ch-i):e.state.overwrite&&!o?W=P(W.line,Math.min(j(l,W.line).text.length,W.ch+f(s).length)):o&&mt&&mt.lineWise&&mt.text.join(` `)==s.join(` -`)&&(E=W=P(E.line,0)));var B={from:E,to:W,text:u?u[L%u.length]:s,origin:n||(o?"paste":e.state.cutIncoming>a?"cut":"+input")};Dr(e.doc,B),Be(e,"inputRead",e,B)}t&&!o&&ko(e,t),xr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ot(t,function(){return pl(t,i,0,null,"paste")}),!0}function ko(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var l=e.getModeAt(n.head),a=!1;if(l.electricChars){for(var o=0;o-1){a=bi(e,n.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(j(e.doc,n.head.line).text.slice(0,n.head.ch))&&(a=bi(e,n.head.line,"smart"));a&&Be(e,"electricInput",e,n.head.line)}}}function xo(e){for(var t=[],i=[],r=0;rl&&(bi(this,o.head.line,r,!0),l=o.head.line,a==this.doc.sel.primIndex&&xr(this));else{var s=o.from(),u=o.to(),c=Math.max(l,s.line);l=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var p=c;p0&&ol(this.doc,a,new de(s,L[a].to()),ht)}}}),getTokenAt:function(r,n){return Il(this,r,n)},getLineTokens:function(r,n){return Il(this,P(r),n,!0)},getTokenTypeAt:function(r){r=se(this.doc,r);var n=El(this,j(this.doc,r.line)),l=0,a=(n.length-1)/2,o=r.ch,s;if(o==0)s=n[2];else for(;;){var u=l+a>>1;if((u?n[u*2-1]:0)>=o)a=u;else if(n[u*2+1]s&&(r=s,a=!0),o=j(this.doc,r)}else o=r;return zi(this,o,{top:0,left:0},n||"page",l||a).top+(a?this.doc.height-Dt(o):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Tr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,l,a,o){var s=this.display;r=vt(this,se(this.doc,r));var u=r.bottom,c=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),s.sizer.appendChild(n),a=="over")u=r.top;else if(a=="above"||a=="near"){var p=Math.max(s.wrapper.clientHeight,this.doc.height),L=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+n.offsetHeight>p)&&r.top>n.offsetHeight?u=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=p&&(u=r.bottom),c+n.offsetWidth>L&&(c=L-n.offsetWidth)}n.style.top=u+"px",n.style.left=n.style.right="",o=="right"?(c=s.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(o=="left"?c=0:o=="middle"&&(c=(s.sizer.clientWidth-n.offsetWidth)/2),n.style.left=c+"px"),l&&Zs(this,{left:c,top:u,right:c+n.offsetWidth,bottom:u+n.offsetHeight})},triggerOnKeyDown:Ve(po),triggerOnKeyPress:Ve(yo),triggerOnKeyUp:vo,triggerOnMouseDown:Ve(mo),execCommand:function(r){if(pi.hasOwnProperty(r))return pi[r].call(null,this)},triggerElectric:Ve(function(r){ko(this,r)}),findPosH:function(r,n,l,a){var o=1;n<0&&(o=-1,n=-n);for(var s=se(this.doc,r),u=0;u0&&c(l.charAt(a-1));)--a;for(;o.5||this.options.lineWrapping)&&Kn(this),Te(this,"refresh",this)}),swapDoc:Ve(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Wa(this,r),jr(this),this.display.input.reset(),ei(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Be(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Mt(e),e.registerHelper=function(r,n,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=l},e.registerGlobalHelper=function(r,n,l,a){e.registerHelper(r,n,a),i[r]._global.push({pred:l,val:a})}}function yl(e,t,i,r,n){var l=t,a=i,o=j(e,t.line),s=n&&e.direction=="rtl"?-i:i;function u(){var X=t.line+s;return X=e.first+e.size?!1:(t=new P(X,t.ch,t.sticky),o=j(e,X))}function c(X){var U;if(r=="codepoint"){var Y=o.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(Y))U=null;else{var ee=i>0?Y>=55296&&Y<56320:Y>=56320&&Y<57343;U=new P(t.line,Math.max(0,Math.min(o.text.length,t.ch+i*(ee?2:1))),-i)}}else n?U=Eu(e.cm,o,t,i):U=ul(o,t,i);if(U==null)if(!X&&u())t=fl(n,e.cm,o,t.line,s);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var p=null,L=r=="group",C=e.cm&&e.cm.getHelper(t,"wordChars"),E=!0;!(i<0&&!c(!E));E=!1){var W=o.text.charAt(t.ch)||` +`)&&(E=W=P(E.line,0)));var B={from:E,to:W,text:u?u[L%u.length]:s,origin:n||(o?"paste":e.state.cutIncoming>a?"cut":"+input")};Dr(e.doc,B),Be(e,"inputRead",e,B)}t&&!o&&xo(e,t),xr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ko(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ot(t,function(){return pl(t,i,0,null,"paste")}),!0}function xo(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var l=e.getModeAt(n.head),a=!1;if(l.electricChars){for(var o=0;o-1){a=bi(e,n.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(j(e.doc,n.head.line).text.slice(0,n.head.ch))&&(a=bi(e,n.head.line,"smart"));a&&Be(e,"electricInput",e,n.head.line)}}}function Ao(e){for(var t=[],i=[],r=0;rl&&(bi(this,o.head.line,r,!0),l=o.head.line,a==this.doc.sel.primIndex&&xr(this));else{var s=o.from(),u=o.to(),c=Math.max(l,s.line);l=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var p=c;p0&&ol(this.doc,a,new de(s,L[a].to()),ht)}}}),getTokenAt:function(r,n){return Hl(this,r,n)},getLineTokens:function(r,n){return Hl(this,P(r),n,!0)},getTokenTypeAt:function(r){r=se(this.doc,r);var n=Wl(this,j(this.doc,r.line)),l=0,a=(n.length-1)/2,o=r.ch,s;if(o==0)s=n[2];else for(;;){var u=l+a>>1;if((u?n[u*2-1]:0)>=o)a=u;else if(n[u*2+1]s&&(r=s,a=!0),o=j(this.doc,r)}else o=r;return zi(this,o,{top:0,left:0},n||"page",l||a).top+(a?this.doc.height-Dt(o):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Tr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,l,a,o){var s=this.display;r=vt(this,se(this.doc,r));var u=r.bottom,c=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),s.sizer.appendChild(n),a=="over")u=r.top;else if(a=="above"||a=="near"){var p=Math.max(s.wrapper.clientHeight,this.doc.height),L=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+n.offsetHeight>p)&&r.top>n.offsetHeight?u=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=p&&(u=r.bottom),c+n.offsetWidth>L&&(c=L-n.offsetWidth)}n.style.top=u+"px",n.style.left=n.style.right="",o=="right"?(c=s.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(o=="left"?c=0:o=="middle"&&(c=(s.sizer.clientWidth-n.offsetWidth)/2),n.style.left=c+"px"),l&&Qs(this,{left:c,top:u,right:c+n.offsetWidth,bottom:u+n.offsetHeight})},triggerOnKeyDown:Ve(vo),triggerOnKeyPress:Ve(mo),triggerOnKeyUp:yo,triggerOnMouseDown:Ve(bo),execCommand:function(r){if(pi.hasOwnProperty(r))return pi[r].call(null,this)},triggerElectric:Ve(function(r){xo(this,r)}),findPosH:function(r,n,l,a){var o=1;n<0&&(o=-1,n=-n);for(var s=se(this.doc,r),u=0;u0&&c(l.charAt(a-1));)--a;for(;o.5||this.options.lineWrapping)&&Kn(this),Te(this,"refresh",this)}),swapDoc:Ve(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Fa(this,r),jr(this),this.display.input.reset(),ei(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Be(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Mt(e),e.registerHelper=function(r,n,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=l},e.registerGlobalHelper=function(r,n,l,a){e.registerHelper(r,n,a),i[r]._global.push({pred:l,val:a})}}function yl(e,t,i,r,n){var l=t,a=i,o=j(e,t.line),s=n&&e.direction=="rtl"?-i:i;function u(){var X=t.line+s;return X=e.first+e.size?!1:(t=new P(X,t.ch,t.sticky),o=j(e,X))}function c(X){var U;if(r=="codepoint"){var Y=o.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(Y))U=null;else{var ee=i>0?Y>=55296&&Y<56320:Y>=56320&&Y<57343;U=new P(t.line,Math.max(0,Math.min(o.text.length,t.ch+i*(ee?2:1))),-i)}}else n?U=Wu(e.cm,o,t,i):U=ul(o,t,i);if(U==null)if(!X&&u())t=fl(n,e.cm,o,t.line,s);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")c();else if(r=="column")c(!0);else if(r=="word"||r=="group")for(var p=null,L=r=="group",C=e.cm&&e.cm.getHelper(t,"wordChars"),E=!0;!(i<0&&!c(!E));E=!1){var W=o.text.charAt(t.ch)||` `,B=H(W,C)?"w":L&&W==` -`?"n":!L||/\s/.test(W)?null:"p";if(L&&!E&&!B&&(B="s"),p&&p!=B){i<0&&(i=1,c(),t.sticky="after");break}if(B&&(p=B),i>0&&!c(!E))break}var z=en(e,t,l,a,!0);return kn(l,z)&&(z.hitSide=!0),z}function Mo(e,t,i,r){var n=e.doc,l=t.left,a;if(r=="page"){var o=Math.min(e.display.wrapper.clientHeight,At(e).innerHeight||n(e).documentElement.clientHeight),s=Math.max(o-.5*Lr(e.display),3);a=(i>0?t.bottom:t.top)+i*s}else r=="line"&&(a=i>0?t.bottom+3:t.top-3);for(var u;u=Rn(e,l,a),!!u.outside;){if(i<0?a<=0:a>=n.height){u.hitSide=!0;break}a+=i*5}return u}var ve=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new gt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ve.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,vl(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(o){for(var s=o.target;s;s=s.parentNode){if(s==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}te(n,"paste",function(o){!l(o)||xe(r,o)||To(o,r)||v<=11&&setTimeout(Re(r,function(){return t.updateFromDOM()}),20)}),te(n,"compositionstart",function(o){t.composing={data:o.data,done:!1}}),te(n,"compositionupdate",function(o){t.composing||(t.composing={data:o.data,done:!1})}),te(n,"compositionend",function(o){t.composing&&(o.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(n,"touchstart",function(){return i.forceCompositionEnd()}),te(n,"input",function(){t.composing||t.readFromDOMSoon()});function a(o){if(!(!l(o)||xe(r,o))){if(r.somethingSelected())on({lineWise:!1,text:r.getSelections()}),o.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=xo(r);on({lineWise:!0,text:s.text}),o.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(o.clipboardData){o.clipboardData.clearData();var u=mt.text.join(` -`);if(o.clipboardData.setData("Text",u),o.clipboardData.getData("Text")==u){o.preventDefault();return}}var c=Ao(),p=c.firstChild;vl(p),r.display.lineSpace.insertBefore(c,r.display.lineSpace.firstChild),p.value=mt.text.join(` -`);var L=tt(Pe(n));Zt(p),setTimeout(function(){r.display.lineSpace.removeChild(c),L.focus(),L==n&&i.showPrimarySelection()},50)}}te(n,"copy",a),te(n,"cut",a)},ve.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ve.prototype.prepareSelection=function(){var e=ya(this.cm,!1);return e.focus=tt(Pe(this.div))==this.div,e},ve.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ve.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ve.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&_o(t,r)||{node:o[0].measure.map[2],offset:0},u=n.linee.firstLine()&&(r=P(r.line-1,j(e.doc,r.line-1).length)),n.ch==j(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var l,a,o;r.line==t.viewFrom||(l=nr(e,r.line))==0?(a=pe(t.view[0].line),o=t.view[0].node):(a=pe(t.view[l].line),o=t.view[l-1].node.nextSibling);var s=nr(e,n.line),u,c;if(s==t.view.length-1?(u=t.viewTo-1,c=t.lineDiv.lastChild):(u=pe(t.view[s+1].line)-1,c=t.view[s+1].node.previousSibling),!o)return!1;for(var p=e.doc.splitLines(ef(e,o,c,a,u)),L=Vt(e.doc,P(a,0),P(u,j(e.doc,u).text.length));p.length>1&&L.length>1;)if(f(p)==f(L))p.pop(),L.pop(),u--;else if(p[0]==L[0])p.shift(),L.shift(),a++;else break;for(var C=0,E=0,W=p[0],B=L[0],z=Math.min(W.length,B.length);Cr.ch&&X.charCodeAt(X.length-E-1)==U.charCodeAt(U.length-E-1);)C--,E++;p[p.length-1]=X.slice(0,X.length-E).replace(/^\u200b+/,""),p[0]=p[0].slice(C).replace(/\u200b+$/,"");var ee=P(a,C),V=P(u,L.length?f(L).length-E:0);if(p.length>1||p[0]||oe(ee,V))return Nr(e.doc,p,ee,V,"+input"),!0},ve.prototype.ensurePolled=function(){this.forceCompositionEnd()},ve.prototype.reset=function(){this.forceCompositionEnd()},ve.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ve.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ve.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ot(this.cm,function(){return rt(e.cm)})},ve.prototype.setUneditable=function(e){e.contentEditable="false"},ve.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Re(this.cm,pl)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ve.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ve.prototype.onContextMenu=function(){},ve.prototype.resetPosition=function(){},ve.prototype.needsContentAttribute=!0;function _o(e,t){var i=Hn(e,t.line);if(!i||i.hidden)return null;var r=j(e.doc,t.line),n=ia(i,r,t.line),l=ge(r,e.doc.direction),a="left";if(l){var o=Ne(l,t.ch);a=o%2?"right":"left"}var s=aa(n.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Vu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ir(e,t){return t&&(e.bad=!0),e}function ef(e,t,i,r,n){var l="",a=!1,o=e.doc.lineSeparator(),s=!1;function u(C){return function(E){return E.id==C}}function c(){a&&(l+=o,s&&(l+=o),a=s=!1)}function p(C){C&&(c(),l+=C)}function L(C){if(C.nodeType==1){var E=C.getAttribute("cm-text");if(E){p(E);return}var W=C.getAttribute("cm-marker"),B;if(W){var z=e.findMarks(P(r,0),P(n+1,0),u(+W));z.length&&(B=z[0].find(0))&&p(Vt(e.doc,B.from,B.to).join(o));return}if(C.getAttribute("contenteditable")=="false")return;var X=/^(pre|div|p|li|table|br)$/i.test(C.nodeName);if(!/^br$/i.test(C.nodeName)&&C.textContent.length==0)return;X&&c();for(var U=0;U=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),te(n,"paste",function(a){xe(r,a)||To(a,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(a){if(!xe(r,a)){if(r.somethingSelected())on({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var o=xo(r);on({lineWise:!0,text:o.text}),a.type=="cut"?r.setSelections(o.ranges,null,ht):(i.prevInput="",n.value=o.text.join(` -`),Zt(n))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(n,"cut",l),te(n,"copy",l),te(e.scroller,"paste",function(a){if(!(Nt(e,a)||xe(r,a))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var o=new Event("paste");o.clipboardData=a.clipboardData,n.dispatchEvent(o)}}),te(e.lineSpace,"selectstart",function(a){Nt(e,a)||Oe(a)}),te(n,"compositionstart",function(){var a=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},_e.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;vl(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},_e.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},_e.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=ya(e);if(e.options.moveInputWithCursor){var n=vt(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+a.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+a.left-l.left))}return r},_e.prototype.showSelection=function(e){var t=this.cm,i=t.display;De(i.cursorDiv,e.cursors),De(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},_e.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&Zt(this.textarea),g&&v>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",g&&v>=9&&(this.hasSelection=null));this.resetting=!1}},_e.prototype.getField=function(){return this.textarea},_e.prototype.supportsTouch=function(){return!1},_e.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!ie||tt(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},_e.prototype.blur=function(){this.textarea.blur()},_e.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},_e.prototype.receivedFocus=function(){this.slowPoll()},_e.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},_e.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},_e.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||es(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(g&&v>=9&&this.hasSelection===n||ne&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=n.charCodeAt(0);if(l==8203&&!r&&(r="​"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,o=Math.min(r.length,n.length);a1e3||n.indexOf(` +`?"n":!L||/\s/.test(W)?null:"p";if(L&&!E&&!B&&(B="s"),p&&p!=B){i<0&&(i=1,c(),t.sticky="after");break}if(B&&(p=B),i>0&&!c(!E))break}var z=en(e,t,l,a,!0);return kn(l,z)&&(z.hitSide=!0),z}function _o(e,t,i,r){var n=e.doc,l=t.left,a;if(r=="page"){var o=Math.min(e.display.wrapper.clientHeight,At(e).innerHeight||n(e).documentElement.clientHeight),s=Math.max(o-.5*Lr(e.display),3);a=(i>0?t.bottom:t.top)+i*s}else r=="line"&&(a=i>0?t.bottom+3:t.top-3);for(var u;u=Rn(e,l,a),!!u.outside;){if(i<0?a<=0:a>=n.height){u.hitSide=!0;break}a+=i*5}return u}var ve=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new gt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ve.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,vl(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(o){for(var s=o.target;s;s=s.parentNode){if(s==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}te(n,"paste",function(o){!l(o)||xe(r,o)||ko(o,r)||v<=11&&setTimeout(Re(r,function(){return t.updateFromDOM()}),20)}),te(n,"compositionstart",function(o){t.composing={data:o.data,done:!1}}),te(n,"compositionupdate",function(o){t.composing||(t.composing={data:o.data,done:!1})}),te(n,"compositionend",function(o){t.composing&&(o.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(n,"touchstart",function(){return i.forceCompositionEnd()}),te(n,"input",function(){t.composing||t.readFromDOMSoon()});function a(o){if(!(!l(o)||xe(r,o))){if(r.somethingSelected())on({lineWise:!1,text:r.getSelections()}),o.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=Ao(r);on({lineWise:!0,text:s.text}),o.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(o.clipboardData){o.clipboardData.clearData();var u=mt.text.join(` +`);if(o.clipboardData.setData("Text",u),o.clipboardData.getData("Text")==u){o.preventDefault();return}}var c=Mo(),p=c.firstChild;vl(p),r.display.lineSpace.insertBefore(c,r.display.lineSpace.firstChild),p.value=mt.text.join(` +`);var L=tt(Pe(n));Zt(p),setTimeout(function(){r.display.lineSpace.removeChild(c),L.focus(),L==n&&i.showPrimarySelection()},50)}}te(n,"copy",a),te(n,"cut",a)},ve.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ve.prototype.prepareSelection=function(){var e=ma(this.cm,!1);return e.focus=tt(Pe(this.div))==this.div,e},ve.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ve.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ve.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Do(t,r)||{node:o[0].measure.map[2],offset:0},u=n.linee.firstLine()&&(r=P(r.line-1,j(e.doc,r.line-1).length)),n.ch==j(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var l,a,o;r.line==t.viewFrom||(l=nr(e,r.line))==0?(a=pe(t.view[0].line),o=t.view[0].node):(a=pe(t.view[l].line),o=t.view[l-1].node.nextSibling);var s=nr(e,n.line),u,c;if(s==t.view.length-1?(u=t.viewTo-1,c=t.lineDiv.lastChild):(u=pe(t.view[s+1].line)-1,c=t.view[s+1].node.previousSibling),!o)return!1;for(var p=e.doc.splitLines(tf(e,o,c,a,u)),L=Vt(e.doc,P(a,0),P(u,j(e.doc,u).text.length));p.length>1&&L.length>1;)if(f(p)==f(L))p.pop(),L.pop(),u--;else if(p[0]==L[0])p.shift(),L.shift(),a++;else break;for(var C=0,E=0,W=p[0],B=L[0],z=Math.min(W.length,B.length);Cr.ch&&X.charCodeAt(X.length-E-1)==U.charCodeAt(U.length-E-1);)C--,E++;p[p.length-1]=X.slice(0,X.length-E).replace(/^\u200b+/,""),p[0]=p[0].slice(C).replace(/\u200b+$/,"");var ee=P(a,C),V=P(u,L.length?f(L).length-E:0);if(p.length>1||p[0]||oe(ee,V))return Nr(e.doc,p,ee,V,"+input"),!0},ve.prototype.ensurePolled=function(){this.forceCompositionEnd()},ve.prototype.reset=function(){this.forceCompositionEnd()},ve.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ve.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ve.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ot(this.cm,function(){return rt(e.cm)})},ve.prototype.setUneditable=function(e){e.contentEditable="false"},ve.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Re(this.cm,pl)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ve.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ve.prototype.onContextMenu=function(){},ve.prototype.resetPosition=function(){},ve.prototype.needsContentAttribute=!0;function Do(e,t){var i=Hn(e,t.line);if(!i||i.hidden)return null;var r=j(e.doc,t.line),n=na(i,r,t.line),l=ge(r,e.doc.direction),a="left";if(l){var o=Ne(l,t.ch);a=o%2?"right":"left"}var s=oa(n.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function ef(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ir(e,t){return t&&(e.bad=!0),e}function tf(e,t,i,r,n){var l="",a=!1,o=e.doc.lineSeparator(),s=!1;function u(C){return function(E){return E.id==C}}function c(){a&&(l+=o,s&&(l+=o),a=s=!1)}function p(C){C&&(c(),l+=C)}function L(C){if(C.nodeType==1){var E=C.getAttribute("cm-text");if(E){p(E);return}var W=C.getAttribute("cm-marker"),B;if(W){var z=e.findMarks(P(r,0),P(n+1,0),u(+W));z.length&&(B=z[0].find(0))&&p(Vt(e.doc,B.from,B.to).join(o));return}if(C.getAttribute("contenteditable")=="false")return;var X=/^(pre|div|p|li|table|br)$/i.test(C.nodeName);if(!/^br$/i.test(C.nodeName)&&C.textContent.length==0)return;X&&c();for(var U=0;U=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),te(n,"paste",function(a){xe(r,a)||ko(a,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(a){if(!xe(r,a)){if(r.somethingSelected())on({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var o=Ao(r);on({lineWise:!0,text:o.text}),a.type=="cut"?r.setSelections(o.ranges,null,ht):(i.prevInput="",n.value=o.text.join(` +`),Zt(n))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(n,"cut",l),te(n,"copy",l),te(e.scroller,"paste",function(a){if(!(Nt(e,a)||xe(r,a))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var o=new Event("paste");o.clipboardData=a.clipboardData,n.dispatchEvent(o)}}),te(e.lineSpace,"selectstart",function(a){Nt(e,a)||Oe(a)}),te(n,"compositionstart",function(){var a=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},_e.prototype.createField=function(e){this.wrapper=Mo(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;vl(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},_e.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},_e.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=ma(e);if(e.options.moveInputWithCursor){var n=vt(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+a.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+a.left-l.left))}return r},_e.prototype.showSelection=function(e){var t=this.cm,i=t.display;De(i.cursorDiv,e.cursors),De(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},_e.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&Zt(this.textarea),g&&v>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",g&&v>=9&&(this.hasSelection=null));this.resetting=!1}},_e.prototype.getField=function(){return this.textarea},_e.prototype.supportsTouch=function(){return!1},_e.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!ie||tt(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},_e.prototype.blur=function(){this.textarea.blur()},_e.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},_e.prototype.receivedFocus=function(){this.slowPoll()},_e.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},_e.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},_e.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||ts(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(g&&v>=9&&this.hasSelection===n||ne&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=n.charCodeAt(0);if(l==8203&&!r&&(r="​"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,o=Math.min(r.length,n.length);a1e3||n.indexOf(` `)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},_e.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},_e.prototype.onKeyPress=function(){g&&v>=9&&(this.hasSelection=null),this.fastPoll()},_e.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var l=ir(i,e),a=r.scroller.scrollTop;if(!l||I)return;var o=i.options.resetSelectionOnContextMenu;o&&i.doc.sel.contains(l)==-1&&Re(i,Qe)(i.doc,Ut(l),ht);var s=n.style.cssText,u=t.wrapper.style.cssText,c=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+`px; z-index: 1000; background: `+(g?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var p;m&&(p=n.ownerDocument.defaultView.scrollY),r.input.focus(),m&&n.ownerDocument.defaultView.scrollTo(null,p),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=C,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function L(){if(n.selectionStart!=null){var W=i.somethingSelected(),B="​"+(W?n.value:"");n.value="⇚",n.value=B,t.prevInput=W?"":"​",n.selectionStart=1,n.selectionEnd=B.length,r.selForContextMenu=i.doc.sel}}function C(){if(t.contextMenuPending==C&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,n.style.cssText=s,g&&v<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),n.selectionStart!=null)){(!g||g&&v<9)&&L();var W=0,B=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="​"?Re(i,$a)(i):W++<10?r.detectingSelectAll=setTimeout(B,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(B,200)}}if(g&&v>=9&&L(),Ie){Xr(e);var E=function(){je(window,"mouseup",E),setTimeout(C,20)};te(window,"mouseup",E)}else setTimeout(C,50)},_e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},_e.prototype.setUneditable=function(){},_e.prototype.needsContentAttribute=!1;function rf(e,t){if(t=t?dt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=tt(Pe(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=o.getValue()}var n;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;n=l.submit;try{var a=l.submit=function(){r(),l.submit=n,l.submit(),l.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var o=Le(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return o}function nf(e){e.off=je,e.on=te,e.wheelEventPixels=fu,e.Doc=it,e.splitLines=mn,e.countColumn=Ze,e.findColumn=Gr,e.isWordChar=F,e.Pass=Ht,e.signal=Te,e.Line=wr,e.changeEnd=Gt,e.scrollbarModel=La,e.Pos=P,e.cmpPos=oe,e.modes=wn,e.mimeModes=mr,e.resolveMode=Di,e.getMode=Cn,e.modeExtensions=br,e.extendMode=ls,e.copyState=jt,e.startState=_l,e.innerMode=Sn,e.commands=pi,e.keyMap=Et,e.keyName=uo,e.isModifierKey=oo,e.lookupKey=Er,e.normalizeKeyMap=Ou,e.StringStream=Ee,e.SharedTextMarker=ci,e.TextMarker=Xt,e.LineWidget=hi,e.e_preventDefault=Oe,e.e_stopPropagation=Al,e.e_stop=Xr,e.addClass=xt,e.contains=ct,e.rmClass=Me,e.keyNames=Yt}qu(Le),ju(Le);var lf="iter insert remove copy getEditor constructor".split(" ");for(var un in it.prototype)it.prototype.hasOwnProperty(un)&&Se(lf,un)<0&&(Le.prototype[un]=function(e){return function(){return e.apply(this.doc,arguments)}}(it.prototype[un]));return Mt(it),Le.inputStyles={textarea:_e,contenteditable:ve},Le.defineMode=function(e){!Le.defaults.mode&&e!="null"&&(Le.defaults.mode=e),is.apply(this,arguments)},Le.defineMIME=ns,Le.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Le.defineMIME("text/plain","null"),Le.defineExtension=function(e,t){Le.prototype[e]=t},Le.defineDocExtension=function(e,t){it.prototype[e]=t},Le.fromTextArea=rf,nf(Le),Le.version="5.65.16",Le})})(Ro);var zo=Ro.exports;const ff=uf(zo);(function(O,b){(function(T){T(zo)})(function(T){var N=T.Pos,M="http://www.w3.org/2000/svg";function G(f,y){this.mv=f,this.type=y,this.classes=y=="left"?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}G.prototype={constructor:G,init:function(f,y,S){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=T(f,dt({value:y,readOnly:!this.mv.options.allowEditingOriginals},dt(S))),this.mv.options.connect=="align"&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new Ht(this.edit)),this.orig.state.trackAlignable=new Ht(this.orig)),this.lockButton.title=this.edit.phrase("Toggle locked scrolling"),this.lockButton.setAttribute("aria-label",this.lockButton.title),this.orig.state.diffViews=[this];var k=S.chunkClassLocation||"background";Object.prototype.toString.call(k)!="[object Array]"&&(k=[k]),this.classes.classLocation=k,this.diff=kt(De(y),De(S.value),this.mv.options.ignoreWhitespace),this.chunks=bt(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=S.showDifferences!==!1},registerEvents:function(f){this.forceUpdate=g(this),x(this,!0,!1),v(this,f)},setShowDifferences:function(f){f=f!==!1,f!=this.showDifferences&&(this.showDifferences=f,this.forceUpdate("full"))}};function h(f){f.diffOutOfDate&&(f.diff=kt(f.orig.getValue(),f.edit.getValue(),f.mv.options.ignoreWhitespace),f.chunks=bt(f.diff),f.diffOutOfDate=!1,T.signal(f.edit,"updateDiff",f.diff))}var d=!1;function g(f){var y={from:0,to:0,marked:[]},S={from:0,to:0,marked:[]},k,A=!1;function D(ue){d=!0,A=!1,ue=="full"&&(f.svg&&At(f.svg),f.copyButtons&&At(f.copyButtons),I(f.edit,y.marked,f.classes),I(f.orig,S.marked,f.classes),y.from=y.to=S.from=S.to=0),h(f),f.showDifferences&&(K(f.edit,f.diff,y,DIFF_INSERT,f.classes),K(f.orig,f.diff,S,DIFF_DELETE,f.classes)),f.mv.options.connect=="align"&&re(f),Z(f),f.needsScrollSync!=null&&m(f,f.needsScrollSync),d=!1}function F(ue){d||(f.dealigned=!0,H(ue))}function H(ue){d||A||(clearTimeout(k),ue===!0&&(A=!0),k=setTimeout(D,ue===!0?20:250))}function R(ue,ce){f.diffOutOfDate||(f.diffOutOfDate=!0,y.from=y.to=S.from=S.to=0),F(ce.text.length-1!=ce.to.line-ce.from.line)}function ae(){f.diffOutOfDate=!0,f.dealigned=!0,D("full")}return f.edit.on("change",R),f.orig.on("change",R),f.edit.on("swapDoc",ae),f.orig.on("swapDoc",ae),f.mv.options.connect=="align"&&(T.on(f.edit.state.trackAlignable,"realign",F),T.on(f.orig.state.trackAlignable,"realign",F)),f.edit.on("viewportChange",function(){H(!1)}),f.orig.on("viewportChange",function(){H(!1)}),D(),D}function v(f,y){f.edit.on("scroll",function(){m(f,!0)&&Z(f)}),f.orig.on("scroll",function(){m(f,!1)&&Z(f),y&&m(y,!0)&&Z(y)})}function m(f,y){if(f.diffOutOfDate)return f.lockScroll&&f.needsScrollSync==null&&(f.needsScrollSync=y),!1;if(f.needsScrollSync=null,!f.lockScroll)return!0;var S,k,A=+new Date;if(y?(S=f.edit,k=f.orig):(S=f.orig,k=f.edit),S.state.scrollSetBy==f&&(S.state.scrollSetAt||0)+250>A)return!1;var D=S.getScrollInfo();if(f.mv.options.connect=="align")Ce=D.top;else{var F=.5*D.clientHeight,H=D.top+F,R=S.lineAtHeight(H,"local"),ae=xt(f.chunks,R,y),ue=w(S,y?ae.edit:ae.orig),ce=w(k,y?ae.orig:ae.edit),me=(H-ue.top)/(ue.bot-ue.top),Ce=ce.top-F+me*(ce.bot-ce.top),be,Ne;if(Ce>D.top&&(Ne=D.top/F)<1)Ce=Ce*Ne+D.top*(1-Ne);else if((be=D.height-D.clientHeight-D.top)be&&(Ne=be/F)<1&&(Ce=Ce*Ne+(ut.height-ut.clientHeight-be)*(1-Ne))}}return k.scrollTo(D.left,Ce),k.state.scrollSetAt=A,k.state.scrollSetBy=f,!0}function w(f,y){var S=y.after;return S==null&&(S=f.lastLine()+1),{top:f.heightAtLine(y.before||0,"local"),bot:f.heightAtLine(S,"local")}}function x(f,y,S){f.lockScroll=y,y&&S!=!1&&m(f,DIFF_INSERT)&&Z(f),(y?T.addClass:T.rmClass)(f.lockButton,"CodeMirror-merge-scrolllock-enabled")}function _(f,y,S){for(var k=S.classLocation,A=0;A20||S.from-D.to>20?(I(f,S.marked,A),q(f,y,k,S.marked,D.from,D.to,A),S.from=D.from,S.to=D.to):(D.fromS.to&&(q(f,y,k,S.marked,S.to,D.to,A),S.to=D.to))})}function $(f,y,S,k,A,D){for(var F=S.classLocation,H=f.getLineHandle(y),R=0;RKr&&(Ce&&(ce(me,Kr),Ce=!1),me=te)}else if(Ce=!0,ut==S){var yr=Ze(H,ge,!0),je=Ur(R,H),Te=ht(ae,yr);Jt(je,Te)||k.push(f.markText(je,Te,{className:ue})),H=yr}}Ce&&ce(me,H.line+1)}function Z(f){if(f.showDifferences){if(f.svg){At(f.svg);var y=f.gap.offsetWidth;gr(f.svg,"width",y,"height",f.gap.offsetHeight)}f.copyButtons&&At(f.copyButtons);for(var S=f.edit.getViewport(),k=f.orig.getViewport(),A=f.mv.wrap.getBoundingClientRect().top,D=A-f.edit.getScrollerElement().getBoundingClientRect().top+f.edit.getScrollInfo().top,F=A-f.orig.getScrollerElement().getBoundingClientRect().top+f.orig.getScrollInfo().top,H=0;H=S.from&&R.origFrom<=k.to&&R.origTo>=k.from&&Ie(f,R,F,D,y)}}}function le(f,y){for(var S=0,k=0,A=0;Af&&D.editFrom<=f)return null;if(D.editFrom>f)break;S=D.editTo,k=D.origTo}return k+(f-S)}function ie(f,y,S){for(var k=f.state.trackAlignable,A=f.firstLine(),D=0,F=[],H=0;;H++){for(var R=y[H],ae=R?S?R.origFrom:R.editFrom:1e9;Dce){D++,A--;continue e}if(me.editTo>ue){if(me.editFrom<=ue)continue e;break}H+=me.origTo-me.origFrom-(me.editTo-me.editFrom),F++}if(ue==ce-H)R[k]=ce,D++;else if(ue1&&k.push(ye(f[F],S[F],R))}}function ye(f,y,S){var k=!0;y>f.lastLine()&&(y--,k=!1);var A=document.createElement("div");return A.className="CodeMirror-merge-spacer",A.style.height=S+"px",A.style.minWidth="1px",f.addLineWidget(y,A,{height:S,above:k,mergeSpacer:!0,handleMouseEvents:!0})}function Ie(f,y,S,k,A){var D=f.type=="left",F=f.orig.heightAtLine(y.origFrom,"local",!0)-S;if(f.svg){var H=F,R=f.edit.heightAtLine(y.editFrom,"local",!0)-k;if(D){var ae=H;H=R,R=ae}var ue=f.orig.heightAtLine(y.origTo,"local",!0)-S,ce=f.edit.heightAtLine(y.editTo,"local",!0)-k;if(D){var ae=ue;ue=ce,ce=ae}var me=" C "+A/2+" "+R+" "+A/2+" "+H+" "+(A+2)+" "+H,Ce=" C "+A/2+" "+ue+" "+A/2+" "+ce+" -1 "+ce;gr(f.svg.appendChild(document.createElementNS(M,"path")),"d","M -1 "+R+me+" L "+(A+2)+" "+ue+Ce+" z","class",f.classes.connect)}if(f.copyButtons){var be=f.copyButtons.appendChild(Pe("div",f.type=="left"?"⇝":"⇜","CodeMirror-merge-copy")),Ne=f.mv.options.allowEditingOriginals;if(be.title=f.edit.phrase(Ne?"Push to left":"Revert chunk"),be.chunk=y,be.style.top=(y.origTo>y.origFrom?F:f.edit.heightAtLine(y.editFrom,"local")-k)+"px",be.setAttribute("role","button"),be.setAttribute("tabindex","0"),be.setAttribute("aria-label",be.title),Ne){var ut=f.edit.heightAtLine(y.editFrom,"local")-k,ge=f.copyButtons.appendChild(Pe("div",f.type=="right"?"⇝":"⇜","CodeMirror-merge-copy-reverse"));ge.title="Push to right",ge.chunk={editFrom:y.origFrom,editTo:y.origTo,origFrom:y.editFrom,origTo:y.editTo},ge.style.top=ut+"px",f.type=="right"?ge.style.left="2px":ge.style.right="2px",ge.setAttribute("role","button"),ge.setAttribute("tabindex","0"),ge.setAttribute("aria-label",ge.title)}}}function Ke(f,y,S,k){if(!f.diffOutOfDate){var A=k.origTo>S.lastLine()?N(k.origFrom-1):N(k.origFrom,0),D=N(k.origTo,0),F=k.editTo>y.lastLine()?N(k.editFrom-1):N(k.editFrom,0),H=N(k.editTo,0),R=f.mv.options.revertChunk;R?R(f.mv,S,A,D,y,F,H):y.replaceRange(S.getRange(A,D),F,H)}}var Me=T.MergeView=function(f,y){if(!(this instanceof Me))return new Me(f,y);this.options=y;var S=y.origLeft,k=y.origRight==null?y.orig:y.origRight,A=S!=null,D=k!=null,F=1+(A?1:0)+(D?1:0),H=[],R=this.left=null,ae=this.right=null,ue=this;if(A){R=this.left=new G(this,"left");var ce=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");H.push(ce),H.push(qe(R))}var me=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(H.push(me),D){ae=this.right=new G(this,"right"),H.push(qe(ae));var Ce=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");H.push(Ce)}(D?Ce:me).className+=" CodeMirror-merge-pane-rightmost",H.push(Pe("div",null,null,"height: 0; clear: both;"));var be=this.wrap=f.appendChild(Pe("div",H,"CodeMirror-merge CodeMirror-merge-"+F+"pane"));this.edit=T(me,dt(y)),R&&R.init(ce,S,y),ae&&ae.init(Ce,k,y),y.collapseIdentical&&this.editor().operation(function(){It(ue,y.collapseIdentical)}),y.connect=="align"&&(this.aligners=[],re(this.left||this.right,!0)),R&&R.registerEvents(ae),ae&&ae.registerEvents(R);var Ne=function(){R&&Z(R),ae&&Z(ae)};T.on(window,"resize",Ne);var ut=setInterval(function(){for(var ge=be.parentNode;ge&&ge!=document.body;ge=ge.parentNode);ge||(clearInterval(ut),T.off(window,"resize",Ne))},5e3)};function qe(f){var y=f.lockButton=Pe("div",null,"CodeMirror-merge-scrolllock");y.setAttribute("role","button"),y.setAttribute("tabindex","0");var S=Pe("div",[y],"CodeMirror-merge-scrolllock-wrap");T.on(y,"click",function(){x(f,!f.lockScroll)}),T.on(y,"keyup",function(F){(F.key==="Enter"||F.code==="Space")&&x(f,!f.lockScroll)});var k=[S];if(f.mv.options.revertButtons!==!1){f.copyButtons=Pe("div",null,"CodeMirror-merge-copybuttons-"+f.type);var A=function(F){var H=F.target||F.srcElement;if(H.chunk){if(H.className=="CodeMirror-merge-copy-reverse"){Ke(f,f.orig,f.edit,H.chunk);return}Ke(f,f.edit,f.orig,H.chunk)}};T.on(f.copyButtons,"click",A),T.on(f.copyButtons,"keyup",function(F){(F.key==="Enter"||F.code==="Space")&&A(F)}),k.unshift(f.copyButtons)}if(f.mv.options.connect!="align"){var D=document.createElementNS&&document.createElementNS(M,"svg");D&&!D.createSVGRect&&(D=null),f.svg=D,D&&k.push(D)}return f.gap=Pe("div",k,"CodeMirror-merge-gap")}Me.prototype={constructor:Me,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(f){this.right&&this.right.setShowDifferences(f),this.left&&this.left.setShowDifferences(f)},rightChunks:function(){if(this.right)return h(this.right),this.right.chunks},leftChunks:function(){if(this.left)return h(this.left),this.left.chunks}};function De(f){return typeof f=="string"?f:f.getValue()}var Q;function kt(f,y,S){Q||(Q=new diff_match_patch);for(var k=Q.diff_main(f,y),A=0;Aue&&(F&&y.push({origFrom:k,origTo:ce,editFrom:S,editTo:ue}),S=Ce,k=be)}else Ze(R==DIFF_INSERT?A:D,H[1])}return(S<=A.line||k<=D.line)&&y.push({origFrom:k,origTo:D.line+1,editFrom:S,editTo:A.line+1}),y}function ct(f,y){if(y==f.length-1)return!0;var S=f[y+1][1];return S.length==1&&y1||y==f.length-3)&&S.charCodeAt(0)==10)}function tt(f,y){if(y==0)return!0;var S=f[y-1][1];return S.charCodeAt(S.length-1)!=10?!1:y==1?!0:(S=f[y-2][1],S.charCodeAt(S.length-1)==10)}function xt(f,y,S){for(var k,A,D,F,H=0;Hy?(A=R.editFrom,F=R.origFrom):ue>y&&(A=R.editTo,F=R.origTo)),ue<=y?(k=R.editTo,D=R.origTo):ae<=y&&(k=R.editFrom,D=R.origFrom)}return{edit:{before:k,after:A},orig:{before:D,after:F}}}function zr(f,y,S){f.addLineClass(y,"wrap","CodeMirror-merge-collapsed-line");var k=document.createElement("span");k.className="CodeMirror-merge-collapsed-widget",k.title=f.phrase("Identical text collapsed. Click to expand.");var A=f.markText(N(y,0),N(S-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:k,clearOnEnter:!0});function D(){A.clear(),f.removeLineClass(y,"wrap","CodeMirror-merge-collapsed-line")}return A.explicitlyCleared&&D(),T.on(k,"click",D),A.on("clear",D),T.on(k,"click",D),{mark:A,clear:D}}function Zt(f,y){var S=[];function k(){for(var H=0;H=0&&Hy){var ue=[{line:R,cm:k}];f.left&&ue.push({line:le(R,f.left.chunks),cm:f.left.orig}),f.right&&ue.push({line:le(R,f.right.chunks),cm:f.right.orig});var ce=Zt(ae,ue);f.options.onCollapse&&f.options.onCollapse(f,R,ae,ce)}}}function Pe(f,y,S,k){var A=document.createElement(f);if(S&&(A.className=S),k&&(A.style.cssText=k),typeof y=="string")A.appendChild(document.createTextNode(y));else if(y)for(var D=0;D0;--y)f.removeChild(f.firstChild)}function gr(f){for(var y=1;y0&&t.prevInput=="​"?Re(i,qa)(i):W++<10?r.detectingSelectAll=setTimeout(B,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(B,200)}}if(g&&v>=9&&L(),Ie){Xr(e);var E=function(){je(window,"mouseup",E),setTimeout(C,20)};te(window,"mouseup",E)}else setTimeout(C,50)},_e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},_e.prototype.setUneditable=function(){},_e.prototype.needsContentAttribute=!1;function nf(e,t){if(t=t?dt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=tt(Pe(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=o.getValue()}var n;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;n=l.submit;try{var a=l.submit=function(){r(),l.submit=n,l.submit(),l.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var o=Le(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return o}function lf(e){e.off=je,e.on=te,e.wheelEventPixels=hu,e.Doc=it,e.splitLines=mn,e.countColumn=Ze,e.findColumn=Gr,e.isWordChar=F,e.Pass=Ht,e.signal=Te,e.Line=wr,e.changeEnd=Gt,e.scrollbarModel=Ta,e.Pos=P,e.cmpPos=oe,e.modes=wn,e.mimeModes=mr,e.resolveMode=Di,e.getMode=Cn,e.modeExtensions=br,e.extendMode=as,e.copyState=jt,e.startState=Dl,e.innerMode=Sn,e.commands=pi,e.keyMap=Et,e.keyName=fo,e.isModifierKey=so,e.lookupKey=Er,e.normalizeKeyMap=Eu,e.StringStream=Ee,e.SharedTextMarker=ci,e.TextMarker=Xt,e.LineWidget=hi,e.e_preventDefault=Oe,e.e_stopPropagation=Ml,e.e_stop=Xr,e.addClass=xt,e.contains=ct,e.rmClass=Me,e.keyNames=Yt}Zu(Le),Vu(Le);var af="iter insert remove copy getEditor constructor".split(" ");for(var un in it.prototype)it.prototype.hasOwnProperty(un)&&Se(af,un)<0&&(Le.prototype[un]=function(e){return function(){return e.apply(this.doc,arguments)}}(it.prototype[un]));return Mt(it),Le.inputStyles={textarea:_e,contenteditable:ve},Le.defineMode=function(e){!Le.defaults.mode&&e!="null"&&(Le.defaults.mode=e),ns.apply(this,arguments)},Le.defineMIME=ls,Le.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Le.defineMIME("text/plain","null"),Le.defineExtension=function(e,t){Le.prototype[e]=t},Le.defineDocExtension=function(e,t){it.prototype[e]=t},Le.fromTextArea=nf,lf(Le),Le.version="5.65.16",Le})}(wl)),wl.exports}var hf=Uo();const cf=ff(hf);(function(O,b){(function(T){T(Uo())})(function(T){var N=T.Pos,M="http://www.w3.org/2000/svg";function G(f,y){this.mv=f,this.type=y,this.classes=y=="left"?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}G.prototype={constructor:G,init:function(f,y,S){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=T(f,dt({value:y,readOnly:!this.mv.options.allowEditingOriginals},dt(S))),this.mv.options.connect=="align"&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new Ht(this.edit)),this.orig.state.trackAlignable=new Ht(this.orig)),this.lockButton.title=this.edit.phrase("Toggle locked scrolling"),this.lockButton.setAttribute("aria-label",this.lockButton.title),this.orig.state.diffViews=[this];var k=S.chunkClassLocation||"background";Object.prototype.toString.call(k)!="[object Array]"&&(k=[k]),this.classes.classLocation=k,this.diff=kt(De(y),De(S.value),this.mv.options.ignoreWhitespace),this.chunks=bt(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=S.showDifferences!==!1},registerEvents:function(f){this.forceUpdate=g(this),x(this,!0,!1),v(this,f)},setShowDifferences:function(f){f=f!==!1,f!=this.showDifferences&&(this.showDifferences=f,this.forceUpdate("full"))}};function h(f){f.diffOutOfDate&&(f.diff=kt(f.orig.getValue(),f.edit.getValue(),f.mv.options.ignoreWhitespace),f.chunks=bt(f.diff),f.diffOutOfDate=!1,T.signal(f.edit,"updateDiff",f.diff))}var d=!1;function g(f){var y={from:0,to:0,marked:[]},S={from:0,to:0,marked:[]},k,A=!1;function D(ue){d=!0,A=!1,ue=="full"&&(f.svg&&At(f.svg),f.copyButtons&&At(f.copyButtons),I(f.edit,y.marked,f.classes),I(f.orig,S.marked,f.classes),y.from=y.to=S.from=S.to=0),h(f),f.showDifferences&&(K(f.edit,f.diff,y,DIFF_INSERT,f.classes),K(f.orig,f.diff,S,DIFF_DELETE,f.classes)),f.mv.options.connect=="align"&&re(f),Z(f),f.needsScrollSync!=null&&m(f,f.needsScrollSync),d=!1}function F(ue){d||(f.dealigned=!0,H(ue))}function H(ue){d||A||(clearTimeout(k),ue===!0&&(A=!0),k=setTimeout(D,ue===!0?20:250))}function R(ue,ce){f.diffOutOfDate||(f.diffOutOfDate=!0,y.from=y.to=S.from=S.to=0),F(ce.text.length-1!=ce.to.line-ce.from.line)}function ae(){f.diffOutOfDate=!0,f.dealigned=!0,D("full")}return f.edit.on("change",R),f.orig.on("change",R),f.edit.on("swapDoc",ae),f.orig.on("swapDoc",ae),f.mv.options.connect=="align"&&(T.on(f.edit.state.trackAlignable,"realign",F),T.on(f.orig.state.trackAlignable,"realign",F)),f.edit.on("viewportChange",function(){H(!1)}),f.orig.on("viewportChange",function(){H(!1)}),D(),D}function v(f,y){f.edit.on("scroll",function(){m(f,!0)&&Z(f)}),f.orig.on("scroll",function(){m(f,!1)&&Z(f),y&&m(y,!0)&&Z(y)})}function m(f,y){if(f.diffOutOfDate)return f.lockScroll&&f.needsScrollSync==null&&(f.needsScrollSync=y),!1;if(f.needsScrollSync=null,!f.lockScroll)return!0;var S,k,A=+new Date;if(y?(S=f.edit,k=f.orig):(S=f.orig,k=f.edit),S.state.scrollSetBy==f&&(S.state.scrollSetAt||0)+250>A)return!1;var D=S.getScrollInfo();if(f.mv.options.connect=="align")Ce=D.top;else{var F=.5*D.clientHeight,H=D.top+F,R=S.lineAtHeight(H,"local"),ae=xt(f.chunks,R,y),ue=w(S,y?ae.edit:ae.orig),ce=w(k,y?ae.orig:ae.edit),me=(H-ue.top)/(ue.bot-ue.top),Ce=ce.top-F+me*(ce.bot-ce.top),be,Ne;if(Ce>D.top&&(Ne=D.top/F)<1)Ce=Ce*Ne+D.top*(1-Ne);else if((be=D.height-D.clientHeight-D.top)be&&(Ne=be/F)<1&&(Ce=Ce*Ne+(ut.height-ut.clientHeight-be)*(1-Ne))}}return k.scrollTo(D.left,Ce),k.state.scrollSetAt=A,k.state.scrollSetBy=f,!0}function w(f,y){var S=y.after;return S==null&&(S=f.lastLine()+1),{top:f.heightAtLine(y.before||0,"local"),bot:f.heightAtLine(S,"local")}}function x(f,y,S){f.lockScroll=y,y&&S!=!1&&m(f,DIFF_INSERT)&&Z(f),(y?T.addClass:T.rmClass)(f.lockButton,"CodeMirror-merge-scrolllock-enabled")}function _(f,y,S){for(var k=S.classLocation,A=0;A20||S.from-D.to>20?(I(f,S.marked,A),q(f,y,k,S.marked,D.from,D.to,A),S.from=D.from,S.to=D.to):(D.fromS.to&&(q(f,y,k,S.marked,S.to,D.to,A),S.to=D.to))})}function $(f,y,S,k,A,D){for(var F=S.classLocation,H=f.getLineHandle(y),R=0;RKr&&(Ce&&(ce(me,Kr),Ce=!1),me=te)}else if(Ce=!0,ut==S){var yr=Ze(H,ge,!0),je=Ur(R,H),Te=ht(ae,yr);Jt(je,Te)||k.push(f.markText(je,Te,{className:ue})),H=yr}}Ce&&ce(me,H.line+1)}function Z(f){if(f.showDifferences){if(f.svg){At(f.svg);var y=f.gap.offsetWidth;gr(f.svg,"width",y,"height",f.gap.offsetHeight)}f.copyButtons&&At(f.copyButtons);for(var S=f.edit.getViewport(),k=f.orig.getViewport(),A=f.mv.wrap.getBoundingClientRect().top,D=A-f.edit.getScrollerElement().getBoundingClientRect().top+f.edit.getScrollInfo().top,F=A-f.orig.getScrollerElement().getBoundingClientRect().top+f.orig.getScrollInfo().top,H=0;H=S.from&&R.origFrom<=k.to&&R.origTo>=k.from&&Ie(f,R,F,D,y)}}}function le(f,y){for(var S=0,k=0,A=0;Af&&D.editFrom<=f)return null;if(D.editFrom>f)break;S=D.editTo,k=D.origTo}return k+(f-S)}function ie(f,y,S){for(var k=f.state.trackAlignable,A=f.firstLine(),D=0,F=[],H=0;;H++){for(var R=y[H],ae=R?S?R.origFrom:R.editFrom:1e9;Dce){D++,A--;continue e}if(me.editTo>ue){if(me.editFrom<=ue)continue e;break}H+=me.origTo-me.origFrom-(me.editTo-me.editFrom),F++}if(ue==ce-H)R[k]=ce,D++;else if(ue1&&k.push(ye(f[F],S[F],R))}}function ye(f,y,S){var k=!0;y>f.lastLine()&&(y--,k=!1);var A=document.createElement("div");return A.className="CodeMirror-merge-spacer",A.style.height=S+"px",A.style.minWidth="1px",f.addLineWidget(y,A,{height:S,above:k,mergeSpacer:!0,handleMouseEvents:!0})}function Ie(f,y,S,k,A){var D=f.type=="left",F=f.orig.heightAtLine(y.origFrom,"local",!0)-S;if(f.svg){var H=F,R=f.edit.heightAtLine(y.editFrom,"local",!0)-k;if(D){var ae=H;H=R,R=ae}var ue=f.orig.heightAtLine(y.origTo,"local",!0)-S,ce=f.edit.heightAtLine(y.editTo,"local",!0)-k;if(D){var ae=ue;ue=ce,ce=ae}var me=" C "+A/2+" "+R+" "+A/2+" "+H+" "+(A+2)+" "+H,Ce=" C "+A/2+" "+ue+" "+A/2+" "+ce+" -1 "+ce;gr(f.svg.appendChild(document.createElementNS(M,"path")),"d","M -1 "+R+me+" L "+(A+2)+" "+ue+Ce+" z","class",f.classes.connect)}if(f.copyButtons){var be=f.copyButtons.appendChild(Pe("div",f.type=="left"?"⇝":"⇜","CodeMirror-merge-copy")),Ne=f.mv.options.allowEditingOriginals;if(be.title=f.edit.phrase(Ne?"Push to left":"Revert chunk"),be.chunk=y,be.style.top=(y.origTo>y.origFrom?F:f.edit.heightAtLine(y.editFrom,"local")-k)+"px",be.setAttribute("role","button"),be.setAttribute("tabindex","0"),be.setAttribute("aria-label",be.title),Ne){var ut=f.edit.heightAtLine(y.editFrom,"local")-k,ge=f.copyButtons.appendChild(Pe("div",f.type=="right"?"⇝":"⇜","CodeMirror-merge-copy-reverse"));ge.title="Push to right",ge.chunk={editFrom:y.origFrom,editTo:y.origTo,origFrom:y.editFrom,origTo:y.editTo},ge.style.top=ut+"px",f.type=="right"?ge.style.left="2px":ge.style.right="2px",ge.setAttribute("role","button"),ge.setAttribute("tabindex","0"),ge.setAttribute("aria-label",ge.title)}}}function Ke(f,y,S,k){if(!f.diffOutOfDate){var A=k.origTo>S.lastLine()?N(k.origFrom-1):N(k.origFrom,0),D=N(k.origTo,0),F=k.editTo>y.lastLine()?N(k.editFrom-1):N(k.editFrom,0),H=N(k.editTo,0),R=f.mv.options.revertChunk;R?R(f.mv,S,A,D,y,F,H):y.replaceRange(S.getRange(A,D),F,H)}}var Me=T.MergeView=function(f,y){if(!(this instanceof Me))return new Me(f,y);this.options=y;var S=y.origLeft,k=y.origRight==null?y.orig:y.origRight,A=S!=null,D=k!=null,F=1+(A?1:0)+(D?1:0),H=[],R=this.left=null,ae=this.right=null,ue=this;if(A){R=this.left=new G(this,"left");var ce=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");H.push(ce),H.push(qe(R))}var me=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(H.push(me),D){ae=this.right=new G(this,"right"),H.push(qe(ae));var Ce=Pe("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");H.push(Ce)}(D?Ce:me).className+=" CodeMirror-merge-pane-rightmost",H.push(Pe("div",null,null,"height: 0; clear: both;"));var be=this.wrap=f.appendChild(Pe("div",H,"CodeMirror-merge CodeMirror-merge-"+F+"pane"));this.edit=T(me,dt(y)),R&&R.init(ce,S,y),ae&&ae.init(Ce,k,y),y.collapseIdentical&&this.editor().operation(function(){It(ue,y.collapseIdentical)}),y.connect=="align"&&(this.aligners=[],re(this.left||this.right,!0)),R&&R.registerEvents(ae),ae&&ae.registerEvents(R);var Ne=function(){R&&Z(R),ae&&Z(ae)};T.on(window,"resize",Ne);var ut=setInterval(function(){for(var ge=be.parentNode;ge&&ge!=document.body;ge=ge.parentNode);ge||(clearInterval(ut),T.off(window,"resize",Ne))},5e3)};function qe(f){var y=f.lockButton=Pe("div",null,"CodeMirror-merge-scrolllock");y.setAttribute("role","button"),y.setAttribute("tabindex","0");var S=Pe("div",[y],"CodeMirror-merge-scrolllock-wrap");T.on(y,"click",function(){x(f,!f.lockScroll)}),T.on(y,"keyup",function(F){(F.key==="Enter"||F.code==="Space")&&x(f,!f.lockScroll)});var k=[S];if(f.mv.options.revertButtons!==!1){f.copyButtons=Pe("div",null,"CodeMirror-merge-copybuttons-"+f.type);var A=function(F){var H=F.target||F.srcElement;if(H.chunk){if(H.className=="CodeMirror-merge-copy-reverse"){Ke(f,f.orig,f.edit,H.chunk);return}Ke(f,f.edit,f.orig,H.chunk)}};T.on(f.copyButtons,"click",A),T.on(f.copyButtons,"keyup",function(F){(F.key==="Enter"||F.code==="Space")&&A(F)}),k.unshift(f.copyButtons)}if(f.mv.options.connect!="align"){var D=document.createElementNS&&document.createElementNS(M,"svg");D&&!D.createSVGRect&&(D=null),f.svg=D,D&&k.push(D)}return f.gap=Pe("div",k,"CodeMirror-merge-gap")}Me.prototype={constructor:Me,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(f){this.right&&this.right.setShowDifferences(f),this.left&&this.left.setShowDifferences(f)},rightChunks:function(){if(this.right)return h(this.right),this.right.chunks},leftChunks:function(){if(this.left)return h(this.left),this.left.chunks}};function De(f){return typeof f=="string"?f:f.getValue()}var Q;function kt(f,y,S){Q||(Q=new diff_match_patch);for(var k=Q.diff_main(f,y),A=0;Aue&&(F&&y.push({origFrom:k,origTo:ce,editFrom:S,editTo:ue}),S=Ce,k=be)}else Ze(R==DIFF_INSERT?A:D,H[1])}return(S<=A.line||k<=D.line)&&y.push({origFrom:k,origTo:D.line+1,editFrom:S,editTo:A.line+1}),y}function ct(f,y){if(y==f.length-1)return!0;var S=f[y+1][1];return S.length==1&&y1||y==f.length-3)&&S.charCodeAt(0)==10)}function tt(f,y){if(y==0)return!0;var S=f[y-1][1];return S.charCodeAt(S.length-1)!=10?!1:y==1?!0:(S=f[y-2][1],S.charCodeAt(S.length-1)==10)}function xt(f,y,S){for(var k,A,D,F,H=0;Hy?(A=R.editFrom,F=R.origFrom):ue>y&&(A=R.editTo,F=R.origTo)),ue<=y?(k=R.editTo,D=R.origTo):ae<=y&&(k=R.editFrom,D=R.origFrom)}return{edit:{before:k,after:A},orig:{before:D,after:F}}}function zr(f,y,S){f.addLineClass(y,"wrap","CodeMirror-merge-collapsed-line");var k=document.createElement("span");k.className="CodeMirror-merge-collapsed-widget",k.title=f.phrase("Identical text collapsed. Click to expand.");var A=f.markText(N(y,0),N(S-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:k,clearOnEnter:!0});function D(){A.clear(),f.removeLineClass(y,"wrap","CodeMirror-merge-collapsed-line")}return A.explicitlyCleared&&D(),T.on(k,"click",D),A.on("clear",D),T.on(k,"click",D),{mark:A,clear:D}}function Zt(f,y){var S=[];function k(){for(var H=0;H=0&&Hy){var ue=[{line:R,cm:k}];f.left&&ue.push({line:le(R,f.left.chunks),cm:f.left.orig}),f.right&&ue.push({line:le(R,f.right.chunks),cm:f.right.orig});var ce=Zt(ae,ue);f.options.onCollapse&&f.options.onCollapse(f,R,ae,ce)}}}function Pe(f,y,S,k){var A=document.createElement(f);if(S&&(A.className=S),k&&(A.style.cssText=k),typeof y=="string")A.appendChild(document.createTextNode(y));else if(y)for(var D=0;D0;--y)f.removeChild(f.firstChild)}function gr(f){for(var y=1;y0)break}this.signal(),this.alignable.splice(S,0,f,y)},find:function(f){for(var y=0;y-1){var ae=this.alignable[D+1];ae==Se?this.alignable.splice(D,2):this.alignable[D+1]=ae&~Se}F>-1&&S&&this.set(f+S,Se)}};function ht(f,y){return(f.line-y.line||f.ch-y.ch)<0?f:y}function Ur(f,y){return(f.line-y.line||f.ch-y.ch)>0?f:y}function Jt(f,y){return f.line==y.line&&f.ch==y.ch}function Gr(f,y,S){for(var k=f.length-1;k>=0;k--){var A=f[k],D=(S?A.origTo:A.editTo)-1;if(Dy)return D}}function vr(f,y){var S=null,k=f.state.diffViews,A=f.getCursor().line;if(k)for(var D=0;DS:R"u"&&(g=!0);var v=g,m=this.diff_commonPrefix(h,d),w=h.substring(0,m);h=h.substring(m),d=d.substring(m),m=this.diff_commonSuffix(h,d);var x=h.substring(h.length-m);h=h.substring(0,h.length-m),d=d.substring(0,d.length-m);var _=this.diff_compute(h,d,v);return w&&_.unshift([M,w]),x&&_.push([M,x]),this.diff_cleanupMerge(_),_},b.prototype.diff_compute=function(h,d,g){var v;if(!h)return[[N,d]];if(!d)return[[T,h]];var m=h.length>d.length?h:d,w=h.length>d.length?d:h,x=m.indexOf(w);if(x!=-1)return v=[[N,m.substring(0,x)],[M,w],[N,m.substring(x+w.length)]],h.length>d.length&&(v[0][0]=v[2][0]=T),v;m=w=null;var _=this.diff_halfMatch(h,d);if(_){var I=_[0],K=_[1],$=_[2],q=_[3],Z=_[4],le=this.diff_main(I,$,g),ie=this.diff_main(K,q,g);return le.concat([[M,Z]],ie)}g&&(h.length<100||d.length<100)&&(g=!1);var ne;if(g){var he=this.diff_linesToChars(h,d);h=he[0],d=he[1],ne=he[2]}if(v=this.diff_map(h,d),v||(v=[[T,h],[N,d]]),g){this.diff_charsToLines(v,ne),this.diff_cleanupSemantic(v),v.push([M,""]);for(var re=0,J=0,ye=0,Ie="",Ke="";re=1&&ye>=1){var he=this.diff_main(Ie,Ke,!1);v.splice(re-J-ye,J+ye),re=re-J-ye;for(var Me=he.length-1;Me>=0;Me--)v.splice(re,0,he[Me]);re=re+he.length}ye=0,J=0,Ie="",Ke="";break}re++}v.pop()}return v},b.prototype.diff_linesToChars=function(h,d){var g=[],v={};g[0]="";function m(_){for(var I="",K=0,$=-1,q=g.length;$<_.length-1;){$=_.indexOf(` `,K),$==-1&&($=_.length-1);var Z=_.substring(K,$+1);K=$+1,(v.hasOwnProperty?v.hasOwnProperty(Z):v[Z]!==void 0)?I+=String.fromCharCode(v[Z]):(I+=String.fromCharCode(q),v[Z]=q,g[q++]=Z)}return I}var w=m(h),x=m(d);return[w,x,g]},b.prototype.diff_charsToLines=function(h,d){for(var g=0;g0&&new Date().getTime()>g)return null;_[re]={};for(var J=-re;J<=re;J+=2){for(J==-re||J!=re&&K[J-1]=0;_--)for(;;)if(h[_][m-1+","+w]!==void 0){m--,x===T?v[0][1]=d.charAt(m)+v[0][1]:v.unshift([T,d.charAt(m)]),x=T;break}else if(h[_][m+","+(w-1)]!==void 0){w--,x===N?v[0][1]=g.charAt(w)+v[0][1]:v.unshift([N,g.charAt(w)]),x=N;break}else{if(m--,w--,d.charAt(m)!=g.charAt(w))throw new Error("No diagonal. Can't happen. (diff_path1)");x===M?v[0][1]=d.charAt(m)+v[0][1]:v.unshift([M,d.charAt(m)]),x=M}return v},b.prototype.diff_path2=function(h,d,g){for(var v=[],m=0,w=d.length,x=g.length,_=null,I=h.length-2;I>=0;I--)for(;;)if(h[I][w-1+","+x]!==void 0){w--,_===T?v[m-1][1]+=d.charAt(d.length-w-1):v[m++]=[T,d.charAt(d.length-w-1)],_=T;break}else if(h[I][w+","+(x-1)]!==void 0){x--,_===N?v[m-1][1]+=g.charAt(g.length-x-1):v[m++]=[N,g.charAt(g.length-x-1)],_=N;break}else{if(w--,x--,d.charAt(d.length-w-1)!=g.charAt(g.length-x-1))throw new Error("No diagonal. Can't happen. (diff_path2)");_===M?v[m-1][1]+=d.charAt(d.length-w-1):v[m++]=[M,d.charAt(d.length-w-1)],_=M}return v},b.prototype.diff_commonPrefix=function(h,d){if(!h||!d||h.charAt(0)!=d.charAt(0))return 0;for(var g=0,v=Math.min(h.length,d.length),m=v,w=0;gd.length?h:d,v=h.length>d.length?d:h;if(g.length<10||v.length<1)return null;var m=this;function w(ie,ne,he){for(var re=ie.substring(he,he+Math.floor(ie.length/4)),J=-1,ye="",Ie,Ke,Me,qe;(J=ne.indexOf(re,J+1))!=-1;){var De=m.diff_commonPrefix(ie.substring(he),ne.substring(J)),Q=m.diff_commonSuffix(ie.substring(0,he),ne.substring(0,J));ye.length=ie.length/2?[Ie,Ke,Me,qe,ye]:null}var x=w(g,v,Math.ceil(g.length/4)),_=w(g,v,Math.ceil(g.length/2)),I;if(!x&&!_)return null;_?x?I=x[4].length>_[4].length?x:_:I=_:I=x;var K,$,q,Z;h.length>d.length?(K=I[0],$=I[1],q=I[2],Z=I[3]):(q=I[0],Z=I[1],K=I[2],$=I[3]);var le=I[4];return[K,$,q,Z,le]},b.prototype.diff_cleanupSemantic=function(h){for(var d=!1,g=[],v=0,m=null,w=0,x=0,_=0;w0?g[v-1]:-1,x=0,_=0,m=null,d=!0)),w++;d&&this.diff_cleanupMerge(h),this.diff_cleanupSemanticLossless(h)},b.prototype.diff_cleanupSemanticLossless=function(h){var d=/[^a-zA-Z0-9]/,g=/\s/,v=/[\r\n]/,m=/\n\r?\n$/,w=/^\r?\n\r?\n/;function x(J,ye){if(!J||!ye)return 5;var Ie=0;return(J.charAt(J.length-1).match(d)||ye.charAt(0).match(d))&&(Ie++,(J.charAt(J.length-1).match(g)||ye.charAt(0).match(g))&&(Ie++,(J.charAt(J.length-1).match(v)||ye.charAt(0).match(v))&&(Ie++,(J.match(m)||ye.match(w))&&Ie++))),Ie}for(var _=1;_=he&&(he=re,le=I,ie=K,ne=$)}h[_-1][1]!=le&&(le?h[_-1][1]=le:(h.splice(_-1,1),_--),h[_][1]=ie,ne?h[_+1][1]=ne:(h.splice(_+1,1),_--))}_++}},b.prototype.diff_cleanupEfficiency=function(h){for(var d=!1,g=[],v=0,m="",w=0,x=!1,_=!1,I=!1,K=!1;w0?g[v-1]:-1,I=K=!1),d=!0)),w++;d&&this.diff_cleanupMerge(h)},b.prototype.diff_cleanupMerge=function(h){h.push([M,""]);for(var d=0,g=0,v=0,m="",w="",x;d0&&h[d-g-v-1][0]==M?h[d-g-v-1][1]+=w.substring(0,x):(h.splice(0,0,[M,w.substring(0,x)]),d++),w=w.substring(x),m=m.substring(x)),x=this.diff_commonSuffix(w,m),x!==0&&(h[d][1]=w.substring(w.length-x)+h[d][1],w=w.substring(0,w.length-x),m=m.substring(0,m.length-x))),g===0?h.splice(d-g-v,g+v,[N,w]):v===0?h.splice(d-g-v,g+v,[T,m]):h.splice(d-g-v,g+v,[T,m],[N,w]),d=d-g-v+(g?1:0)+(v?1:0)+1):d!==0&&h[d-1][0]==M?(h[d-1][1]+=h[d][1],h.splice(d,1)):d++,v=0,g=0,m="",w="";break}h[h.length-1][1]===""&&h.pop();var _=!1;for(d=1;dd));x++)m=g,w=v;return h.length!=x&&h[x][0]===T?w:w+(d-m)},b.prototype.diff_prettyHtml=function(h){for(var d=[],g=0,v=0;v/g,">").replace(/\n/g,"¶
");switch(m){case N:d[v]=''+x+"";break;case T:d[v]=''+x+"";break;case M:d[v]=''+x+"";break}m!==T&&(g+=w.length)}return d.join("")},b.prototype.diff_text1=function(h){for(var d=[],g=0;gthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var v=this.match_alphabet(d),m=this;function w(Ie,Ke){var Me=Ie/d.length,qe=Math.abs(g-Ke);return m.Match_Distance?Me+qe/m.Match_Distance:qe?1:Me}var x=this.Match_Threshold,_=h.indexOf(d,g);_!=-1&&(x=Math.min(w(0,_),x),_=h.lastIndexOf(d,g+d.length),_!=-1&&(x=Math.min(w(0,_),x)));var I=1<=ie;re--){var J=v[h.charAt(re-1)];if(le===0?he[re]=(he[re+1]<<1|1)&J:he[re]=(he[re+1]<<1|1)&J|((Z[re+1]|Z[re])<<1|1)|Z[re+1],he[re]&I){var ye=w(le,re-1);if(ye<=x)if(x=ye,_=re-1,_>g)ie=Math.max(1,2*g-_);else break}}if(w(le+1,g)>x)break;Z=he}return _},b.prototype.match_alphabet=function(h){for(var d={},g=0;g"u")v=h,m=this.diff_main(v,d,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(h&&typeof h=="object"&&typeof d>"u"&&typeof g>"u")m=h,v=this.diff_text1(m);else if(typeof h=="string"&&d&&typeof d=="object"&&typeof g>"u")v=h,m=d;else if(typeof h=="string"&&typeof d=="string"&&g&&typeof g=="object")v=h,m=g;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var w=[],x=new G,_=0,I=0,K=0,$=v,q=v,Z=0;Z=2*this.Patch_Margin&&_&&(this.patch_addContext(x,$),w.push(x),x=new G,_=0,$=q,I=K);break}le!==N&&(I+=ie.length),le!==T&&(K+=ie.length)}return _&&(this.patch_addContext(x,$),w.push(x)),w},b.prototype.patch_deepCopy=function(h){for(var d=[],g=0;gthis.Match_MaxBits?(I=this.match_main(d,_.substring(0,this.Match_MaxBits),x),I!=-1&&(K=this.match_main(d,_.substring(_.length-this.Match_MaxBits),x+_.length-this.Match_MaxBits),(K==-1||I>=K)&&(I=-1))):I=this.match_main(d,_,x),I==-1)m[w]=!1,v-=h[w].length2-h[w].length1;else{m[w]=!0,v=I-x;var $;if(K==-1?$=d.substring(I,I+_.length):$=d.substring(I,K+this.Match_MaxBits),_==$)d=d.substring(0,I)+this.diff_text2(h[w].diffs)+d.substring(I+_.length);else{var q=this.diff_main(_,$,!1);if(_.length>this.Match_MaxBits&&this.diff_levenshtein(q)/_.length>this.Patch_DeleteThreshold)m[w]=!1;else{this.diff_cleanupSemanticLossless(q);for(var Z=0,le,ie=0;iew[0][1].length){var x=d-w[0][1].length;w[0][1]=g.substring(w[0][1].length)+w[0][1],m.start1-=x,m.start2-=x,m.length1+=x,m.length2+=x}if(m=h[h.length-1],w=m.diffs,w.length==0||w[w.length-1][0]!=M)w.push([M,g]),m.length1+=d,m.length2+=d;else if(d>w[w.length-1][1].length){var x=d-w[w.length-1][1].length;w[w.length-1][1]+=g.substring(0,x),m.length1+=x,m.length2+=x}return g},b.prototype.patch_splitMax=function(h){for(var d=0;dthis.Match_MaxBits){var g=h[d];h.splice(d--,1);for(var v=this.Match_MaxBits,m=g.start1,w=g.start2,x="";g.diffs.length!==0;){var _=new G,I=!0;for(_.start1=m-x.length,_.start2=w-x.length,x!==""&&(_.length1=_.length2=x.length,_.diffs.push([M,x]));g.diffs.length!==0&&_.length12*v?(_.length1+=$.length,m+=$.length,I=!1,_.diffs.push([K,$]),g.diffs.shift()):($=$.substring(0,v-_.length1-this.Patch_Margin),_.length1+=$.length,m+=$.length,K===M?(_.length2+=$.length,w+=$.length):I=!1,_.diffs.push([K,$]),$==g.diffs[0][1]?g.diffs.shift():g.diffs[0][1]=g.diffs[0][1].substring($.length))}x=this.diff_text2(_.diffs),x=x.substring(x.length-this.Patch_Margin);var q=this.diff_text1(g.diffs).substring(0,this.Patch_Margin);q!==""&&(_.length1+=q.length,_.length2+=q.length,_.diffs.length!==0&&_.diffs[_.diffs.length-1][0]===M?_.diffs[_.diffs.length-1][1]+=q:_.diffs.push([M,q])),I||h.splice(++d,0,_)}}},b.prototype.patch_toText=function(h){for(var d=[],g=0;gO}):void 0,Uo="$lit$",qt=`lit$${(Math.random()+"").slice(9)}$`,Go="?"+qt,hf=`<${Go}>`,dr=document,ki=()=>dr.createComment(""),xi=O=>O===null||typeof O!="object"&&typeof O!="function",Ko=Array.isArray,cf=O=>Ko(O)||typeof(O==null?void 0:O[Symbol.iterator])=="function",wl=`[ -\f\r]`,wi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Oo=/-->/g,Eo=/>/g,hr=RegExp(`>|${wl}(?:([^\\s"'>=/]+)(${wl}*=${wl}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Wo=/'/g,Fo=/"/g,Xo=/^(?:script|style|textarea|title)$/i,df=O=>(b,...T)=>({_$litType$:O,strings:b,values:T}),Li=df(1),Ai=Symbol.for("lit-noChange"),$e=Symbol.for("lit-nothing"),Io=new WeakMap,cr=dr.createTreeWalker(dr,129);function Yo(O,b){if(!Array.isArray(O)||!O.hasOwnProperty("raw"))throw Error("invalid template strings array");return No!==void 0?No.createHTML(b):b}const gf=(O,b)=>{const T=O.length-1,N=[];let M,G=b===2?"":"",h=wi;for(let d=0;d"?(h=M??wi,w=-1):m[1]===void 0?w=-2:(w=h.lastIndex-m[2].length,v=m[1],h=m[3]===void 0?hr:m[3]==='"'?Fo:Wo):h===Fo||h===Wo?h=hr:h===Oo||h===Eo?h=wi:(h=hr,M=void 0);const _=h===hr&&O[d+1].startsWith("/>")?" ":"";G+=h===wi?g+hf:w>=0?(N.push(v),g.slice(0,w)+Uo+g.slice(w)+qt+_):g+qt+(w===-2?d:_)}return[Yo(O,G+(O[T]||"")+(b===2?"":"")),N]};class Mi{constructor({strings:b,_$litType$:T},N){let M;this.parts=[];let G=0,h=0;const d=b.length-1,g=this.parts,[v,m]=gf(b,T);if(this.el=Mi.createElement(v,N),cr.currentNode=this.el.content,T===2){const w=this.el.content.firstChild;w.replaceWith(...w.childNodes)}for(;(M=cr.nextNode())!==null&&g.length0){M.textContent=cn?cn.emptyScript:"";for(let _=0;_2||N[0]!==""||N[1]!==""?(this._$AH=Array(N.length-1).fill(new String),this.strings=N):this._$AH=$e}_$AI(b,T=this,N,M){const G=this.strings;let h=!1;if(G===void 0)b=Br(this,b,T,0),h=!xi(b)||b!==this._$AH&&b!==Ai,h&&(this._$AH=b);else{const d=b;let g,v;for(b=G[0],g=0;g{const N=(T==null?void 0:T.renderBefore)??b;let M=N._$litPart$;if(M===void 0){const G=(T==null?void 0:T.renderBefore)??null;N._$litPart$=M=new _i(b.insertBefore(ki(),G),G,void 0,T??{})}return M._$AI(O),M};function wf(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function Ll(O,b=!1){const T=wf(),N=`_${T}`;return Object.defineProperty(window,N,{value:M=>(b&&Reflect.deleteProperty(window,N),O==null?void 0:O(M)),writable:!1,configurable:!0}),T}async function $o(O,b={}){return new Promise((T,N)=>{const M=Ll(h=>{T(h),Reflect.deleteProperty(window,`_${G}`)},!0),G=Ll(h=>{N(h),Reflect.deleteProperty(window,`_${M}`)},!0);window.__TAURI_IPC__({cmd:O,callback:M,error:G,...b})})}async function Tl(O){return $o("tauri",O)}async function Cf(O=0){return Tl({__tauriModule:"Process",message:{cmd:"exit",exitCode:O}})}const kl="__TAURI__"in globalThis;async function qo(O,b,T){if(kl){let N={};return T!=null&&(N={result:T}),await $o(O,N)}else return await Zo(O,b,T)}async function Zo(O,b,T){let N=null,M={};T!=null&&(N=JSON.stringify(T),M["Content-Type"]="application/json");let G=await fetch(`/api/${O}`,{method:b,body:N,headers:M});if(G.ok)return await G.json();{let h="";throw G.status<500&&(h=`Likely bug in the webapp: got response "${G.status} ${G.statusText}" for "${O}" request. Additional details, if any, follow. `),h+await G.text()}}async function xl(O){kl?await Cf(O):await Zo("exit","POST",O)}async function Sf(){await xl(0)}async function Ho(){await xl(1)}async function Lf(){await xl(2)}async function Po(O){return await qo("save","PUT",O)}async function Tf(){let O=await qo("get_merge_data","GET");for(let b in O)O[b]={left:O[b][0],right:O[b][1],edit:O[b][2]};return O}async function kf(O,b){return Tl({__tauriModule:"Event",message:{cmd:"unlisten",event:O,eventId:b}})}async function xf(O,b,T){return Tl({__tauriModule:"Event",message:{cmd:"listen",event:O,windowLabel:b,handler:Ll(T)}}).then(N=>async()=>kf(O,N))}var Bo;(function(O){O.WINDOW_RESIZED="tauri://resize",O.WINDOW_MOVED="tauri://move",O.WINDOW_CLOSE_REQUESTED="tauri://close-requested",O.WINDOW_CREATED="tauri://window-created",O.WINDOW_DESTROYED="tauri://destroyed",O.WINDOW_FOCUS="tauri://focus",O.WINDOW_BLUR="tauri://blur",O.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",O.WINDOW_THEME_CHANGED="tauri://theme-changed",O.WINDOW_FILE_DROP="tauri://file-drop",O.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",O.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",O.MENU="tauri://menu",O.CHECK_UPDATE="tauri://update",O.UPDATE_AVAILABLE="tauri://update-available",O.INSTALL_UPDATE="tauri://update-install",O.STATUS_UPDATE="tauri://update-status",O.DOWNLOAD_PROGRESS="tauri://update-download-progress"})(Bo||(Bo={}));async function fn(O,b){return xf(O,null,b)}class Af{constructor(b){Do(this,"merge_views");this.merge_views=b}values(){let b={};for(let T in this.merge_views)b[T]=this.merge_views[T].editor().getValue();return b}}function Mf(O,b){let T=[],N=h=>`${h}_${O}`;for(let h in b)T.push(Li` + */const Si=globalThis,cn=Si.trustedTypes,Eo=cn?cn.createPolicy("lit-html",{createHTML:O=>O}):void 0,Go="$lit$",qt=`lit$${(Math.random()+"").slice(9)}$`,Ko="?"+qt,df=`<${Ko}>`,dr=document,ki=()=>dr.createComment(""),xi=O=>O===null||typeof O!="object"&&typeof O!="function",Xo=Array.isArray,gf=O=>Xo(O)||typeof(O==null?void 0:O[Symbol.iterator])=="function",Cl=`[ +\f\r]`,wi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wo=/-->/g,Fo=/>/g,hr=RegExp(`>|${Cl}(?:([^\\s"'>=/]+)(${Cl}*=${Cl}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),Io=/'/g,Ho=/"/g,Yo=/^(?:script|style|textarea|title)$/i,pf=O=>(b,...T)=>({_$litType$:O,strings:b,values:T}),Li=pf(1),Ai=Symbol.for("lit-noChange"),$e=Symbol.for("lit-nothing"),Po=new WeakMap,cr=dr.createTreeWalker(dr,129);function $o(O,b){if(!Array.isArray(O)||!O.hasOwnProperty("raw"))throw Error("invalid template strings array");return Eo!==void 0?Eo.createHTML(b):b}const vf=(O,b)=>{const T=O.length-1,N=[];let M,G=b===2?"":"",h=wi;for(let d=0;d"?(h=M??wi,w=-1):m[1]===void 0?w=-2:(w=h.lastIndex-m[2].length,v=m[1],h=m[3]===void 0?hr:m[3]==='"'?Ho:Io):h===Ho||h===Io?h=hr:h===Wo||h===Fo?h=wi:(h=hr,M=void 0);const _=h===hr&&O[d+1].startsWith("/>")?" ":"";G+=h===wi?g+df:w>=0?(N.push(v),g.slice(0,w)+Go+g.slice(w)+qt+_):g+qt+(w===-2?d:_)}return[$o(O,G+(O[T]||"")+(b===2?"":"")),N]};class Mi{constructor({strings:b,_$litType$:T},N){let M;this.parts=[];let G=0,h=0;const d=b.length-1,g=this.parts,[v,m]=vf(b,T);if(this.el=Mi.createElement(v,N),cr.currentNode=this.el.content,T===2){const w=this.el.content.firstChild;w.replaceWith(...w.childNodes)}for(;(M=cr.nextNode())!==null&&g.length0){M.textContent=cn?cn.emptyScript:"";for(let _=0;_2||N[0]!==""||N[1]!==""?(this._$AH=Array(N.length-1).fill(new String),this.strings=N):this._$AH=$e}_$AI(b,T=this,N,M){const G=this.strings;let h=!1;if(G===void 0)b=Br(this,b,T,0),h=!xi(b)||b!==this._$AH&&b!==Ai,h&&(this._$AH=b);else{const d=b;let g,v;for(b=G[0],g=0;g{const N=(T==null?void 0:T.renderBefore)??b;let M=N._$litPart$;if(M===void 0){const G=(T==null?void 0:T.renderBefore)??null;N._$litPart$=M=new _i(b.insertBefore(ki(),G),G,void 0,T??{})}return M._$AI(O),M};function Sf(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function Tl(O,b=!1){const T=Sf(),N=`_${T}`;return Object.defineProperty(window,N,{value:M=>(b&&Reflect.deleteProperty(window,N),O==null?void 0:O(M)),writable:!1,configurable:!0}),T}async function qo(O,b={}){return new Promise((T,N)=>{const M=Tl(h=>{T(h),Reflect.deleteProperty(window,`_${G}`)},!0),G=Tl(h=>{N(h),Reflect.deleteProperty(window,`_${M}`)},!0);window.__TAURI_IPC__({cmd:O,callback:M,error:G,...b})})}async function kl(O){return qo("tauri",O)}async function Lf(O=0){return kl({__tauriModule:"Process",message:{cmd:"exit",exitCode:O}})}const xl="__TAURI__"in globalThis;async function Zo(O,b,T){if(xl){let N={};return T!=null&&(N={result:T}),await qo(O,N)}else return await Qo(O,b,T)}async function Qo(O,b,T){let N=null,M={};T!=null&&(N=JSON.stringify(T),M["Content-Type"]="application/json");let G=await fetch(`/api/${O}`,{method:b,body:N,headers:M});if(G.ok)return await G.json();{let h="";throw G.status<500&&(h=`Likely bug in the webapp: got response "${G.status} ${G.statusText}" for "${O}" request. Additional details, if any, follow. `),h+await G.text()}}async function Al(O){xl?await Lf(O):await Qo("exit","POST",O)}async function Tf(){await Al(0)}async function Bo(){await Al(1)}async function kf(){await Al(2)}async function Ro(O){return await Zo("save","PUT",O)}async function xf(){let O=await Zo("get_merge_data","GET");for(let b in O)O[b]={left:O[b][0],right:O[b][1],edit:O[b][2]};return O}async function Af(O,b){return kl({__tauriModule:"Event",message:{cmd:"unlisten",event:O,eventId:b}})}async function Mf(O,b,T){return kl({__tauriModule:"Event",message:{cmd:"listen",event:O,windowLabel:b,handler:Tl(T)}}).then(N=>async()=>Af(O,N))}var zo;(function(O){O.WINDOW_RESIZED="tauri://resize",O.WINDOW_MOVED="tauri://move",O.WINDOW_CLOSE_REQUESTED="tauri://close-requested",O.WINDOW_CREATED="tauri://window-created",O.WINDOW_DESTROYED="tauri://destroyed",O.WINDOW_FOCUS="tauri://focus",O.WINDOW_BLUR="tauri://blur",O.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",O.WINDOW_THEME_CHANGED="tauri://theme-changed",O.WINDOW_FILE_DROP="tauri://file-drop",O.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",O.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",O.MENU="tauri://menu",O.CHECK_UPDATE="tauri://update",O.UPDATE_AVAILABLE="tauri://update-available",O.INSTALL_UPDATE="tauri://update-install",O.STATUS_UPDATE="tauri://update-status",O.DOWNLOAD_PROGRESS="tauri://update-download-progress"})(zo||(zo={}));async function fn(O,b){return Mf(O,null,b)}class _f{constructor(b){No(this,"merge_views");this.merge_views=b}values(){let b={};for(let T in this.merge_views)b[T]=this.merge_views[T].editor().getValue();return b}}function Df(O,b){let T=[],N=h=>`${h}_${O}`;for(let h in b)T.push(Li`
@@ -61,10 +61,10 @@ b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.
- `);let M=document.getElementById(O);M.innerHTML="",Ti(Li`${T}`,M);let G={};for(let h in b){let d=document.getElementById(`collapse_${N(h)}`),g=document.getElementById(`linewrap_${N(h)}`),v=document.getElementById(`prevChange_${N(h)}`),m=document.getElementById(`nextChange_${N(h)}`),w=document.getElementById(`details_${N(h)}`),x=document.getElementById(`cm_${N(h)}`),_={value:b[h].edit??"",origLeft:b[h].left??"",orig:b[h].right??"",lineNumbers:!0,lineWrapping:!1,mode:"text/plain",connect:"align",collapseIdentical:!0},I=ff.MergeView(x,_);I.editor().setOption("extraKeys",{"Alt-Down":Ci,"Option-Down":Ci,"Cmd-Down":Ci,"Alt-Up":hn,"Option-Up":hn,"Cmd-Up":hn,Tab:Ci}),d.onclick=()=>_f(I.editor()),g.onclick=()=>Df(I.editor()),v.onclick=()=>hn(I.editor()),m.onclick=()=>Ci(I.editor()),w.open=!1,w.ontoggle=()=>I.editor().refresh(),console.log(w),G[h]=I}return new Af(G)}function _f(O){O.setOption("collapseIdentical",!O.getOption("collapseIdentical")),O.setValue(O.getValue()),console.log(O.getOption("collapseIdentical")),O.scrollIntoView(null,50)}function Df(O){O.setOption("lineWrapping",!O.getOption("lineWrapping")),O.setValue(O.getValue())}function Ci(O){O.execCommand("goNextDiff"),O.scrollIntoView(null,50)}function hn(O){O.execCommand("goPrevDiff"),O.scrollIntoView(null,50)}function Qo(O){console.log("Caught error, showing to user:",O);let b=document.getElementById("modal_dialog_with_message"),T=document.getElementById("message_of_modal_dialog_with_message");Ti(`${String(O)}`,T),b.showModal(),console.log("Done showing error to user.")}async function Sl(O){try{return await O()}catch(b){Qo(b)}}window.addEventListener("DOMContentLoaded",async()=>{let O=document.getElementById("loading_message");O.innerHTML="",Ti(Li` + `);let M=document.getElementById(O);M.innerHTML="",Ti(Li`${T}`,M);let G={};for(let h in b){let d=document.getElementById(`collapse_${N(h)}`),g=document.getElementById(`linewrap_${N(h)}`),v=document.getElementById(`prevChange_${N(h)}`),m=document.getElementById(`nextChange_${N(h)}`),w=document.getElementById(`details_${N(h)}`),x=document.getElementById(`cm_${N(h)}`),_={value:b[h].edit??"",origLeft:b[h].left??"",orig:b[h].right??"",lineNumbers:!0,lineWrapping:!1,mode:"text/plain",connect:"align",collapseIdentical:!0},I=cf.MergeView(x,_);I.editor().setOption("extraKeys",{"Alt-Down":Ci,"Option-Down":Ci,"Cmd-Down":Ci,"Alt-Up":hn,"Option-Up":hn,"Cmd-Up":hn,Tab:Ci}),d.onclick=()=>Nf(I.editor()),g.onclick=()=>Of(I.editor()),v.onclick=()=>hn(I.editor()),m.onclick=()=>Ci(I.editor()),w.open=!1,w.ontoggle=()=>I.editor().refresh(),console.log(w),G[h]=I}return new _f(G)}function Nf(O){O.setOption("collapseIdentical",!O.getOption("collapseIdentical")),O.setValue(O.getValue()),console.log(O.getOption("collapseIdentical")),O.scrollIntoView(null,50)}function Of(O){O.setOption("lineWrapping",!O.getOption("lineWrapping")),O.setValue(O.getValue())}function Ci(O){O.execCommand("goNextDiff"),O.scrollIntoView(null,50)}function hn(O){O.execCommand("goPrevDiff"),O.scrollIntoView(null,50)}function Jo(O){console.log("Caught error, showing to user:",O);let b=document.getElementById("modal_dialog_with_message"),T=document.getElementById("message_of_modal_dialog_with_message");Ti(`${String(O)}`,T),b.showModal(),console.log("Done showing error to user.")}async function Ll(O){try{return await O()}catch(b){Jo(b)}}window.addEventListener("DOMContentLoaded",async()=>{let O=document.getElementById("loading_message");O.innerHTML="",Ti(Li`

Loading...

Getting the data we want to merge...

- `,O);let b;try{b=await Tf()}catch(v){throw Qo(v),await Lf(),new Error("Internal error: this statement should be unreachable")}Ti(Li` + `,O);let b;try{b=await xf()}catch(v){throw Jo(v),await kf(),new Error("Internal error: this statement should be unreachable")}Ti(Li`

Loading...

Rendering diffs...

- `,O);let T=Mf("lit",b);Ti(Li``,O);let N=async()=>await Sl(async()=>{await Po(T.values())}),M=document.getElementById("button_save"),G=document.getElementById("button_save_and_quit"),h=async()=>await Sl(async()=>{await Po(T.values()),M.disabled=!0,G.disabled=!0,Sf(),await new Promise(v=>setTimeout(v,100)),window.close()}),d=async()=>await Sl(async()=>{M.disabled=!0,G.disabled=!0,Ho(),await new Promise(v=>setTimeout(v,100)),window.close()}),g=()=>(window.location.reload(),!1);M.onclick=N,G.onclick=h,document.getElementById("button_abandon_changes_and_quit").onclick=d,document.getElementById("button_revert").onclick=g,kl?(await fn("save",async v=>N()),await fn("save_and_quit",async v=>h()),await fn("revert",async v=>g()),await fn("abandon_changes_and_quit",async v=>Ho())):document.addEventListener("keydown",async v=>{let m=v.metaKey||v.ctrlKey;return v.key=="s"&&m?(await N(),v.preventDefault(),!1):!0})});button_collapse_uncollapse_menu.onclick=function(O){console.log(O),console.log(this.closest(".main-menu")),this.closest(".main-menu").classList.toggle("collapsed")}; + `,O);let T=Df("lit",b);Ti(Li``,O);let N=async()=>await Ll(async()=>{await Ro(T.values())}),M=document.getElementById("button_save"),G=document.getElementById("button_save_and_quit"),h=async()=>await Ll(async()=>{await Ro(T.values()),M.disabled=!0,G.disabled=!0,Tf(),await new Promise(v=>setTimeout(v,100)),window.close()}),d=async()=>await Ll(async()=>{M.disabled=!0,G.disabled=!0,Bo(),await new Promise(v=>setTimeout(v,100)),window.close()}),g=()=>(window.location.reload(),!1);M.onclick=N,G.onclick=h,document.getElementById("button_abandon_changes_and_quit").onclick=d,document.getElementById("button_revert").onclick=g,xl?(await fn("save",async v=>N()),await fn("save_and_quit",async v=>h()),await fn("revert",async v=>g()),await fn("abandon_changes_and_quit",async v=>Bo())):document.addEventListener("keydown",async v=>{let m=v.metaKey||v.ctrlKey;return v.key=="s"&&m?(await N(),v.preventDefault(),!1):!0})});button_collapse_uncollapse_menu.onclick=function(O){console.log(O),console.log(this.closest(".main-menu")),this.closest(".main-menu").classList.toggle("collapsed")}; diff --git a/webapp/dist/index.html b/webapp/dist/index.html index 139e3b4..ab8a43b 100644 --- a/webapp/dist/index.html +++ b/webapp/dist/index.html @@ -13,7 +13,7 @@ filter: drop-shadow(0 0 2em #2d79c7); } - +