tildefriends/deps/codemirror/codemirror.min.js

1 line
166 KiB
JavaScript
Raw Normal View History

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,s=navigator.platform,m=/gecko\/\d/i.test(e),t=/MSIE \d/.test(e),a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),u=/Edge\/(\d+)/.exec(e),w=t||a||u,v=w&&(t?document.documentMode||6:+(u||a)[1]),x=!u&&/WebKit\//.test(e),t=x&&/Qt\/\d+\.\d+/.test(e),U=!u&&/Chrome\/(\d+)/.exec(e),V=U&&+U[1],K=/Opera\//.test(e),j=/Apple Computer/.test(navigator.vendor),c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),X=/PhantomJS/.test(e),d=j&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),Y=/Android/.test(e),$=d||Y||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),C=d||/Mac/.test(s),_=/\bCrOS\b/.test(e),a=/win/i.test(s),u=K&&e.match(/Version\/(\d*\.\d*)/),q=((u=u&&Number(u[1]))&&15<=u&&(x=!(K=!1)),C&&(t||K&&(null==u||u<12.11))),Z=m||w&&9<=v;function Q(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var J=function(e,t){var n,r=e.className,t=Q(t).exec(r);t&&(n=r.slice(t.index+t[0].length),e.className=r.slice(0,t.index)+(n?t[1]+n:""))};function ee(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function y(e,t){return ee(e).appendChild(t)}function M(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function te(e,t,n,r){e=M(e,t,n,r);return e.setAttribute("role","presentation"),e}function ne(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function N(t){var n;try{n=t.activeElement}catch(e){n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function re(e,t){var n=e.className;Q(t).test(n)||(e.className+=(n?" ":"")+t)}function ie(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Q(n[r]).test(t)&&(t+=" "+n[r]);return t}var oe=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r},le=function(e){e.select()};function se(e){return e.display.wrapper.ownerDocument}function ae(e){return se(e).defaultView}function ue(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ce(e,t,n){for(var r in t=t||{},e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function he(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||t<=s)return l+(t-o);l=(l+=s-o)+(n-l%n),o=s+1}}d?le=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:w&&(le=function(e){try{e.select()}catch(e){}});function de(){this.id=null,this.f=null,this.time=0,this.handler=ue(this.onTimeout,this)}function S(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}de.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};var fe=50,pe={toString:function(){return"CodeMirror.Pass"}},ge={scroll:!(de.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)})},me={origin:"*mouse"},ve={origin:"+move"};function ye(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r),l=(o=-1==o?e.length:o)-r;if(o==e.length||t<=i+l)return r+Math.min(l,t-i);if(i+=o-r,r=o+1,t<=(i+=n-i%n))return r}}var be=[""];function we(e){for(;be.length<=e;)be.push(I(be)+" ");return be[e]}function I(e){return e[e.length-1]}function xe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Ce(){}function Se(e,t){e=Object.create?Object.create(e):(Ce.prototype=e,new Ce);return t&&ce(t,e),e}var Le=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\