代码拉取完成,页面将自动刷新
同步操作将从 hbyufan/kindeditor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/* DuxEditor 5.1.0 (2018-12-11), Copyright (C) kindsoft.net, Licence: http://kindeditor.net/license.php */
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.CodeMirror=b()}(this,function(){"use strict";function a(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function b(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function c(a,c){return b(a).appendChild(c)}function d(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function e(a,b,c,e){var f=d(a,b,c,e);return f.setAttribute("role","presentation"),f}function f(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function g(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function h(b,c){var d=b.className;a(c).test(d)||(b.className+=(d?" ":"")+c)}function i(b,c){for(var d=b.split(" "),e=0;e<d.length;e++)d[e]&&!a(d[e]).test(c)&&(c+=" "+d[e]);return c}function j(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function k(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function l(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;;){var h=a.indexOf(" ",f);if(0>h||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}}function m(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function n(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function o(a){for(;Xg.length<=a;)Xg.push(p(Xg)+" ");return Xg[a]}function p(a){return a[a.length-1]}function q(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function r(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function s(){}function t(a,b){var c;return Object.create?c=Object.create(a):(s.prototype=a,c=new s),b&&k(b,c),c}function u(a){return/\w/.test(a)||a>""&&(a.toUpperCase()!=a.toLowerCase()||Yg.test(a))}function v(a,b){return b?b.source.indexOf("\\w")>-1&&u(a)?!0:b.test(a):u(a)}function w(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function x(a){return a.charCodeAt(0)>=768&&Zg.test(a)}function y(a,b,c){for(;(0>c?b>0:b<a.length)&&x(a.charAt(b));)b+=c;return b}function z(a,b,c){for(var d=b>c?-1:1;;){if(b==c)return b;var e=(b+c)/2,f=0>d?Math.ceil(e):Math.floor(e);if(f==b)return a(f)?b:c;a(f)?c=f:b=f+d}}function A(a,b,c){var f=this;this.input=c,f.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),f.scrollbarFiller.setAttribute("cm-not-content","true"),f.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),f.gutterFiller.setAttribute("cm-not-content","true"),f.lineDiv=e("div",null,"CodeMirror-code"),f.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),f.cursorDiv=d("div",null,"CodeMirror-cursors"),f.measure=d("div",null,"CodeMirror-measure"),f.lineMeasure=d("div",null,"CodeMirror-measure"),f.lineSpace=e("div",[f.measure,f.lineMeasure,f.selectionDiv,f.cursorDiv,f.lineDiv],null,"position: relative; outline: none");var g=e("div",[f.lineSpace],"CodeMirror-lines");f.mover=d("div",[g],null,"position: relative"),f.sizer=d("div",[f.mover],"CodeMirror-sizer"),f.sizerWidth=null,f.heightForcer=d("div",null,null,"position: absolute; height: "+Sg+"px; width: 1px;"),f.gutters=d("div",null,"CodeMirror-gutters"),f.lineGutter=null,f.scroller=d("div",[f.sizer,f.heightForcer,f.gutters],"CodeMirror-scroll"),f.scroller.setAttribute("tabIndex","-1"),f.wrapper=d("div",[f.scrollbarFiller,f.gutterFiller,f.scroller],"CodeMirror"),ug&&8>vg&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),wg||qg&&Fg||(f.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(f.wrapper):a(f.wrapper)),f.viewFrom=f.viewTo=b.first,f.reportedViewFrom=f.reportedViewTo=b.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,c.init(f)}function B(a,b){if(b-=a.first,0>b||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function C(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function D(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function E(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function F(a){if(null==a.parent)return null;for(var b=a.parent,c=m(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function G(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(f>b){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var g=0;g<a.lines.length;++g){var h=a.lines[g],i=h.height;if(i>b)break;b-=i}return c+g}function H(a,b){return b>=a.first&&b<a.first+a.size}function I(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function J(a,b,c){return void 0===c&&(c=null),this instanceof J?(this.line=a,this.ch=b,void(this.sticky=c)):new J(a,b,c)}function K(a,b){return a.line-b.line||a.ch-b.ch}function L(a,b){return a.sticky==b.sticky&&0==K(a,b)}function M(a){return J(a.line,a.ch)}function N(a,b){return K(a,b)<0?b:a}function O(a,b){return K(a,b)<0?a:b}function P(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Q(a,b){if(b.line<a.first)return J(a.first,0);var c=a.first+a.size-1;return b.line>c?J(c,B(a,c).text.length):R(b,B(a,b.line).text.length)}function R(a,b){var c=a.ch;return null==c||c>b?J(a.line,b):0>c?J(a.line,0):a}function S(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=Q(a,b[d]);return c}function T(){$g=!0}function U(){_g=!0}function V(a,b,c){this.marker=a,this.from=b,this.to=c}function W(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function X(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Y(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Z(a,b,c){var d;if(a)for(var e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push(new V(g,f.from,i?null:f.to))}}return d}function $(a,b,c){var d;if(a)for(var e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push(new V(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return d}function _(a,b){if(b.full)return null;var c=H(a,b.from.line)&&B(a,b.from.line).markedSpans,d=H(a,b.to.line)&&B(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==K(b.from,b.to),h=Z(c,e,g),i=$(d,f,g),j=1==b.text.length,k=p(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=W(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var o=0;o<i.length;++o){var q=i[o];if(null!=q.to&&(q.to+=k),null==q.from){var r=W(h,q.marker);r||(q.from=k,j&&(h||(h=[])).push(q))}else q.from+=k,j&&(h||(h=[])).push(q)}h&&(h=aa(h)),i&&i!=h&&(i=aa(i));var s=[h];if(!j){var t,u=b.text.length-2;if(u>0&&h)for(var v=0;v<h.length;++v)null==h[v].to&&(t||(t=[])).push(new V(h[v].marker,null,null));for(var w=0;u>w;++w)s.push(t);s.push(i)}return s}function aa(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function ba(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=m(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(0),i=0;i<e.length;++i){var j=e[i];if(!(K(j.to,h.from)<0||K(j.from,h.to)>0)){var k=[i,1],l=K(j.from,h.from),n=K(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(n>0||!g.inclusiveRight&&!n)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-3}}return e}function ca(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function da(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function ea(a){return a.inclusiveLeft?-1:0}function fa(a){return a.inclusiveRight?1:0}function ga(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=K(d.from,e.from)||ea(a)-ea(b);if(f)return-f;var g=K(d.to,e.to)||fa(a)-fa(b);return g?g:b.id-a.id}function ha(a,b){var c,d=_g&&a.markedSpans;if(d)for(var e=void 0,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||ga(c,e.marker)<0)&&(c=e.marker);return c}function ia(a){return ha(a,!0)}function ja(a){return ha(a,!1)}function ka(a,b,c,d,e){var f=B(a,b),g=_g&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=K(j.from,c)||ea(i.marker)-ea(e),l=K(j.to,d)||fa(i.marker)-fa(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(i.marker.inclusiveRight&&e.inclusiveLeft?K(j.to,c)>=0:K(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?K(j.from,d)<=0:K(j.from,d)<0)))return!0}}}function la(a){for(var b;b=ia(a);)a=b.find(-1,!0).line;return a}function ma(a){for(var b;b=ja(a);)a=b.find(1,!0).line;return a}function na(a){for(var b,c;b=ja(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function oa(a,b){var c=B(a,b),d=la(c);return c==d?b:F(d)}function pa(a,b){if(b>a.lastLine())return b;var c,d=B(a,b);if(!qa(a,d))return b;for(;c=ja(d);)d=c.find(1,!0).line;return F(d)+1}function qa(a,b){var c=_g&&b.markedSpans;if(c)for(var d=void 0,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&ra(a,b,d))return!0}}function ra(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return ra(a,d.line,W(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e=void 0,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&ra(a,b,e))return!0}function sa(a){a=la(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var g=0;g<f.children.length;++g){var h=f.children[g];if(h==c)break;b+=h.height}return b}function ta(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=ia(d);){var e=b.find(0,!0);d=e.from.line,c+=e.from.ch-e.to.ch}for(d=a;b=ja(d);){var f=b.find(0,!0);c-=d.text.length-f.from.ch,d=f.to.line,c+=d.text.length-f.to.ch}return c}function ua(a){var b=a.display,c=a.doc;b.maxLine=B(c,c.first),b.maxLineLength=ta(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=ta(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function va(a,b,c,d){if(!a)return d(b,c,"ltr",0);for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr",f),e=!0)}e||d(b,c,"ltr")}function wa(a,b,c){var d;ah=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==c?d=e:ah=e),f.from==b&&(f.from!=f.to&&"before"!=c?d=e:ah=e)}return null!=d?d:ah}function xa(a,b){var c=a.order;return null==c&&(c=a.order=bh(a.text,b)),c}function ya(a,b){return a._handlers&&a._handlers[b]||ch}function za(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers,e=d&&d[b];if(e){var f=m(e,c);f>-1&&(d[b]=e.slice(0,f).concat(e.slice(f+1)))}}}function Aa(a,b){var c=ya(a,b);if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Ba(a,b,c){return"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}}),Aa(a,c||b.type,a,b),Ha(b)||b.codemirrorIgnore}function Ca(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)-1==m(c,b[d])&&c.push(b[d])}function Da(a,b){return ya(a,b).length>0}function Ea(a){a.prototype.on=function(a,b){dh(this,a,b)},a.prototype.off=function(a,b){za(this,a,b)}}function Fa(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ga(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Ha(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ia(a){Fa(a),Ga(a)}function Ja(a){return a.target||a.srcElement}function Ka(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),Gg&&a.ctrlKey&&1==b&&(b=3),b}function La(a){if(null==Qg){var b=d("span","");c(a,d("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Qg=b.offsetWidth<=1&&b.offsetHeight>2&&!(ug&&8>vg))}var e=Qg?d("span",""):d("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return e.setAttribute("cm-text",""),e}function Ma(a){if(null!=Rg)return Rg;var d=c(a,document.createTextNode("AخA")),e=Kg(d,0,1).getBoundingClientRect(),f=Kg(d,1,2).getBoundingClientRect();return b(a),e&&e.left!=e.right?Rg=f.right-e.right<3:!1}function Na(a){if(null!=ih)return ih;var b=c(a,d("span","x")),e=b.getBoundingClientRect(),f=Kg(b,0,1).getBoundingClientRect();return ih=Math.abs(e.left-f.left)>1}function Oa(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),jh[a]=b}function Pa(a,b){kh[a]=b}function Qa(a){if("string"==typeof a&&kh.hasOwnProperty(a))a=kh[a];else if(a&&"string"==typeof a.name&&kh.hasOwnProperty(a.name)){var b=kh[a.name];"string"==typeof b&&(b={name:b}),a=t(b,a),a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Qa("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Qa("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function Ra(a,b){b=Qa(b);var c=jh[b.name];if(!c)return Ra(a,"text/plain");var d=c(a,b);if(lh.hasOwnProperty(b.name)){var e=lh[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var g in b.modeProps)d[g]=b.modeProps[g];return d}function Sa(a,b){var c=lh.hasOwnProperty(a)?lh[a]:lh[a]={};k(b,c)}function Ta(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function Ua(a,b){for(var c;a.innerMode&&(c=a.innerMode(b),c&&c.mode!=a);)b=c.state,a=c.mode;return c||{mode:a,state:b}}function Va(a,b,c){return a.startState?a.startState(b,c):!0}function Wa(a,b,c,d){var e=[a.state.modeGen],f={};cb(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);for(var g=c.state,h=function(d){c.baseTokens=e;var h=a.state.overlays[d],i=1,j=0;c.state=!0,cb(a,b.text,h.mode,c,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"overlay "+b}},f),c.state=g,c.baseTokens=null,c.baseTokenPos=1},i=0;i<a.state.overlays.length;++i)h(i);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Xa(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Ya(a,F(b)),e=b.text.length>a.options.maxHighlightLength&&Ta(a.doc.mode,d.state),f=Wa(a,b,d);e&&(d.state=e),b.stateAfter=d.save(!e),b.styles=f.styles,f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Ya(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new oh(d,!0,b);var f=db(a,b,c),g=f>d.first&&B(d,f-1).stateAfter,h=g?oh.fromSaved(d,g,f):new oh(d,Va(d.mode),f);return d.iter(f,b,function(c){Za(a,c.text,h);var d=h.line;c.stateAfter=d==b-1||d%5==0||d>=e.viewFrom&&d<e.viewTo?h.save():null,h.nextLine()}),c&&(d.modeFrontier=h.line),h}function Za(a,b,c,d){var e=a.doc.mode,f=new mh(b,a.options.tabSize,c);for(f.start=f.pos=d||0,""==b&&$a(e,c.state);!f.eol();)_a(e,f,c.state),f.start=f.pos}function $a(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=Ua(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function _a(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=Ua(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw new Error("Mode "+a.name+" failed to advance stream.")}function ab(a,b,c,d){var e,f=a.doc,g=f.mode;b=Q(f,b);var h,i=B(f,b.line),j=Ya(a,b.line,c),k=new mh(i.text,a.options.tabSize,j);for(d&&(h=[]);(d||k.pos<b.ch)&&!k.eol();)k.start=k.pos,e=_a(g,k,j.state),d&&h.push(new ph(k,e,Ta(f.mode,j.state)));return d?h:new ph(k,e,j.state)}function bb(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function cb(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var i,j=0,k=null,l=new mh(b,a.options.tabSize,d),m=a.options.addModeClass&&[null];for(""==b&&bb($a(c,d.state),f);!l.eol();){if(l.pos>a.options.maxHighlightLength?(h=!1,g&&Za(a,b,d,l.pos),l.pos=b.length,i=null):i=bb(_a(c,l,d.state,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;j<l.start;)j=Math.min(l.start,j+5e3),e(j,k);k=i}l.start=l.pos}for(;j<l.pos;){var o=Math.min(l.pos,j+5e3);e(o,k),j=o}}function db(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=B(f,h-1),j=i.stateAfter;if(j&&(!c||h+(j instanceof nh?j.lookAhead:0)<=f.modeFrontier))return h;var k=l(i.text,null,a.options.tabSize);(null==e||d>k)&&(e=h-1,d=k)}return e}function eb(a,b){if(a.modeFrontier=Math.min(a.modeFrontier,b),!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=B(a,d).stateAfter;if(e&&(!(e instanceof nh)||d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function fb(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),ca(a),da(a,c);var e=d?d(a):1;e!=a.height&&E(a,e)}function gb(a){a.parent=null,ca(a)}function hb(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?th:sh;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function ib(a,b){var c=e("span",null,null,wg?"padding-right: .1px":null),d={pre:e("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(ug||wg)&&a.getOption("lineWrapping")};b.measure={};for(var f=0;f<=(b.rest?b.rest.length:0);f++){var g=f?b.rest[f-1]:b.line,h=void 0;d.pos=0,d.addToken=kb,Ma(a.display.measure)&&(h=xa(g,a.doc.direction))&&(d.addToken=mb(d.addToken,h)),d.map=[];var j=b!=a.display.externalMeasured&&F(g);ob(g,d,Xa(a,g,j)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=i(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=i(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(La(a.display.measure))),0==f?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(wg){var k=d.content.lastChild;(/\bcm-tab\b/.test(k.className)||k.querySelector&&k.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack")}return Aa(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=i(d.pre.className,d.textClass||"")),d}function jb(a){var b=d("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function kb(a,b,c,e,f,g,h){if(b){var i,j=a.splitSpaces?lb(b,a.trailingSpace):b,k=a.cm.state.specialChars,l=!1;if(k.test(b)){i=document.createDocumentFragment();for(var m=0;;){k.lastIndex=m;var n=k.exec(b),p=n?n.index-m:b.length-m;if(p){var q=document.createTextNode(j.slice(m,m+p));ug&&9>vg?i.appendChild(d("span",[q])):i.appendChild(q),a.map.push(a.pos,a.pos+p,q),a.col+=p,a.pos+=p}if(!n)break;m+=p+1;var r=void 0;if(" "==n[0]){var s=a.cm.options.tabSize,t=s-a.col%s;r=i.appendChild(d("span",o(t),"cm-tab")),r.setAttribute("role","presentation"),r.setAttribute("cm-text"," "),a.col+=t}else"\r"==n[0]||"\n"==n[0]?(r=i.appendChild(d("span","\r"==n[0]?"␍":"","cm-invalidchar")),r.setAttribute("cm-text",n[0]),a.col+=1):(r=a.cm.options.specialCharPlaceholder(n[0]),r.setAttribute("cm-text",n[0]),ug&&9>vg?i.appendChild(d("span",[r])):i.appendChild(r),a.col+=1);a.map.push(a.pos,a.pos+1,r),a.pos++}}else a.col+=b.length,i=document.createTextNode(j),a.map.push(a.pos,a.pos+b.length,i),ug&&9>vg&&(l=!0),a.pos+=b.length;if(a.trailingSpace=32==j.charCodeAt(b.length-1),c||e||f||l||h){var u=c||"";e&&(u+=e),f&&(u+=f);var v=d("span",[i],u,h);return g&&(v.title=g),a.content.appendChild(v)}a.content.appendChild(i)}}function lb(a,b){if(a.length>1&&!/ /.test(a))return a;for(var c=b,d="",e=0;e<a.length;e++){var f=a.charAt(e);" "!=f||!c||e!=a.length-1&&32!=a.charCodeAt(e+1)||(f=" "),d+=f,c=" "==f}return d}function mb(a,b){return function(c,d,e,f,g,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var j=c.pos,k=j+d.length;;){for(var l=void 0,m=0;m<b.length&&(l=b[m],!(l.to>j&&l.from<=j));m++);if(l.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,l.to-j),e,f,null,h,i),f=null,d=d.slice(l.to-j),j=l.to}}}function nb(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b,a.trailingSpace=!1}function ob(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=void 0,u=0;u<d.length;++u){var v=d[u],w=v.marker;"bookmark"==w.type&&v.from==o&&w.widgetNode?s.push(w):v.from<=o&&(null==v.to||v.to>o||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(t||(t=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||ga(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(t)for(var x=0;x<t.length;x+=2)t[x+1]==r&&(j+=" "+t[x]);if(!m||m.from==o)for(var y=0;y<s.length;++y)nb(b,0,s[y]);if(m&&(m.from||0)==o){if(nb(b,(null==m.to?n+1:m.to)-o,m.marker,null==m.from),null==m.to)return;m.to==o&&(m=!1)}}if(o>=n)break;for(var z=Math.min(n,r);;){if(q){var A=o+q.length;if(!m){var B=A>z?q.slice(0,z-o):q;b.addToken(b,B,g?g+i:i,k,o+B.length==r?j:"",l,h)}if(A>=z){q=q.slice(z-o),o=z;break}o=A,k=""}q=e.slice(f,f=c[p++]),g=hb(c[p++],b.cm.options)}}else for(var C=1;C<c.length;C+=2)b.addToken(b,e.slice(f,f=c[C]),hb(c[C+1],b.cm.options))}function pb(a,b,c){this.line=b,this.rest=na(b),this.size=this.rest?F(p(this.rest))-c+1:1,this.node=this.text=null,this.hidden=qa(a,b)}function qb(a,b,c){for(var d,e=[],f=b;c>f;f=d){var g=new pb(a.doc,B(a.doc,f),f);d=f+g.size,e.push(g)}return e}function rb(a){uh?uh.ops.push(a):a.ownsGroup=uh={ops:[a],delayedCallbacks:[]}}function sb(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c].call(null);for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(c<b.length)}function tb(a,b){var c=a.ownsGroup;if(c)try{sb(c)}finally{uh=null,b(c)}}function ub(a,b){var c=ya(a,b);if(c.length){var d,e=Array.prototype.slice.call(arguments,2);uh?d=uh.delayedCallbacks:vh?d=vh:(d=vh=[],setTimeout(vb,0));for(var f=function(a){d.push(function(){return c[a].apply(null,e)})},g=0;g<c.length;++g)f(g)}}function vb(){var a=vh;vh=null;for(var b=0;b<a.length;++b)a[b]()}function wb(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?Ab(a,b):"gutter"==f?Cb(a,b,c,d):"class"==f?Bb(a,b):"widget"==f&&Db(a,b,d)}b.changes=null}function xb(a){return a.node==a.text&&(a.node=d("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),ug&&8>vg&&(a.node.style.zIndex=2)),a.node}function yb(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;if(c&&(c+=" CodeMirror-linebackground"),b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var e=xb(b);b.background=e.insertBefore(d("div",null,c),e.firstChild),a.display.input.setUneditable(b.background)}}function zb(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):ib(a,b)}function Ab(a,b){var c=b.text.className,d=zb(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,Bb(a,b)):c&&(b.text.className=c)}function Bb(a,b){yb(a,b),b.line.wrapClass?xb(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");var c=b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass;b.text.className=c||""}function Cb(a,b,c,e){if(b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null),b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null),b.line.gutterClass){var f=xb(b);b.gutterBackground=d("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px; width: "+e.gutterTotalWidth+"px"),a.display.input.setUneditable(b.gutterBackground),f.insertBefore(b.gutterBackground,b.text)}var g=b.line.gutterMarkers;if(a.options.lineNumbers||g){var h=xb(b),i=b.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px");if(a.display.input.setUneditable(i),h.insertBefore(i,b.text),b.line.gutterClass&&(i.className+=" "+b.line.gutterClass),!a.options.lineNumbers||g&&g["CodeMirror-linenumbers"]||(b.lineNumber=i.appendChild(d("div",I(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),g)for(var j=0;j<a.options.gutters.length;++j){var k=a.options.gutters[j],l=g.hasOwnProperty(k)&&g[k];l&&i.appendChild(d("div",[l],"CodeMirror-gutter-elt","left: "+e.gutterLeft[k]+"px; width: "+e.gutterWidth[k]+"px"))}}}function Db(a,b,c){b.alignable&&(b.alignable=null);for(var d=b.node.firstChild,e=void 0;d;d=e)e=d.nextSibling,"CodeMirror-linewidget"==d.className&&b.node.removeChild(d);Fb(a,b,c)}function Eb(a,b,c,d){var e=zb(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),Bb(a,b),Cb(a,b,c,d),Fb(a,b,d),b.node}function Fb(a,b,c){if(Gb(a,b.line,b,c,!0),b.rest)for(var d=0;d<b.rest.length;d++)Gb(a,b.rest[d],b,c,!1)}function Gb(a,b,c,e,f){if(b.widgets)for(var g=xb(c),h=0,i=b.widgets;h<i.length;++h){var j=i[h],k=d("div",[j.node],"CodeMirror-linewidget");j.handleMouseEvents||k.setAttribute("cm-ignore-events","true"),Hb(j,k,c,e),a.display.input.setUneditable(k),f&&j.above?g.insertBefore(k,c.gutter||c.text):g.appendChild(k),ub(j,"redraw")}}function Hb(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function Ib(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!f(document.body,a.node)){var e="position: relative;";a.coverGutter&&(e+="margin-left: -"+b.display.gutters.offsetWidth+"px;"),a.noHScroll&&(e+="width: "+b.display.wrapper.clientWidth+"px;"),c(b.display.measure,d("div",[a.node],null,e))}return a.height=a.node.parentNode.offsetHeight}function Jb(a,b){for(var c=Ja(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Kb(a){return a.lineSpace.offsetTop}function Lb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Mb(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=c(a.measure,d("pre","x")),e=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,f={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};return isNaN(f.left)||isNaN(f.right)||(a.cachedPaddingH=f),f}function Nb(a){return Sg-a.display.nativeBarWidth}function Ob(a){return a.display.scroller.clientWidth-Nb(a)-a.display.barWidth}function Pb(a){return a.display.scroller.clientHeight-Nb(a)-a.display.barHeight}function Qb(a,b,c){var d=a.options.lineWrapping,e=d&&Ob(a);if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Rb(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var e=0;e<a.rest.length;e++)if(F(a.rest[e])>c)return{map:a.measure.maps[e],cache:a.measure.caches[e],before:!0}}function Sb(a,b){b=la(b);var d=F(b),e=a.display.externalMeasured=new pb(a.doc,b,d);e.lineN=d;var f=e.built=ib(a,e);return e.text=f.pre,c(a.display.lineMeasure,f.pre),e}function Tb(a,b,c,d){return Wb(a,Vb(a,b),c,d)}function Ub(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[zc(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function Vb(a,b){var c=F(b),d=Ub(a,c);d&&!d.text?d=null:d&&d.changes&&(wb(a,d,c,uc(a)),a.curOp.forceUpdate=!0),d||(d=Sb(a,b));var e=Rb(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function Wb(a,b,c,d,e){b.before&&(c=-1);var f,g=c+(d||"");return b.cache.hasOwnProperty(g)?f=b.cache[g]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(Qb(a,b.view,b.rect),b.hasHeights=!0),f=Zb(a,b,c,d),f.bogus||(b.cache[g]=f)),{left:f.left,right:f.right,top:e?f.rtop:f.top,bottom:e?f.rbottom:f.bottom}}function Xb(a,b,c){for(var d,e,f,g,h,i,j=0;j<a.length;j+=3)if(h=a[j],i=a[j+1],h>b?(e=0,f=1,g="left"):i>b?(e=b-h,f=e+1):(j==a.length-3||b==i&&a[j+3]>b)&&(f=i-h,e=f-1,b>=i&&(g="right")),null!=e){if(d=a[j+2],h==i&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;j&&a[j-2]==a[j-3]&&a[j-1].insertLeft;)d=a[(j-=3)+2],g="left";if("right"==c&&e==i-h)for(;j<a.length-3&&a[j+3]==a[j+4]&&!a[j+5].insertLeft;)d=a[(j+=3)+2],g="right";break}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:i}}function Yb(a,b){var c=wh;if("left"==b)for(var d=0;d<a.length&&(c=a[d]).left==c.right;d++);else for(var e=a.length-1;e>=0&&(c=a[e]).left==c.right;e--);return c}function Zb(a,b,c,d){var e,f=Xb(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;
if(3==g.nodeType){for(var k=0;4>k;k++){for(;h&&x(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i<f.coverEnd&&x(b.line.text.charAt(f.coverStart+i));)++i;if(e=ug&&9>vg&&0==h&&i==f.coverEnd-f.coverStart?g.parentNode.getBoundingClientRect():Yb(Kg(g,h,i).getClientRects(),d),e.left||e.right||0==h)break;i=h,h-=1,j="right"}ug&&11>vg&&(e=$b(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(ug&&9>vg&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+tc(a.display),top:m.top,bottom:m.bottom}:wh}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,r=0;r<q.length-1&&!(p<q[r]);r++);var s=r?q[r-1]:0,t=q[r],u={left:("right"==j?e.right:e.left)-b.rect.left,right:("left"==j?e.left:e.right)-b.rect.left,top:s,bottom:t};return e.left||e.right||(u.bogus=!0),a.options.singleCursorHeightPerLine||(u.rtop=n,u.rbottom=o),u}function $b(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Na(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function _b(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ac(a){a.display.externalMeasure=null,b(a.display.lineMeasure);for(var c=0;c<a.display.view.length;c++)_b(a.display.view[c])}function bc(a){ac(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function cc(){return yg&&Eg?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function dc(){return yg&&Eg?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ec(a){var b=0;if(a.widgets)for(var c=0;c<a.widgets.length;++c)a.widgets[c].above&&(b+=Ib(a.widgets[c]));return b}function fc(a,b,c,d,e){if(!e){var f=ec(b);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=sa(b);if("local"==d?g+=Kb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:dc());var i=h.left+("window"==d?0:cc());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function gc(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=cc(),e-=dc();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function hc(a,b,c,d,e){return d||(d=B(a.doc,b.line)),fc(a,d,Tb(a,d,b.ch,e),c)}function ic(a,b,c,d,e,f){function g(b,g){var h=Wb(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,fc(a,d,h,c)}function h(a,b,c){var d=i[b],e=1==d.level;return g(c?a-1:a,e!=c)}d=d||B(a.doc,b.line),e||(e=Vb(a,d));var i=xa(d,a.doc.direction),j=b.ch,k=b.sticky;if(j>=d.text.length?(j=d.text.length,k="before"):0>=j&&(j=0,k="after"),!i)return g("before"==k?j-1:j,"before"==k);var l=wa(i,j,k),m=ah,n=h(j,l,"before"==k);return null!=m&&(n.other=h(j,m,"before"!=k)),n}function jc(a,b){var c=0;b=Q(a.doc,b),a.options.lineWrapping||(c=tc(a.display)*b.ch);var d=B(a.doc,b.line),e=sa(d)+Kb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function kc(a,b,c,d,e){var f=J(a,b,c);return f.xRel=e,d&&(f.outside=!0),f}function lc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return kc(d.first,0,null,!0,-1);var e=G(d,c),f=d.first+d.size-1;if(e>f)return kc(d.first+d.size-1,B(d,f).text.length,null,!0,1);0>b&&(b=0);for(var g=B(d,e);;){var h=pc(a,g,e,b,c),i=ja(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=F(g=j.to.line)}}function mc(a,b,c,d){d-=ec(b);var e=b.text.length,f=z(function(b){return Wb(a,c,b-1).bottom<=d},e,0);return e=z(function(b){return Wb(a,c,b).top>d},f,e),{begin:f,end:e}}function nc(a,b,c,d){c||(c=Vb(a,b));var e=fc(a,b,Wb(a,c,d),"line").top;return mc(a,b,c,e)}function oc(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function pc(a,b,c,d,e){e-=sa(b);var f=Vb(a,b),g=ec(b),h=0,i=b.text.length,j=!0,k=xa(b,a.doc.direction);if(k){var l=(a.options.lineWrapping?rc:qc)(a,b,c,f,k,d,e);j=1!=l.level,h=j?l.from:l.to-1,i=j?l.to:l.from-1}var m,n,o=null,p=null,q=z(function(b){var c=Wb(a,f,b);return c.top+=g,c.bottom+=g,oc(c,d,e,!1)?(c.top<=e&&c.left<=d&&(o=b,p=c),!0):!1},h,i),r=!1;if(p){var s=d-p.left<p.right-d,t=s==j;q=o+(t?0:1),n=t?"after":"before",m=s?p.left:p.right}else{j||q!=i&&q!=h||q++,n=0==q?"after":q==b.text.length?"before":Wb(a,f,q-(j?1:0)).bottom+g<=e==j?"after":"before";var u=ic(a,J(c,q,n),"line",b,f);m=u.left,r=e<u.top||e>=u.bottom}return q=y(b.text,q,1),kc(c,q,n,r,d-m)}function qc(a,b,c,d,e,f,g){var h=z(function(h){var i=e[h],j=1!=i.level;return oc(ic(a,J(c,j?i.to:i.from,j?"before":"after"),"line",b,d),f,g,!0)},0,e.length-1),i=e[h];if(h>0){var j=1!=i.level,k=ic(a,J(c,j?i.from:i.to,j?"after":"before"),"line",b,d);oc(k,f,g,!0)&&k.top>g&&(i=e[h-1])}return i}function rc(a,b,c,d,e,f,g){var h=mc(a,b,d,g),i=h.begin,j=h.end;/\s/.test(b.text.charAt(j-1))&&j--;for(var k=null,l=null,m=0;m<e.length;m++){var n=e[m];if(!(n.from>=j||n.to<=i)){var o=1!=n.level,p=Wb(a,d,o?Math.min(j,n.to)-1:Math.max(i,n.from)).right,q=f>p?f-p+1e9:p-f;(!k||l>q)&&(k=n,l=q)}}return k||(k=e[e.length-1]),k.from<i&&(k={from:i,to:k.to,level:k.level}),k.to>j&&(k={from:k.from,to:j,level:k.level}),k}function sc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==rh){rh=d("pre");for(var e=0;49>e;++e)rh.appendChild(document.createTextNode("x")),rh.appendChild(d("br"));rh.appendChild(document.createTextNode("x"))}c(a.measure,rh);var f=rh.offsetHeight/50;return f>3&&(a.cachedTextHeight=f),b(a.measure),f||1}function tc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=d("span","xxxxxxxxxx"),e=d("pre",[b]);c(a.measure,e);var f=b.getBoundingClientRect(),g=(f.right-f.left)/10;return g>2&&(a.cachedCharWidth=g),g||10}function uc(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:vc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function vc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function wc(a){var b=sc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/tc(a.display)-3);return function(e){if(qa(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function xc(a){var b=a.doc,c=wc(a);b.iter(function(a){var b=c(a);b!=a.height&&E(a,b)})}function yc(a,b,c,d){var e=a.display;if(!c&&"true"==Ja(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=lc(a,f,g);if(d&&1==j.xRel&&(i=B(a.doc,j.line).text).length==j.ch){var k=l(i,i.length,a.options.tabSize)-i.length;j=J(j.line,Math.max(0,Math.round((f-Mb(a.display).left)/tc(a.display))-k))}return j}function zc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Ac(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Bc(a,b){void 0===b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var i=h.empty();(i||a.options.showCursorWhenSelecting)&&Cc(a,h.head,e),i||Ec(a,h,f)}}return d}function Cc(a,b,c){var e=ic(a,b,"div",null,null,!a.options.singleCursorHeightPerLine),f=c.appendChild(d("div"," ","CodeMirror-cursor"));if(f.style.left=e.left+"px",f.style.top=e.top+"px",f.style.height=Math.max(0,e.bottom-e.top)*a.options.cursorHeight+"px",e.other){var g=c.appendChild(d("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=e.other.left+"px",g.style.top=e.other.top+"px",g.style.height=.85*(e.other.bottom-e.other.top)+"px"}}function Dc(a,b){return a.top-b.top||a.left-b.left}function Ec(a,b,c){function e(a,b,c,e){0>b&&(b=0),b=Math.round(b),e=Math.round(e),i.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+b+"px; width: "+(null==c?l-a:c)+"px;\n height: "+(e-b)+"px"))}function f(b,c,d){function f(c,d){return hc(a,J(b,c),"div",n,d)}function g(b,c,d){var e=nc(a,n,null,b),g="ltr"==c==("after"==d)?"left":"right",h="after"==d?e.begin:e.end-(/\s/.test(n.text.charAt(e.end-1))?2:1);return f(h,g)[g]}var i,j,n=B(h,b),o=n.text.length,p=xa(n,h.direction);return va(p,c||0,null==d?o:d,function(a,b,h,n){var q="ltr"==h,r=f(a,q?"left":"right"),s=f(b-1,q?"right":"left"),t=null==c&&0==a,u=null==d&&b==o,v=0==n,w=!p||n==p.length-1;if(s.top-r.top<=3){var x=(m?t:u)&&v,y=(m?u:t)&&w,z=x?k:(q?r:s).left,A=y?l:(q?s:r).right;e(z,r.top,A-z,r.bottom)}else{var B,C,D,E;q?(B=m&&t&&v?k:r.left,C=m?l:g(a,h,"before"),D=m?k:g(b,h,"after"),E=m&&u&&w?l:s.right):(B=m?g(a,h,"before"):k,C=!m&&t&&v?l:r.right,D=!m&&u&&w?k:s.left,E=m?g(b,h,"after"):l),e(B,r.top,C-B,r.bottom),r.bottom<s.top&&e(k,r.bottom,null,s.top),e(D,s.top,E-D,s.bottom)}(!i||Dc(r,i)<0)&&(i=r),Dc(s,i)<0&&(i=s),(!j||Dc(r,j)<0)&&(j=r),Dc(s,j)<0&&(j=s)}),{start:i,end:j}}var g=a.display,h=a.doc,i=document.createDocumentFragment(),j=Mb(a.display),k=j.left,l=Math.max(g.sizerWidth,Ob(a)-g.sizer.offsetLeft)-j.right,m="ltr"==h.direction,n=b.from(),o=b.to();if(n.line==o.line)f(n.line,n.ch,o.ch);else{var p=B(h,n.line),q=B(h,o.line),r=la(p)==la(q),s=f(n.line,n.ch,r?p.text.length+1:null).end,t=f(o.line,r?0:null,o.ch).start;r&&(s.top<t.top-2?(e(s.right,s.top,null,s.bottom),e(k,t.top,t.left,t.bottom)):e(s.right,s.top,t.left-s.right,s.bottom)),s.bottom<t.top&&e(k,s.bottom,null,t.top)}c.appendChild(i)}function Fc(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Gc(a){a.state.focused||(a.display.input.focus(),Ic(a))}function Hc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Jc(a))},100)}function Ic(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Aa(a,"focus",a,b),a.state.focused=!0,h(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),wg&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Fc(a))}function Jc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(Aa(a,"blur",a,b),a.state.focused=!1,Ng(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Kc(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d<b.view.length;d++){var e=b.view[d],f=void 0;if(!e.hidden){if(ug&&8>vg){var g=e.node.offsetTop+e.node.offsetHeight;f=g-c,c=g}else{var h=e.node.getBoundingClientRect();f=h.bottom-h.top}var i=e.line.height-f;if(2>f&&(f=sc(b)),(i>.005||-.005>i)&&(E(e.line,f),Lc(e.line),e.rest))for(var j=0;j<e.rest.length;j++)Lc(e.rest[j])}}}function Lc(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b){var c=a.widgets[b],d=c.node.parentNode;d&&(c.height=d.offsetHeight)}}function Mc(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Kb(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=G(b,d),g=G(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;f>h?(f=h,g=G(b,sa(B(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=G(b,sa(B(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function Nc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=vc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&(c[g].gutter&&(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Oc(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=I(a.options,b.first+b.size-1),e=a.display;if(c.length!=e.lineNumChars){var f=e.measure.appendChild(d("div",[d("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),g=f.firstChild.offsetWidth,h=f.offsetWidth-g;return e.lineGutter.style.width="",e.lineNumInnerWidth=Math.max(g,e.lineGutter.offsetWidth-h)+1,e.lineNumWidth=e.lineNumInnerWidth+h,e.lineNumChars=e.lineNumInnerWidth?c.length:-1,e.lineGutter.style.width=e.lineNumWidth+"px",Fd(a),!0}return!1}function Pc(a,b){if(!Ba(a,"scrollCursorIntoView")){var c=a.display,e=c.sizer.getBoundingClientRect(),f=null;if(b.top+e.top<0?f=!0:b.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),null!=f&&!Cg){var g=d("div","",null,"position: absolute;\n top: "+(b.top-c.viewOffset-Kb(a.display))+"px;\n height: "+(b.bottom-b.top+Nb(a)+c.barHeight)+"px;\n left: "+b.left+"px; width: "+Math.max(2,b.right-b.left)+"px;");a.display.lineSpace.appendChild(g),g.scrollIntoView(f),a.display.lineSpace.removeChild(g)}}}function Qc(a,b,c,d){null==d&&(d=0);var e;a.options.lineWrapping||b!=c||(b=b.ch?J(b.line,"before"==b.sticky?b.ch-1:b.ch,"after"):b,c="before"==b.sticky?J(b.line,b.ch+1,"before"):b);for(var f=0;5>f;f++){var g=!1,h=ic(a,b),i=c&&c!=b?ic(a,c):h;e={left:Math.min(h.left,i.left),top:Math.min(h.top,i.top)-d,right:Math.max(h.left,i.left),bottom:Math.max(h.bottom,i.bottom)+d};var j=Sc(a,e),k=a.doc.scrollTop,l=a.doc.scrollLeft;if(null!=j.scrollTop&&(Zc(a,j.scrollTop),Math.abs(a.doc.scrollTop-k)>1&&(g=!0)),null!=j.scrollLeft&&(_c(a,j.scrollLeft),Math.abs(a.doc.scrollLeft-l)>1&&(g=!0)),!g)break}return e}function Rc(a,b){var c=Sc(a,b);null!=c.scrollTop&&Zc(a,c.scrollTop),null!=c.scrollLeft&&_c(a,c.scrollLeft)}function Sc(a,b){var c=a.display,d=sc(a.display);b.top<0&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,f=Pb(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+Lb(c),i=b.top<d,j=b.bottom>h-d;if(b.top<e)g.scrollTop=i?0:b.top;else if(b.bottom>e+f){var k=Math.min(b.top,(j?h:b.bottom)-f);k!=e&&(g.scrollTop=k)}var l=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft,m=Ob(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0),n=b.right-b.left>m;return n&&(b.right=b.left+m),b.left<10?g.scrollLeft=0:b.left<l?g.scrollLeft=Math.max(0,b.left-(n?0:10)):b.right>m+l-3&&(g.scrollLeft=b.right+(n?0:10)-m),g}function Tc(a,b){null!=b&&(Xc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Uc(a){Xc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Vc(a,b,c){(null!=b||null!=c)&&Xc(a),null!=b&&(a.curOp.scrollLeft=b),null!=c&&(a.curOp.scrollTop=c)}function Wc(a,b){Xc(a),a.curOp.scrollToPos=b}function Xc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=jc(a,b.from),d=jc(a,b.to);Yc(a,c,d,b.margin)}}function Yc(a,b,c,d){var e=Sc(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Vc(a,e.scrollLeft,e.scrollTop)}function Zc(a,b){Math.abs(a.doc.scrollTop-b)<2||(qg||Dd(a,{top:b}),$c(a,b,!0),qg&&Dd(a),wd(a,100))}function $c(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b),(a.display.scroller.scrollTop!=b||c)&&(a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b))}function _c(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),(!(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||d)&&(a.doc.scrollLeft=b,Nc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function ad(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Lb(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Nb(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function bd(a,b){b||(b=ad(a));var c=a.display.barWidth,d=a.display.barHeight;cd(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&Kc(a),cd(a,ad(a)),c=a.display.barWidth,d=a.display.barHeight}function cd(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",c.heightForcer.style.borderBottom=d.bottom+"px solid transparent",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function dd(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Ng(a.display.wrapper,a.display.scrollbars.addClass)),a.display.scrollbars=new zh[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller),dh(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)}),b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?_c(a,b):Zc(a,b)},a),a.display.scrollbars.addClass&&h(a.display.wrapper,a.display.scrollbars.addClass)}function ed(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ah},rb(a.curOp)}function fd(a){var b=a.curOp;tb(b,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;gd(a)})}function gd(a){for(var b=a.ops,c=0;c<b.length;c++)hd(b[c]);for(var d=0;d<b.length;d++)id(b[d]);for(var e=0;e<b.length;e++)jd(b[e]);for(var f=0;f<b.length;f++)kd(b[f]);for(var g=0;g<b.length;g++)ld(b[g])}function hd(a){var b=a.cm,c=b.display;yd(b),a.updateMaxLine&&ua(b),a.mustUpdate=a.viewChanged||a.forceUpdate||null!=a.scrollTop||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new Bh(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function id(a){a.updatedDisplay=a.mustUpdate&&Bd(a.cm,a.update)}function jd(a){var b=a.cm,c=b.display;a.updatedDisplay&&Kc(b),a.barMeasure=ad(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Tb(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Nb(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Ob(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection())}function kd(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&_c(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1);var c=a.focus&&a.focus==g();a.preparedSelection&&b.display.input.showSelection(a.preparedSelection,c),(a.updatedDisplay||a.startHeight!=b.doc.height)&&bd(b,a.barMeasure),a.updatedDisplay&&Gd(b,a.barMeasure),a.selectionChanged&&Fc(b),b.state.focused&&a.updateInput&&b.display.input.reset(a.typing),c&&Gc(a.cm)}function ld(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay&&Cd(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null!=a.scrollTop&&$c(b,a.scrollTop,a.forceScroll),null!=a.scrollLeft&&_c(b,a.scrollLeft,!0,!0),a.scrollToPos){var e=Qc(b,Q(d,a.scrollToPos.from),Q(d,a.scrollToPos.to),a.scrollToPos.margin);Pc(b,e)}var f=a.maybeHiddenMarkers,g=a.maybeUnhiddenMarkers;if(f)for(var h=0;h<f.length;++h)f[h].lines.length||Aa(f[h],"hide");if(g)for(var i=0;i<g.length;++i)g[i].lines.length&&Aa(g[i],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.changeObjs&&Aa(b,"changes",b,a.changeObjs),a.update&&a.update.finish()}function md(a,b){if(a.curOp)return b();ed(a);try{return b()}finally{fd(a)}}function nd(a,b){return function(){if(a.curOp)return b.apply(a,arguments);ed(a);try{return b.apply(a,arguments)}finally{fd(a)}}}function od(a){return function(){if(this.curOp)return a.apply(this,arguments);ed(this);try{return a.apply(this,arguments)}finally{fd(this)}}}function pd(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);ed(b);try{return a.apply(this,arguments)}finally{fd(b)}}}function qd(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)_g&&oa(a.doc,b)<e.viewTo&&sd(a);else if(c<=e.viewFrom)_g&&pa(a.doc,c+d)>e.viewFrom?sd(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)sd(a);else if(b<=e.viewFrom){var f=td(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):sd(a)}else if(c>=e.viewTo){var g=td(a,b,b,-1);g?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):sd(a)}else{var h=td(a,b,b,-1),i=td(a,c,c+d,1);h&&i?(e.view=e.view.slice(0,h.index).concat(qb(a,h.lineN,i.lineN)).concat(e.view.slice(i.index)),e.viewTo+=d):sd(a)}var j=e.externalMeasured;j&&(c<j.lineN?j.lineN+=d:b<j.lineN+j.size&&(e.externalMeasured=null))}function rd(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[zc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==m(g,c)&&g.push(c)}}}function sd(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function td(a,b,c,d){var e,f=zc(a,b),g=a.display.view;if(!_g||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=a.display.viewFrom,i=0;f>i;i++)h+=g[i].size;if(h!=b){if(d>0){if(f==g.length-1)return null;e=h+g[f].size-b,f++}else e=h-b;b+=e,c+=e}for(;oa(a.doc,c)!=c;){if(f==(0>d?0:g.length-1))return null;c+=d*g[f-(0>d?1:0)].size,f+=d}return{index:f,lineN:c}}function ud(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=qb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=qb(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(zc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(qb(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,zc(a,c)))),d.viewTo=c}function vd(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function wd(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,j(xd,a))}function xd(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Ya(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?Ta(b.mode,d.state):null,i=Wa(a,f,d,!0);h&&(d.state=h),f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&m<g.length;++m)l=g[m]!=f.styles[m];l&&e.push(d.line),f.stateAfter=d.save(),d.nextLine()}else f.text.length<=a.options.maxHighlightLength&&Za(a,f.text,d),f.stateAfter=d.line%5==0?d.save():null,d.nextLine();return+new Date>c?(wd(a,a.options.workDelay),!0):void 0}),b.highlightFrontier=d.line,b.modeFrontier=Math.max(b.modeFrontier,d.line),e.length&&md(a,function(){for(var b=0;b<e.length;b++)rd(a,e[b],"text")})}}function yd(a){var b=a.display;!b.scrollbarsClipped&&b.scroller.offsetWidth&&(b.nativeBarWidth=b.scroller.offsetWidth-b.scroller.clientWidth,b.heightForcer.style.height=Nb(a)+"px",b.sizer.style.marginBottom=-b.nativeBarWidth+"px",b.sizer.style.borderRightWidth=Nb(a)+"px",b.scrollbarsClipped=!0)}function zd(a){if(a.hasFocus())return null;var b=g();if(!b||!f(a.display.lineDiv,b))return null;var c={activeElt:b};if(window.getSelection){var d=window.getSelection();d.anchorNode&&d.extend&&f(a.display.lineDiv,d.anchorNode)&&(c.anchorNode=d.anchorNode,c.anchorOffset=d.anchorOffset,c.focusNode=d.focusNode,c.focusOffset=d.focusOffset)}return c}function Ad(a){if(a&&a.activeElt&&a.activeElt!=g()&&(a.activeElt.focus(),a.anchorNode&&f(document.body,a.anchorNode)&&f(document.body,a.focusNode))){var b=window.getSelection(),c=document.createRange();c.setEnd(a.anchorNode,a.anchorOffset),c.collapse(!1),b.removeAllRanges(),b.addRange(c),b.extend(a.focusNode,a.focusOffset)}}function Bd(a,c){var d=a.display,e=a.doc;if(c.editorIsHidden)return sd(a),!1;if(!c.force&&c.visible.from>=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==vd(a))return!1;Oc(a)&&(sd(a),c.dims=uc(a));var f=e.first+e.size,g=Math.max(c.visible.from-a.options.viewportMargin,e.first),h=Math.min(f,c.visible.to+a.options.viewportMargin);d.viewFrom<g&&g-d.viewFrom<20&&(g=Math.max(e.first,d.viewFrom)),d.viewTo>h&&d.viewTo-h<20&&(h=Math.min(f,d.viewTo)),_g&&(g=oa(a.doc,g),h=pa(a.doc,h));var i=g!=d.viewFrom||h!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;ud(a,g,h),d.viewOffset=sa(B(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var j=vd(a);if(!i&&0==j&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;var k=zd(a);return j>4&&(d.lineDiv.style.display="none"),Ed(a,d.updateLineNumbers,c.dims),j>4&&(d.lineDiv.style.display=""),d.renderedView=d.view,Ad(k),b(d.cursorDiv),b(d.selectionDiv),d.gutters.style.height=d.sizer.style.minHeight=0,i&&(d.lastWrapHeight=c.wrapperHeight,d.lastWrapWidth=c.wrapperWidth,wd(a,400)),d.updateLineNumbers=null,!0}function Cd(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Ob(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Lb(a.display)-Pb(a),c.top)}),b.visible=Mc(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&Bd(a,b);d=!1){Kc(a);var e=ad(a);Ac(a),bd(a,e),Gd(a,e),b.force=!1}b.signal(a,"update",a),(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)&&(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function Dd(a,b){var c=new Bh(a,b);if(Bd(a,c)){Kc(a),Cd(a,c);var d=ad(a);Ac(a),bd(a,d),Gd(a,d),c.finish()}}function Ed(a,c,d){function e(b){var c=b.nextSibling;return wg&&Gg&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var f=a.display,g=a.options.lineNumbers,h=f.lineDiv,i=h.firstChild,j=f.view,k=f.viewFrom,l=0;l<j.length;l++){var n=j[l];if(n.hidden);else if(n.node&&n.node.parentNode==h){for(;i!=n.node;)i=e(i);var o=g&&null!=c&&k>=c&&n.lineNumber;n.changes&&(m(n.changes,"gutter")>-1&&(o=!1),wb(a,n,k,d)),o&&(b(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(I(a.options,k)))),i=n.node.nextSibling}else{var p=Eb(a,n,k,d);h.insertBefore(p,i)}k+=n.size}for(;i;)i=e(i)}function Fd(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function Gd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Nb(a)+"px"}function Hd(a){var c=a.display.gutters,e=a.options.gutters;b(c);for(var f=0;f<e.length;++f){var g=e[f],h=c.appendChild(d("div",null,"CodeMirror-gutter "+g));"CodeMirror-linenumbers"==g&&(a.display.lineGutter=h,h.style.width=(a.display.lineNumWidth||1)+"px")}c.style.display=f?"":"none",Fd(a)}function Id(a){var b=m(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Jd(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}}function Kd(a){var b=Jd(a);return b.x*=Dh,b.y*=Dh,b}function Ld(a,b){var c=Jd(b),d=c.x,e=c.y,f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&Gg&&wg)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==j){a.display.currentWheelTarget=j;break a}if(d&&!qg&&!zg&&null!=Dh)return e&&i&&Zc(a,Math.max(0,g.scrollTop+e*Dh)),_c(a,Math.max(0,g.scrollLeft+d*Dh)),(!e||e&&i)&&Fa(b),void(f.wheelStartX=null);if(e&&null!=Dh){var m=e*Dh,n=a.doc.scrollTop,o=n+f.wrapper.clientHeight;0>m?n=Math.max(0,n+m-50):o=Math.min(a.doc.height,o+m+50),Dd(a,{top:n,bottom:o})}20>Ch&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(Dh=(Dh*Ch+c)/(Ch+1),++Ch)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function Md(a,b){var c=a[b];a.sort(function(a,b){return K(a.from(),b.from())}),b=m(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(K(f.to(),e.from())>=0){var g=O(f.from(),e.from()),h=N(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new Fh(i?h:g,i?g:h))}}return new Eh(a,b)}function Nd(a,b){return new Eh([new Fh(a,b||a)],0)}function Od(a){return a.text?J(a.from.line+a.text.length-1,p(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Pd(a,b){if(K(a,b.from)<0)return a;if(K(a,b.to)<=0)return Od(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Od(b).ch-b.to.ch),J(c,d)}function Qd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new Fh(Pd(e.anchor,b),Pd(e.head,b)))}return Md(c,a.sel.primIndex)}function Rd(a,b,c){return a.line==b.line?J(c.line,a.ch-b.ch+c.ch):J(c.line+(a.line-b.line),a.ch)}function Sd(a,b,c){for(var d=[],e=J(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Rd(h.from,e,f),j=Rd(Od(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=K(k.head,k.anchor)<0;d[g]=new Fh(l?j:i,l?i:j)}else d[g]=new Fh(i,i)}return new Eh(d,a.sel.primIndex)}function Td(a){a.doc.mode=Ra(a.options,a.doc.modeOption),Ud(a)}function Ud(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first,
wd(a,100),a.state.modeGen++,a.curOp&&qd(a)}function Vd(a,b){return 0==b.from.ch&&0==b.to.ch&&""==p(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Wd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){fb(a,c,e,d),ub(a,"change",a,b)}function g(a,b){for(var c=[],f=a;b>f;++f)c.push(new qh(j[f],e(f),d));return c}var h=b.from,i=b.to,j=b.text,k=B(a,h.line),l=B(a,i.line),m=p(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Vd(a,b)){var q=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),q.length&&a.insert(h.line,q)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var r=g(1,j.length-1);r.push(new qh(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,r)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var s=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,s)}ub(a,"change",a,b)}function Xd(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function Yd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,xc(a),Td(a),Zd(a),a.options.lineWrapping||ua(a),a.options.mode=b.modeOption,qd(a)}function Zd(a){("rtl"==a.doc.direction?h:Ng)(a.display.lineDiv,"CodeMirror-rtl")}function $d(a){md(a,function(){Zd(a),qd(a)})}function _d(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function ae(a,b){var c={from:M(b.from),to:Od(b),text:C(a,b.from,b.to)};return he(a,c,b.from.line,b.to.line+1),Xd(a,function(a){return he(a,c,b.from.line,b.to.line+1)},!0),c}function be(a){for(;a.length;){var b=p(a);if(!b.ranges)break;a.pop()}}function ce(a,b){return b?(be(a.done),p(a.done)):a.done.length&&!p(a.done).ranges?p(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),p(a.done)):void 0}function de(a,b,c,d){var e=a.history;e.undone.length=0;var f,g,h=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&e.lastModTime>h-(a.cm?a.cm.options.historyEventDelay:500)||"*"==b.origin.charAt(0)))&&(f=ce(e,e.lastOp==d)))g=p(f.changes),0==K(b.from,b.to)&&0==K(b.from,g.to)?g.to=Od(b):f.changes.push(ae(a,b));else{var i=p(e.done);for(i&&i.ranges||ge(a.sel,e.done),f={changes:[ae(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=h,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,g||Aa(a,"historyAdded")}function ee(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function fe(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ee(a,f,p(e.done),b))?e.done[e.done.length-1]=b:ge(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&be(e.undone)}function ge(a,b){var c=p(b);c&&c.ranges&&c.equals(a)||b.push(a)}function he(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ie(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function je(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=[],e=0;e<b.text.length;++e)d.push(ie(c[e]));return d}function ke(a,b){var c=je(a,b),d=_(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function le(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?Eh.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];d.push({changes:h});for(var i=0;i<g.length;++i){var j=g[i],k=void 0;if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&m(b,Number(k[1]))>-1&&(p(h)[l]=j[l],delete j[l])}}}return d}function me(a,b,c,d){if(d){var e=a.anchor;if(c){var f=K(b,e)<0;f!=K(c,e)<0?(e=b,b=c):f!=K(b,c)<0&&(b=c)}return new Fh(e,b)}return new Fh(c||b,b)}function ne(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend)),te(a,new Eh([me(a.sel.primary(),b,c,e)],0),d)}function oe(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)d[f]=me(a.sel.ranges[f],b[f],null,e);var g=Md(d,a.sel.primIndex);te(a,g,c)}function pe(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,te(a,Md(e,a.sel.primIndex),d)}function qe(a,b,c,d){te(a,Nd(b,c),d)}function re(a,b,c){var d={ranges:b.ranges,update:function(b){var c=this;this.ranges=[];for(var d=0;d<b.length;d++)c.ranges[d]=new Fh(Q(a,b[d].anchor),Q(a,b[d].head))},origin:c&&c.origin};return Aa(a,"beforeSelectionChange",a,d),a.cm&&Aa(a.cm,"beforeSelectionChange",a.cm,d),d.ranges!=b.ranges?Md(d.ranges,d.ranges.length-1):b}function se(a,b,c){var d=a.history.done,e=p(d);e&&e.ranges?(d[d.length-1]=b,ue(a,b,c)):te(a,b,c)}function te(a,b,c){ue(a,b,c),fe(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function ue(a,b,c){(Da(a,"beforeSelectionChange")||a.cm&&Da(a.cm,"beforeSelectionChange"))&&(b=re(a,b,c));var d=c&&c.bias||(K(b.primary().head,a.sel.primary().head)<0?-1:1);ve(a,xe(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Uc(a.cm)}function ve(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Ca(a.cm)),ub(a,"cursorActivity",a))}function we(a){ve(a,xe(a,a.sel,null,!1))}function xe(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],i=ze(a,g.anchor,h&&h.anchor,c,d),j=ze(a,g.head,h&&h.head,c,d);(e||i!=g.anchor||j!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new Fh(i,j))}return e?Md(e,b.primIndex):b}function ye(a,b,c,d,e){var f=B(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],i=h.marker;if((null==h.from||(i.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(i.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(Aa(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j=i.find(0>d?1:-1),k=void 0;if((0>d?i.inclusiveRight:i.inclusiveLeft)&&(j=Ae(a,j,-d,j&&j.line==b.line?f:null)),j&&j.line==b.line&&(k=K(j,c))&&(0>d?0>k:k>0))return ye(a,j,b,d,e)}var l=i.find(0>d?-1:1);return(0>d?i.inclusiveLeft:i.inclusiveRight)&&(l=Ae(a,l,d,l.line==b.line?f:null)),l?ye(a,l,b,d,e):null}}return b}function ze(a,b,c,d,e){var f=d||1,g=ye(a,b,c,f,e)||!e&&ye(a,b,c,f,!0)||ye(a,b,c,-f,e)||!e&&ye(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,J(a.first,0))}function Ae(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?Q(a,J(b.line-1)):null:c>0&&b.ch==(d||B(a,b.line)).text.length?b.line<a.first+a.size-1?J(b.line+1,0):null:new J(b.line,b.ch+c)}function Be(a){a.setSelection(J(a.firstLine(),0),J(a.lastLine()),Ug)}function Ce(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};return c&&(d.update=function(b,c,e,f){b&&(d.from=Q(a,b)),c&&(d.to=Q(a,c)),e&&(d.text=e),void 0!==f&&(d.origin=f)}),Aa(a,"beforeChange",a,d),a.cm&&Aa(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function De(a,b,c){if(a.cm){if(!a.cm.curOp)return nd(a.cm,De)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(Da(a,"beforeChange")||a.cm&&Da(a.cm,"beforeChange"))||(b=Ce(a,b,!0))){var d=$g&&!c&&ba(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Ee(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text,origin:b.origin});else Ee(a,b)}}function Ee(a,b){if(1!=b.text.length||""!=b.text[0]||0!=K(b.from,b.to)){var c=Qd(a,b);de(a,b,c,a.cm?a.cm.curOp.id:NaN),He(a,b,c,_(a,b));var d=[];Xd(a,function(a,c){c||-1!=m(d,a.history)||(Me(a.history,b),d.push(a.history)),He(a,b,null,_(a,b))})}}function Fe(a,b,c){var d=a.cm&&a.cm.state.suppressEdits;if(!d||c){for(var e,f=a.history,g=a.sel,h="undo"==b?f.done:f.undone,i="undo"==b?f.undone:f.done,j=0;j<h.length&&(e=h[j],c?!e.ranges||e.equals(a.sel):e.ranges);j++);if(j!=h.length){for(f.lastOrigin=f.lastSelOrigin=null;;){if(e=h.pop(),!e.ranges){if(d)return void h.push(e);break}if(ge(e,i),c&&!e.equals(a.sel))return void te(a,e,{clearRedo:!1});g=e}var k=[];ge(g,i),i.push({changes:k,generation:f.generation}),f.generation=e.generation||++f.maxGeneration;for(var l=Da(a,"beforeChange")||a.cm&&Da(a.cm,"beforeChange"),n=function(c){var d=e.changes[c];if(d.origin=b,l&&!Ce(a,d,!1))return h.length=0,{};k.push(ae(a,d));var f=c?Qd(a,d):p(h);He(a,d,f,ke(a,d)),!c&&a.cm&&a.cm.scrollIntoView({from:d.from,to:Od(d)});var g=[];Xd(a,function(a,b){b||-1!=m(g,a.history)||(Me(a.history,d),g.push(a.history)),He(a,d,null,ke(a,d))})},o=e.changes.length-1;o>=0;--o){var q=n(o);if(q)return q.v}}}}function Ge(a,b){if(0!=b&&(a.first+=b,a.sel=new Eh(q(a.sel.ranges,function(a){return new Fh(J(a.anchor.line+b,a.anchor.ch),J(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){qd(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)rd(a.cm,d,"gutter")}}function He(a,b,c,d){if(a.cm&&!a.cm.curOp)return nd(a.cm,He)(a,b,c,d);if(b.to.line<a.first)return void Ge(a,b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ge(a,e),b={from:J(a.first,0),to:J(b.to.line+e,b.to.ch),text:[p(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:J(f,B(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=C(a,b.from,b.to),c||(c=Qd(a,b)),a.cm?Ie(a.cm,b,d):Wd(a,b,d),ue(a,c,Ug)}}function Ie(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=F(la(B(d,f.line))),d.iter(i,g.line+1,function(a){return a==e.maxLine?(h=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&Ca(a),Wd(d,b,c,wc(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=ta(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),eb(d,f.line),wd(a,400);var j=b.text.length-(g.line-f.line)-1;b.full?qd(a):f.line!=g.line||1!=b.text.length||Vd(a.doc,b)?qd(a,f.line,g.line+1,j):rd(a,f.line,"text");var k=Da(a,"changes"),l=Da(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&ub(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function Je(a,b,c,d,e){if(d||(d=c),K(d,c)<0){var f;f=[d,c],c=f[0],d=f[1],f}"string"==typeof b&&(b=a.splitLines(b)),De(a,{from:c,to:d,text:b,origin:e})}function Ke(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Le(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Ke(f.ranges[h].anchor,b,c,d),Ke(f.ranges[h].head,b,c,d)}else{for(var i=0;i<f.changes.length;++i){var j=f.changes[i];if(c<j.from.line)j.from=J(j.from.line+d,j.from.ch),j.to=J(j.to.line+d,j.to.ch);else if(b<=j.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Me(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Le(a.done,c,d,e),Le(a.undone,c,d,e)}function Ne(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=B(a,P(a,b)):e=F(b),null==e?null:(d(f,e)&&a.cm&&rd(a.cm,e,c),f)}function Oe(a){var b=this;this.lines=a,this.parent=null;for(var c=0,d=0;d<a.length;++d)a[d].parent=b,c+=a[d].height;this.height=c}function Pe(a){var b=this;this.children=a;for(var c=0,d=0,e=0;e<a.length;++e){var f=a[e];c+=f.chunkSize(),d+=f.height,f.parent=b}this.size=c,this.height=d,this.parent=null}function Qe(a,b,c){sa(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Tc(a,c)}function Re(a,b,c,d){var e=new Gh(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Ne(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!qa(a,b)){var d=sa(b)<a.scrollTop;E(b,b.height+Ib(e)),d&&Tc(f,e.height),f.curOp.forceUpdate=!0}return!0}),f&&ub(f,"lineWidgetAdded",f,e,"number"==typeof b?b:F(b)),e}function Se(a,b,c,d,f){if(d&&d.shared)return Te(a,b,c,d,f);if(a.cm&&!a.cm.curOp)return nd(a.cm,Se)(a,b,c,d,f);var g=new Ih(a,f),h=K(b,c);if(d&&k(d,g,!1),h>0||0==h&&g.clearWhenEmpty!==!1)return g;if(g.replacedWith&&(g.collapsed=!0,g.widgetNode=e("span",[g.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(g.widgetNode.insertLeft=!0)),g.collapsed){if(ka(a,b.line,b,c,g)||b.line!=c.line&&ka(a,c.line,b,c,g))throw new Error("Inserting collapsed marker partially overlapping an existing one");U()}g.addToHistory&&de(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var i,j=b.line,l=a.cm;if(a.iter(j,c.line+1,function(a){l&&g.collapsed&&!l.options.lineWrapping&&la(a)==l.display.maxLine&&(i=!0),g.collapsed&&j!=b.line&&E(a,0),Y(a,new V(g,j==b.line?b.ch:null,j==c.line?c.ch:null)),++j}),g.collapsed&&a.iter(b.line,c.line+1,function(b){qa(a,b)&&E(b,0)}),g.clearOnEnter&&dh(g,"beforeCursorEnter",function(){return g.clear()}),g.readOnly&&(T(),(a.history.done.length||a.history.undone.length)&&a.clearHistory()),g.collapsed&&(g.id=++Hh,g.atomic=!0),l){if(i&&(l.curOp.updateMaxLine=!0),g.collapsed)qd(l,b.line,c.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(var m=b.line;m<=c.line;m++)rd(l,m,"text");g.atomic&&we(l.doc),ub(l,"markerAdded",l,g)}return g}function Te(a,b,c,d,e){d=k(d),d.shared=!1;var f=[Se(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Xd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Se(a,Q(a,b),Q(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=p(f)}),new Jh(f,g)}function Ue(a){return a.findMarks(J(a.first,0),a.clipPos(J(a.lastLine())),function(a){return a.parent})}function Ve(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(K(f,g)){var h=Se(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function We(a){for(var b=function(b){var c=a[b],d=[c.primary.doc];Xd(c.primary.doc,function(a){return d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==m(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}},c=0;c<a.length;c++)b(c)}function Xe(a){var b=this;if($e(b),!Ba(b,a)&&!Jb(b.display,a)){Fa(a),ug&&(Mh=+new Date);var c=yc(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=m(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=nd(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=Q(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};De(b.doc,i),se(b.doc,Nd(c,Od(i)))}}),h.readAsText(a)}},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){return b.display.input.focus()},20);try{var j=a.dataTransfer.getData("Text");if(j){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),ue(b.doc,Nd(c,c)),k)for(var l=0;l<k.length;++l)Je(b.doc,"",k[l].anchor,k[l].head,"drag");b.replaceSelection(j,"around","paste"),b.display.input.focus()}}catch(a){}}}}function Ye(a,b){if(ug&&(!a.state.draggingText||+new Date-Mh<100))return void Ia(b);if(!Ba(a,b)&&!Jb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Ag)){var c=d("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zg&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),zg&&c.parentNode.removeChild(c)}}function Ze(a,b){var e=yc(a,b);if(e){var f=document.createDocumentFragment();Cc(a,e,f),a.display.dragCursor||(a.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv)),c(a.display.dragCursor,f)}}function $e(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function _e(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function af(){Nh||(bf(),Nh=!0)}function bf(){var a;dh(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,_e(cf)},100))}),dh(window,"blur",function(){return _e(Jc)})}function cf(a){var b=a.display;(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)&&(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function df(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else{if(!/^s(hift)?$/i.test(h))throw new Error("Unrecognized modifier name: "+h);e=!0}}return c&&(a="Alt-"+a),d&&(a="Ctrl-"+a),f&&(a="Cmd-"+a),e&&(a="Shift-"+a),a}function ef(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=q(c.split(" "),df),f=0;f<e.length;f++){var g=void 0,h=void 0;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a}function ff(a,b,c,d){b=kf(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return ff(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=ff(a,b.fallthrough[f],c,d);if(g)return g}}}function gf(a){var b="string"==typeof a?a:Oh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function hf(a,b,c){var d=a;return b.altKey&&"Alt"!=d&&(a="Alt-"+a),(Lg?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a),(Lg?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a),!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a),a}function jf(a,b){if(zg&&34==a.keyCode&&a["char"])return!1;var c=Oh[a.keyCode];return null==c||a.altGraphKey?!1:(3==a.keyCode&&a.code&&(c=a.code),hf(c,a,b))}function kf(a){return"string"==typeof a?Sh[a]:a}function lf(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&K(f.from,p(d).to)<=0;){var g=d.pop();if(K(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}md(a,function(){for(var b=d.length-1;b>=0;b--)Je(a.doc,"",d[b].from,d[b].to,"+delete");Uc(a)})}function mf(a,b,c){var d=y(a.text,b+c,c);return 0>d||d>a.text.length?null:d}function nf(a,b,c){var d=mf(a,b.ch,c);return null==d?null:new J(b.line,d,0>c?"after":"before")}function of(a,b,c,d,e){if(a){var f=xa(c,b.doc.direction);if(f){var g,h=0>e?p(f):f[0],i=0>e==(1==h.level),j=i?"after":"before";if(h.level>0||"rtl"==b.doc.direction){var k=Vb(b,c);g=0>e?c.text.length-1:0;var l=Wb(b,k,g).top;g=z(function(a){return Wb(b,k,a).top==l},0>e==(1==h.level)?h.from:h.to-1,g),"before"==j&&(g=mf(c,g,1))}else g=0>e?h.to:h.from;return new J(d,g,j)}}return new J(d,0>e?c.text.length:0,0>e?"before":"after")}function pf(a,b,c,d){var e=xa(b,a.doc.direction);if(!e)return nf(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):c.ch<=0&&(c.ch=0,c.sticky="after");var f=wa(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&g.level%2==0&&(d>0?g.to>c.ch:g.from<c.ch))return nf(b,c,d);var h,i=function(a,c){return mf(b,a instanceof J?a.ch:a,c)},j=function(c){return a.options.lineWrapping?(h=h||Vb(a,b),nc(a,b,h,c)):{begin:0,end:b.text.length}},k=j("before"==c.sticky?i(c,-1):c.ch);if("rtl"==a.doc.direction||1==g.level){var l=1==g.level==0>d,m=i(c,l?1:-1);if(null!=m&&(l?m<=g.to&&m<=k.end:m>=g.from&&m>=k.begin)){var n=l?"before":"after";return new J(c.line,m,n)}}var o=function(a,b,d){for(var f=function(a,b){return b?new J(c.line,i(a,1),"before"):new J(c.line,a,"after")};a>=0&&a<e.length;a+=b){var g=e[a],h=b>0==(1!=g.level),j=h?d.begin:i(d.end,-1);if(g.from<=j&&j<g.to)return f(j,h);if(j=h?g.from:i(g.to,-1),d.begin<=j&&j<d.end)return f(j,h)}},p=o(f+d,d,k);if(p)return p;var q=d>0?k.end:i(k.begin,-1);return null==q||d>0&&q==b.text.length||!(p=o(d>0?0:e.length-1,d,j(q)))?null:p}function qf(a,b){var c=B(a.doc,b),d=la(c);return d!=c&&(b=F(d)),of(!0,a,d,b,1)}function rf(a,b){var c=B(a.doc,b),d=ma(c);return d!=c&&(b=F(d)),of(!0,a,c,b,-1)}function sf(a,b){var c=qf(a,b.line),d=B(a.doc,c.line),e=xa(d,a.doc.direction);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return J(c.line,g?0:f,c.sticky)}return c}function tf(a,b,c){if("string"==typeof b&&(b=Th[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Tg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function uf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=ff(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&ff(b,a.options.extraKeys,c,a)||ff(b,a.options.keyMap,c,a)}function vf(a,b,c,d){var e=a.state.keySeq;if(e){if(gf(b))return"handled";if(/\'$/.test(b)?a.state.keySeq=null:Uh.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}),wf(a,e+" "+b,c,d))return!0}return wf(a,b,c,d)}function wf(a,b,c,d){var e=uf(a,b,d);return"multi"==e&&(a.state.keySeq=b),"handled"==e&&ub(a,"keyHandled",a,b,c),("handled"==e||"multi"==e)&&(Fa(c),Fc(a)),!!e}function xf(a,b){var c=jf(b,!0);return c?b.shiftKey&&!a.state.keySeq?vf(a,"Shift-"+c,b,function(b){return tf(a,b,!0)})||vf(a,c,b,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?tf(a,b):void 0}):vf(a,c,b,function(b){return tf(a,b)}):!1}function yf(a,b,c){return vf(a,"'"+c+"'",b,function(b){return tf(a,b,!0)})}function zf(a){var b=this;if(b.curOp.focus=g(),!Ba(b,a)){ug&&11>vg&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=xf(b,a);zg&&(Vh=d?c:null,!d&&88==c&&!hh&&(Gg?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||Af(b)}}function Af(a){function b(a){18!=a.keyCode&&a.altKey||(Ng(c,"CodeMirror-crosshair"),za(document,"keyup",b),za(document,"mouseover",b))}var c=a.display.lineDiv;h(c,"CodeMirror-crosshair"),dh(document,"keyup",b),dh(document,"mouseover",b)}function Bf(a){16==a.keyCode&&(this.doc.sel.shift=!1),Ba(this,a)}function Cf(a){var b=this;if(!(Jb(b.display,a)||Ba(b,a)||a.ctrlKey&&!a.altKey||Gg&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(zg&&c==Vh)return Vh=null,void Fa(a);if(!zg||a.which&&!(a.which<10)||!xf(b,a)){var e=String.fromCharCode(null==d?c:d);"\b"!=e&&(yf(b,a,e)||b.display.input.onKeyPress(a))}}}function Df(a,b){var c=+new Date;return Zh&&Zh.compare(c,a,b)?(Yh=Zh=null,"triple"):Yh&&Yh.compare(c,a,b)?(Zh=new Xh(c,a,b),Yh=null,"double"):(Yh=new Xh(c,a,b),Zh=null,"single")}function Ef(a){var b=this,c=b.display;if(!(Ba(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.input.ensurePolled(),c.shift=a.shiftKey,Jb(c,a))return void(wg||(c.scroller.draggable=!1,setTimeout(function(){return c.scroller.draggable=!0},100)));if(!Nf(b,a)){var d=yc(b,a),e=Ka(a),f=d?Df(d,e):"single";window.focus(),1==e&&b.state.selectingText&&b.state.selectingText(a),d&&Ff(b,e,d,f,a)||(1==e?d?Hf(b,d,f,a):Ja(a)==c.scroller&&Fa(a):2==e?(d&&ne(b.doc,d),setTimeout(function(){return c.input.focus()},20)):3==e&&(Mg?Of(b,a):Hc(b)))}}}function Ff(a,b,c,d,e){var f="Click";return"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f),f=(1==b?"Left":2==b?"Middle":"Right")+f,vf(a,hf(f,e),e,function(b){if("string"==typeof b&&(b=Th[b]),!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Tg}finally{a.state.suppressEdits=!1}return d})}function Gf(a,b,c){var d=a.getOption("configureMouse"),e=d?d(a,b,c):{};if(null==e.unit){var f=Hg?c.shiftKey&&c.metaKey:c.altKey;e.unit=f?"rectangle":"single"==b?"char":"double"==b?"word":"line"}return(null==e.extend||a.doc.extend)&&(e.extend=a.doc.extend||c.shiftKey),null==e.addNew&&(e.addNew=Gg?c.metaKey:c.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(Gg?c.altKey:c.ctrlKey)),e}function Hf(a,b,c,d){ug?setTimeout(j(Gc,a),0):a.curOp.focus=g();var e,f=Gf(a,c,d),h=a.doc.sel;a.options.dragDrop&&eh&&!a.isReadOnly()&&"single"==c&&(e=h.contains(b))>-1&&(K((e=h.ranges[e]).from(),b)<0||b.xRel>0)&&(K(e.to(),b)>0||b.xRel<0)?If(a,d,b,f):Kf(a,d,b,f)}function If(a,b,c,d){var e=a.display,f=!1,g=nd(a,function(b){wg&&(e.scroller.draggable=!1),a.state.draggingText=!1,za(e.wrapper.ownerDocument,"mouseup",g),za(e.wrapper.ownerDocument,"mousemove",h),za(e.scroller,"dragstart",i),za(e.scroller,"drop",g),f||(Fa(b),d.addNew||ne(a.doc,c,null,null,d.extend),wg||ug&&9==vg?setTimeout(function(){e.wrapper.ownerDocument.body.focus(),e.input.focus()},20):e.input.focus())}),h=function(a){f=f||Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)>=10},i=function(){return f=!0};wg&&(e.scroller.draggable=!0),a.state.draggingText=g,g.copy=!d.moveOnDrag,e.scroller.dragDrop&&e.scroller.dragDrop(),dh(e.wrapper.ownerDocument,"mouseup",g),dh(e.wrapper.ownerDocument,"mousemove",h),dh(e.scroller,"dragstart",i),dh(e.scroller,"drop",g),Hc(a),setTimeout(function(){return e.input.focus()},20)}function Jf(a,b,c){if("char"==c)return new Fh(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new Fh(J(b.line,0),Q(a.doc,J(b.line+1,0)));var d=c(a,b);return new Fh(d.from,d.to)}function Kf(a,b,c,d){function e(b){if(0!=K(r,b))if(r=b,"rectangle"==d.unit){for(var e=[],f=a.options.tabSize,g=l(B(j,c.line).text,c.ch,f),h=l(B(j,b.line).text,b.ch,f),i=Math.min(g,h),p=Math.max(g,h),q=Math.min(c.line,b.line),s=Math.min(a.lastLine(),Math.max(c.line,b.line));s>=q;q++){var t=B(j,q).text,u=n(t,i,f);i==p?e.push(new Fh(J(q,u),J(q,u))):t.length>u&&e.push(new Fh(J(q,u),J(q,n(t,p,f))))}e.length||e.push(new Fh(c,c)),te(j,Md(o.ranges.slice(0,m).concat(e),m),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var v,w=k,x=Jf(a,b,d.unit),y=w.anchor;K(x.anchor,y)>0?(v=x.head,y=O(w.from(),x.anchor)):(v=x.anchor,y=N(w.to(),x.head));var z=o.ranges.slice(0);z[m]=Lf(a,new Fh(Q(j,y),v)),te(j,Md(z,m),Vg)}}function f(b){var c=++t,h=yc(a,b,!0,"rectangle"==d.unit);if(h)if(0!=K(h,r)){a.curOp.focus=g(),e(h);var k=Mc(i,j);(h.line>=k.to||h.line<k.from)&&setTimeout(nd(a,function(){t==c&&f(b)}),150)}else{var l=b.clientY<s.top?-20:b.clientY>s.bottom?20:0;l&&setTimeout(nd(a,function(){t==c&&(i.scroller.scrollTop+=l,f(b))}),50)}}function h(b){a.state.selectingText=!1,t=1/0,Fa(b),i.input.focus(),za(i.wrapper.ownerDocument,"mousemove",u),za(i.wrapper.ownerDocument,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Fa(b);var k,m,o=j.sel,p=o.ranges;if(d.addNew&&!d.extend?(m=j.sel.contains(c),k=m>-1?p[m]:new Fh(c,c)):(k=j.sel.primary(),m=j.sel.primIndex),"rectangle"==d.unit)d.addNew||(k=new Fh(c,c)),c=yc(a,b,!0,!0),m=-1;else{var q=Jf(a,c,d.unit);k=d.extend?me(k,q.anchor,q.head,d.extend):q}d.addNew?-1==m?(m=p.length,te(j,Md(p.concat([k]),m),{scroll:!1,origin:"*mouse"})):p.length>1&&p[m].empty()&&"char"==d.unit&&!d.extend?(te(j,Md(p.slice(0,m).concat(p.slice(m+1)),0),{scroll:!1,origin:"*mouse"}),o=j.sel):pe(j,m,k,Vg):(m=0,te(j,new Eh([k],0),Vg),o=j.sel);var r=c,s=i.wrapper.getBoundingClientRect(),t=0,u=nd(a,function(a){Ka(a)?f(a):h(a)}),v=nd(a,h);a.state.selectingText=v,dh(i.wrapper.ownerDocument,"mousemove",u),dh(i.wrapper.ownerDocument,"mouseup",v)}function Lf(a,b){var c=b.anchor,d=b.head,e=B(a.doc,c.line);if(0==K(c,d)&&c.sticky==d.sticky)return b;var f=xa(e);if(!f)return b;var g=wa(f,c.ch,c.sticky),h=f[g];if(h.from!=c.ch&&h.to!=c.ch)return b;var i=g+(h.from==c.ch==(1!=h.level)?0:1);if(0==i||i==f.length)return b;var j;if(d.line!=c.line)j=(d.line-c.line)*("ltr"==a.doc.direction?1:-1)>0;else{var k=wa(f,d.ch,d.sticky),l=k-g||(d.ch-c.ch)*(1==h.level?-1:1);j=k==i-1||k==i?0>l:l>0}var m=f[i+(j?-1:0)],n=j==(1==m.level),o=n?m.from:m.to,p=n?"after":"before";return c.ch==o&&c.sticky==p?b:new Fh(new J(c.line,o,p),d)}function Mf(a,b,c,d){var e,f;if(b.touches)e=b.touches[0].clientX,f=b.touches[0].clientY;else try{e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Fa(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Da(a,c))return Ha(b);f-=h.top-g.viewOffset;for(var i=0;i<a.options.gutters.length;++i){var j=g.gutters.childNodes[i];if(j&&j.getBoundingClientRect().right>=e){var k=G(a.doc,f),l=a.options.gutters[i];return Aa(a,c,a,k,l,b),Ha(b)}}}function Nf(a,b){return Mf(a,b,"gutterClick",!0)}function Of(a,b){Jb(a.display,b)||Pf(a,b)||Ba(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Pf(a,b){return Da(a,"gutterContextMenu")?Mf(a,b,"gutterContextMenu",!1):!1}function Qf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),bc(a)}function Rf(a){function b(b,d,e,f){a.defaults[b]=d,e&&(c[b]=f?function(a,b,c){c!=$h&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b,a.Init=$h,b("value","",function(a,b){return a.setValue(b)},!0),b("mode",null,function(a,b){a.doc.modeOption=b,Td(a)},!0),b("indentUnit",2,Td,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,function(a){Ud(a),bc(a),qd(a)},!0),b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length,c.push(J(d,f))}d++});for(var e=c.length-1;e>=0;e--)Je(a.doc,b,c[e],J(c[e].line,c[e].ch+b.length))}}),b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test(" ")?"":"| "),"g"),c!=$h&&a.refresh()}),b("specialCharPlaceholder",jb,function(a){return a.refresh()},!0),b("electricChars",!0),b("inputStyle",Fg?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0),b("rtlMoveVisually",!Ig),b("wholeLineUpdateBefore",!0),b("theme","default",function(a){Qf(a),Sf(a)},!0),b("keyMap","default",function(a,b,c){var d=kf(b),e=c!=$h&&kf(c);e&&e.detach&&e.detach(a,d),d.attach&&d.attach(a,e||null)}),b("extraKeys",null),b("configureMouse",null),b("lineWrapping",!1,Uf,!0),b("gutters",[],function(a){Id(a.options),Sf(a)},!0),b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?vc(a.display)+"px":"0",a.refresh()},!0),b("coverGutterNextToScrollbar",!1,function(a){return bd(a)},!0),b("scrollbarStyle","native",function(a){dd(a),bd(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),b("lineNumbers",!1,function(a){Id(a.options),Sf(a)},!0),b("firstLineNumber",1,Sf,!0),b("lineNumberFormatter",function(a){return a},Sf,!0),b("showCursorWhenSelecting",!1,Ac,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("pasteLinesPerSelection",!0),b("readOnly",!1,function(a,b){"nocursor"==b&&(Jc(a),a.display.input.blur()),a.display.input.readOnlyChanged(b)}),b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),b("dragDrop",!0,Tf),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,Ac,!0),b("singleCursorHeightPerLine",!0,Ac,!0),b("workTime",100),b("workDelay",100),
b("flattenSpans",!0,Ud,!0),b("addModeClass",!1,Ud,!0),b("pollInterval",100),b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b}),b("historyEventDelay",1250),b("viewportMargin",10,function(a){return a.refresh()},!0),b("maxHighlightLength",1e4,Ud,!0),b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""}),b("autofocus",null),b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)}function Sf(a){Hd(a),qd(a),Nc(a)}function Tf(a,b,c){var d=c&&c!=$h;if(!b!=!d){var e=a.display.dragFunctions,f=b?dh:za;f(a.display.scroller,"dragstart",e.start),f(a.display.scroller,"dragenter",e.enter),f(a.display.scroller,"dragover",e.over),f(a.display.scroller,"dragleave",e.leave),f(a.display.scroller,"drop",e.drop)}}function Uf(a){a.options.lineWrapping?(h(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Ng(a.display.wrapper,"CodeMirror-wrap"),ua(a)),xc(a),qd(a),bc(a),setTimeout(function(){return bd(a)},100)}function Vf(a,b){var c=this;if(!(this instanceof Vf))return new Vf(a,b);this.options=b=b?k(b):{},k(_h,b,!1),Id(b);var d=b.value;"string"==typeof d&&(d=new Lh(d,b.mode,null,b.lineSeparator,b.direction)),this.doc=d;var e=new Vf.inputStyles[b.inputStyle](this),f=this.display=new A(a,d,e);f.wrapper.CodeMirror=this,Hd(this),Qf(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),dd(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 Pg,keySeq:null,specialChars:null},b.autofocus&&!Fg&&f.input.focus(),ug&&11>vg&&setTimeout(function(){return c.display.input.reset(!0)},20),Wf(this),af(),ed(this),this.curOp.forceUpdate=!0,Yd(this,d),b.autofocus&&!Fg||this.hasFocus()?setTimeout(j(Ic,this),20):Jc(this);for(var g in ai)ai.hasOwnProperty(g)&&ai[g](c,b[g],$h);Oc(this),b.finishInit&&b.finishInit(this);for(var h=0;h<bi.length;++h)bi[h](c);fd(this),wg&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(f.lineDiv).textRendering&&(f.lineDiv.style.textRendering="auto")}function Wf(a){function b(){e.activeTouch&&(f=setTimeout(function(){return e.activeTouch=null},1e3),g=e.activeTouch,g.end=+new Date)}function c(a){if(1!=a.touches.length)return!1;var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>400}var e=a.display;dh(e.scroller,"mousedown",nd(a,Ef)),ug&&11>vg?dh(e.scroller,"dblclick",nd(a,function(b){if(!Ba(a,b)){var c=yc(a,b);if(c&&!Nf(a,b)&&!Jb(a.display,b)){Fa(b);var d=a.findWordAt(c);ne(a.doc,d.anchor,d.head)}}})):dh(e.scroller,"dblclick",function(b){return Ba(a,b)||Fa(b)}),Mg||dh(e.scroller,"contextmenu",function(b){return Of(a,b)});var f,g={end:0};dh(e.scroller,"touchstart",function(b){if(!Ba(a,b)&&!c(b)&&!Nf(a,b)){e.input.ensurePolled(),clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),dh(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),dh(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Jb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new Fh(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new Fh(J(h.line,0),Q(a.doc,J(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Fa(c)}b()}),dh(e.scroller,"touchcancel",b),dh(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Zc(a,e.scroller.scrollTop),_c(a,e.scroller.scrollLeft,!0),Aa(a,"scroll",a))}),dh(e.scroller,"mousewheel",function(b){return Ld(a,b)}),dh(e.scroller,"DOMMouseScroll",function(b){return Ld(a,b)}),dh(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){Ba(a,b)||Ia(b)},over:function(b){Ba(a,b)||(Ze(a,b),Ia(b))},start:function(b){return Ye(a,b)},drop:nd(a,Xe),leave:function(b){Ba(a,b)||$e(a)}};var h=e.input.getField();dh(h,"keyup",function(b){return Bf.call(a,b)}),dh(h,"keydown",nd(a,zf)),dh(h,"keypress",nd(a,Cf)),dh(h,"focus",function(b){return Ic(a,b)}),dh(h,"blur",function(b){return Jc(a,b)})}function Xf(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Ya(a,b).state:c="prev");var g=a.options.tabSize,h=B(f,b),i=l(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Tg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?l(B(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var m="",n=0;if(a.options.indentWithTabs)for(var p=Math.floor(j/g);p;--p)n+=g,m+=" ";if(j>n&&(m+=o(j-n)),m!=k)return Je(f,m,J(b,0),J(b,k.length),"+input"),h.stateAfter=null,!0;for(var q=0;q<f.sel.ranges.length;q++){var r=f.sel.ranges[q];if(r.head.line==b&&r.head.ch<k.length){var s=J(b,k.length);pe(f,q,new Fh(s,s));break}}}function Yf(a){ci=a}function Zf(a,b,c,d,e){var f=a.doc;a.display.shift=!1,d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=fh(b),i=null;if(g&&d.ranges.length>1)if(ci&&ci.text.join("\n")==b){if(d.ranges.length%ci.text.length==0){i=[];for(var j=0;j<ci.text.length;j++)i.push(f.splitLines(ci.text[j]))}}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(i=q(h,function(a){return[a]}));for(var k,l=d.ranges.length-1;l>=0;l--){var m=d.ranges[l],n=m.from(),o=m.to();m.empty()&&(c&&c>0?n=J(n.line,n.ch-c):a.state.overwrite&&!g?o=J(o.line,Math.min(B(f,o.line).text.length,o.ch+p(h).length)):ci&&ci.lineWise&&ci.text.join("\n")==b&&(n=o=J(n.line,0))),k=a.curOp.updateInput;var r={from:n,to:o,text:i?i[l%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};De(a.doc,r),ub(a,"inputRead",a,r)}b&&!g&&_f(a,b),Uc(a),a.curOp.updateInput=k,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function $f(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");return c?(a.preventDefault(),b.isReadOnly()||b.options.disableInput||md(b,function(){return Zf(b,c,0,null,"paste")}),!0):void 0}function _f(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++)if(b.indexOf(f.electricChars.charAt(h))>-1){g=Xf(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(B(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Xf(a,e.head.line,"smart"));g&&ub(a,"electricInput",a,e.head.line)}}}function ag(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,f={anchor:J(e,0),head:J(e+1,0)};c.push(f),b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function bg(a,b){a.setAttribute("autocorrect","off"),a.setAttribute("autocapitalize","off"),a.setAttribute("spellcheck",!!b)}function cg(){var a=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=d("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return wg?a.style.width="1000px":a.setAttribute("wrap","off"),Dg&&(a.style.border="1px solid black"),bg(a),b}function dg(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];(d[a]!=c||"mode"==a)&&(d[a]=c,b.hasOwnProperty(a)&&nd(this,b[a])(this,c,e),Aa(this,"optionChange",this,a))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](kf(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:od(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");r(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority}),this.state.modeGen++,qd(this)}),removeOverlay:od(function(a){for(var b=this,c=this.state.overlays,d=0;d<c.length;++d){var e=c[d].modeSpec;if(e==a||"string"==typeof a&&e.name==a)return c.splice(d,1),b.state.modeGen++,void qd(b)}}),indentLine:od(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),H(this.doc,a)&&Xf(this,a,b,c)}),indentSelection:od(function(a){for(var b=this,c=this.doc.sel.ranges,d=-1,e=0;e<c.length;e++){var f=c[e];if(f.empty())f.head.line>d&&(Xf(b,f.head.line,a,!0),d=f.head.line,e==b.doc.sel.primIndex&&Uc(b));else{var g=f.from(),h=f.to(),i=Math.max(d,g.line);d=Math.min(b.lastLine(),h.line-(h.ch?0:1))+1;for(var j=i;d>j;++j)Xf(b,j,a);var k=b.doc.sel.ranges;0==g.ch&&c.length==k.length&&k[e].from().ch>0&&pe(b.doc,e,new Fh(g,k[e].to()),Ug)}}}),getTokenAt:function(a,b){return ab(this,a,b)},getLineTokens:function(a,b){return ab(this,J(a),b,!0)},getTokenTypeAt:function(a){a=Q(this.doc,a);var b,c=Xa(this,B(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]<f)){b=c[2*g+2];break}d=g+1}}var h=b?b.indexOf("overlay "):-1;return 0>h?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=this,e=[];if(!c.hasOwnProperty(b))return e;var f=c[b],g=this.getModeAt(a);if("string"==typeof g[b])f[g[b]]&&e.push(f[g[b]]);else if(g[b])for(var h=0;h<g[b].length;h++){var i=f[g[b][h]];i&&e.push(i)}else g.helperType&&f[g.helperType]?e.push(f[g.helperType]):f[g.name]&&e.push(f[g.name]);for(var j=0;j<f._global.length;j++){var k=f._global[j];k.pred(g,d)&&-1==m(e,k.val)&&e.push(k.val)}return e},getStateAfter:function(a,b){var c=this.doc;return a=P(c,null==a?c.first+c.size-1:a),Ya(this,a+1,b).state},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?Q(this.doc,a):a?d.from():d.to(),ic(this,c,b||"page")},charCoords:function(a,b){return hc(this,Q(this.doc,a),b||"page")},coordsChar:function(a,b){return a=gc(this,a,b||"page"),lc(this,a.left,a.top)},lineAtHeight:function(a,b){return a=gc(this,{top:a,left:0},b||"page").top,G(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d,e=!1;if("number"==typeof a){var f=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>f&&(a=f,e=!0),d=B(this.doc,a)}else d=a;return fc(this,d,{top:0,left:0},b||"page",c||e).top+(e?this.doc.height-sa(d):0)},defaultTextHeight:function(){return sc(this.display)},defaultCharWidth:function(){return tc(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=ic(this,Q(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Rc(this,{left:h,top:g,right:h+b.offsetWidth,bottom:g+b.offsetHeight})},triggerOnKeyDown:od(zf),triggerOnKeyPress:od(Cf),triggerOnKeyUp:Bf,triggerOnMouseDown:od(Ef),execCommand:function(a){return Th.hasOwnProperty(a)?Th[a].call(null,this):void 0},triggerElectric:od(function(a){_f(this,a)}),findPosH:function(a,b,c,d){var e=this,f=1;0>b&&(f=-1,b=-b);for(var g=Q(this.doc,a),h=0;b>h&&(g=eg(e.doc,g,f,c,d),!g.hitSide);++h);return g},moveH:od(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?eg(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Wg)}),deleteH:od(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):lf(this,function(c){var e=eg(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=this,f=1,g=d;0>b&&(f=-1,b=-b);for(var h=Q(this.doc,a),i=0;b>i;++i){var j=ic(e,h,"div");if(null==g?g=j.left:j.left=g,h=fg(e,j,f,c),h.hitSide)break}return h},moveV:od(function(a,b){var c=this,d=this.doc,e=[],f=!this.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=ic(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=fg(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Tc(c,hc(c,i,"div").top-h.top),i},Wg),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=this.doc,c=B(b,a.line).text,d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");"before"!=a.sticky&&e!=c.length||!d?++e:--d;for(var g=c.charAt(d),h=v(g,f)?function(a){return v(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!v(a)};d>0&&h(c.charAt(d-1));)--d;for(;e<c.length&&h(c.charAt(e));)++e}return new Fh(J(a.line,d),J(a.line,e))},toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?h(this.display.cursorDiv,"CodeMirror-overwrite"):Ng(this.display.cursorDiv,"CodeMirror-overwrite"),Aa(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==g()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:od(function(a,b){Vc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Nb(this)-this.display.barHeight,width:a.scrollWidth-Nb(this)-this.display.barWidth,clientHeight:Pb(this),clientWidth:Ob(this)}},scrollIntoView:od(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:J(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line?Wc(this,a):Yc(this,a.from,a.to,a.margin)}),setSize:od(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a)),null!=b&&(this.display.wrapper.style.height=d(b)),this.options.lineWrapping&&ac(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){rd(c,e,"widget");break}++e}),this.curOp.forceUpdate=!0,Aa(this,"refresh",this)}),operation:function(a){return md(this,a)},startOperation:function(){return ed(this)},endOperation:function(){return fd(this)},refresh:od(function(){var a=this.display.cachedTextHeight;qd(this),this.curOp.forceUpdate=!0,bc(this),Vc(this,this.doc.scrollLeft,this.doc.scrollTop),Fd(this),(null==a||Math.abs(a-sc(this.display))>.5)&&xc(this),Aa(this,"refresh",this)}),swapDoc:od(function(a){var b=this.doc;return b.cm=null,Yd(this,a),bc(this),this.display.input.reset(),Vc(this,a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,ub(this,"swapDoc",this,b),b}),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}},Ea(a),a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]}),c[b][d]=e},a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f),c[b]._global.push({pred:e,val:f})}}function eg(a,b,c,d,e){function f(){var d=b.line+c;return d<a.first||d>=a.first+a.size?!1:(b=new J(d,b.ch,b.sticky),j=B(a,d))}function g(d){var g;if(g=e?pf(a.cm,j,b,c):nf(j,b,c),null==g){if(d||!f())return!1;b=of(e,a.cm,j,b.line,c)}else b=g;return!0}var h=b,i=c,j=B(a,b.line);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var k=null,l="group"==d,m=a.cm&&a.cm.getHelper(b,"wordChars"),n=!0;!(0>c)||g(!n);n=!1){var o=j.text.charAt(b.ch)||"\n",p=v(o,m)?"w":l&&"\n"==o?"n":!l||/\s/.test(o)?null:"p";if(!l||n||p||(p="s"),k&&k!=p){0>c&&(c=1,g(),b.sticky="after");break}if(p&&(k=p),c>0&&!g(!n))break}var q=ze(a,b,h,i,!0);return L(h,q)&&(q.hitSide=!0),q}function fg(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*sc(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(var j;j=lc(a,g,e),j.outside;){if(0>c?0>=e:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function gg(a,b){var c=Ub(a,b.line);if(!c||c.hidden)return null;var d=B(a.doc,b.line),e=Rb(c,d,b.line),f=xa(d,a.doc.direction),g="left";if(f){var h=wa(f,b.ch);g=h%2?"right":"left"}var i=Xb(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function hg(a){for(var b=a;b;b=b.parentNode)if(/CodeMirror-gutter-wrapper/.test(b.className))return!0;return!1}function ig(a,b){return b&&(a.bad=!0),a}function jg(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(){k&&(j+=l,k=!1)}function h(a){a&&(g(),j+=a)}function i(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return void h(c||b.textContent.replace(/\u200b/g,""));var j,m=b.getAttribute("cm-marker");if(m){var n=a.findMarks(J(d,0),J(e+1,0),f(+m));return void(n.length&&(j=n[0].find(0))&&h(C(a.doc,j.from,j.to).join(l)))}if("false"==b.getAttribute("contenteditable"))return;var o=/^(pre|div|p)$/i.test(b.nodeName);o&&g();for(var p=0;p<b.childNodes.length;p++)i(b.childNodes[p]);o&&(k=!0)}else 3==b.nodeType&&h(b.nodeValue)}for(var j="",k=!1,l=a.doc.lineSeparator();i(b),b!=c;)b=b.nextSibling;return j}function kg(a,b,c){var d;if(b==a.display.lineDiv){if(d=a.display.lineDiv.childNodes[c],!d)return ig(a.clipPos(J(a.display.viewTo-1)),!0);b=null,c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return lg(f,b,c)}}function lg(a,b,c){function d(b,c,d){for(var e=-1;e<(l?l.length:0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var i=F(0>e?a.line:a.rest[e]),j=f[g]+d;return(0>d||h!=b)&&(j=f[g+(d?1:0)]),J(i,j)}}}var e=a.text.firstChild,g=!1;if(!b||!f(e,b))return ig(J(F(a.line),0),!0);if(b==e&&(g=!0,b=e.childNodes[c],c=0,!b)){var h=a.rest?p(a.rest):a.line;return ig(J(F(h),h.text.length),g)}var i=3==b.nodeType?b:null,j=b;for(i||1!=b.childNodes.length||3!=b.firstChild.nodeType||(i=b.firstChild,c&&(c=i.nodeValue.length));j.parentNode!=e;)j=j.parentNode;var k=a.measure,l=k.maps,m=d(i,j,c);if(m)return ig(m,g);for(var n=j.nextSibling,o=i?i.nodeValue.length-c:0;n;n=n.nextSibling){if(m=d(n,n.firstChild,0))return ig(J(m.line,m.ch-o),g);o+=n.textContent.length}for(var q=j.previousSibling,r=c;q;q=q.previousSibling){if(m=d(q,q.firstChild,-1))return ig(J(m.line,m.ch+r),g);r+=q.textContent.length}}function mg(a,b){function c(){a.value=j.getValue()}if(b=b?k(b):{},b.value=a.value,!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var d=g();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(dh(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var h=f.submit=function(){c(),f.submit=e,f.submit(),f.submit=h}}catch(i){}}b.finishInit=function(b){b.save=c,b.getTextArea=function(){return a},b.toTextArea=function(){b.toTextArea=isNaN,c(),a.parentNode.removeChild(b.getWrapperElement()),a.style.display="",a.form&&(za(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}},a.style.display="none";var j=Vf(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return j}function ng(a){a.off=za,a.on=dh,a.wheelEventPixels=Kd,a.Doc=Lh,a.splitLines=fh,a.countColumn=l,a.findColumn=n,a.isWordChar=u,a.Pass=Tg,a.signal=Aa,a.Line=qh,a.changeEnd=Od,a.scrollbarModel=zh,a.Pos=J,a.cmpPos=K,a.modes=jh,a.mimeModes=kh,a.resolveMode=Qa,a.getMode=Ra,a.modeExtensions=lh,a.extendMode=Sa,a.copyState=Ta,a.startState=Va,a.innerMode=Ua,a.commands=Th,a.keyMap=Sh,a.keyName=jf,a.isModifierKey=gf,a.lookupKey=ff,a.normalizeKeyMap=ef,a.StringStream=mh,a.SharedTextMarker=Jh,a.TextMarker=Ih,a.LineWidget=Gh,a.e_preventDefault=Fa,a.e_stopPropagation=Ga,a.e_stop=Ia,a.addClass=h,a.contains=f,a.rmClass=Ng,a.keyNames=Oh}var og=navigator.userAgent,pg=navigator.platform,qg=/gecko\/\d/i.test(og),rg=/MSIE \d/.test(og),sg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(og),tg=/Edge\/(\d+)/.exec(og),ug=rg||sg||tg,vg=ug&&(rg?document.documentMode||6:+(tg||sg)[1]),wg=!tg&&/WebKit\//.test(og),xg=wg&&/Qt\/\d+\.\d+/.test(og),yg=!tg&&/Chrome\//.test(og),zg=/Opera\//.test(og),Ag=/Apple Computer/.test(navigator.vendor),Bg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(og),Cg=/PhantomJS/.test(og),Dg=!tg&&/AppleWebKit/.test(og)&&/Mobile\/\w+/.test(og),Eg=/Android/.test(og),Fg=Dg||Eg||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(og),Gg=Dg||/Mac/.test(pg),Hg=/\bCrOS\b/.test(og),Ig=/win/i.test(pg),Jg=zg&&og.match(/Version\/(\d*\.\d*)/);Jg&&(Jg=Number(Jg[1])),Jg&&Jg>=15&&(zg=!1,wg=!0);var Kg,Lg=Gg&&(xg||zg&&(null==Jg||12.11>Jg)),Mg=qg||ug&&vg>=9,Ng=function(b,c){var d=b.className,e=a(c).exec(d);if(e){var f=d.slice(e.index+e[0].length);b.className=d.slice(0,e.index)+(f?e[1]+f:"")}};Kg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Og=function(a){a.select()};Dg?Og=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:ug&&(Og=function(a){try{a.select()}catch(b){}});var Pg=function(){this.id=null};Pg.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Qg,Rg,Sg=30,Tg={toString:function(){return"CodeMirror.Pass"}},Ug={scroll:!1},Vg={origin:"*mouse"},Wg={origin:"+move"},Xg=[""],Yg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Zg=/[\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]/,$g=!1,_g=!1,ah=null,bh=function(){function a(a){return 247>=a?c.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1785>=a?d.charAt(a-1536):a>=1774&&2220>=a?"r":a>=8192&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/;return function(c,d){var j="ltr"==d?"L":"R";if(0==c.length||"ltr"==d&&!e.test(c))return!1;for(var k=c.length,l=[],m=0;k>m;++m)l.push(a(c.charCodeAt(m)));for(var n=0,o=j;k>n;++n){var q=l[n];"m"==q?l[n]=o:o=q}for(var r=0,s=j;k>r;++r){var t=l[r];"1"==t&&"r"==s?l[r]="n":g.test(t)&&(s=t,"r"==t&&(l[r]="R"))}for(var u=1,v=l[0];k-1>u;++u){var w=l[u];"+"==w&&"1"==v&&"1"==l[u+1]?l[u]="1":","!=w||v!=l[u+1]||"1"!=v&&"n"!=v||(l[u]=v),v=w}for(var x=0;k>x;++x){var y=l[x];if(","==y)l[x]="N";else if("%"==y){var z=void 0;for(z=x+1;k>z&&"%"==l[z];++z);for(var A=x&&"!"==l[x-1]||k>z&&"1"==l[z]?"1":"N",B=x;z>B;++B)l[B]=A;x=z-1}}for(var C=0,D=j;k>C;++C){var E=l[C];"L"==D&&"1"==E?l[C]="L":g.test(E)&&(D=E)}for(var F=0;k>F;++F)if(f.test(l[F])){var G=void 0;for(G=F+1;k>G&&f.test(l[G]);++G);for(var H="L"==(F?l[F-1]:j),I="L"==(k>G?l[G]:j),J=H==I?H?"L":"R":j,K=F;G>K;++K)l[K]=J;F=G-1}for(var L,M=[],N=0;k>N;)if(h.test(l[N])){var O=N;for(++N;k>N&&h.test(l[N]);++N);M.push(new b(0,O,N))}else{var P=N,Q=M.length;for(++N;k>N&&"L"!=l[N];++N);for(var R=P;N>R;)if(i.test(l[R])){R>P&&M.splice(Q,0,new b(1,P,R));var S=R;for(++R;N>R&&i.test(l[R]);++R);M.splice(Q,0,new b(2,S,R)),P=R}else++R;N>P&&M.splice(Q,0,new b(1,P,N))}return"ltr"==d&&(1==M[0].level&&(L=c.match(/^\s+/))&&(M[0].from=L[0].length,M.unshift(new b(0,0,L[0].length))),1==p(M).level&&(L=c.match(/\s+$/))&&(p(M).to-=L[0].length,M.push(new b(0,k-L[0].length,k)))),"rtl"==d?M.reverse():M}}(),ch=[],dh=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={});d[b]=(d[b]||ch).concat(c)}},eh=function(){if(ug&&9>vg)return!1;var a=d("div");return"draggable"in a||"dragDrop"in a}(),fh=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},gh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},hh=function(){var a=d("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),ih=null,jh={},kh={},lh={},mh=function(a,b,c){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=c};mh.prototype.eol=function(){return this.pos>=this.string.length},mh.prototype.sol=function(){return this.pos==this.lineStart},mh.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},mh.prototype.next=function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},mh.prototype.eat=function(a){var b,c=this.string.charAt(this.pos);return b="string"==typeof a?c==a:c&&(a.test?a.test(c):a(c)),b?(++this.pos,c):void 0},mh.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b},mh.prototype.eatSpace=function(){for(var a=this,b=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++a.pos;return this.pos>b},mh.prototype.skipToEnd=function(){this.pos=this.string.length},mh.prototype.skipTo=function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},mh.prototype.backUp=function(a){this.pos-=a},mh.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=l(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?l(this.string,this.lineStart,this.tabSize):0)},mh.prototype.indentation=function(){return l(this.string,null,this.tabSize)-(this.lineStart?l(this.string,this.lineStart,this.tabSize):0)},mh.prototype.match=function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},mh.prototype.current=function(){return this.string.slice(this.start,this.pos)},mh.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}},mh.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)},mh.prototype.baseToken=function(){var a=this.lineOracle;return a&&a.baseToken(this.pos)};var nh=function(a,b){this.state=a,this.lookAhead=b},oh=function(a,b,c,d){this.state=b,this.doc=a,this.line=c,this.maxLookAhead=d||0,this.baseTokens=null,this.baseTokenPos=1};oh.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);return null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a),b},oh.prototype.baseToken=function(a){var b=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)b.baseTokenPos+=2;var c=this.baseTokens[this.baseTokenPos+1];return{type:c&&c.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}},oh.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},oh.fromSaved=function(a,b,c){return b instanceof nh?new oh(a,Ta(a.mode,b.state),c,b.lookAhead):new oh(a,Ta(a.mode,b),c)},oh.prototype.save=function(a){var b=a!==!1?Ta(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new nh(b,this.maxLookAhead):b};var ph=function(a,b,c){this.start=a.start,this.end=a.pos,this.string=a.current(),this.type=b||null,this.state=c},qh=function(a,b,c){this.text=a,da(this,b),this.height=c?c(this):1};qh.prototype.lineNo=function(){return F(this)},Ea(qh);var rh,sh={},th={},uh=null,vh=null,wh={left:0,right:0,top:0,bottom:0},xh=function(a,b,c){this.cm=c;var e=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(e),a(f),dh(e,"scroll",function(){e.clientHeight&&b(e.scrollTop,"vertical")}),dh(f,"scroll",function(){f.clientWidth&&b(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ug&&8>vg&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xh.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",
this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+f)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},xh.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xh.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xh.prototype.zeroWidthHack=function(){var a=Gg&&!Bg?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Pg,this.disableVert=new Pg},xh.prototype.enableZeroWidthBar=function(a,b,c){function d(){var e=a.getBoundingClientRect(),f="vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1);f!=a?a.style.pointerEvents="none":b.set(1e3,d)}a.style.pointerEvents="auto",b.set(1e3,d)},xh.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)};var yh=function(){};yh.prototype.update=function(){return{bottom:0,right:0}},yh.prototype.setScrollLeft=function(){},yh.prototype.setScrollTop=function(){},yh.prototype.clear=function(){};var zh={"native":xh,"null":yh},Ah=0,Bh=function(a,b,c){var d=a.display;this.viewport=b,this.visible=Mc(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.wrapperWidth=d.wrapper.clientWidth,this.oldDisplayWidth=Ob(a),this.force=c,this.dims=uc(a),this.events=[]};Bh.prototype.signal=function(a,b){Da(a,b)&&this.events.push(arguments)},Bh.prototype.finish=function(){for(var a=this,b=0;b<this.events.length;b++)Aa.apply(null,a.events[b])};var Ch=0,Dh=null;ug?Dh=-.53:qg?Dh=15:yg?Dh=-.7:Ag&&(Dh=-1/3);var Eh=function(a,b){this.ranges=a,this.primIndex=b};Eh.prototype.primary=function(){return this.ranges[this.primIndex]},Eh.prototype.equals=function(a){var b=this;if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var c=0;c<this.ranges.length;c++){var d=b.ranges[c],e=a.ranges[c];if(!L(d.anchor,e.anchor)||!L(d.head,e.head))return!1}return!0},Eh.prototype.deepCopy=function(){for(var a=this,b=[],c=0;c<this.ranges.length;c++)b[c]=new Fh(M(a.ranges[c].anchor),M(a.ranges[c].head));return new Eh(b,this.primIndex)},Eh.prototype.somethingSelected=function(){for(var a=this,b=0;b<this.ranges.length;b++)if(!a.ranges[b].empty())return!0;return!1},Eh.prototype.contains=function(a,b){var c=this;b||(b=a);for(var d=0;d<this.ranges.length;d++){var e=c.ranges[d];if(K(b,e.from())>=0&&K(a,e.to())<=0)return d}return-1};var Fh=function(a,b){this.anchor=a,this.head=b};Fh.prototype.from=function(){return O(this.anchor,this.head)},Fh.prototype.to=function(){return N(this.anchor,this.head)},Fh.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Oe.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=this,d=a,e=a+b;e>d;++d){var f=c.lines[d];c.height-=f.height,gb(f),ub(f,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){var d=this;this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var e=0;e<b.length;++e)b[e].parent=d},iterN:function(a,b,c){for(var d=this,e=a+b;e>a;++a)if(c(d.lines[a]))return!0}},Pe.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){var c=this;this.size-=b;for(var d=0;d<this.children.length;++d){var e=c.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a),h=e.height;if(e.removeInner(a,g),c.height-=h-e.height,f==g&&(c.children.splice(d--,1),e.parent=null),0==(b-=g))break;a=0}else a-=f}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Oe))){var i=[];this.collapse(i),this.children=[new Oe(i)],this.children[0].parent=this}},collapse:function(a){for(var b=this,c=0;c<this.children.length;++c)b.children[c].collapse(a)},insertInner:function(a,b,c){var d=this;this.size+=b.length,this.height+=c;for(var e=0;e<this.children.length;++e){var f=d.children[e],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(var h=f.lines.length%25+25,i=h;i<f.lines.length;){var j=new Oe(f.lines.slice(i,i+=25));f.height-=j.height,d.children.splice(++e,0,j),j.parent=d}f.lines=f.lines.slice(0,h),d.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Pe(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=m(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Pe(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=this,e=0;e<this.children.length;++e){var f=d.children[e],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var Gh=function(a,b,c){var d=this;if(c)for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);this.doc=a,this.node=b};Gh.prototype.clear=function(){var a=this,b=this.doc.cm,c=this.line.widgets,d=this.line,e=F(d);if(null!=e&&c){for(var f=0;f<c.length;++f)c[f]==a&&c.splice(f--,1);c.length||(d.widgets=null);var g=Ib(this);E(d,Math.max(0,d.height-g)),b&&(md(b,function(){Qe(b,d,-g),rd(b,e,"widget")}),ub(b,"lineWidgetCleared",b,this,e))}},Gh.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=Ib(this)-b;e&&(E(d,d.height+e),c&&md(c,function(){c.curOp.forceUpdate=!0,Qe(c,d,e),ub(c,"lineWidgetChanged",c,a,F(d))}))},Ea(Gh);var Hh=0,Ih=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++Hh};Ih.prototype.clear=function(){var a=this;if(!this.explicitlyCleared){var b=this.doc.cm,c=b&&!b.curOp;if(c&&ed(b),Da(this,"clear")){var d=this.find();d&&ub(this,"clear",d.from,d.to)}for(var e=null,f=null,g=0;g<this.lines.length;++g){var h=a.lines[g],i=W(h.markedSpans,a);b&&!a.collapsed?rd(b,F(h),"text"):b&&(null!=i.to&&(f=F(h)),null!=i.from&&(e=F(h))),h.markedSpans=X(h.markedSpans,i),null==i.from&&a.collapsed&&!qa(a.doc,h)&&b&&E(h,sc(b.display))}if(b&&this.collapsed&&!b.options.lineWrapping)for(var j=0;j<this.lines.length;++j){var k=la(a.lines[j]),l=ta(k);l>b.display.maxLineLength&&(b.display.maxLine=k,b.display.maxLineLength=l,b.display.maxLineChanged=!0)}null!=e&&b&&this.collapsed&&qd(b,e,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,b&&we(b.doc)),b&&ub(b,"markerCleared",b,this,e,f),c&&fd(b),this.parent&&this.parent.clear()}},Ih.prototype.find=function(a,b){var c=this;null==a&&"bookmark"==this.type&&(a=1);for(var d,e,f=0;f<this.lines.length;++f){var g=c.lines[f],h=W(g.markedSpans,c);if(null!=h.from&&(d=J(b?g:F(g),h.from),-1==a))return d;if(null!=h.to&&(e=J(b?g:F(g),h.to),1==a))return e}return d&&{from:d,to:e}},Ih.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&md(d,function(){var e=b.line,f=F(b.line),g=Ub(d,f);if(g&&(_b(g),d.curOp.selectionChanged=d.curOp.forceUpdate=!0),d.curOp.updateMaxLine=!0,!qa(c.doc,e)&&null!=c.height){var h=c.height;c.height=null;var i=Ib(c)-h;i&&E(e,e.height+i)}ub(d,"markerChanged",d,a)})},Ih.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=m(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},Ih.prototype.detachLine=function(a){if(this.lines.splice(m(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},Ea(Ih);var Jh=function(a,b){var c=this;this.markers=a,this.primary=b;for(var d=0;d<a.length;++d)a[d].parent=c};Jh.prototype.clear=function(){var a=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var b=0;b<this.markers.length;++b)a.markers[b].clear();ub(this,"clear")}},Jh.prototype.find=function(a,b){return this.primary.find(a,b)},Ea(Jh);var Kh=0,Lh=function(a,b,c,d,e){if(!(this instanceof Lh))return new Lh(a,b,c,d,e);null==c&&(c=0),Pe.call(this,[new Oe([new qh("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=c;var f=J(c,0);this.sel=Nd(f),this.history=new _d(null),this.id=++Kh,this.modeOption=b,this.lineSep=d,this.direction="rtl"==e?"rtl":"ltr",this.extend=!1,"string"==typeof a&&(a=this.splitLines(a)),Wd(this,{from:f,to:f,text:a}),te(this,Nd(f),Ug)};Lh.prototype=t(Pe.prototype,{constructor:Lh,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=D(this,this.first,this.first+this.size);return a===!1?b:b.join(a||this.lineSeparator())},setValue:pd(function(a){var b=J(this.first,0),c=this.first+this.size-1;De(this,{from:b,to:J(c,B(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0),this.cm&&Vc(this.cm,0,0),te(this,Nd(b),Ug)}),replaceRange:function(a,b,c,d){b=Q(this,b),c=c?Q(this,c):b,Je(this,a,b,c,d)},getRange:function(a,b,c){var d=C(this,Q(this,a),Q(this,b));return c===!1?d:d.join(c||this.lineSeparator())},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return H(this,a)?B(this,a):void 0},getLineNumber:function(a){return F(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=B(this,a)),la(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Q(this,a)},getCursor:function(a){var b,c=this.sel.primary();return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||"to"==a||a===!1?c.to():c.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pd(function(a,b,c){qe(this,Q(this,"number"==typeof a?J(a,b||0):a),null,c)}),setSelection:pd(function(a,b,c){qe(this,Q(this,a),Q(this,b||a),c)}),extendSelection:pd(function(a,b,c){ne(this,Q(this,a),b&&Q(this,b),c)}),extendSelections:pd(function(a,b){oe(this,S(this,a),b)}),extendSelectionsBy:pd(function(a,b){var c=q(this.sel.ranges,a);oe(this,S(this,c),b)}),setSelections:pd(function(a,b,c){var d=this;if(a.length){for(var e=[],f=0;f<a.length;f++)e[f]=new Fh(Q(d,a[f].anchor),Q(d,a[f].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),te(this,Md(e,b),c)}}),addSelection:pd(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new Fh(Q(this,a),Q(this,b||a))),te(this,Md(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this,d=this.sel.ranges,e=0;e<d.length;e++){var f=C(c,d[e].from(),d[e].to());b=b?b.concat(f):f}return a===!1?b:b.join(a||this.lineSeparator())},getSelections:function(a){for(var b=this,c=[],d=this.sel.ranges,e=0;e<d.length;e++){var f=C(b,d[e].from(),d[e].to());a!==!1&&(f=f.join(a||b.lineSeparator())),c[e]=f}return c},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:pd(function(a,b,c){for(var d=this,e=[],f=this.sel,g=0;g<f.ranges.length;g++){var h=f.ranges[g];e[g]={from:h.from(),to:h.to(),text:d.splitLines(a[g]),origin:c}}for(var i=b&&"end"!=b&&Sd(this,e,b),j=e.length-1;j>=0;j--)De(d,e[j]);i?se(this,i):this.cm&&Uc(this.cm)}),undo:pd(function(){Fe(this,"undo")}),redo:pd(function(){Fe(this,"redo")}),undoSelection:pd(function(){Fe(this,"undo",!0)}),redoSelection:pd(function(){Fe(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var e=0;e<a.undone.length;e++)a.undone[e].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new _d(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:le(this.history.done),undone:le(this.history.undone)}},setHistory:function(a){var b=this.history=new _d(this.history.maxGeneration);b.done=le(a.done.slice(0),null,!0),b.undone=le(a.undone.slice(0),null,!0)},setGutterMarker:pd(function(a,b,c){return Ne(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&w(d)&&(a.gutterMarkers=null),!0})}),clearGutter:pd(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&Ne(b,c,"gutter",function(){return c.gutterMarkers[a]=null,w(c.gutterMarkers)&&(c.gutterMarkers=null),!0})})}),lineInfo:function(a){var b;if("number"==typeof a){if(!H(this,a))return null;if(b=a,a=B(this,a),!a)return null}else if(b=F(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:pd(function(b,c,d){return Ne(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass";if(b[e]){if(a(d).test(b[e]))return!1;b[e]+=" "+d}else b[e]=d;return!0})}),removeLineClass:pd(function(b,c,d){return Ne(this,b,"gutter"==c?"gutter":"class",function(b){var e="text"==c?"textClass":"background"==c?"bgClass":"gutter"==c?"gutterClass":"wrapClass",f=b[e];if(!f)return!1;if(null==d)b[e]=null;else{var g=f.match(a(d));if(!g)return!1;var h=g.index+g[0].length;b[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}return!0})}),addLineWidget:pd(function(a,b,c){return Re(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Se(this,Q(this,a),Q(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};return a=Q(this,a),Se(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Q(this,a);var b=[],c=B(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=Q(this,a),b=Q(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];null!=i.to&&e==a.line&&a.ch>=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;return this.iter(function(e){var f=e.text.length+d;return f>a?(b=a,!0):(a-=f,void++c)}),Q(this,J(c,b))},indexFromPos:function(a){a=Q(this,a);var b=a.ch;if(a.line<this.first||a.ch<0)return 0;var c=this.lineSeparator().length;return this.iter(this.first,a.line,function(a){b+=a.text.length+c}),b},copy:function(a){var b=new Lh(D(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new Lh(D(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],Ve(d,Ue(this)),d},unlinkDoc:function(a){var b=this;if(a instanceof Vf&&(a=a.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=b.linked[c];if(d.doc==a){b.linked.splice(c,1),a.unlinkDoc(b),We(Ue(b));break}}if(a.history==this.history){var e=[a.id];Xd(a,function(a){return e.push(a.id)},!0),a.history=new _d(null),a.history.done=le(this.history.done,e),a.history.undone=le(this.history.undone,e)}},iterLinkedDocs:function(a){Xd(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):fh(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:pd(function(a){"rtl"!=a&&(a="ltr"),a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&$d(this.cm))})}),Lh.prototype.eachLine=Lh.prototype.iter;for(var Mh=0,Nh=!1,Oh={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ph=0;10>Ph;Ph++)Oh[Ph+48]=Oh[Ph+96]=String(Ph);for(var Qh=65;90>=Qh;Qh++)Oh[Qh]=String.fromCharCode(Qh);for(var Rh=1;12>=Rh;Rh++)Oh[Rh+111]=Oh[Rh+63235]="F"+Rh;var Sh={};Sh.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Sh.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Sh.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Sh.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Sh["default"]=Gg?Sh.macDefault:Sh.pcDefault;var Th={selectAll:Be,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ug)},killLine:function(a){return lf(a,function(b){if(b.empty()){var c=B(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:J(b.head.line+1,0)}:{from:b.head,to:J(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return lf(a,function(b){return{from:J(b.from().line,0),to:Q(a.doc,J(b.to().line+1,0))}})},delLineLeft:function(a){return lf(a,function(a){return{from:J(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return lf(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){return lf(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(J(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(J(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return qf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return sf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){return rf(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},Wg)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},Wg)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?sf(a,b.head):d},Wg)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection(" ")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=l(a.getLine(f.line),f.ch,d);b.push(o(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return md(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=b[d].head,f=B(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new J(e.line,e.ch-1)),e.ch>0)e=new J(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),J(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=B(a.doc,e.line-1).text;g&&(e=new J(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),J(e.line-1,g.length-1),e,"+transpose"))}c.push(new Fh(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return md(a,function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(var d=0;d<b.length;d++)a.indentLine(b[d].from().line,null,!0);Uc(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Uh=new Pg,Vh=null,Wh=400,Xh=function(a,b,c){this.time=a,this.pos=b,this.button=c};Xh.prototype.compare=function(a,b,c){return this.time+Wh>a&&0==K(b,this.pos)&&c==this.button};var Yh,Zh,$h={toString:function(){return"CodeMirror.Init"}},_h={},ai={};Vf.defaults=_h,Vf.optionHandlers=ai;var bi=[];Vf.defineInitHook=function(a){return bi.push(a)};var ci=null,di=function(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Pg,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};di.prototype.init=function(a){function b(a){if(!Ba(e,a)){if(e.somethingSelected())Yf({lineWise:!1,text:e.getSelections()}),"cut"==a.type&&e.replaceSelection("",null,"cut");else{if(!e.options.lineWiseCopyCut)return;var b=ag(e);Yf({lineWise:!0,text:b.text}),"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,Ug),e.replaceSelection("",null,"cut")})}if(a.clipboardData){a.clipboardData.clearData();var c=ci.text.join("\n");if(a.clipboardData.setData("Text",c),a.clipboardData.getData("Text")==c)return void a.preventDefault()}var g=cg(),h=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild),h.value=ci.text.join("\n");var i=document.activeElement;Og(h),setTimeout(function(){e.display.lineSpace.removeChild(g),i.focus(),i==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;bg(f,e.options.spellcheck),dh(f,"paste",function(a){Ba(e,a)||$f(a,e)||11>=vg&&setTimeout(nd(e,function(){return c.updateFromDOM()}),20)}),dh(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}}),dh(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})}),dh(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)}),dh(f,"touchstart",function(){return d.forceCompositionEnd()}),dh(f,"input",function(){c.composing||c.readFromDOMSoon()}),dh(f,"copy",b),dh(f,"cut",b)},di.prototype.prepareSelection=function(){var a=Bc(this.cm,!1);return a.focus=this.cm.state.focused,a},di.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},di.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from(),e=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||e.line<b.display.viewFrom)return void a.removeAllRanges();var f=kg(b,a.anchorNode,a.anchorOffset),g=kg(b,a.focusNode,a.focusOffset);if(!f||f.bad||!g||g.bad||0!=K(O(f,g),d)||0!=K(N(f,g),e)){var h=b.display.view,i=d.line>=b.display.viewFrom&&gg(b,d)||{node:h[0].measure.map[2],offset:0},j=e.line<b.display.viewTo&&gg(b,e);if(!j){var k=h[h.length-1].measure,l=k.maps?k.maps[k.maps.length-1]:k.map;j={node:l[l.length-1],offset:l[l.length-2]-l[l.length-3]}}if(!i||!j)return void a.removeAllRanges();var m,n=a.rangeCount&&a.getRangeAt(0);try{m=Kg(i.node,i.offset,j.offset,j.node)}catch(o){}m&&(!qg&&b.state.focused?(a.collapse(i.node,i.offset),m.collapsed||(a.removeAllRanges(),a.addRange(m))):(a.removeAllRanges(),a.addRange(m)),n&&null==a.anchorNode?a.addRange(n):qg&&this.startGracePeriod()),this.rememberSelection()}},di.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)},di.prototype.showMultipleSelections=function(a){c(this.cm.display.cursorDiv,a.cursors),c(this.cm.display.selectionDiv,a.selection)},di.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},di.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return f(this.div,b)},di.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},di.prototype.blur=function(){this.div.blur()},di.prototype.getField=function(){return this.div},di.prototype.supportsTouch=function(){return!0},di.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():md(this.cm,function(){return b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},di.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},di.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;if(Eg&&yg&&this.cm.options.gutters.length&&hg(a.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var c=kg(b,a.anchorNode,a.anchorOffset),d=kg(b,a.focusNode,a.focusOffset);c&&d&&md(b,function(){te(b.doc,Nd(c,d),Ug),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}}},di.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(0==d.ch&&d.line>a.firstLine()&&(d=J(d.line-1,B(a.doc,d.line-1).length)),e.ch==B(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=J(e.line+1,0)),d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f,g,h;d.line==b.viewFrom||0==(f=zc(a,d.line))?(g=F(b.view[0].line),h=b.view[0].node):(g=F(b.view[f].line),h=b.view[f-1].node.nextSibling);var i,j,k=zc(a,e.line);if(k==b.view.length-1?(i=b.viewTo-1,j=b.lineDiv.lastChild):(i=F(b.view[k+1].line)-1,j=b.view[k+1].node.previousSibling),!h)return!1;for(var l=a.doc.splitLines(jg(a,h,j,g,i)),m=C(a.doc,J(g,0),J(i,B(a.doc,i).text.length));l.length>1&&m.length>1;)if(p(l)==p(m))l.pop(),m.pop(),i--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,q=l[0],r=m[0],s=Math.min(q.length,r.length);s>n&&q.charCodeAt(n)==r.charCodeAt(n);)++n;for(var t=p(l),u=p(m),v=Math.min(t.length-(1==l.length?n:0),u.length-(1==m.length?n:0));v>o&&t.charCodeAt(t.length-o-1)==u.charCodeAt(u.length-o-1);)++o;if(1==l.length&&1==m.length&&g==d.line)for(;n&&n>d.ch&&t.charCodeAt(t.length-o-1)==u.charCodeAt(u.length-o-1);)n--,o++;l[l.length-1]=t.slice(0,t.length-o).replace(/^\u200b+/,""),l[0]=l[0].slice(n).replace(/\u200b+$/,"");var w=J(g,n),x=J(i,m.length?p(m).length-o:0);return l.length>1||l[0]||K(w,x)?(Je(a.doc,l,w,x,"+input"),!0):void 0},di.prototype.ensurePolled=function(){this.forceCompositionEnd()},di.prototype.reset=function(){this.forceCompositionEnd()},di.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),
this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},di.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(a.readDOMTimeout=null,a.composing){if(!a.composing.done)return;a.composing=null}a.updateFromDOM()},80))},di.prototype.updateFromDOM=function(){var a=this;(this.cm.isReadOnly()||!this.pollContent())&&md(this.cm,function(){return qd(a.cm)})},di.prototype.setUneditable=function(a){a.contentEditable="false"},di.prototype.onKeyPress=function(a){0==a.charCode||this.composing||(a.preventDefault(),this.cm.isReadOnly()||nd(this.cm,Zf)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))},di.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)},di.prototype.onContextMenu=function(){},di.prototype.resetPosition=function(){},di.prototype.needsContentAttribute=!0;var ei=function(a){this.cm=a,this.prevInput="",this.pollingFast=!1,this.polling=new Pg,this.hasSelection=!1,this.composing=null};ei.prototype.init=function(a){function b(a){if(!Ba(e,a)){if(e.somethingSelected())Yf({lineWise:!1,text:e.getSelections()});else{if(!e.options.lineWiseCopyCut)return;var b=ag(e);Yf({lineWise:!0,text:b.text}),"cut"==a.type?e.setSelections(b.ranges,null,Ug):(d.prevInput="",f.value=b.text.join("\n"),Og(f))}"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm;this.createField(a);var f=this.textarea;a.wrapper.insertBefore(this.wrapper,a.wrapper.firstChild),Dg&&(f.style.width="0px"),dh(f,"input",function(){ug&&vg>=9&&c.hasSelection&&(c.hasSelection=null),d.poll()}),dh(f,"paste",function(a){Ba(e,a)||$f(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())}),dh(f,"cut",b),dh(f,"copy",b),dh(a.scroller,"paste",function(b){Jb(a,b)||Ba(e,b)||(e.state.pasteIncoming=!0,d.focus())}),dh(a.lineSpace,"selectstart",function(b){Jb(a,b)||Fa(b)}),dh(f,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear(),d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}}),dh(f,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})},ei.prototype.createField=function(a){this.wrapper=cg(),this.textarea=this.wrapper.firstChild},ei.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Bc(a);if(a.options.moveInputWithCursor){var e=ic(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},ei.prototype.showSelection=function(a){var b=this.cm,d=b.display;c(d.cursorDiv,a.cursors),c(d.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},ei.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;if(b.somethingSelected()){this.prevInput="";var c=b.getSelection();this.textarea.value=c,b.state.focused&&Og(this.textarea),ug&&vg>=9&&(this.hasSelection=c)}else a||(this.prevInput=this.textarea.value="",ug&&vg>=9&&(this.hasSelection=null))}},ei.prototype.getField=function(){return this.textarea},ei.prototype.supportsTouch=function(){return!1},ei.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Fg||g()!=this.textarea))try{this.textarea.focus()}catch(a){}},ei.prototype.blur=function(){this.textarea.blur()},ei.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ei.prototype.receivedFocus=function(){this.slowPoll()},ei.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},ei.prototype.fastPoll=function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},ei.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||gh(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(ug&&vg>=9&&this.hasSelection===e||Gg&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(8203!=f||d||(d=""),8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,h=Math.min(d.length,e.length);h>g&&d.charCodeAt(g)==e.charCodeAt(g);)++g;return md(b,function(){Zf(b,e.slice(g),d.length-g,null,a.composing?"*compose":null),e.length>1e3||e.indexOf("\n")>-1?c.value=a.prevInput="":a.prevInput=e,a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ei.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ei.prototype.onKeyPress=function(){ug&&vg>=9&&(this.hasSelection=null),this.fastPoll()},ei.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b=""+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,ug&&9>vg&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!ug||ug&&9>vg)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&""==d.prevInput?nd(e,Be)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=yc(e,a),i=f.scroller.scrollTop;if(h&&!zg){var j=e.options.resetSelectionOnContextMenu;j&&-1==e.doc.sel.contains(h)&&nd(e,te)(e.doc,Nd(h),Ug);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px;\n z-index: 1000; background: "+(ug?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;if(wg&&(n=window.scrollY),f.input.focus(),wg&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),ug&&vg>=9&&b(),Mg){Ia(a);var o=function(){za(window,"mouseup",o),setTimeout(c,20)};dh(window,"mouseup",o)}else setTimeout(c,50)}},ei.prototype.readOnlyChanged=function(a){a||this.reset(),this.textarea.disabled="nocursor"==a},ei.prototype.setUneditable=function(){},ei.prototype.needsContentAttribute=!1,Rf(Vf),dg(Vf);var fi="iter insert remove copy getEditor constructor".split(" ");for(var gi in Lh.prototype)Lh.prototype.hasOwnProperty(gi)&&m(fi,gi)<0&&(Vf.prototype[gi]=function(a){return function(){return a.apply(this.doc,arguments)}}(Lh.prototype[gi]));return Ea(Lh),Vf.inputStyles={textarea:ei,contenteditable:di},Vf.defineMode=function(a){Vf.defaults.mode||"null"==a||(Vf.defaults.mode=a),Oa.apply(this,arguments)},Vf.defineMIME=Pa,Vf.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}}),Vf.defineMIME("text/plain","null"),Vf.defineExtension=function(a,b){Vf.prototype[a]=b},Vf.defineDocExtension=function(a,b){Lh.prototype[a]=b},Vf.fromTextArea=mg,ng(Vf),Vf.version="5.37.0",Vf}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";var b={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},c={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};a.defineMode("xml",function(d,e){function f(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d)return a.eat("!")?a.eat("[")?a.match("CDATA[")?c(i("atom","]]>")):null:a.match("--")?c(i("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(j(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=i("meta","?>"),"meta"):(A=a.eat("/")?"closeTag":"openTag",b.tokenize=g,"tag bracket");if("&"==d){var e;return e=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),e?"atom":"error"}return a.eatWhile(/[^&<]/),null}function g(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=f,A=">"==c?"endTag":"selfcloseTag","tag bracket";if("="==c)return A="equals",null;if("<"==c){b.tokenize=f,b.state=n,b.tagName=b.tagStart=null;var d=b.tokenize(a,b);return d?d+" tag error":"tag error"}return/[\'\"]/.test(c)?(b.tokenize=h(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=g;break}return"string"};return b.isInAttribute=!0,b}function i(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=f;break}c.next()}return a}}function j(a){return function(b,c){for(var d;null!=(d=b.next());){if("<"==d)return c.tokenize=j(a+1),c.tokenize(b,c);if(">"==d){if(1==a){c.tokenize=f;break}return c.tokenize=j(a-1),c.tokenize(b,c)}}return"meta"}}function k(a,b,c){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=c,(x.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function l(a){a.context&&(a.context=a.context.prev)}function m(a,b){for(var c;;){if(!a.context)return;if(c=a.context.tagName,!x.contextGrabbers.hasOwnProperty(c)||!x.contextGrabbers[c].hasOwnProperty(b))return;l(a)}}function n(a,b,c){return"openTag"==a?(c.tagStart=b.column(),o):"closeTag"==a?p:n}function o(a,b,c){return"word"==a?(c.tagName=b.current(),B="tag",s):x.allowMissingTagName&&"endTag"==a?(B="tag bracket",s(a,b,c)):(B="error",o)}function p(a,b,c){if("word"==a){var d=b.current();return c.context&&c.context.tagName!=d&&x.implicitlyClosed.hasOwnProperty(c.context.tagName)&&l(c),c.context&&c.context.tagName==d||x.matchClosing===!1?(B="tag",q):(B="tag error",r)}return x.allowMissingTagName&&"endTag"==a?(B="tag bracket",q(a,b,c)):(B="error",r)}function q(a,b,c){return"endTag"!=a?(B="error",q):(l(c),n)}function r(a,b,c){return B="error",q(a,b,c)}function s(a,b,c){if("word"==a)return B="attribute",t;if("endTag"==a||"selfcloseTag"==a){var d=c.tagName,e=c.tagStart;return c.tagName=c.tagStart=null,"selfcloseTag"==a||x.autoSelfClosers.hasOwnProperty(d)?m(c,d):(m(c,d),c.context=new k(c,d,e==c.indented)),n}return B="error",s}function t(a,b,c){return"equals"==a?u:(x.allowMissing||(B="error"),s(a,b,c))}function u(a,b,c){return"string"==a?v:"word"==a&&x.allowUnquoted?(B="string",s):(B="error",s(a,b,c))}function v(a,b,c){return"string"==a?v:s(a,b,c)}var w=d.indentUnit,x={},y=e.htmlMode?b:c;for(var z in y)x[z]=y[z];for(var z in e)x[z]=e[z];var A,B;return f.isInText=!0,{startState:function(a){var b={tokenize:f,state:n,indented:a||0,tagName:null,tagStart:null,context:null};return null!=a&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;A=null;var c=b.tokenize(a,b);return(c||A)&&"comment"!=c&&(B=null,b.state=b.state(A||c,a,b),B&&(c="error"==B?c+" error":B)),c},indent:function(b,c,d){var e=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+w;if(e&&e.noIndent)return a.Pass;if(b.tokenize!=g&&b.tokenize!=f)return d?d.match(/^(\s*)/)[0].length:0;if(b.tagName)return x.multilineTagIndentPastTag!==!1?b.tagStart+b.tagName.length+2:b.tagStart+w*(x.multilineTagIndentFactor||1);if(x.alignCDATA&&/<!\[CDATA\[/.test(c))return 0;var h=c&&/^<(\/)?([\w_:\.-]*)/.exec(c);if(h&&h[1])for(;e;){if(e.tagName==h[2]){e=e.prev;break}if(!x.implicitlyClosed.hasOwnProperty(e.tagName))break;e=e.prev}else if(h)for(;e;){var i=x.contextGrabbers[e.tagName];if(!i||!i.hasOwnProperty(h[2]))break;e=e.prev}for(;e&&e.prev&&!e.startOfLine;)e=e.prev;return e?e.indent+w:b.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:x.htmlMode?"html":"xml",helperType:x.htmlMode?"html":"xml",skipAttribute:function(a){a.state==u&&(a.state=s)}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c<a.length;++c)b[a[c].toLowerCase()]=!0;return b}function c(a,b){for(var c,d=!1;null!=(c=a.next());){if(d&&"/"==c){b.tokenize=null;break}d="*"==c}return["comment","comment"]}a.defineMode("css",function(b,c){function d(a,b){return o=b,a}function e(a,b){var c=a.next();if(r[c]){var e=r[c](a,b);if(e!==!1)return e}return"@"==c?(a.eatWhile(/[\w\\\-]/),d("def",a.current())):"="==c||("~"==c||"|"==c)&&a.eat("=")?d(null,"compare"):'"'==c||"'"==c?(b.tokenize=f(c),b.tokenize(a,b)):"#"==c?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):"!"==c?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)||"."==c&&a.eat(/\d/)?(a.eatWhile(/[\w.%]/),d("number","unit")):"-"!==c?/[,+>*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):("u"==c||"U"==c)&&a.match(/rl(-prefix)?\(/i)||("d"==c||"D"==c)&&a.match("omain(",!0,!0)||("r"==c||"R"==c)&&a.match("egexp(",!0,!0)?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c,d){return a.context=new h(c,b.indentation()+(d===!1?0:q),a.context),c}function j(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function k(a,b,c){return F[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();p=B.hasOwnProperty(b)?"atom":A.hasOwnProperty(b)?"keyword":"variable"}var n=c.inline;c.propertyKeywords||(c=a.resolveMode("text/css"));var o,p,q=b.indentUnit,r=c.tokenHooks,s=c.documentTypes||{},t=c.mediaTypes||{},u=c.mediaFeatures||{},v=c.mediaValueKeywords||{},w=c.propertyKeywords||{},x=c.nonStandardPropertyKeywords||{},y=c.fontProperties||{},z=c.counterDescriptors||{},A=c.colorKeywords||{},B=c.valueKeywords||{},C=c.allowNested,D=c.lineComment,E=c.supportsAtComponent===!0,F={};return F.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(E&&/@component/i.test(a))return i(c,b,"atComponentBlock");if(/^@(-moz-)?document$/i.test(a))return i(c,b,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(a))return i(c,b,"atBlock");if(/^@(font-face|counter-style)/i.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)p="builtin";else if("word"==a)p="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(C&&"("==a)return i(c,b,"parens")}return c.context.type},F.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return w.hasOwnProperty(d)?(p="property","maybeprop"):x.hasOwnProperty(d)?(p="string-2","maybeprop"):C?(p=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==a?"block":C||"hash"!=a&&"qualifier"!=a?F.top(a,b,c):(p="error","block")},F.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},F.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&C)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else p+=" error";return"prop"},F.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(p="property","maybeprop"):c.context.type},F.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},F.pseudo=function(a,b,c){return"meta"==a?"pseudo":"word"==a?(p="variable-3",c.context.type):k(a,b,c)},F.documentTypes=function(a,b,c){return"word"==a&&s.hasOwnProperty(b.current())?(p="tag",c.context.type):F.atBlock(a,b,c)},F.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a||";"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,C?"block":"top");if("interpolation"==a)return i(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();p="only"==d||"not"==d||"and"==d||"or"==d?"keyword":t.hasOwnProperty(d)?"attribute":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"keyword":w.hasOwnProperty(d)?"property":x.hasOwnProperty(d)?"string-2":B.hasOwnProperty(d)?"atom":A.hasOwnProperty(d)?"keyword":"error"}return c.context.type},F.atComponentBlock=function(a,b,c){return"}"==a?l(a,b,c):"{"==a?j(c)&&i(c,b,C?"block":"top",!1):("word"==a&&(p="error"),c.context.type)},F.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):F.atBlock(a,b,c)},F.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(p="variable","restricted_atBlock_before"):k(a,b,c)},F.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(p="@font-face"==c.stateArg&&!y.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!z.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},F.keyframes=function(a,b,c){return"word"==a?(p="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},F.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?p="tag":"hash"==a&&(p="builtin"),"at")},F.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?p="variable":"variable"!=a&&"("!=a&&")"!=a&&(p="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new h(n?"block":"top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(o=c[1],c=c[0]),p=c,"comment"!=o&&(b.state=F[b.state](o,a,b)),p},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),c.prev&&("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type?(")"==d&&("parens"==c.type||"atBlock_parens"==c.type)||"{"==d&&("at"==c.type||"atBlock"==c.type))&&(e=Math.max(0,c.indent-q)):(c=c.prev,e=c.indent)),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:D,fold:"brace"}});var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],i=b(h),j=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],k=b(j),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],m=b(l),n=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],o=b(n),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],q=b(p),r=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],s=b(r),t=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],u=b(t),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=b(v),x=d.concat(f).concat(h).concat(j).concat(l).concat(n).concat(t).concat(v);
a.registerHelper("hintWords","css",x),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,tokenHooks:{"/":function(a,b){return a.eat("*")?(b.tokenize=c,c(a,b)):!1}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return a.match(/\s*\{/,!1)?[null,null]:!1},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return a.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)?!1:(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),a.defineMIME("text/x-gss",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(a,b){return a.eat("*")?(b.tokenize=c,c(a,b)):!1}},name:"css",helperType:"gss"})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b,c){var d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):d.match(/<\/?$/)&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function c(a){var b=i[a];return b?b:i[a]=new RegExp("\\s+"+a+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function d(a,b){var d=a.match(c(b));return d?/^\s*(.*?)\s*$/.exec(d[2])[1]:""}function e(a,b){return new RegExp((b?"^":"")+"</s*"+a+"s*>","i")}function f(a,b){for(var c in a)for(var d=b[c]||(b[c]=[]),e=a[c],f=e.length-1;f>=0;f--)d.unshift(e[f])}function g(a,b){for(var c=0;c<a.length;c++){var e=a[c];if(!e[0]||e[1].test(d(b,e[0])))return e[2]}}var h={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},i={};a.defineMode("htmlmixed",function(c,d){function i(d,f){var h,l=j.token(d,f.htmlState),m=/\btag\b/.test(l);if(m&&!/[<>\s\/]/.test(d.current())&&(h=f.htmlState.tagName&&f.htmlState.tagName.toLowerCase())&&k.hasOwnProperty(h))f.inTag=h+" ";else if(f.inTag&&m&&/>$/.test(d.current())){var n=/^([\S]+) (.*)/.exec(f.inTag);f.inTag=null;var o=">"==d.current()&&g(k[n[1]],n[2]),p=a.getMode(c,o),q=e(n[1],!0),r=e(n[1],!1);f.token=function(a,c){return a.match(q,!1)?(c.token=i,c.localState=c.localMode=null,null):b(a,r,c.localMode.token(a,c.localState))},f.localMode=p,f.localState=a.startState(p,j.indent(f.htmlState,""))}else f.inTag&&(f.inTag+=d.current(),d.eol()&&(f.inTag+=" "));return l}var j=a.getMode(c,{name:"xml",htmlMode:!0,multilineTagIndentFactor:d.multilineTagIndentFactor,multilineTagIndentPastTag:d.multilineTagIndentPastTag}),k={},l=d&&d.tags,m=d&&d.scriptTypes;if(f(h,k),l&&f(l,k),m)for(var n=m.length-1;n>=0;n--)k.script.unshift(["type",m[n].matches,m[n].mode]);return{startState:function(){var b=a.startState(j);return{token:i,inTag:null,localMode:null,localState:null,htmlState:b}},copyState:function(b){var c;return b.localState&&(c=a.copyState(b.localMode,b.localState)),{token:b.token,inTag:b.inTag,localMode:b.localMode,localState:c,htmlState:a.copyState(j,b.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(b,c,d){return!b.localMode||/^\s*<\//.test(c)?j.indent(b.htmlState,c):b.localMode.indent?b.localMode.indent(b.localState,c,d):a.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||j}}}},"xml","javascript","css"),a.defineMIME("text/html","htmlmixed")}),function(window,undefined){function _isArray(a){return a?"[object Array]"===Object.prototype.toString.call(a):!1}function _isFunction(a){return a?"[object Function]"===Object.prototype.toString.call(a):!1}function _inArray(a,b){for(var c=0,d=b.length;d>c;c++)if(a===b[c])return c;return-1}function _each(a,b){if(_isArray(a))for(var c=0,d=a.length;d>c&&b.call(a[c],c,a[c])!==!1;c++);else for(var e in a)if(a.hasOwnProperty(e)&&b.call(a[e],e,a[e])===!1)break}function _trim(a){return a.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,"")}function _inString(a,b,c){return c=c===undefined?",":c,(c+b+c).indexOf(c+a+c)>=0}function _addUnit(a,b){return b=b||"px",a&&/^-?\d+(?:\.\d+)?$/.test(a)?a+b:a}function _removeUnit(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function _escape(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function _unescape(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function _toCamel(a){var b=a.split("-");return a="",_each(b,function(b,c){a+=b>0?c.charAt(0).toUpperCase()+c.substr(1):c}),a}function _toHex(a){function b(a){var b=parseInt(a,10).toString(16).toUpperCase();return b.length>1?b:"0"+b}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi,function(a,c,d,e){return"#"+b(c)+b(d)+b(e)})}function _toMap(a,b){b=b===undefined?",":b;var c,d={},e=_isArray(a)?a:a.split(b);return _each(e,function(a,b){if(c=/^(\d+)\.\.(\d+)$/.exec(b))for(var e=parseInt(c[1],10);e<=parseInt(c[2],10);e++)d[e.toString()]=!0;else d[b]=!0}),d}function _toArray(a,b){return Array.prototype.slice.call(a,b||0)}function _undef(a,b){return a===undefined?b:a}function _invalidUrl(a){return!a||/[<>"]/.test(a)}function _addParam(a,b){return a.indexOf("?")>=0?a+"&"+b:a+"?"+b}function _extend(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype,d=new e,_each(c,function(a,b){d[a]=b})}else d=c;d.constructor=a,a.prototype=d,a.parent=b?b.prototype:null}function _json(text){var match;(match=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))&&(text=match[0]);var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+text+")");throw"JSON parse error"}function _getBasePath(){for(var a,b=document.getElementsByTagName("script"),c=0,d=b.length;d>c;c++)if(a=b[c].src||"",/kindeditor[\w\-\.]*\.js/.test(a))return a.substring(0,a.lastIndexOf("/")+1);return""}function _bindEvent(a,b,c){a.addEventListener?a.addEventListener(b,c,_useCapture):a.attachEvent&&a.attachEvent("on"+b,c)}function _unbindEvent(a,b,c){a.removeEventListener?a.removeEventListener(b,c,_useCapture):a.detachEvent&&a.detachEvent("on"+b,c)}function KEvent(a,b){this.init(a,b)}function _getId(a){return a[_eventExpendo]||null}function _setId(a){return a[_eventExpendo]=++_eventId,_eventId}function _removeId(a){try{delete a[_eventExpendo]}catch(b){a.removeAttribute&&a.removeAttribute(_eventExpendo)}}function _bind(a,b,c){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_bind(a,this,c)});var d=_getId(a);d||(d=_setId(a)),_eventData[d]===undefined&&(_eventData[d]={});var e=_eventData[d][b];e&&e.length>0?_unbindEvent(a,b,e[0]):(_eventData[d][b]=[],_eventData[d].el=a),e=_eventData[d][b],0===e.length&&(e[0]=function(b){var c=b?new KEvent(a,b):undefined;_each(e,function(b,d){b>0&&d&&d.call(a,c)})}),_inArray(c,e)<0&&e.push(c),_bindEvent(a,b,e[0])}function _unbind(a,b,c){if(b&&b.indexOf(",")>=0)return void _each(b.split(","),function(){_unbind(a,this,c)});var d=_getId(a);if(d){if(b===undefined)return void(d in _eventData&&(_each(_eventData[d],function(b,c){"el"!=b&&c.length>0&&_unbindEvent(a,b,c[0])}),delete _eventData[d],_removeId(a)));if(_eventData[d]){var e=_eventData[d][b];if(e&&e.length>0){c===undefined?(_unbindEvent(a,b,e[0]),delete _eventData[d][b]):(_each(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),1==e.length&&(_unbindEvent(a,b,e[0]),delete _eventData[d][b]));var f=0;_each(_eventData[d],function(){f++}),2>f&&(delete _eventData[d],_removeId(a))}}}}function _fire(a,b){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_fire(a,this)});var c=_getId(a);if(c){var d=_eventData[c][b];_eventData[c]&&d&&d.length>0&&d[0]()}}function _ctrl(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0),_bind(a,"keydown",function(d){!d.ctrlKey||d.which!=b||d.shiftKey||d.altKey||(c.call(a),d.stop())})}function _ready(a){function b(){e||(e=!0,a(KindEditor),_readyFinished=!0)}function c(){if(!e){try{document.documentElement.doScroll("left")}catch(a){return void setTimeout(c,100)}b()}}function d(){"complete"===document.readyState&&b()}if(_readyFinished)return void a(KindEditor);var e=!1;if(document.addEventListener)_bind(document,"DOMContentLoaded",b);else if(document.attachEvent){_bind(document,"readystatechange",d);var f=!1;try{f=null==window.frameElement}catch(g){}document.documentElement.doScroll&&f&&c()}_bind(window,"load",b)}function _getCssList(a){a=a.replace(/"/g,'"');for(var b,c={},d=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g;b=d.exec(a);){var e=_trim(b[1].toLowerCase()),f=_trim(_toHex(b[2]));c[e]=f}return c}function _getAttrList(a){for(var b,c={},d=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;b=d.exec(a);){var e=(b[1]||b[2]||b[4]||b[6]).toLowerCase(),f=(b[2]?b[3]:b[4]?b[5]:b[7])||"";c[e]=f}return c}function _addClassToTag(a,b){return a=/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,c,d,e){return(" "+d+" ").indexOf(" "+b+" ")<0?""===d?c+b+e:c+d+" "+b+e:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function _formatCss(a){var b="";return _each(_getCssList(a),function(a,c){b+=a+":"+c+";"}),b}function _formatUrl(a,b,c,d){function e(a){for(var b=a.split("/"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];".."==f?c.length>0&&c.pop():""!==f&&"."!=f&&c.push(f)}return"/"+c.join("/")}function f(b,c){if(a.substr(0,b.length)===b){for(var e=[],g=0;c>g;g++)e.push("..");var i=".";return e.length>0&&(i+="/"+e.join("/")),"/"==d&&(i+="/"),i+a.substr(b.length)}return(h=/^(.*)\//.exec(b))?f(h[1],++c):void 0}if(b=_undef(b,"").toLowerCase(),"data:"!=a.substr(0,5)&&(a=a.replace(/([^:])\/\//g,"$1/")),_inArray(b,["absolute","relative","domain"])<0)return a;if(c=c||location.protocol+"//"+location.host,d===undefined){var g=location.pathname.match(/^(\/.*)\//);d=g?g[1]:""}var h;if(h=/^(\w+:\/\/[^\/]*)/.exec(a)){if(h[1]!==c)return a}else if(/^\w+:/.test(a))return a;return/^\//.test(a)?a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a)),"relative"===b?a=f(c+d,0).substr(2):"absolute"===b&&a.substr(0,c.length)===c&&(a=a.substr(c.length)),a}function _formatHtml(a,b,c,d,e){null==a&&(a=""),c=c||"",d=_undef(d,!1),e=_undef(e," ");var f="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/gi,"\n")+d}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/gi,"</p>"),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/gi,"$1<br />$2"),a=a.replace(/\u200B/g,""),a=a.replace(/\u00A9/g,"©"),a=a.replace(/\u00AE/g,"®"),a=a.replace(/\u2003/g," "),a=a.replace(/\u3000/g," "),a=a.replace(/<[^>]+/g,function(a){return a.replace(/\s+/g," ")});var g={};b&&(_each(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;e>d;d++)g[c[d]]=_toMap(b)}),g.script||(a=a.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/gi,"")),g.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var h=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,i=[];return a=a.replace(h,function(a,h,j,k,l,m,n){var o=a,p=h||"",q=j||"",r=k.toLowerCase(),s=l||"",t=m?" "+m:"",u=n||"";if(b&&!g[r])return"";if(""===t&&_SINGLE_TAG_MAP[r]&&(t=" /"),_INLINE_TAG_MAP[r]&&(p&&(p=" "),u&&(u=" ")),_PRE_TAG_MAP[r]&&(q?u="\n":p="\n"),d&&"br"==r&&(u="\n"),_BLOCK_TAG_MAP[r]&&!_PRE_TAG_MAP[r])if(d){q&&i.length>0&&i[i.length-1]===r?i.pop():i.push(r),p="\n",u="\n";for(var v=0,w=q?i.length:i.length-1;w>v;v++)p+=e,q||(u+=e);t?i.pop():q||(u+=e)}else p=u="";if(""!==s){var x=_getAttrList(o);if("font"===r){var y={},z="";_each(x,function(a,b){"color"===a&&(y.color=b,delete x[a]),"size"===a&&(y["font-size"]=f[parseInt(b,10)-1]||"",delete x[a]),"face"===a&&(y["font-family"]=b,delete x[a]),"style"===a&&(z=b)}),z&&!/;$/.test(z)&&(z+=";"),_each(y,function(a,b){""!==b&&(/\s/.test(b)&&(b="'"+b+"'"),z+=a+":"+b+";")}),x.style=z}_each(x,function(a,d){if(_FILL_ATTR_MAP[a]&&(x[a]=a),_inArray(a,["src","href"])>=0&&(x[a]=_formatUrl(d,c)),(b&&"style"!==a&&!g[r]["*"]&&!g[r][a]||"body"===r&&"contenteditable"===a||/^kindeditor_\d+$/.test(a))&&delete x[a],"style"===a&&""!==d){var e=_getCssList(d);_each(e,function(a,c){!b||g[r].style||g[r]["."+a]||delete e[a]});var f="";_each(e,function(a,b){f+=a+":"+b+";"}),x.style=f}}),s="",_each(x,function(a,b){("style"!==a||""!==b)&&(b=b.replace(/"/g,"""),s+=" "+a+'="'+b+'"')})}return"font"===r&&(r="span"),p+"<"+q+r+s+t+">"+u}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/\n/g,'<span id="__kindeditor_pre_newline__">\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/<span id="__kindeditor_pre_newline__">\n/g,"\n"),_trim(a)}function _clearMsWord(a,b){return a=a.replace(/<meta[\s\S]*?>/gi,"").replace(/<![\s\S]*?>/gi,"").replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<w:[^>]+>[\s\S]*?<\/w:[^>]+>/gi,"").replace(/<o:[^>]+>[\s\S]*?<\/o:[^>]+>/gi,"").replace(/<xml>[\s\S]*?<\/xml>/gi,"").replace(/<(?:table|td)[^>]*>/gi,function(a){return a.replace(/border-bottom:([#\w\s]+)/gi,"border:$1")}),_formatHtml(a,b)}function _mediaType(a){return/\.(swf)(\?|$)/i.test(a)?"application/x-shockwave-flash":/\.(mp4)(\?|$)/i.test(a)?"video/mp4":/\.(webm)(\?|$)/i.test(a)?"video/webm":/\.(flv)(\?|$)/i.test(a)?"video/flv":/\.(mp3)(\?|$)/i.test(a)?"audio/mp3":/\.(wav)(\?|$)/i.test(a)?"audio/wav":/\.(ogg)(\?|$)/i.test(a)?"audio/ogg":"video/x-ms-asf-plugin"}function _mediaClass(a){return/flash/i.test(a)?"ke-flash":/video/i.test(a)?"ke-video":/audio/i.test(a)?"ke-audio":"ke-media"}function _mediaAttrs(a){return _getAttrList(unescape(a))}function _mediaEmbed(a){var b="embed";if(/video/i.test(a.type)&&(b="video"),/audio/i.test(a.type)&&(b="audio"),"embed"!==b)var c="<"+b+" ";else var c="<embed ";return _each(a,function(a,b){c+=a+'="'+b+'" '}),c+="embed"!==b?"></"+b+">":"/>"}function _mediaImg(a,b){var c=b.width,d=b.height,e=b.type||_mediaType(b.src),f=_mediaEmbed(b),g="";/\D/.test(c)?g+="width:"+c+";":c>0&&(g+="width:"+c+"px;"),/\D/.test(d)?g+="height:"+d+";":d>0&&(g+="height:"+d+"px;");var h='<img class="'+_mediaClass(e)+'" src="'+a+'" ';return""!==g&&(h+='style="'+g+'" '),h+='data-ke-tag="'+escape(f)+'" alt="" />'}function _tmpl(a,b){var c=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return b?c(b):c}function _contains(a,b){if(9==a.nodeType&&9!=b.nodeType)return!0;for(;b=b.parentNode;)if(b==a)return!0;return!1}function _getAttr(a,b){b=b.toLowerCase();var c=null;if(_GET_SET_ATTRIBUTE||"script"==a.nodeName.toLowerCase())try{c=a.getAttribute(b,2)}catch(d){c=a.getAttribute(b,1)}else{var e=a.ownerDocument.createElement("div");e.appendChild(a.cloneNode(!1));var f=_getAttrList(_unescape(e.innerHTML));b in f&&(c=f[b])}return"style"===b&&null!==c&&(c=_formatCss(c)),c}function _queryAll(a,b){function c(a){return"string"!=typeof a?a:a.replace(/([^\w\-])/g,"\\$1")}function d(a){return a.replace(/\\/g,"")}function e(a,b){return"*"===a||a.toLowerCase()===c(b.toLowerCase())}function f(a,b,c){var f=[],g=c.ownerDocument||c,h=g.getElementById(d(a));return h&&e(b,h.nodeName)&&_contains(c,h)&&f.push(h),f}function g(a,b,c){var f,g,h,i,j=c.ownerDocument||c,k=[];if(c.getElementsByClassName)for(f=c.getElementsByClassName(d(a)),g=0,h=f.length;h>g;g++)i=f[g],e(b,i.nodeName)&&k.push(i);else if(j.querySelectorAll)for(f=j.querySelectorAll(("#document"!==c.nodeName?c.nodeName+" ":"")+b+"."+a),g=0,h=f.length;h>g;g++)i=f[g],_contains(c,i)&&k.push(i);else for(f=c.getElementsByTagName(b),a=" "+a+" ",g=0,h=f.length;h>g;g++)if(i=f[g],1==i.nodeType){var l=i.className;l&&(" "+l+" ").indexOf(a)>-1&&k.push(i)}return k}function h(a,b,c){for(var f,g=[],h=c.ownerDocument||c,i=h.getElementsByName(d(a)),j=0,k=i.length;k>j;j++)f=i[j],e(b,f.nodeName)&&_contains(c,f)&&null!==f.getAttribute("name")&&g.push(f);return g}function i(a,b,d,e){for(var f,g=[],h=e.getElementsByTagName(d),i=0,j=h.length;j>i;i++)f=h[i],1==f.nodeType&&(null===b?null!==_getAttr(f,a)&&g.push(f):b===c(_getAttr(f,a))&&g.push(f));return g}function j(a,b){var c,d=[];c=/^((?:\\.|[^.#\s\[<>])+)/.exec(a);var e=c?c[1]:"*";if(c=/#((?:[\w\-]|\\.)+)$/.exec(a))d=f(c[1],e,b);else if(c=/\.((?:[\w\-]|\\.)+)$/.exec(a))d=g(c[1],e,b);else if(c=/\[((?:[\w\-]|\\.)+)\]/.exec(a))d=i(c[1].toLowerCase(),null,e,b);else if(c=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){var j=c[1].toLowerCase(),k=c[2];d="id"===j?f(k,e,b):"class"===j?g(k,e,b):"name"===j?h(k,e,b):i(j,k,e,b)}else for(var l,m=b.getElementsByTagName(e),n=0,o=m.length;o>n;n++)l=m[n],1==l.nodeType&&d.push(l);return d}var k=a.split(",");if(k.length>1){var l=[];return _each(k,function(){_each(_queryAll(this,b),function(){_inArray(this,l)<0&&l.push(this)})}),l}b=b||document;for(var m,n=[],o=/((?:\\.|[^\s>])+|[\s>])/g;m=o.exec(a);)" "!==m[1]&&n.push(m[1]);var p=[];if(1==n.length)return j(n[0],b);var q,r,s,t,u,v,w,x,y,z,A=!1;for(v=0,lenth=n.length;v<lenth;v++)if(q=n[v],">"!==q){if(v>0){for(r=[],w=0,y=p.length;y>w;w++)for(t=p[w],s=j(q,t),x=0,z=s.length;z>x;x++)u=s[x],A?t===u.parentNode&&r.push(u):r.push(u);p=r}else p=j(q,b);if(0===p.length)return[]}else A=!0;return p}function _query(a,b){var c=_queryAll(a,b);return c.length>0?c[0]:null}function _get(a){return K(a)[0]}function _getDoc(a){return a?a.ownerDocument||a.document||a:document}function _getWin(a){if(!a)return window;var b=_getDoc(a);return b.parentWindow||b.defaultView}function _setHtml(a,b){if(1==a.nodeType){var c=_getDoc(a);try{a.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+b;var d=c.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d)}catch(e){K(a).empty(),K("@"+b,c).each(function(){a.appendChild(this)})}}}function _hasClass(a,b){return _inString(b,a.className," ")}function _setAttr(a,b,c){_IE&&8>_V&&"class"==b.toLowerCase()&&(b="className"),a.setAttribute(b,""+c)}function _removeAttr(a,b){_IE&&8>_V&&"class"==b.toLowerCase()&&(b="className"),_setAttr(a,b,""),a.removeAttribute(b)}function _getNodeName(a){return a&&a.nodeName?a.nodeName.toLowerCase():""}function _computedCss(a,b){var c=_getWin(a),d=_toCamel(b),e="";if(c.getComputedStyle){var f=c.getComputedStyle(a,null);e=f[d]||f.getPropertyValue(b)||a.style[d]}else a.currentStyle&&(e=a.currentStyle[d]||a.style[d]);return e}function _hasVal(a){return!!_VALUE_TAG_MAP[_getNodeName(a)]}function _docElement(a){return a=a||document,_QUIRKS?a.body:a.documentElement}function _docHeight(a){var b=_docElement(a);return Math.max(b.scrollHeight,b.clientHeight)}function _docWidth(a){var b=_docElement(a);return Math.max(b.scrollWidth,b.clientWidth)}function _getScrollPos(a){a=a||document;var b,c;return _IE||_NEWIE||_OPERA?(b=_docElement(a).scrollLeft,c=_docElement(a).scrollTop):(b=_getWin(a).scrollX,c=_getWin(a).scrollY),{x:b,y:c}}function KNode(a){this.init(a)}function _updateCollapsed(a){return a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset,a}function _copyAndDelete(a,b,c){function d(d,e,f){var g,i=d.nodeValue.length;if(b){var j=d.cloneNode(!0);g=e>0?j.splitText(e):j,i>f&&g.splitText(f-e)}if(c){var k=d;if(e>0&&(k=d.splitText(e),a.setStart(d,e)),i>f){var l=k.splitText(f-e);a.setEnd(l,0)}h.push(k)}return g}function e(){c&&a.up().collapse(!0);for(var b=0,d=h.length;d>b;b++){var e=h[b];e.parentNode&&e.parentNode.removeChild(e)}}function f(e,n){for(var o,p=e.firstChild;p;){var q=new KRange(g).selectNode(p);if(j=q.compareBoundaryPoints(_START_TO_END,a),j>=0&&0>=k&&(k=q.compareBoundaryPoints(_START_TO_START,a)),k>=0&&0>=l&&(l=q.compareBoundaryPoints(_END_TO_END,a)),l>=0&&0>=m&&(m=q.compareBoundaryPoints(_END_TO_START,a)),m>=0)return!1;if(o=p.nextSibling,j>0)if(1==p.nodeType)if(k>=0&&0>=l)b&&n.appendChild(p.cloneNode(!0)),c&&h.push(p);else{var r;if(b&&(r=p.cloneNode(!1),n.appendChild(r)),f(p,r)===!1)return!1}else if(3==p.nodeType){var s;if(s=p==i.startContainer?d(p,i.startOffset,p.nodeValue.length):p==i.endContainer?d(p,0,i.endOffset):d(p,0,p.nodeValue.length),b)try{n.appendChild(s)}catch(t){}}p=o}}var g=a.doc,h=[],i=a.cloneRange().down(),j=-1,k=-1,l=-1,m=-1,n=a.commonAncestor(),o=g.createDocumentFragment();if(3==n.nodeType){var p=d(n,a.startOffset,a.endOffset);return b&&o.appendChild(p),e(),b?o:a}f(n,o),c&&a.up().collapse(!0);for(var q=0,r=h.length;r>q;q++){var s=h[q];s.parentNode&&s.parentNode.removeChild(s)}return b?o:a}function _moveToElementText(a,b){for(var c=b;c;){var d=K(c);if("marquee"==d.name||"select"==d.name)return;c=c.parentNode}try{a.moveToElementText(b)}catch(e){}}function _getStartEnd(a,b){var c=a.parentElement().ownerDocument,d=a.duplicate();d.collapse(b);var e=d.parentElement(),f=e.childNodes;if(0===f.length)return{node:e.parentNode,offset:K(e).index()};var g=c,h=0,i=-1,j=a.duplicate();_moveToElementText(j,e);for(var k=0,l=f.length;l>k;k++){var m=f[k];if(i=j.compareEndPoints("StartToStart",d),0===i)return{node:m.parentNode,offset:k};if(1==m.nodeType){var n,o=a.duplicate(),p=K(m),q=m;p.isControl()&&(n=c.createElement("span"),p.after(n),q=n,h+=p.text().replace(/\r\n|\n|\r/g,"").length),_moveToElementText(o,q),j.setEndPoint("StartToEnd",o),i>0?h+=o.text.replace(/\r\n|\n|\r/g,"").length:h=0,n&&K(n).remove()}else 3==m.nodeType&&(j.moveStart("character",m.nodeValue.length),h+=m.nodeValue.length);0>i&&(g=m)}if(0>i&&1==g.nodeType)return{node:e,offset:K(e.lastChild).index()+1};if(i>0)for(;g.nextSibling&&1==g.nodeType;)g=g.nextSibling;if(j=a.duplicate(),_moveToElementText(j,e),j.setEndPoint("StartToEnd",d),h-=j.text.replace(/\r\n|\n|\r/g,"").length,i>0&&3==g.nodeType)for(var r=g.previousSibling;r&&3==r.nodeType;)h-=r.nodeValue.length,r=r.previousSibling;return{node:g,offset:h}}function _getEndRange(a,b){var c=a.ownerDocument||a,d=c.body.createTextRange();if(c==a)return d.collapse(!0),d;if(1==a.nodeType&&a.childNodes.length>0){var e,f,g=a.childNodes;if(0===b?(f=g[0],e=!0):(f=g[b-1],e=!1),!f)return d;if("head"===K(f).name)return 1===b&&(e=!0),2===b&&(e=!1),d.collapse(e),d;if(1==f.nodeType){var h,i=K(f);return i.isControl()&&(h=c.createElement("span"),e?i.before(h):i.after(h),f=h),_moveToElementText(d,f),d.collapse(e),h&&K(h).remove(),d}a=f,b=e?0:f.nodeValue.length}var j=c.createElement("span");return K(a).before(j),_moveToElementText(d,j),d.moveStart("character",b),K(j).remove(),d}function _toRange(a){function b(a){"tr"==K(a.node).name&&(a.node=a.node.cells[a.offset],a.offset=0)}var c,d;if(_IERANGE){if(a.item)return c=_getDoc(a.item(0)),d=new KRange(c),d.selectNode(a.item(0)),d;c=a.parentElement().ownerDocument;var e=_getStartEnd(a,!0),f=_getStartEnd(a,!1);return b(e),b(f),d=new KRange(c),d.setStart(e.node,e.offset),d.setEnd(f.node,f.offset),d}var g=a.startContainer;return c=g.ownerDocument||g,d=new KRange(c),d.setStart(g,a.startOffset),d.setEnd(a.endContainer,a.endOffset),d}function KRange(a){this.init(a)}function _range(a){return a.nodeName?new KRange(a):a.constructor===KRange?a:_toRange(a)}function _nativeCommand(a,b,c){try{a.execCommand(b,!1,c)}catch(d){}}function _nativeCommandValue(a,b){var c="";try{c=a.queryCommandValue(b)}catch(d){}return"string"!=typeof c&&(c=""),c}function _getSel(a){var b=_getWin(a);return _IERANGE?a.selection:b.getSelection()}function _getRng(a){var b,c=_getSel(a);try{b=c.rangeCount>0?c.getRangeAt(0):c.createRange()}catch(d){}return!_IERANGE||b&&(b.item||b.parentElement().ownerDocument===a)?b:null}function _singleKeyMap(a){var b,c,d={};return _each(a,function(a,e){b=a.split(",");for(var f=0,g=b.length;g>f;f++)c=b[f],d[c]=e}),d}function _hasAttrOrCss(a,b){return _hasAttrOrCssByKey(a,b,"*")||_hasAttrOrCssByKey(a,b)}function _hasAttrOrCssByKey(a,b,c){if(c=c||a.name,1!==a.type)return!1;var d=_singleKeyMap(b);if(!d[c])return!1;for(var e=d[c].split(","),f=0,g=e.length;g>f;f++){var h=e[f];if("*"===h)return!0;var i=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(h),j=i[1]?"css":"attr";h=i[2];var k=i[3]||"";if(""===k&&""!==a[j](h))return!0;if(""!==k&&a[j](h)===k)return!0}return!1}function _removeAttrOrCss(a,b){1==a.type&&(_removeAttrOrCssByKey(a,b,"*"),_removeAttrOrCssByKey(a,b))}function _removeAttrOrCssByKey(a,b,c){if(c=c||a.name,1===a.type){var d=_singleKeyMap(b);if(d[c]){for(var e=d[c].split(","),f=!1,g=0,h=e.length;h>g;g++){var i=e[g];if("*"===i){f=!0;break}var j=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(i);i=j[2],j[1]?(i=_toCamel(i),a[0].style[i]&&(a[0].style[i]="")):a.removeAttr(i)}f&&a.remove(!0)}}}function _getInnerNode(a){for(var b=a;b.first();)b=b.first();return b}function _isEmptyNode(a){return 1!=a.type||a.isSingle()?!1:""===a.html().replace(/<[^>]+>/g,"")}function _mergeWrapper(a,b){a=a.clone(!0);for(var c=_getInnerNode(a),d=a,e=!1;b;){for(;d;)d.name===b.name&&(_mergeAttrs(d,b.attr(),b.css()),e=!0),d=d.first();e||c.append(b.clone(!1)),e=!1,b=b.first()}return a}function _wrapNode(a,b){if(b=b.clone(!0),3==a.type)return _getInnerNode(b).append(a.clone(!1)),a.replaceWith(b),b;for(var c,d=a;(c=a.first())&&1==c.children().length;)a=c;c=a.first();for(var e=a.doc.createDocumentFragment();c;)e.appendChild(c[0]),c=c.next();return b=_mergeWrapper(d,b),e.firstChild&&_getInnerNode(b).append(e),d.replaceWith(b),b}function _mergeAttrs(a,b,c){_each(b,function(b,c){"style"!==b&&a.attr(b,c)}),_each(c,function(b,c){a.css(b,c)})}function _inPreElement(a){for(;a&&"body"!=a.name;){if(_PRE_TAG_MAP[a.name]||"div"==a.name&&a.hasClass("ke-script"))return!0;a=a.parent()}return!1}function KCmd(a){this.init(a)}function _cmd(a){if(a.nodeName){var b=_getDoc(a);a=_range(b).selectNodeContents(b.body).collapse(!1)}return new KCmd(a)}function _drag(a){var b=a.moveEl,c=a.moveFn,d=a.clickEl||b,e=a.beforeDrag,f=a.iframeFix===undefined?!0:a.iframeFix,g=[document];f&&K("iframe").each(function(){var a=_formatUrl(this.src||"","absolute");if(!/^https?:\/\//.test(a)){var b;try{b=_iframeDoc(this)}catch(c){}if(b){var d=K(this).pos();K(b).data("pos-x",d.x),K(b).data("pos-y",d.y),g.push(b)}}}),d.mousedown(function(a){function f(a){a.preventDefault();var b=K(_getDoc(a.target)),e=_round((b.data("pos-x")||0)+a.pageX-o),f=_round((b.data("pos-y")||0)+a.pageY-p);c.call(d,k,l,m,n,e,f)}function h(a){a.preventDefault()}function i(a){a.preventDefault(),K(g).unbind("mousemove",f).unbind("mouseup",i).unbind("selectstart",h),j.releaseCapture&&j.releaseCapture()}if(0===a.button||1===a.button){a.stopPropagation();var j=d.get(),k=_removeUnit(b.css("left")),l=_removeUnit(b.css("top")),m=b.width(),n=b.height(),o=a.pageX,p=a.pageY;e&&e(),K(g).mousemove(f).mouseup(i).bind("selectstart",h),j.setCapture&&j.setCapture()}})}function KWidget(a){this.init(a)}function _widget(a){return new KWidget(a)}function _iframeDoc(a){return a=_get(a),a.contentDocument||a.contentWindow.document}function _getInitHtml(a,b,c,d){var e=[""===_direction?"<html>":'<html dir="'+_direction+'">','<head><meta charset="utf-8" /><title></title>',"<style>","html {margin:0;padding:0;}","body {margin:0;padding:20px;}","body, td {font:16px/1.6 Roboto, system-ui,PingFang SC,STHeiti,sans-serif;}","body, p, div {word-wrap: break-word;}","p {margin:10px 0;}","table {border-collapse:collapse;}","img {border:0;}","noscript {display:none;}","table.ke-zeroborder td {border:1px dotted #AAA;}","img.ke-flash {"," border:1px solid #AAA;"," background-image:url("+a+"common/flash.png);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-media {"," border:1px solid #AAA;"," background-image:url("+a+"common/media.png);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-video {"," border:1px solid #AAA;"," background-image:url("+a+"common/video.png);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-audio {"," border:1px solid #AAA;"," background-image:url("+a+"common/audio.png);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:80px;","}","img.ke-anchor {"," border:1px dashed #666;"," width:16px;"," height:16px;","}",".ke-script, .ke-noscript, .ke-display-none {"," display:none;"," font-size:0;"," width:0;"," height:0;","}",".ke-pagebreak {"," border:1px dotted #AAA;"," font-size:0;"," height:2px;","}","</style>"];return _isArray(c)||(c=[c]),_each(c,function(a,b){b&&e.push('<link href="'+b+'" rel="stylesheet" />')}),d&&e.push("<style>"+d+"</style>"),e.push("</head><body "+(b?'class="'+b+'"':"")+"></body></html>"),e.join("\n")}function _elementVal(a,b){if(a.hasVal()){if(b===undefined){var c=a.val();return c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,"")}return a.val(b)}return a.html(b)}function KEdit(a){this.init(a)}function _edit(a){return new KEdit(a)}function _selectToolbar(a,b){var c=this,d=c.get(a);if(d){if(d.hasClass("ke-disabled"))return;b(d)}}function KToolbar(a){this.init(a)}function _toolbar(a){return new KToolbar(a)}function KMenu(a){this.init(a)}function _menu(a){return new KMenu(a)}function KColorPicker(a){this.init(a)}function _colorpicker(a){return new KColorPicker(a)}function KUploadButton(a){this.init(a)}function _uploadbutton(a){return new KUploadButton(a)}function _createButton(a){a=a||{};var b=a.name||"",c=K('<span class="ke-button-common ke-button-outer" title="'+b+'"></span>'),d=K('<input class="ke-button-common ke-button" type="button" value="'+b+'" />');return a.click&&d.click(a.click),c.append(d),c}function KDialog(a){this.init(a)}function _dialog(a){return new KDialog(a)}function _tabs(a){var b=_widget(a),c=b.remove,d=a.afterSelect,e=b.div,f=[];e.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()});var g=K('<ul class="ke-tabs-ul ke-clearfix"></ul>');return e.append(g),b.add=function(a){var b=K('<li class="ke-tabs-li">'+a.title+"</li>");b.data("tab",a),f.push(b),g.append(b)},b.selectedIndex=0,b.select=function(a){b.selectedIndex=a,_each(f,function(c,d){d.unbind(),c===a?(d.addClass("ke-tabs-li-selected"),K(d.data("tab").panel).show("")):(d.removeClass("ke-tabs-li-selected").removeClass("ke-tabs-li-on").mouseover(function(){
K(this).addClass("ke-tabs-li-on")}).mouseout(function(){K(this).removeClass("ke-tabs-li-on")}).click(function(){b.select(c)}),K(d.data("tab").panel).hide())}),d&&d.call(b,a)},b.remove=function(){_each(f,function(){this.remove()}),g.remove(),c.call(b)},b}function _loadScript(a,b){var c=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),d=document.createElement("script");c.appendChild(d),d.src=a,d.charset="utf-8",d.onload=d.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState||(b&&b(),d.onload=d.onreadystatechange=null,c.removeChild(d))}}function _chopQuery(a){var b=a.indexOf("?");return b>0?a.substr(0,b):a}function _loadStyle(a){for(var b=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),c=document.createElement("link"),d=_chopQuery(_formatUrl(a,"absolute")),e=K('link[rel="stylesheet"]',b),f=0,g=e.length;g>f;f++)if(_chopQuery(_formatUrl(e[f].href,"absolute"))===d)return;b.appendChild(c),c.href=a,c.rel="stylesheet"}function _ajax(a,b,c,d,e){c=c||"GET",e=e||"json";var f=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(f.open(c,a,!0),f.onreadystatechange=function(){if(4==f.readyState&&200==f.status&&b){var a=_trim(f.responseText);"json"==e&&(a=_json(a)),b(a)}},"POST"==c){var g=[];_each(d,function(a,b){g.push(encodeURIComponent(a)+"="+encodeURIComponent(b))});try{f.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(h){}f.send(g.join("&"))}else f.send(null)}function _plugin(a,b){return a===undefined?_plugins:b?void(_plugins[a]=b):_plugins[a]}function _parseLangKey(a){var b,c="core";return(b=/^(\w+)\.(\w+)$/.exec(a))&&(c=b[1],a=b[2]),{ns:c,key:a}}function _lang(a,b){if(b=b===undefined?K.options.langType:b,"string"==typeof a){if(!_language[b])return"no language";var c=a.length-1;if("."===a.substr(c))return _language[b][a.substr(0,c)];var d=_parseLangKey(a);return _language[b][d.ns][d.key]}_each(a,function(a,c){var d=_parseLangKey(a);_language[b]||(_language[b]={}),_language[b][d.ns]||(_language[b][d.ns]={}),_language[b][d.ns][d.key]=c})}function _getImageFromRange(a,b){if(!a.collapsed){a=a.cloneRange().up();var c=a.startContainer,d=a.startOffset;if(_WEBKIT||a.isControl()){var e=K(c.childNodes[d]);if(e&&"img"==e.name)return b(e)?e:void 0}}}function _bindContextmenuEvent(){var a=this,b=a.edit.doc;K(b).contextmenu(function(b){if(a.menu&&a.hideMenu(),!a.useContextmenu)return void b.preventDefault();if(0!==a._contextmenus.length){var c=0,d=[];for(_each(a._contextmenus,function(){return"-"==this.title?void d.push(this):void(this.cond&&this.cond()&&(d.push(this),this.width&&this.width>c&&(c=this.width)))});d.length>0&&"-"==d[0].title;)d.shift();for(;d.length>0&&"-"==d[d.length-1].title;)d.pop();var e=null;if(_each(d,function(a){"-"==this.title&&"-"==e.title&&delete d[a],e=this}),d.length>0){b.preventDefault();var f=K(a.edit.iframe).pos(),g=_menu({x:f.x+b.clientX,y:f.y+b.clientY,width:c,css:{visibility:"hidden"},shadowMode:a.shadowMode});_each(d,function(){this.title&&g.addItem(this)});var h=_docElement(g.doc),i=g.div.height();b.clientY+i>=h.clientHeight-100&&g.pos(g.x,_removeUnit(g.y)-i),g.div.css("visibility","visible"),a.menu=g}}})}function _bindNewlineEvent(){function a(a){for(var b=K(a.commonAncestor());b&&(1!=b.type||b.isStyle());)b=b.parent();return b.name}var b=this,c=b.edit.doc,d=b.newlineTag;if(!(_IE&&"br"!==d||_GECKO&&3>_V&&"p"!==d||_OPERA&&9>_V)){var e=_toMap("h1,h2,h3,h4,h5,h6,pre,li"),f=_toMap("p,h1,h2,h3,h4,h5,h6,pre,li,blockquote");K(c).keydown(function(g){if(!(13!=g.which||g.shiftKey||g.ctrlKey||g.altKey)){b.cmd.selection();var h=a(b.cmd.range);if("marquee"!=h&&"select"!=h)return"br"!==d||e[h]?void(f[h]||_nativeCommand(c,"formatblock","<p>")):(g.preventDefault(),void b.insertHtml("<br />"+(_IE&&9>_V?"":"")))}}),K(c).keyup(function(e){if(!(13!=e.which||e.shiftKey||e.ctrlKey||e.altKey)&&"br"!=d){if(_GECKO){var g=b.cmd.commonAncestor("p"),h=b.cmd.commonAncestor("a");return void(h&&""==h.text()&&(h.remove(!0),b.cmd.range.selectNodeContents(g[0]).collapse(!0),b.cmd.select()))}b.cmd.selection();var i=a(b.cmd.range);if("marquee"!=i&&"select"!=i){f[i]||_nativeCommand(c,"formatblock","<p>");var j=b.cmd.commonAncestor("div");if(j){for(var k=K("<p></p>"),l=j[0].firstChild;l;){var m=l.nextSibling;k.append(l),l=m}j.before(k),j.remove(),b.cmd.range.selectNodeContents(k[0]),b.cmd.select()}}}})}}function _bindTabEvent(){var a=this,b=a.edit.doc;K(b).keydown(function(c){if(9==c.which){if(c.preventDefault(),a.afterTab)return void a.afterTab.call(a,c);var d=a.cmd,e=d.range;e.shrink(),e.collapsed&&1==e.startContainer.nodeType&&(e.insertNode(K("@ ",b)[0]),d.select()),a.insertHtml(" ")}})}function _bindFocusEvent(){var a=this;K(a.edit.textarea[0],a.edit.win).focus(function(b){a.afterFocus&&a.afterFocus.call(a,b)}).blur(function(b){a.afterBlur&&a.afterBlur.call(a,b)})}function _removeBookmarkTag(a){return _trim(a.replace(/<span [^>]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/gi,""))}function _removeTempTag(a){return a.replace(/<div[^>]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/gi,"")}function _addBookmarkToStack(a,b){if(0===a.length)return void a.push(b);var c=a[a.length-1];_removeBookmarkTag(b.html)!==_removeBookmarkTag(c.html)&&a.push(b)}function _undoToRedo(a,b){var c,d,e=this,f=e.edit,g=f.doc.body;if(0===a.length)return e;f.designMode?(c=e.cmd.range,d=c.createBookmark(!0),d.html=g.innerHTML):d={html:g.innerHTML},_addBookmarkToStack(b,d);var h=a.pop();return _removeBookmarkTag(d.html)===_removeBookmarkTag(h.html)&&a.length>0&&(h=a.pop()),f.designMode?(f.html(h.html),h.start&&(c.moveToBookmark(h),e.select())):K(g).html(_removeBookmarkTag(h.html)),e}function KEditor(a){function b(a,b){KEditor.prototype[a]===undefined&&(c[a]=b),c.options[a]=b}var c=this;c.options={},_each(a,function(c,d){b(c,a[c])}),_each(K.options,function(a,d){c[a]===undefined&&b(a,d)});var d=K(c.srcElement||"<textarea/>");c.width||(c.width=d[0].style.width||d.width()),c.height||(c.height=d[0].style.height||d.height()),b("width",_undef(c.width,c.minWidth)),b("height",_undef(c.height,c.minHeight)),b("width",_addUnit(c.width)),b("height",_addUnit(c.height)),_MOBILE&&(!_IOS||534>_V)&&(c.designMode=!1),c.srcElement=d,c.initContent="",c.plugin={},c.isCreated=!1,c._handlers={},c._contextmenus=[],c._undoStack=[],c._redoStack=[],c._firstAddBookmark=!0,c.menu=c.contextmenu=null,c.dialogs=[]}function _editor(a){return new KEditor(a)}function _create(a,b){function c(a){return _each(_plugins,function(b,c){_isFunction(c)&&(c.call(a,KindEditor),a._pluginStatus||(a._pluginStatus={}),a._pluginStatus[b]="inited")}),a.create()}if(b=b||{},b.basePath=_undef(b.basePath,K.basePath),b.themesPath=_undef(b.themesPath,b.basePath+"themes/"),b.langPath=_undef(b.langPath,b.basePath+"lang/"),b.pluginsPath=_undef(b.pluginsPath,b.basePath+"plugins/"),_undef(b.loadStyleMode,K.options.loadStyleMode)){var d=_undef(b.themeType,K.options.themeType);_loadStyle(b.themesPath+"default/default.css"),_loadStyle(b.themesPath+d+"/"+d+".css")}var e=K(a);if(e&&0!==e.length){if(e.length>1)return e.each(function(){_create(this,b)}),_instances[0];b.srcElement=e[0];var f=new KEditor(b);return _instances.push(f),_language[f.langType]?c(f):(_loadScript(f.langPath+f.langType+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){c(f)}),f)}}function _eachEditor(a,b){K(a).each(function(a,c){K.each(_instances,function(a,d){return d&&d.srcElement[0]==c?(b.call(d,a),!1):void 0})})}if(!window.KindEditor){window.console||(window.console={}),console.log||(console.log=function(){});var _VERSION="5.1.0 (2018-12-11)",_ua=navigator.userAgent.toLowerCase(),_IE=_ua.indexOf("msie")>-1&&-1==_ua.indexOf("opera"),_NEWIE=-1==_ua.indexOf("msie")&&_ua.indexOf("trident")>-1,_GECKO=_ua.indexOf("gecko")>-1&&-1==_ua.indexOf("khtml"),_WEBKIT=_ua.indexOf("applewebkit")>-1,_OPERA=_ua.indexOf("opera")>-1,_MOBILE=_ua.indexOf("mobile")>-1,_IOS=/ipad|iphone|ipod/.test(_ua),_QUIRKS="CSS1Compat"!=document.compatMode,_IERANGE=!window.getSelection,_matches=/(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua),_V=_matches?_matches[1]:"0",_TIME=(new Date).getTime(),_round=Math.round,K={DEBUG:!1,VERSION:_VERSION,IE:_IE,GECKO:_GECKO,WEBKIT:_WEBKIT,OPERA:_OPERA,V:_V,TIME:_TIME,each:_each,isArray:_isArray,isFunction:_isFunction,inArray:_inArray,inString:_inString,trim:_trim,addUnit:_addUnit,removeUnit:_removeUnit,escape:_escape,unescape:_unescape,toCamel:_toCamel,toHex:_toHex,toMap:_toMap,toArray:_toArray,undef:_undef,invalidUrl:_invalidUrl,addParam:_addParam,extend:_extend,json:_json},_INLINE_TAG_MAP=_toMap("a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),_BLOCK_TAG_MAP=_toMap("address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul,video,audio"),_SINGLE_TAG_MAP=_toMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),_STYLE_TAG_MAP=_toMap("b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u"),_CONTROL_TAG_MAP=_toMap("img,table,input,textarea,button"),_PRE_TAG_MAP=_toMap("pre,style,script"),_NOSPLIT_TAG_MAP=_toMap("html,head,body,td,tr,table,ol,ul,li"),_AUTOCLOSE_TAG_MAP=_toMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),_FILL_ATTR_MAP=_toMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),_VALUE_TAG_MAP=_toMap("input,button,textarea,select");K.basePath=_getBasePath(),K.options={mdu:"editor",autoSave:!1,designMode:!0,fullscreenMode:!1,filterMode:!1,wellFormatMode:!1,shadowMode:!0,loadStyleMode:!0,basePath:K.basePath,themesPath:K.basePath+"themes/",langPath:K.basePath+"lang/",pluginsPath:K.basePath+"plugins/",themeType:"default",langType:"zh-CN",urlType:"",newlineTag:"p",resizeType:1,syncType:"form",pasteType:2,dialogAlignType:"page",useContextmenu:!0,fullscreenShortcut:!1,bodyClass:"ke-content",indentChar:" ",cssPath:"",cssData:"",minWidth:650,minHeight:100,minChangeSize:50,zIndex:811213,remote:!1,remoteDomain:"www.baidu.com",remoteUpload:"",items:["source","|","undo","redo","|","preview","print","template","code","cut","copy","paste","plainpaste","wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","clearhtml","quickformat","selectall","|","fullscreen","/","formatblock","fontname","fontsize","|","forecolor","hilitecolor","bold","italic","underline","strikethrough","lineheight","removeformat","|","image","flash","media","video","audio","insertfile","multiupload","table","hr","baidumap","pagebreak","anchor","link","unlink","|","xiumi","remoteimg","|","about"],noDisableItems:["source","fullscreen"],colorTable:[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]],fontSizeTable:["9px","10px","12px","14px","16px","18px","24px","32px"],htmlTags:{font:["id","class","color","size","face",".background-color"],span:["id","class",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".line-height"],"div,article,section":["id","class","align",".border",".margin",".padding",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".background",".font-style",".text-decoration",".vertical-align",".margin-left",".margin-right"],table:["id","class","border","cellspacing","cellpadding","width","height","align","bordercolor",".padding",".margin",".border","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".background",".width",".height",".border-collapse"],"td,th":["id","class","align","valign","width","height","colspan","rowspan","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".vertical-align",".background",".border"],a:["id","class","href","target","name"],embed:["id","class","src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess","wmode","source"],video:["id","class","src","width","height","type","loop","autoplay","quality",".width",".height","align","preload","poster","controls","data-video","data-src","data-width","data-height","data-autostart","data-loop"],audio:["id","class","src","width","type","loop","autoplay","preload","controls",".width"],img:["id","class","src","width","height","border","alt","title","align",".width",".height",".border"],"p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":["id","class","align",".text-align",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".text-indent",".margin-left",".margin-right"],pre:["id","class"],hr:["id","class",".page-break-after"],"br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del":["id","class"],iframe:["id","class","src","frameborder","width","height",".width",".height"]},layout:'<div class="container"><div class="toolbar"></div><div class="edit"></div><div class="statusbar"></div></div>'};var _useCapture=!1,_INPUT_KEY_MAP=_toMap("8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222"),_CURSORMOVE_KEY_MAP=_toMap("33..40"),_CHANGE_KEY_MAP={};_each(_INPUT_KEY_MAP,function(a,b){_CHANGE_KEY_MAP[a]=b}),_each(_CURSORMOVE_KEY_MAP,function(a,b){_CHANGE_KEY_MAP[a]=b});var _EVENT_PROPS="altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which".split(",");_extend(KEvent,{init:function(a,b){var c=this,d=a.ownerDocument||a.document||a;if(c.event=b,_each(_EVENT_PROPS,function(a,d){c[d]=b[d]}),c.target||(c.target=c.srcElement||d),3===c.target.nodeType&&(c.target=c.target.parentNode),!c.relatedTarget&&c.fromElement&&(c.relatedTarget=c.fromElement===c.target?c.toElement:c.fromElement),null==c.pageX&&null!=c.clientX){var e=d.documentElement,f=d.body;c.pageX=c.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),c.pageY=c.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)}switch(!c.which&&(c.charCode||0===c.charCode?c.charCode:c.keyCode)&&(c.which=c.charCode||c.keyCode),!c.metaKey&&c.ctrlKey&&(c.metaKey=c.ctrlKey),c.which||c.button===undefined||(c.which=1&c.button?1:2&c.button?3:4&c.button?2:0),c.which){case 186:c.which=59;break;case 187:case 107:case 43:c.which=61;break;case 189:case 45:c.which=109;break;case 42:c.which=106;break;case 47:c.which=111;break;case 78:c.which=110}c.which>=96&&c.which<=105&&(c.which-=48)},preventDefault:function(){var a=this.event;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){var a=this.event;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},stop:function(){this.preventDefault(),this.stopPropagation()}});var _eventExpendo="kindeditor_"+_TIME,_eventId=0,_eventData={},_readyFinished=!1;window.attachEvent&&window.attachEvent("onunload",function(){_each(_eventData,function(a,b){b.el&&_unbind(b.el)})}),K.ctrl=_ctrl,K.ready=_ready,K.formatUrl=_formatUrl,K.formatHtml=_formatHtml,K.getCssList=_getCssList,K.getAttrList=_getAttrList,K.mediaType=_mediaType,K.mediaAttrs=_mediaAttrs,K.mediaEmbed=_mediaEmbed,K.mediaImg=_mediaImg,K.clearMsWord=_clearMsWord,K.tmpl=_tmpl;var _getSetAttrDiv=document.createElement("div");_getSetAttrDiv.setAttribute("className","t");var _GET_SET_ATTRIBUTE="t"!==_getSetAttrDiv.className;K.query=_query,K.queryAll=_queryAll,_extend(KNode,{init:function(a){var b=this;a=_isArray(a)?a:[a];for(var c=0,d=0,e=a.length;e>d;d++)a[d]&&(b[d]=a[d].constructor===KNode?a[d][0]:a[d],c++);b.length=c,b.doc=_getDoc(b[0]),b.name=_getNodeName(b[0]),b.type=b.length>0?b[0].nodeType:null,b.win=_getWin(b[0])},each:function(a){for(var b=this,c=0;c<b.length;c++)if(a.call(b[c],c,b[c])===!1)return b;return b},bind:function(a,b){return this.each(function(){_bind(this,a,b)}),this},unbind:function(a,b){return this.each(function(){_unbind(this,a,b)}),this},fire:function(a){return this.length<1?this:(_fire(this[0],a),this)},hasAttr:function(a){return this.length<1?!1:!!_getAttr(this[0],a)},attr:function(a,b){var c=this;return a===undefined?_getAttrList(c.outer()):"object"==typeof a?(_each(a,function(a,b){c.attr(a,b)}),c):b===undefined?(b=c.length<1?null:_getAttr(c[0],a),null===b?"":b):(c.each(function(){_setAttr(this,a,b)}),c)},removeAttr:function(a){return this.each(function(){_removeAttr(this,a)}),this},get:function(a){return this.length<1?null:this[a||0]},eq:function(a){return this.length<1?null:this[a]?new KNode(this[a]):null},hasClass:function(a){return this.length<1?!1:_hasClass(this[0],a)},addClass:function(a){return this.each(function(){_hasClass(this,a)||(this.className=_trim(this.className+" "+a))}),this},removeClass:function(a){return this.each(function(){_hasClass(this,a)&&(this.className=_trim(this.className.replace(new RegExp("(^|\\s)"+a+"(\\s|$)")," ")))}),this},html:function(a){var b=this;return a===undefined?b.length<1||1!=b.type?"":_formatHtml(b[0].innerHTML):(b.each(function(){_setHtml(this,a)}),b)},text:function(){var a=this;return a.length<1?"":_IE?a[0].innerText:a[0].textContent},hasVal:function(){return this.length<1?!1:_hasVal(this[0])},val:function(a){var b=this;return a===undefined?b.length<1?"":b.hasVal()?b[0].value:b.attr("value"):(b.each(function(){_hasVal(this)?this.value=a:_setAttr(this,"value",a)}),b)},css:function(a,b){var c=this;return a===undefined?_getCssList(c.attr("style")):"object"==typeof a?(_each(a,function(a,b){c.css(a,b)}),c):b===undefined?c.length<1?"":c[0].style[_toCamel(a)]||_computedCss(c[0],a)||"":(c.each(function(){this.style[_toCamel(a)]=b}),c)},width:function(a){var b=this;return a===undefined?b.length<1?0:b[0].offsetWidth:b.css("width",_addUnit(a))},height:function(a){var b=this;return a===undefined?b.length<1?0:b[0].offsetHeight:b.css("height",_addUnit(a))},opacity:function(a){return this.each(function(){this.style.opacity===undefined?this.style.filter=1==a?"":"alpha(opacity="+100*a+")":this.style.opacity=1==a?"":a}),this},data:function(a,b){var c=this;return a="kindeditor_data_"+a,b===undefined?c.length<1?null:c[0][a]:(this.each(function(){this[a]=b}),c)},pos:function(){var a=this,b=a[0],c=0,d=0;if(b)if(b.getBoundingClientRect){var e=b.getBoundingClientRect(),f=_getScrollPos(a.doc);c=e.left+f.x,d=e.top+f.y}else for(;b;)c+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;return{x:_round(c),y:_round(d)}},clone:function(a){return new KNode(this.length<1?[]:this[0].cloneNode(a))},append:function(a){return this.each(function(){this.appendChild&&this.appendChild(_get(a))}),this},appendTo:function(a){return this.each(function(){_get(a).appendChild(this)}),this},before:function(a){return this.each(function(){this.parentNode.insertBefore(_get(a),this)}),this},after:function(a){return this.each(function(){this.nextSibling?this.parentNode.insertBefore(_get(a),this.nextSibling):this.parentNode.appendChild(_get(a))}),this},replaceWith:function(a){var b=[];return this.each(function(c,d){_unbind(d);var e=_get(a);d.parentNode.replaceChild(e,d),b.push(e)}),K(b)},empty:function(){var a=this;return a.each(function(a,b){for(var c=b.firstChild;c;){if(!b.parentNode)return;var d=c.nextSibling;c.parentNode.removeChild(c),c=d}}),a},remove:function(a){var b=this;return b.each(function(c,d){if(d.parentNode){if(_unbind(d),a)for(var e=d.firstChild;e;){var f=e.nextSibling;d.parentNode.insertBefore(e,d),e=f}d.parentNode.removeChild(d),delete b[c]}}),b.length=0,b},show:function(a){var b=this;return a===undefined&&(a=b._originDisplay||""),"none"!=b.css("display")?b:b.css("display",a)},hide:function(){var a=this;return a.length<1?a:(a._originDisplay=a[0].style.display,a.css("display","none"))},outer:function(){var a=this;if(a.length<1)return"";var b,c=a.doc.createElement("div");return c.appendChild(a[0].cloneNode(!0)),b=_formatHtml(c.innerHTML),c=null,b},isSingle:function(){return!!_SINGLE_TAG_MAP[this.name]},isInline:function(){return!!_INLINE_TAG_MAP[this.name]},isBlock:function(){return!!_BLOCK_TAG_MAP[this.name]},isStyle:function(){return!!_STYLE_TAG_MAP[this.name]},isControl:function(){return!!_CONTROL_TAG_MAP[this.name]},contains:function(a){return this.length<1?!1:_contains(this[0],_get(a))},parent:function(){if(this.length<1)return null;var a=this[0].parentNode;return a?new KNode(a):null},children:function(){if(this.length<1)return new KNode([]);for(var a=[],b=this[0].firstChild;b;)(3!=b.nodeType||""!==_trim(b.nodeValue))&&a.push(b),b=b.nextSibling;return new KNode(a)},first:function(){var a=this.children();return a.length>0?a.eq(0):null},last:function(){var a=this.children();return a.length>0?a.eq(a.length-1):null},index:function(){if(this.length<1)return-1;for(var a=-1,b=this[0];b;)a++,b=b.previousSibling;return a},prev:function(){if(this.length<1)return null;var a=this[0].previousSibling;return a?new KNode(a):null},next:function(){if(this.length<1)return null;var a=this[0].nextSibling;return a?new KNode(a):null},scan:function(a,b){function c(d){for(var e=b?d.firstChild:d.lastChild;e;){var f=b?e.nextSibling:e.previousSibling;if(a(e)===!1)return!1;if(c(e)===!1)return!1;e=f}}if(!(this.length<1))return b=b===undefined?!0:b,c(this[0]),this}}),_each("blur,focus,focusin,focusout,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error,contextmenu".split(","),function(a,b){KNode.prototype[b]=function(a){return a?this.bind(b,a):this.fire(b)}});var _K=K;K=function(a,b){function c(a){return a[0]||(a=[]),new KNode(a)}if(a!==undefined&&null!==a){if("string"==typeof a){b&&(b=_get(b));var d=a.length;if("@"===a.charAt(0)&&(a=a.substr(1)),a.length!==d||/<.+>/.test(a)){var e=b?b.ownerDocument||b:document,f=e.createElement("div"),g=[];f.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+a;for(var h=0,i=f.childNodes.length;i>h;h++){var j=f.childNodes[h];"__kindeditor_temp_tag__"!=j.id&&g.push(j)}return c(g)}return c(_queryAll(a,b))}return a&&a.constructor===KNode?a:(a.toArray&&(a=a.toArray()),c(_isArray(a)?a:_toArray(arguments)))}},_each(_K,function(a,b){K[a]=b}),K.NodeClass=KNode,window.KindEditor=K;var _START_TO_START=0,_START_TO_END=1,_END_TO_END=2,_END_TO_START=3,_BOOKMARK_ID=0;_extend(KRange,{init:function(a){var b=this;b.startContainer=a,b.startOffset=0,b.endContainer=a,b.endOffset=0,b.collapsed=!0,b.doc=a},commonAncestor:function(){function a(a){for(var b=[];a;)b.push(a),a=a.parentNode;return b}for(var b,c,d=a(this.startContainer),e=a(this.endContainer),f=0,g=d.length,h=e.length;++f&&(b=d[g-f],c=e[h-f],b&&c&&b===c););return d[g-f+1]},setStart:function(a,b){var c=this,d=c.doc;return c.startContainer=a,c.startOffset=b,c.endContainer===d&&(c.endContainer=a,c.endOffset=b),_updateCollapsed(this)},setEnd:function(a,b){var c=this,d=c.doc;return c.endContainer=a,c.endOffset=b,c.startContainer===d&&(c.startContainer=a,c.startOffset=b),_updateCollapsed(this)},setStartBefore:function(a){return this.setStart(a.parentNode||this.doc,K(a).index())},setStartAfter:function(a){return this.setStart(a.parentNode||this.doc,K(a).index()+1)},setEndBefore:function(a){return this.setEnd(a.parentNode||this.doc,K(a).index())},setEndAfter:function(a){return this.setEnd(a.parentNode||this.doc,K(a).index()+1)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){var b=K(a);if(3==b.type||b.isSingle())return this.selectNode(a);var c=b.children();return c.length>0?this.setStartBefore(c[0]).setEndAfter(c[c.length-1]):this.setStart(a,0).setEnd(a,0)},collapse:function(a){return a?this.setEnd(this.startContainer,this.startOffset):this.setStart(this.endContainer,this.endOffset)},compareBoundaryPoints:function(a,b){var c=this.get(),d=b.get();if(!_IERANGE)return c.compareBoundaryPoints(a,d);var e={};e[_START_TO_START]="StartToStart",e[_START_TO_END]="EndToStart",e[_END_TO_END]="EndToEnd",e[_END_TO_START]="StartToEnd";var f=c.compareEndPoints(e[a],d);if(0!==f)return f;var g,h,i,j,k;if((a===_START_TO_START||a===_END_TO_START)&&(g=this.startContainer,j=this.startOffset),(a===_START_TO_END||a===_END_TO_END)&&(g=this.endContainer,j=this.endOffset),(a===_START_TO_START||a===_START_TO_END)&&(h=b.startContainer,k=b.startOffset),(a===_END_TO_END||a===_END_TO_START)&&(h=b.endContainer,k=b.endOffset),g===h){var l=j-k;return l>0?1:0>l?-1:0}for(i=h;i&&i.parentNode!==g;)i=i.parentNode;if(i)return K(i).index()>=j?-1:1;for(i=g;i&&i.parentNode!==h;)i=i.parentNode;return i?K(i).index()>=k?1:-1:(i=K(h).next(),i&&i.contains(g)?1:(i=K(g).next(),i&&i.contains(h)?-1:void 0))},cloneRange:function(){return new KRange(this.doc).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer,this.endOffset)},toString:function(){var a=this.get(),b=_IERANGE?a.text:a.toString();return b.replace(/\r\n|\n|\r/g,"")},cloneContents:function(){return _copyAndDelete(this,!0,!1)},deleteContents:function(){return _copyAndDelete(this,!1,!0)},extractContents:function(){return _copyAndDelete(this,!0,!0)},insertNode:function(a){var b,c,d,e=this,f=e.startContainer,g=e.startOffset,h=e.endContainer,i=e.endOffset,j=1;return"#document-fragment"===a.nodeName.toLowerCase()&&(b=a.firstChild,c=a.lastChild,j=a.childNodes.length),1==f.nodeType?(d=f.childNodes[g],d?(f.insertBefore(a,d),f===h&&(i+=j)):f.appendChild(a)):3==f.nodeType&&(0===g?(f.parentNode.insertBefore(a,f),f.parentNode===h&&(i+=j)):g>=f.nodeValue.length?f.nextSibling?f.parentNode.insertBefore(a,f.nextSibling):f.parentNode.appendChild(a):(d=g>0?f.splitText(g):f,f.parentNode.insertBefore(a,d),f===h&&(h=d,i-=g))),b?e.setStartBefore(b).setEndAfter(c):e.selectNode(a),e.compareBoundaryPoints(_END_TO_END,e.cloneRange().setEnd(h,i))>=1?e:e.setEnd(h,i)},surroundContents:function(a){return a.appendChild(this.extractContents()),this.insertNode(a).selectNode(a)},isControl:function(){var a=this,b=a.startContainer,c=a.startOffset,d=a.endContainer,e=a.endOffset;return 1==b.nodeType&&b===d&&c+1===e&&K(b.childNodes[c]).isControl()},get:function(a){var b,c=this,d=c.doc;if(!_IERANGE){b=d.createRange();try{b.setStart(c.startContainer,c.startOffset),b.setEnd(c.endContainer,c.endOffset)}catch(e){}return b}if(a&&c.isControl())return b=d.body.createControlRange(),b.addElement(c.startContainer.childNodes[c.startOffset]),b;var f=c.cloneRange().down();return b=d.body.createTextRange(),b.setEndPoint("StartToStart",_getEndRange(f.startContainer,f.startOffset)),b.setEndPoint("EndToStart",_getEndRange(f.endContainer,f.endOffset)),b},html:function(){return K(this.cloneContents()).outer()},down:function(){function a(a,c,d){if(1==a.nodeType){var e=K(a).children();if(0!==e.length){var f,g,h,i;c>0&&(f=e.eq(c-1)),c<e.length&&(g=e.eq(c)),f&&3==f.type&&(h=f[0],i=h.nodeValue.length),g&&3==g.type&&(h=g[0],i=0),h&&(d?b.setStart(h,i):b.setEnd(h,i))}}}var b=this;return a(b.startContainer,b.startOffset,!0),a(b.endContainer,b.endOffset,!1),b},up:function(){function a(a,c,d){3==a.nodeType&&(0===c?d?b.setStartBefore(a):b.setEndBefore(a):c==a.nodeValue.length&&(d?b.setStartAfter(a):b.setEndAfter(a)))}var b=this;return a(b.startContainer,b.startOffset,!0),a(b.endContainer,b.endOffset,!1),b},enlarge:function(a){function b(b,d,e){var f,g=K(b);if(!(3==g.type||_NOSPLIT_TAG_MAP[g.name]||!a&&g.isBlock()))if(0===d){for(;!g.prev()&&(f=g.parent(),f&&!_NOSPLIT_TAG_MAP[f.name]&&(a||!f.isBlock()));)g=f;e?c.setStartBefore(g[0]):c.setEndBefore(g[0])}else if(d==g.children().length){for(;!g.next()&&(f=g.parent(),f&&!_NOSPLIT_TAG_MAP[f.name]&&(a||!f.isBlock()));)g=f;e?c.setStartAfter(g[0]):c.setEndAfter(g[0])}}var c=this;return c.up(),b(c.startContainer,c.startOffset,!0),b(c.endContainer,c.endOffset,!1),c},shrink:function(){for(var a,b=this,c=b.collapsed;1==b.startContainer.nodeType&&(a=b.startContainer.childNodes[b.startOffset])&&1==a.nodeType&&!K(a).isSingle();)b.setStart(a,0);if(c)return b.collapse(c);for(;1==b.endContainer.nodeType&&b.endOffset>0&&(a=b.endContainer.childNodes[b.endOffset-1])&&1==a.nodeType&&!K(a).isSingle();)b.setEnd(a,a.childNodes.length);return b},createBookmark:function(a){var b,c=this,d=c.doc,e=K('<span style="display:none;"></span>',d)[0];return e.id="__kindeditor_bookmark_start_"+_BOOKMARK_ID++ +"__",c.collapsed||(b=e.cloneNode(!0),b.id="__kindeditor_bookmark_end_"+_BOOKMARK_ID++ +"__"),b&&c.cloneRange().collapse(!1).insertNode(b).setEndBefore(b),c.insertNode(e).setStartAfter(e),{start:a?"#"+e.id:e,end:b?a?"#"+b.id:b:null}},moveToBookmark:function(a){var b=this,c=b.doc,d=K(a.start,c),e=a.end?K(a.end,c):null;return!d||d.length<1?b:(b.setStartBefore(d[0]),d.remove(),e&&e.length>0?(b.setEndBefore(e[0]),e.remove()):b.collapse(!0),b)},dump:function(){console.log("--------------------"),console.log(3==this.startContainer.nodeType?this.startContainer.nodeValue:this.startContainer,this.startOffset),console.log(3==this.endContainer.nodeType?this.endContainer.nodeValue:this.endContainer,this.endOffset)}}),K.RangeClass=KRange,K.range=_range,K.START_TO_START=_START_TO_START,K.START_TO_END=_START_TO_END,K.END_TO_END=_END_TO_END,K.END_TO_START=_END_TO_START,_extend(KCmd,{init:function(a){var b=this,c=a.doc;b.doc=c,b.win=_getWin(c),b.sel=_getSel(c),b.range=a},selection:function(a){var b=this,c=b.doc,d=_getRng(c);return b.sel=_getSel(c),d?(b.range=_range(d),"html"==K(b.range.startContainer).name&&b.range.selectNodeContents(c.body).collapse(!1),b):(a&&b.range.selectNodeContents(c.body).collapse(!1),b)},select:function(a){a=_undef(a,!0);var b,c=this,d=c.sel,e=c.range.cloneRange().shrink(),f=e.startContainer,g=e.startOffset,h=(e.endContainer,e.endOffset,_getDoc(f)),i=c.win,j=!1;if(a&&1==f.nodeType&&e.collapsed){if(_IERANGE){var k=K("<span> </span>",h);e.insertNode(k[0]),b=h.body.createTextRange();try{b.moveToElementText(k[0])}catch(l){}return b.collapse(!1),b.select(),k.remove(),i.focus(),c}if(_WEBKIT){var m=f.childNodes;(K(f).isInline()||g>0&&K(m[g-1]).isInline()||m[g]&&K(m[g]).isInline())&&(e.insertNode(h.createTextNode("")),j=!0)}}if(_IERANGE)try{b=e.get(!0),b.select()}catch(n){}else if(j&&e.collapse(!1),b=e.get(!0),d.removeAllRanges(),d.addRange(b),h!==document){var o=K(b.endContainer).pos();i.scrollTo(o.x,o.y)}return i.focus(),c},wrap:function(a){var b,c=this,d=c.doc,e=c.range;if(b=K(a,d),e.collapsed)return e.shrink(),e.insertNode(b[0]).selectNodeContents(b[0]),c;if(b.isBlock()){for(var f=b.clone(!0),g=f;g.first();)g=g.first();return g.append(e.extractContents()),e.insertNode(f[0]).selectNode(f[0]),c}e.enlarge();var h=e.createBookmark(),i=e.commonAncestor(),j=!1;return K(i).scan(function(a){if(!j&&a==h.start)return void(j=!0);if(j){if(a==h.end)return!1;var c=K(a);if(_inPreElement(c))return;if(3==c.type&&_trim(a.nodeValue).length>0){for(var d;(d=c.parent())&&d.isStyle()&&1==d.children().length;)c=d;_wrapNode(c,b)}}}),e.moveToBookmark(h),c},split:function(a,b){for(var c,d=this.range,e=d.doc,f=d.cloneRange().collapse(a),g=f.startContainer,h=f.startOffset,i=3==g.nodeType?g.parentNode:g,j=!1;i&&i.parentNode;){if(c=K(i),b){if(!c.isStyle())break;if(!_hasAttrOrCss(c,b))break}else if(_NOSPLIT_TAG_MAP[c.name])break;j=!0,i=i.parentNode}if(j){var k=e.createElement("span");d.cloneRange().collapse(!a).insertNode(k),a?f.setStartBefore(i.firstChild).setEnd(g,h):f.setStart(g,h).setEndAfter(i.lastChild);var l=f.extractContents(),m=l.firstChild,n=l.lastChild;a?(f.insertNode(l),d.setStartAfter(n).setEndBefore(k)):(i.appendChild(l),
d.setStartBefore(k).setEndBefore(m));var o=k.parentNode;if(o==d.endContainer){var p=K(k).prev(),q=K(k).next();p&&q&&3==p.type&&3==q.type?d.setEnd(p[0],p[0].nodeValue.length):a||d.setEnd(d.endContainer,d.endOffset-1)}o.removeChild(k)}return this},remove:function(a){var b=this,c=b.doc,d=b.range;if(d.enlarge(),0===d.startOffset){for(var e,f=K(d.startContainer);(e=f.parent())&&e.isStyle()&&1==e.children().length;)f=e;d.setStart(f[0],0),f=K(d.startContainer),f.isBlock()&&_removeAttrOrCss(f,a);var g=f.parent();g&&g.isBlock()&&_removeAttrOrCss(g,a)}var h,i;if(d.collapsed){if(b.split(!0,a),h=d.startContainer,i=d.startOffset,i>0){var j=K(h.childNodes[i-1]);j&&_isEmptyNode(j)&&(j.remove(),d.setStart(h,i-1))}var k=K(h.childNodes[i]);return k&&_isEmptyNode(k)&&k.remove(),_isEmptyNode(h)&&(d.startBefore(h),h.remove()),d.collapse(!0),b}b.split(!0,a),b.split(!1,a);var l=c.createElement("span"),m=c.createElement("span");d.cloneRange().collapse(!1).insertNode(m),d.cloneRange().collapse(!0).insertNode(l);var n=[],o=!1;K(d.commonAncestor()).scan(function(a){return o||a!=l?a==m?!1:void(o&&n.push(a)):void(o=!0)}),K(l).remove(),K(m).remove(),h=d.startContainer,i=d.startOffset;var p=d.endContainer,q=d.endOffset;if(i>0){var r=K(h.childNodes[i-1]);r&&_isEmptyNode(r)&&(r.remove(),d.setStart(h,i-1),h==p&&d.setEnd(p,q-1));var s=K(h.childNodes[i]);s&&_isEmptyNode(s)&&(s.remove(),h==p&&d.setEnd(p,q-1))}var t=K(p.childNodes[d.endOffset]);t&&_isEmptyNode(t)&&t.remove();var u=d.createBookmark(!0);return _each(n,function(b,c){_removeAttrOrCss(K(c),a)}),d.moveToBookmark(u),b},commonNode:function(a){function b(b){for(var c=b,d=b;d;){if(_hasAttrOrCss(K(d),a))return K(d);d=d.parentNode}for(;c&&(c=c.lastChild);)if(_hasAttrOrCss(K(c),a))return K(c);return null}var c=this.range,d=c.endContainer,e=c.endOffset,f=3==d.nodeType||0===e?d:d.childNodes[e-1],g=b(f);if(g)return g;if(1==f.nodeType||3==d.nodeType&&0===e){var h=K(f).prev();if(h)return b(h)}return null},commonAncestor:function(a){function b(b){for(;b;){if(1==b.nodeType&&b.tagName.toLowerCase()===a)return b;b=b.parentNode}return null}var c=this.range,d=c.startContainer,e=c.startOffset,f=c.endContainer,g=c.endOffset,h=3==d.nodeType||0===e?d:d.childNodes[e-1],i=3==f.nodeType||0===g?f:f.childNodes[g-1],j=b(h),k=b(i);return j&&k&&j===k?K(j):null},state:function(a){var b=this,c=b.doc,d=!1;try{d=c.queryCommandState(a)}catch(e){}return d},val:function(a){function b(a){return a.toLowerCase()}var c=this,d=c.doc;c.range;a=b(a);var e,f="";return"fontfamily"===a||"fontname"===a?(f=_nativeCommandValue(d,"fontname"),f=f.replace(/['"]/g,""),b(f)):"formatblock"===a?(f=_nativeCommandValue(d,a),""===f&&(e=c.commonNode({"h1,h2,h3,h4,h5,h6,p,div,pre,address":"*"}),e&&(f=e.name)),"Normal"===f&&(f="p"),b(f)):"fontsize"===a?(e=c.commonNode({"*":".font-size"}),e&&(f=e.css("font-size")),b(f)):"forecolor"===a?(e=c.commonNode({"*":".color"}),e&&(f=e.css("color")),f=_toHex(f),""===f&&(f="default"),b(f)):"hilitecolor"===a?(e=c.commonNode({"*":".background-color"}),e&&(f=e.css("background-color")),f=_toHex(f),""===f&&(f="default"),b(f)):f},toggle:function(a,b){var c=this;return c.commonNode(b)?c.remove(b):c.wrap(a),c.select()},bold:function(){return this.toggle("<strong></strong>",{span:".font-weight=bold",strong:"*",b:"*"})},italic:function(){return this.toggle("<em></em>",{span:".font-style=italic",em:"*",i:"*"})},underline:function(){return this.toggle("<u></u>",{span:".text-decoration=underline",u:"*"})},strikethrough:function(){return this.toggle("<s></s>",{span:".text-decoration=line-through",s:"*"})},forecolor:function(a){return this.wrap('<span style="color:'+a+';"></span>').select()},hilitecolor:function(a){return this.wrap('<span style="background-color:'+a+';"></span>').select()},fontsize:function(a){return this.wrap('<span style="font-size:'+a+';"></span>').select()},fontname:function(a){return this.fontfamily(a)},fontfamily:function(a){return this.wrap('<span style="font-family:'+a+';"></span>').select()},removeformat:function(){var a={"*":".font-weight,.font-style,.text-decoration,.color,.background-color,.font-size,.font-family,.text-indent"},b=_STYLE_TAG_MAP;return _each(b,function(b,c){a[b]="*"}),this.remove(a),this.select()},inserthtml:function(a,b){function c(a,b){b='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+b;var c=a.get();c.item?c.item(0).outerHTML=b:c.pasteHTML(b);var d=a.doc.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d);var f=_toRange(c);a.setEnd(f.endContainer,f.endOffset),a.collapse(!1),e.select(!1)}function d(a,b){var c=a.doc,d=c.createDocumentFragment();K("@"+b,c).each(function(){d.appendChild(this)}),a.deleteContents(),a.insertNode(d),a.collapse(!1),e.select(!1)}var e=this,f=e.range;if(""===a)return e;if(_IERANGE&&b){try{c(f,a)}catch(g){d(f,a)}return e}return d(f,a),e},hr:function(){return this.inserthtml("<hr />")},print:function(){return this.win.print(),this},insertimage:function(a,b,c,d,e,f){b=_undef(b,""),e=_undef(e,0);var g='<img src="'+_escape(a)+'" data-ke-src="'+_escape(a)+'" ';return c&&(g+='width="'+_escape(c)+'" '),d&&(g+='height="'+_escape(d)+'" '),b&&(g+='title="'+_escape(b)+'" '),f&&(g+='align="'+_escape(f)+'" '),g+='alt="'+_escape(b)+'" ',g+="/>",this.inserthtml(g)},createlink:function(a,b){function c(a,b,c){K(a).attr("href",b).attr("data-ke-src",b),c?K(a).attr("target",c):K(a).removeAttr("target")}var d=this,e=d.doc,f=d.range;d.select();var g=d.commonNode({a:"*"});g&&!f.isControl()&&(f.selectNode(g.get()),d.select());var h='<a href="'+_escape(a)+'" data-ke-src="'+_escape(a)+'" ';if(b&&(h+=' target="'+_escape(b)+'"'),f.collapsed)return h+=">"+_escape(a)+"</a>",d.inserthtml(h);if(f.isControl()){var i=K(f.startContainer.childNodes[f.startOffset]);return h+="></a>",i.after(K(h,e)),i.next().append(i),f.selectNode(i[0]),d.select()}var j=f.startContainer,k=f.startOffset,l=f.endContainer,m=f.endOffset;if(1==j.nodeType&&j===l&&k+1===m){var n=j.childNodes[k];if("a"==n.nodeName.toLowerCase())return c(n,a,b),d}return _nativeCommand(e,"createlink","__kindeditor_temp_url__"),K('a[href="__kindeditor_temp_url__"]',e).each(function(){c(this,a,b)}),d},unlink:function(){var a=this,b=a.doc,c=a.range;if(a.select(),c.collapsed){var d=a.commonNode({a:"*"});if(d&&(c.selectNode(d.get()),a.select()),_nativeCommand(b,"unlink",null),_WEBKIT&&"img"===K(c.startContainer).name){var e=K(c.startContainer).parent();"a"===e.name&&e.remove(!0)}}else _nativeCommand(b,"unlink",null);return a}}),_each("formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript".split(","),function(a,b){KCmd.prototype[b]=function(a){var c=this;return c.select(),_nativeCommand(c.doc,b,a),_IERANGE&&_inArray(b,"justifyleft,justifycenter,justifyright,justifyfull".split(","))>=0&&c.selection(),(!_IERANGE||_inArray(b,"formatblock,selectall,insertorderedlist,insertunorderedlist".split(","))>=0)&&c.selection(),c}}),_each("cut,copy,paste".split(","),function(a,b){KCmd.prototype[b]=function(){var a=this;if(!a.doc.queryCommandSupported(b))throw"not supported";return a.select(),_nativeCommand(a.doc,b,null),a}}),K.CmdClass=KCmd,K.cmd=_cmd,_extend(KWidget,{init:function(a){var b=this;if(b.name=a.name||"",b.doc=a.doc||document,b.win=_getWin(b.doc),b.x=_addUnit(a.x),b.y=_addUnit(a.y),b.z=a.z,b.width=_addUnit(a.width),b.height=_addUnit(a.height),b.div=K('<div style="display:block;"></div>'),b.options=a,b._alignEl=a.alignEl,b.width&&b.div.css("width",b.width),b.height&&b.div.css("height",b.height),b.z&&b.div.css({position:"absolute",left:b.x,top:b.y,"z-index":b.z}),!b.z||b.x!==undefined&&b.y!==undefined||b.autoPos(b.width,b.height),a.cls&&b.div.addClass(a.cls),a.shadowMode&&b.div.addClass("ke-shadow"),a.css&&b.div.css(a.css),a.src?K(a.src).replaceWith(b.div):K(b.doc.body).append(b.div),a.html&&b.div.html(a.html),a.autoScroll)if(_IE&&7>_V||_QUIRKS){var c=_getScrollPos();K(b.win).bind("scroll",function(a){var d=_getScrollPos(),e=d.x-c.x,f=d.y-c.y;b.pos(_removeUnit(b.x)+e,_removeUnit(b.y)+f,!1)})}else b.div.css("position","fixed")},pos:function(a,b,c){var d=this;return c=_undef(c,!0),null!==a&&(a=0>a?0:_addUnit(a),d.div.css("left",a),c&&(d.x=a)),null!==b&&(b=0>b?0:_addUnit(b),d.div.css("top",b),c&&(d.y=b)),d},autoPos:function(a,b){var c,d,e=this,f=_removeUnit(a)||0,g=_removeUnit(b)||0,h=_getScrollPos();if(e._alignEl){var i=K(e._alignEl),j=i.pos(),k=_round(i[0].clientWidth/2-f/2),l=_round(i[0].clientHeight/2-g/2);c=0>k?j.x:j.x+k,d=0>l?j.y:j.y+l}else{var m=_docElement(e.doc);c=_round(h.x+(m.clientWidth-f)/2),d=_round(h.y+(m.clientHeight-g)/2)}return _IE&&7>_V||_QUIRKS||(c-=h.x,d-=h.y),e.pos(c,d)},remove:function(){var a=this;return(_IE&&7>_V||_QUIRKS)&&K(a.win).unbind("scroll"),a.div.remove(),_each(a,function(b){a[b]=null}),this},show:function(){return this.div.show(),this},hide:function(){return this.div.hide(),this},draggable:function(a){var b=this;return a=a||{},a.moveEl=b.div,a.moveFn=function(a,c,d,e,f,g){(a+=f)<0&&(a=0),(c+=g)<0&&(c=0),b.pos(a,c)},_drag(a),b}}),K.WidgetClass=KWidget,K.widget=_widget;var html,_direction="";(html=document.getElementsByTagName("html"))&&(_direction=html[0].dir),_extend(KEdit,KWidget,{init:function(a){function b(){var b=_iframeDoc(c.iframe);b.open(),h&&(b.domain=document.domain),b.write(_getInitHtml(d,e,f,g)),b.close(),c.win=c.iframe[0].contentWindow,c.doc=b;var i=_cmd(b);c.afterChange(function(a){i.selection()}),_WEBKIT&&K(b).click(function(a){"img"===K(a.target).name&&(i.selection(!0),i.range.selectNode(a.target),i.select())}),_IE&&(c._mousedownHandler=function(){var a=i.range.cloneRange();a.shrink(),a.isControl()&&c.blur()},K(document).mousedown(c._mousedownHandler),K(b).keydown(function(a){if(8==a.which){i.selection();var b=i.range;b.isControl()&&(b.collapse(!0),K(b.startContainer.childNodes[b.startOffset]).remove(),a.preventDefault())}})),c.cmd=i,c.html(_elementVal(c.srcElement)),_IE?(b.body.disabled=!0,b.body.contentEditable=!0,b.body.removeAttribute("disabled")):b.designMode="on",a.afterCreate&&a.afterCreate.call(c)}var c=this;KEdit.parent.init.call(c,a),c.srcElement=K(a.srcElement),c.div.addClass("ke-edit"),c.designMode=_undef(a.designMode,!0),c.beforeGetHtml=a.beforeGetHtml,c.beforeSetHtml=a.beforeSetHtml,c.afterSetHtml=a.afterSetHtml;var d=_undef(a.themesPath,""),e=a.bodyClass,f=a.cssPath,g=a.cssData,h="res:"!=location.protocol&&location.host.replace(/:\d+/,"")!==document.domain,i="document.open();"+(h?'document.domain="'+document.domain+'";':"")+"document.close();",j=_IE?' src="javascript:void(function(){'+encodeURIComponent(i)+'}())"':"";c.iframe=K('<iframe class="ke-edit-iframe" hidefocus="true" frameborder="0"'+j+"></iframe>").css("width","100%"),c.textarea=K('<textarea class="ke-edit-textarea" hidefocus="true" style="display: none"></textarea>').css("width","100%"),c.tabIndex=isNaN(parseInt(a.tabIndex,10))?c.srcElement.attr("tabindex"):parseInt(a.tabIndex,10),c.iframe.attr("tabindex",c.tabIndex),c.textarea.attr("tabindex",c.tabIndex),h&&c.iframe.bind("load",function(a){c.iframe.unbind("load"),_IE?b():setTimeout(b,0)}),c.div.append(c.iframe),c.div.append(c.textarea),c.srcElement.hide(),!h&&b(),c.codeEditor=CodeMirror.fromTextArea(c.textarea[0],{mode:"htmlmixed",indentUnit:4,indentWithTabs:!0,lineNumbers:!0,lineWrapping:!0,foldGutter:!0,matchBrackets:!0}),c.width&&c.setWidth(c.width),c.height&&c.setHeight(c.height),c.designMode?K(".CodeMirror",c.div).hide():c.iframe.hide()},setWidth:function(a){var b=this;return a=_addUnit(a),b.width=a,b.div.css("width",a),b},setHeight:function(a){var b=this;return a=_addUnit(a),b.height=a,b.div.css("height",a),b.iframe.css("height",a),(_IE&&8>_V||_QUIRKS)&&(a=_addUnit(_removeUnit(a)-2)),b.codeEditor.setSize("100%",a),b},remove:function(){var a=this,b=a.doc;K(b.body).unbind(),K(b).unbind(),K(a.win).unbind(),a._mousedownHandler&&K(document).unbind("mousedown",a._mousedownHandler),_elementVal(a.srcElement,a.html()),a.srcElement.show(),a.iframe.unbind(),KEdit.parent.remove.call(a)},html:function(a,b){var c=this,d=c.doc;if(c.designMode){var e=d.body;return a===undefined?(a=b?"<!doctype html><html>"+e.parentNode.innerHTML+"</html>":e.innerHTML,c.beforeGetHtml&&(a=c.beforeGetHtml(a)),_GECKO&&"<br />"==a&&(a=""),a):(c.beforeSetHtml&&(a=c.beforeSetHtml(a)),_IE&&_V>=9&&(a=a.replace(/(<.*?checked=")checked(".*>)/gi,"$1$2")),K(e).html(a),c.afterSetHtml&&c.afterSetHtml(),c)}return a===undefined?c.codeEditor.getValue():(c.codeEditor.setValue(a),c)},design:function(a){var b,c=this;if(a===undefined?!c.designMode:a){if(!c.designMode){b=c.html(),c.designMode=!0,K(".CodeMirror",c.div).hide(),c.html(b);var d=c.iframe,e=_removeUnit(c.height);d.height(e-2),d.show(),setTimeout(function(){d.height(e)},0)}}else c.designMode&&(b=c.html(),c.designMode=!1,c.html(b),c.iframe.hide(),K(".CodeMirror",c.div).show(),c.codeEditor.refresh());return c.focus()},focus:function(){var a=this;return a.designMode?a.win.focus():a.codeEditor.focus(),a},blur:function(){var a=this;if(_IE){var b=K('<input type="text" style="float:left;width:0;height:0;padding:0;margin:0;border:0;" value="" />',a.div);a.div.append(b),b[0].focus(),b.remove()}else a.designMode?a.win.blur():a.codeEditor.blur();return a},afterChange:function(a){function b(b){setTimeout(function(){a(b)},1)}var c=this,d=c.doc,e=d.body;return K(d).keyup(function(b){b.ctrlKey||b.altKey||!_CHANGE_KEY_MAP[b.which]||a(b)}),K(d).mouseup(a).contextmenu(a),K(c.win).blur(a),K(e).bind("paste",b),K(e).bind("cut",b),c}}),K.EditClass=KEdit,K.edit=_edit,K.iframeDoc=_iframeDoc,_extend(KToolbar,KWidget,{init:function(a){function b(a){var b=K(a);return b.hasClass("ke-outline")?b:b.hasClass("ke-toolbar-icon")?b.parent():void 0}function c(a,c){var d=b(a.target);if(d){if(d.hasClass("ke-disabled"))return;if(d.hasClass("ke-selected"))return;d[c]("ke-on")}}var d=this;KToolbar.parent.init.call(d,a),d.disableMode=_undef(a.disableMode,!1),d.noDisableItemMap=_toMap(_undef(a.noDisableItems,[])),d._itemMap={},d.div.addClass("ke-toolbar").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()}).attr("unselectable","on"),d.div.mouseover(function(a){c(a,"addClass")}).mouseout(function(a){c(a,"removeClass")}).click(function(a){var c=b(a.target);if(c){if(c.hasClass("ke-disabled"))return;d.options.click.call(this,a,c.attr("data-name"))}})},get:function(a){return this._itemMap[a]?this._itemMap[a]:this._itemMap[a]=K("span.ke-icon-"+a,this.div).parent()},select:function(a){return _selectToolbar.call(this,a,function(a){a.addClass("ke-selected")}),self},unselect:function(a){return _selectToolbar.call(this,a,function(a){a.removeClass("ke-selected").removeClass("ke-on")}),self},enable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-disabled"),c.opacity(1)),b},disable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-selected").addClass("ke-disabled"),c.opacity(.5)),b},disableAll:function(a,b){var c=this,d=c.noDisableItemMap;return b&&(d=_toMap(b)),(a===undefined?!c.disableMode:a)?(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.disable(a)}),c.disableMode=!0):(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.enable(a)}),c.disableMode=!1),c}}),K.ToolbarClass=KToolbar,K.toolbar=_toolbar,_extend(KMenu,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KMenu.parent.init.call(b,a),b.centerLineMode=_undef(a.centerLineMode,!0),b.div.addClass("ke-menu").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on")},addItem:function(a){var b=this;if("-"===a.title)return void b.div.append(K('<div class="ke-menu-separator"></div>'));var c=K('<div class="ke-menu-item" unselectable="on"></div>'),d=K('<div class="ke-inline-block ke-menu-item-left"></div>'),e=K('<div class="ke-inline-block ke-menu-item-right"></div>'),f=_addUnit(a.height),g=_undef(a.iconClass,"");b.div.append(c),f&&(c.css("height",f),e.css("line-height",f));var h;return b.centerLineMode&&(h=K('<div class="ke-inline-block ke-menu-item-center"></div>'),f&&h.css("height",f)),c.mouseover(function(a){K(this).addClass("ke-menu-item-on"),h&&h.addClass("ke-menu-item-center-on")}).mouseout(function(a){K(this).removeClass("ke-menu-item-on"),h&&h.removeClass("ke-menu-item-center-on")}).click(function(b){a.click.call(K(this)),b.stopPropagation()}).append(d),h&&c.append(h),c.append(e),a.checked&&(g="ke-icon-checked"),""!==g&&d.html('<span class="ke-inline-block ke-toolbar-icon ke-toolbar-icon-url '+g+'"></span>'),e.html(a.title),b},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),K(".ke-menu-item",a.div[0]).unbind(),KMenu.parent.remove.call(a),a}}),K.MenuClass=KMenu,K.menu=_menu,_extend(KColorPicker,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KColorPicker.parent.init.call(b,a);var c=a.colors||[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]];b.selectedColor=(a.selectedColor||"").toLowerCase(),b._cells=[],b.div.addClass("ke-colorpicker").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on");var d=b.doc.createElement("table");b.div.append(d),d.className="ke-colorpicker-table",d.cellPadding=0,d.cellSpacing=0,d.border=0;var e=d.insertRow(0),f=e.insertCell(0);f.colSpan=c[0].length,b._addAttr(f,"","ke-colorpicker-cell-top");for(var g=0;g<c.length;g++){e=d.insertRow(g+1);for(var h=0;h<c[g].length;h++)f=e.insertCell(h),b._addAttr(f,c[g][h],"ke-colorpicker-cell")}},_addAttr:function(a,b,c){var d=this;a=K(a).addClass(c),d.selectedColor===b.toLowerCase()&&a.addClass("ke-colorpicker-cell-selected"),a.attr("title",b||d.options.noColor),a.mouseover(function(a){K(this).addClass("ke-colorpicker-cell-on")}),a.mouseout(function(a){K(this).removeClass("ke-colorpicker-cell-on")}),a.click(function(a){a.stop(),d.options.click.call(K(this),b)}),b?a.append(K('<div class="ke-colorpicker-cell-color" unselectable="on"></div>').css("background-color",b)):a.html(d.options.noColor),K(a).attr("unselectable","on"),d._cells.push(a)},remove:function(){var a=this;return _each(a._cells,function(){this.unbind()}),KColorPicker.parent.remove.call(a),a}}),K.ColorPickerClass=KColorPicker,K.colorpicker=_colorpicker,_extend(KUploadButton,{init:function(a){var b=this,c=K(a.button),d=a.fieldName||"file",e=(a.url||"",c.text()),f=a.extraParams||{};c[0].className||"";a.afterError=a.afterError||function(a){alert(a)};var g=[];for(var h in f)g.push('<input type="hidden" name="'+h+'" value="'+f[h]+'" />');var i=['<div class="ke-upload-area">',g.join(""),'<button type="button" class="ke-button">'+e+"</button>","</span>",'<input type="file" class="ke-upload-file" name="'+d+'" tabindex="-1" />',"</div>"].join(""),j=K(i,c.doc);c.hide(),c.before(j),b.div=j,b.button=c,b.fileBox=K(".ke-upload-file",j),b.options=a},submit:function(){var a=this,b=new FormData,c=a.options.url,d=a.fileBox[0].files;b.append(a.options.fieldName,d[0]);var e=new XMLHttpRequest;return e.open("POST",c,!0),e.addEventListener("readystatechange",function(){var b=e;if(200!=b.status)a.options.afterError.call(a,b.response);else if(4==b.readyState){var c=K.json(_unescape(b.response));a.options.afterUpload.call(a,c)}}),e.send(b),a},remove:function(){var a=this;return a.fileBox&&a.fileBox.unbind(),a.iframe.remove(),a.div.remove(),a.button.show(),a}}),K.UploadButtonClass=KUploadButton,K.uploadbutton=_uploadbutton,_extend(KDialog,KWidget,{init:function(a){var b=this,c=_undef(a.shadowMode,!0);a.z=a.z||811213,a.shadowMode=!1,a.autoScroll=_undef(a.autoScroll,!0),KDialog.parent.init.call(b,a);var d=a.title,e=K(a.body,b.doc),f=a.previewBtn,g=a.yesBtn,h=a.noBtn,i=a.closeBtn,j=_undef(a.showMask,!0);b.div.addClass("ke-dialog").bind("click,mousedown",function(a){a.stopPropagation()});var k=K('<div class="ke-dialog-content"></div>').appendTo(b.div);_IE&&7>_V?b.iframeMask=K('<iframe src="about:blank" class="ke-dialog-shadow"></iframe>').appendTo(b.div):c&&K('<div class="ke-dialog-shadow"></div>').appendTo(b.div);var l=K('<div class="ke-dialog-header"></div>');k.append(l),l.html(d),b.closeIcon=K('<span class="ke-dialog-icon-close" title="'+i.name+'"></span>').click(i.click),l.append(b.closeIcon),b.draggable({clickEl:l,beforeDrag:a.beforeDrag});var m=K('<div class="ke-dialog-body"></div>');k.append(m),m.append(e);var n=K('<div class="ke-dialog-footer"></div>');if((f||g||h)&&k.append(n),_each([{btn:f,name:"preview"},{btn:g,name:"yes"},{btn:h,name:"no"}],function(){if(this.btn){var a=_createButton(this.btn);a.addClass("ke-dialog-"+this.name),n.append(a)}}),b.height&&m.height(_removeUnit(b.height)-l.height()-n.height()),b.div.width(b.div.width()),b.div.height(b.div.height()),b.mask=null,j){var o=_docElement(b.doc),p=Math.max(o.scrollWidth,o.clientWidth),q=Math.max(o.scrollHeight,o.clientHeight);b.mask=_widget({x:0,y:0,z:b.z-1,cls:"ke-dialog-mask",width:p,height:q})}b.autoPos(b.div.width(),b.div.height()),b.footerDiv=n,b.bodyDiv=m,b.headerDiv=l,b.isLoading=!1},setMaskIndex:function(a){var b=this;b.mask.div.css("z-index",a)},showLoading:function(a){a=_undef(a,"");var b=this,c=b.bodyDiv;return b.loading=K('<div class="ke-dialog-loading"><div class="ke-inline-block ke-dialog-loading-content" style="margin-top:'+Math.round(c.height()/3)+'px;">'+a+"</div></div>").width(c.width()).height(c.height()).css("top",b.headerDiv.height()+"px"),c.css("visibility","hidden").after(b.loading),b.isLoading=!0,b},hideLoading:function(){return this.loading&&this.loading.remove(),this.bodyDiv.css("visibility","visible"),this.isLoading=!1,this},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),a.mask&&a.mask.remove(),a.iframeMask&&a.iframeMask.remove(),a.closeIcon.unbind(),K("input",a.div).unbind(),K("button",a.div).unbind(),a.footerDiv.unbind(),a.bodyDiv.unbind(),a.headerDiv.unbind(),K("iframe",a.div).each(function(){K(this).remove()}),KDialog.parent.remove.call(a),a}}),K.DialogClass=KDialog,K.dialog=_dialog,K.tabs=_tabs,K.loadScript=_loadScript,K.loadStyle=_loadStyle,K.ajax=_ajax;var _plugins={},_language={};KEditor.prototype={lang:function(a){return _lang(a,this.langType)},loadPlugin:function(a,b){var c=this,d=this._pluginStatus;return d||(d=this._pluginStatus={}),_plugins[a]?_isFunction(_plugins[a])?(d[a]||(_plugins[a].call(c,KindEditor),d[a]="inited"),b&&b.call(c),c):(setTimeout(function(){c.loadPlugin(a,b)},100),c):(_plugins[a]="loading",_loadScript(c.pluginsPath+a+"/"+a+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){setTimeout(function(){_plugins[a]&&c.loadPlugin(a,b)},0)}),c)},handler:function(a,b){var c=this;return c._handlers[a]||(c._handlers[a]=[]),_isFunction(b)?(c._handlers[a].push(b),c):(_each(c._handlers[a],function(){b=this.call(c,b)}),b)},clickToolbar:function(a,b){var c=this,d="clickToolbar"+a;return b===undefined?c._handlers[d]?c.handler(d):(c.loadPlugin(a,function(){c.handler(d)}),c):c.handler(d,b)},updateState:function(){var a=this;return _each("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","),function(b,c){a.cmd.state(c)?a.toolbar.select(c):a.toolbar.unselect(c)}),a},addContextmenu:function(a){return this._contextmenus.push(a),this},afterCreate:function(a){return this.handler("afterCreate",a)},beforeRemove:function(a){return this.handler("beforeRemove",a)},beforeGetHtml:function(a){return this.handler("beforeGetHtml",a)},beforeSetHtml:function(a){return this.handler("beforeSetHtml",a)},afterSetHtml:function(a){return this.handler("afterSetHtml",a)},create:function(){function a(){return 0===i.height()?void setTimeout(a,100):void b.resize(d,e,!1)}var b=this,c=b.fullscreenMode;if(b.isCreated)return b;if(b.srcElement.data("kindeditor"))return b;b.srcElement.data("kindeditor","true"),c?_docElement().style.overflow="hidden":_docElement().style.overflow="";var d=c?_docElement().clientWidth+"px":b.width,e=c?_docElement().clientHeight+"px":b.height;(_IE&&8>_V||_QUIRKS)&&(e=_addUnit(_removeUnit(e)+2));var f=b.container=K(b.layout);c?K(document.body).append(f):b.srcElement.before(f);var g=K(".toolbar",f),h=K(".edit",f),i=b.statusbar=K(".statusbar",f);f.removeClass("container").addClass("ke-container ke-container-"+b.themeType).css("width",d),c?(f.css({position:"absolute",left:0,top:0,"z-index":811211}),_GECKO||(b._scrollPos=_getScrollPos()),window.scrollTo(0,0),K(document.body).css({height:"1px",overflow:"hidden"}),K(document.body.parentNode).css("overflow","hidden"),b._fullscreenExecuted=!0):(b._fullscreenExecuted&&(K(document.body).css({height:"",overflow:""}),K(document.body.parentNode).css("overflow","")),b._scrollPos&&window.scrollTo(b._scrollPos.x,b._scrollPos.y));var j=[];K.each(b.items,function(a,c){"|"==c?j.push('<span class="ke-inline-block ke-separator"></span>'):"/"==c?j.push('<div class="ke-hr"></div>'):(j.push('<span class="ke-outline" data-name="'+c+'" title="'+b.lang(c)+'" unselectable="on">'),j.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-'+c+'" unselectable="on"></span></span>'))});var k=b.toolbar=_toolbar({src:g,html:j.join(""),noDisableItems:b.noDisableItems,click:function(a,c){if(a.stop(),b.menu){var d=b.menu.name;if(b.hideMenu(),d===c)return}b.clickToolbar(c)}});i.removeClass("statusbar").addClass("ke-statusbar").append('<div class="ke-statusbar-content"> <div class="ke-statusbar-left">'+b.lang("paths")+': <span class="count-path">body</span> </div><div class="ke-statusbar-right"><span class="count-tips"></span> '+b.lang("words")+': <span class="count-words">0</span></div> <div class="ke-clearfix"></div></div>').append('<span class="ke-statusbar-right-icon"></span>');var l=_removeUnit(e)-k.div.height(),m=b.edit=_edit({height:l>0&&_removeUnit(e)>b.minHeight?l:b.minHeight,src:h,srcElement:b.srcElement,designMode:b.designMode,themesPath:b.themesPath,bodyClass:b.bodyClass,cssPath:b.cssPath,cssData:b.cssData,beforeGetHtml:function(a){return a=b.beforeGetHtml(a),a=_removeBookmarkTag(_removeTempTag(a)),_formatHtml(a,b.filterMode?b.htmlTags:null,b.urlType,b.wellFormatMode,b.indentChar)},beforeSetHtml:function(a){return a=_formatHtml(a,b.filterMode?b.htmlTags:null,"",!1),b.beforeSetHtml(a)},afterSetHtml:function(){b.edit=m=this,b.afterSetHtml()},afterCreate:function(){if(b.edit=m=this,b.cmd=m.cmd,b._docMousedownFn=function(a){b.menu&&b.hideMenu()},K(m.doc,document).mousedown(b._docMousedownFn),_bindContextmenuEvent.call(b),_bindNewlineEvent.call(b),_bindTabEvent.call(b),_bindFocusEvent.call(b),m.afterChange(function(a){if(m.designMode){b.updateState(),b.addBookmark(),b.options.afterChange&&b.options.afterChange.call(b),K(".count-words",i).html(b.count());var c=function(a){for(var b=[];null!=a.parentNode;){for(var c=0,d=0,e=0;e<a.parentNode.childNodes.length;e++){var f=a.parentNode.childNodes[e];f.nodeName==a.nodeName&&(f===a&&(d=c),c++)}b.unshift(a.nodeName.toLowerCase()),a=a.parentNode}return b.slice(1)},d=c(K(m.cmd.range.startContainer)[0]);K(".count-path",i).html(d.join(" > "))}}),m.textarea.keyup(function(a){a.ctrlKey||a.altKey||!_INPUT_KEY_MAP[a.which]||b.options.afterChange&&b.options.afterChange.call(b)}),b.readonlyMode&&b.readonly(),b.isCreated=!0,""===b.initContent&&(b.initContent=b.html()),b._undoStack.length>0){var a=b._undoStack.pop();a.start&&(b.html(a.html),m.cmd.range.moveToBookmark(a),b.select())}b.afterCreate(),b.options.afterCreate&&b.options.afterCreate.call(b),K(".count-words",i).html(b.count())}});return b.autoSave(),b._fullscreenResizeHandler&&(K(window).unbind("resize",b._fullscreenResizeHandler),b._fullscreenResizeHandler=null),a(),c?(b._fullscreenResizeHandler=function(a){b.isCreated&&b.resize(_docElement().clientWidth,_docElement().clientHeight,!1)},K(window).bind("resize",b._fullscreenResizeHandler),k.select("fullscreen"),i.last().css("visibility","hidden")):(_GECKO&&K(window).bind("scroll",function(a){b._scrollPos=_getScrollPos()}),b.resizeType?_drag({moveEl:f,clickEl:i.last(),moveFn:function(a,c,d,e,f,g){e+=g,b.resize(d,e)}}):i.last().css("visibility","hidden")),b},autoSave:function(){var a=this;if(!a.options.autoSave)return a;var b=a.statusbar;if(window.localStorage){var c="content-"+a.options.mdu;console.log(c);var e=window.localStorage.getItem(c);if(null!==e&&(K(".count-tips",b).html(a.lang("autoSaveTip")+", <a href='javascript:;' class='restore'>"+a.lang("autoSaveRestore")+"</a> / <a href='javascript:;' class='discarded'>"+a.lang("autoSaveUndo")+"</a> "),K(".count-tips .restore",b).click(function(){a.html(e),K(".count-tips",b).html(""),window.localStorage.removeItem(c),a.autoSave()}),K(".count-tips .discarded",b).click(function(){K(".count-tips",b).html(""),window.localStorage.removeItem(c),a.autoSave()})),null!==e)return a;a.autoSaveInterval=setInterval(function(){d=new Date;var e=d.getHours(),f=d.getMinutes();e=10>e?"0"+e:e,f=10>f?"0"+f:f;var g=a.html();g.length>0&&(window.localStorage.setItem(c,g),K(".count-tips",b).html(a.lang("autoSave")+" "+e+":"+f+" "),console.log("auto save"))},5e3)}else K(".count-tips",b).html(a.lang("autoSaveError"));return a},clearSave:function(){var a=this;a.autoSaveInterval&&(console.log("clearAutoSave - "+a.autoSaveInterval),clearInterval(a.autoSaveInterval)),console.log("clearAutoSave - content-"+a.options.mdu),window.localStorage.removeItem("content-"+a.options.mdu)},remove:function(){var a=this;return a.isCreated?(a.beforeRemove(),a.srcElement.data("kindeditor",""),a.menu&&a.hideMenu(),_each(a.dialogs,function(){a.hideDialog()}),K(document).unbind("mousedown",a._docMousedownFn),a.toolbar.remove(),a.edit.remove(),a.statusbar.last().unbind(),a.statusbar.unbind(),a.container.remove(),a.clearSave(),a.container=a.toolbar=a.edit=a.menu=null,a.dialogs=[],a.isCreated=!1,a):a},resize:function(a,b,c){var d=this;if(c=_undef(c,!0),a&&(/%/.test(a)||(a=_removeUnit(a),a=a<d.minWidth?d.minWidth:a),d.container.css("width",_addUnit(a)),c&&(d.width=_addUnit(a))),b){b=_removeUnit(b);var e=_removeUnit(b)-d.toolbar.div.height()-d.statusbar.height();e=e<d.minHeight?d.minHeight:e,d.edit.setHeight(e),c&&(d.height=_addUnit(b))}return d},select:function(){return this.isCreated&&this.cmd.select(),this},html:function(a){var b=this;return a===undefined?b.isCreated?b.edit.html():_elementVal(b.srcElement):(b.isCreated?b.edit.html(a):_elementVal(b.srcElement,a),b.isCreated&&b.cmd.selection(),b)},fullHtml:function(){return this.isCreated?this.edit.html(undefined,!0):""},text:function(a){var b=this;return a===undefined?_trim(b.html().replace(/<(?!img|embed).*?>/gi,"").replace(/ /gi," ")):b.html(_escape(a))},isEmpty:function(){return""===_trim(this.text().replace(/\r\n|\n|\r/,""))},isDirty:function(){return _trim(this.initContent.replace(/\r\n|\n|\r|t/g,""))!==_trim(this.html().replace(/\r\n|\n|\r|t/g,""))},selectedHtml:function(){var a=this.isCreated?this.cmd.range.html():"";return a=_removeBookmarkTag(_removeTempTag(a))},count:function(a){var b=this;return a=(a||"html").toLowerCase(),"html"===a?b.html().length:"text"===a?b.text().replace(/<(?:img|embed).*?>/gi,"K").replace(/\r\n|\n|\r/g,"").length:0},exec:function(a){a=a.toLowerCase();var b=this,c=b.cmd,d=_inArray(a,"selectall,copy,paste,print".split(","))<0;return d&&b.addBookmark(!1),c[a].apply(c,_toArray(arguments,1)),d&&(b.updateState(),b.addBookmark(!1),b.options.afterChange&&b.options.afterChange.call(b)),b},insertHtml:function(a,b){return this.isCreated?(a=this.beforeSetHtml(a),this.exec("inserthtml",a,b),this):this},appendHtml:function(a){if(this.html(this.html()+a),this.isCreated){var b=this.cmd;b.range.selectNodeContents(b.doc.body).collapse(!1),b.select()}return this},sync:function(){return _elementVal(this.srcElement,this.html()),this},focus:function(){return this.isCreated?this.edit.focus():this.srcElement[0].focus(),this},blur:function(){return this.isCreated?this.edit.blur():this.srcElement[0].blur(),this},addBookmark:function(a){a=_undef(a,!0);var b,c=this,d=c.edit,e=d.doc.body,f=_removeTempTag(e.innerHTML);
if(a&&c._undoStack.length>0){var g=c._undoStack[c._undoStack.length-1];if(Math.abs(f.length-_removeBookmarkTag(g.html).length)<c.minChangeSize)return c}if(d.designMode&&!c._firstAddBookmark){var h=c.cmd.range;b=h.createBookmark(!0),b.html=_removeTempTag(e.innerHTML),h.moveToBookmark(b)}else b={html:f};return c._firstAddBookmark=!1,_addBookmarkToStack(c._undoStack,b),c},undo:function(){return _undoToRedo.call(this,this._undoStack,this._redoStack)},redo:function(){return _undoToRedo.call(this,this._redoStack,this._undoStack)},fullscreen:function(a){return this.fullscreenMode=a===undefined?!this.fullscreenMode:a,this.addBookmark(!1),this.remove().create()},readonly:function(a){a=_undef(a,!0);var b=this,c=b.edit,d=c.doc;b.designMode?b.toolbar.disableAll(a,[]):_each(b.noDisableItems,function(){b.toolbar[a?"disable":"enable"](this)}),_IE?d.body.contentEditable=!a:d.designMode=a?"off":"on",c.textarea[0].disabled=a},createMenu:function(a){var b=this,c=a.name,d=b.toolbar.get(c),e=d.pos();return a.x=e.x,a.y=e.y+d.height(),a.z=b.options.zIndex,a.shadowMode=_undef(a.shadowMode,b.shadowMode),a.selectedColor!==undefined?(a.cls="ke-colorpicker-"+b.themeType,a.noColor=b.lang("noColor"),b.menu=_colorpicker(a)):(a.cls="ke-menu-"+b.themeType,a.centerLineMode=!1,b.menu=_menu(a)),b.menu},hideMenu:function(){return this.menu.remove(),this.menu=null,this},hideContextmenu:function(){return this.contextmenu.remove(),this.contextmenu=null,this},createDialog:function(a){var b=this;a.name;if(a.z=b.options.zIndex,a.shadowMode=_undef(a.shadowMode,b.shadowMode),a.closeBtn=_undef(a.closeBtn,{name:b.lang("close"),click:function(a){b.hideDialog(),_IE&&b.cmd&&b.cmd.select()}}),a.noBtn=_undef(a.noBtn,{name:b.lang(a.yesBtn?"no":"close"),click:function(a){b.hideDialog(),_IE&&b.cmd&&b.cmd.select()}}),"page"!=b.dialogAlignType&&(a.alignEl=b.container),a.cls="ke-dialog-"+b.themeType,b.dialogs.length>0){var c=b.dialogs[0],d=b.dialogs[b.dialogs.length-1];c.setMaskIndex(d.z+2),a.z=d.z+3,a.showMask=!1}var e=_dialog(a);return b.dialogs.push(e),e},hideDialog:function(){var a=this;if(a.dialogs.length>0&&a.dialogs.pop().remove(),a.dialogs.length>0){var b=a.dialogs[0],c=a.dialogs[a.dialogs.length-1];b.setMaskIndex(c.z-1)}return a},errorDialog:function(a){var b=this,c=b.createDialog({width:750,title:b.lang("uploadError"),body:'<div style="padding:10px 20px;"><iframe frameborder="0" style="width:708px;height:400px;"></iframe></div>'}),d=K("iframe",c.div),e=K.iframeDoc(d);return e.open(),e.write(a),e.close(),K(e.body).css("background-color","#FFF"),d[0].contentWindow.focus(),b},remoteImages:function(){if(console.log("本地化图片",this.remote),!this.remote)return!1;var a=self.container=K(self.layout),b=K(".statusbar",a);K(".count-tips",b).html("解析图片中...");for(var c=this.html(),d=[],e=/<img.+?src=('|")?([^'"]+)('|")?(?:\s+|>)/gim;tem=e.exec(c);)d.push(tem[2]);for(var e=/url\s*\(([^\)]+)\)/gim,f=new RegExp("(\"|'|")","g");tem=e.exec(c);){var g=tem[1];g=g.replace(f,""),d.push(g)}var h=[];for(var i in d){var j=d[i];j.indexOf(this.remoteDomain)<0&&(j.indexOf("http://")>=0||j.indexOf("https://")>=0)&&h.push(j)}if(h.length<=0)return K(".count-tips",b).html("没有需要保存的图片"),!1;K(".count-tips",b).html("保存图片中...");var k=this;return K.ajax(this.remoteUpload,function(a){if(console.log("替换远程图片",a),a.error)return alert(a.message),K(".count-tips",b).html(""),!1;if(a.files.length<=0)return K(".count-tips",b).html(""),!1;var c=k.html();for(var d in h)c=c.replace(h[d],a.files[d]);return k.html(c),K(".count-tips",b).html("图片保存成功"),!0},"POST",{files:h,domain:this.remoteDomain}),!0}};var _instances=[];K.remove=function(a){_eachEditor(a,function(a){this.remove(),_instances.splice(a,1)})},K.sync=function(a){_eachEditor(a,function(){this.sync()})},K.html=function(a,b){_eachEditor(a,function(){this.html(b)})},K.insertHtml=function(a,b){_eachEditor(a,function(){this.insertHtml(b)})},K.appendHtml=function(a,b){_eachEditor(a,function(){this.appendHtml(b)})},K.remoteImages=function(a,b){_eachEditor(a,function(){this.remoteImages(b)})},_IE&&7>_V&&_nativeCommand(document,"BackgroundImageCache",!0),K.EditorClass=KEditor,K.editor=_editor,K.create=_create,K.instances=_instances,K.plugin=_plugin,K.lang=_lang,_plugin("core",function(a){var b=this,c={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};if(b.afterSetHtml(function(){b.options.afterChange&&b.options.afterChange.call(b)}),b.afterCreate(function(){if("form"==b.syncType){for(var c=a(b.srcElement),d=!1;c=c.parent();)if("form"==c.name){d=!0;break}if(d){c.bind("submit",function(c){b.sync(),b.clearSave(),a(window).bind("unload",function(){b.edit.textarea.remove()})});var e=a('[type="reset"]',c);e.click(function(){b.html(b.initContent),b.cmd.selection()}),b.beforeRemove(function(){c.unbind(),e.unbind()})}}}),b.clickToolbar("source",function(){b.edit.designMode?(b.toolbar.disableAll(!0),b.edit.design(!1),b.toolbar.select("source")):(b.toolbar.disableAll(!1),b.edit.design(!0),b.toolbar.unselect("source"),_GECKO?setTimeout(function(){b.cmd.selection()},0):b.cmd.selection()),b.designMode=b.edit.designMode}),b.afterCreate(function(){b.designMode||b.toolbar.disableAll(!0).select("source")}),b.clickToolbar("fullscreen",function(){b.fullscreen()}),b.fullscreenShortcut){var d=!1;b.afterCreate(function(){if(a(b.edit.doc,b.edit.textarea).keyup(function(a){27==a.which&&setTimeout(function(){b.fullscreen()},0)}),d){if(_IE&&!b.designMode)return;b.focus()}d||(d=!0)})}_each("undo,redo".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.clickToolbar(d)})}),b.clickToolbar(d,function(){b[d]()})}),b.clickToolbar("formatblock",function(){var a=b.lang("formatblock.formatBlock"),c={h1:28,h2:24,h3:18,H4:14,p:12},d=b.cmd.val("formatblock"),e=b.createMenu({name:"formatblock",width:"en"==b.langType?200:150});_each(a,function(a,f){var g="font-size:"+c[a]+"px;";"h"===a.charAt(0)&&(g+="font-weight:bold;"),e.addItem({title:'<span style="'+g+'" unselectable="on">'+f+"</span>",height:c[a]+12,checked:d===a||d===f,click:function(){b.select().exec("formatblock","<"+a+">").hideMenu()}})})}),b.clickToolbar("fontname",function(){var a=b.cmd.val("fontname"),c=b.createMenu({name:"fontname",width:150});_each(b.lang("fontname.fontName"),function(d,e){c.addItem({title:'<span style="font-family: '+d+';" unselectable="on">'+e+"</span>",checked:a===d.toLowerCase()||a===e.toLowerCase(),click:function(){b.exec("fontname",d).hideMenu()}})})}),b.clickToolbar("fontsize",function(){var a=b.cmd.val("fontsize"),c=b.createMenu({name:"fontsize",width:150});_each(b.fontSizeTable,function(d,e){c.addItem({title:'<span style="font-size:'+e+';" unselectable="on">'+e+"</span>",height:_removeUnit(e)+12,checked:a===e,click:function(){b.exec("fontsize",e).hideMenu()}})})}),_each("forecolor,hilitecolor".split(","),function(a,c){b.clickToolbar(c,function(){b.createMenu({name:c,selectedColor:b.cmd.val(c)||"default",colors:b.colorTable,click:function(a){b.exec(c,a).hideMenu()}})})}),_each("cut,copy,paste".split(","),function(a,c){b.clickToolbar(c,function(){b.focus();try{b.exec(c,null)}catch(a){alert(b.lang(c+"Error"))}})}),b.clickToolbar("about",function(){var a='<div style="margin:20px;"><div>DuxKindEditor '+_VERSION+'</div><div>Copyright © <a href="https://gitee.com/duxcms/kindeditor/" target="_blank">DuxKindEditor</a> All rights reserved.</div></div>';b.createDialog({name:"about",width:350,title:b.lang("about"),body:a})}),b.plugin.getSelectedLink=function(){return b.cmd.commonAncestor("a")},b.plugin.getSelectedImage=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return!/^ke-\w+$/i.test(a[0].className)})},b.plugin.getSelectedFlash=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-flash"==a[0].className})},b.plugin.getSelectedMedia=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-media"==a[0].className})},b.plugin.getSelectedVideo=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-video"==a[0].className})},b.plugin.getSelectedAudio=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-aduio"==a[0].className})},b.plugin.getSelectedAnchor=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-anchor"==a[0].className})},_each("link,image,flash,media,anchor,video,audio".split(","),function(a,c){var d=c.charAt(0).toUpperCase()+c.substr(1);_each("edit,delete".split(","),function(a,e){b.addContextmenu({title:b.lang(e+d),click:function(){b.loadPlugin(c,function(){b.plugin[c][e](),b.hideMenu()})},cond:b.plugin["getSelected"+d],width:150,iconClass:"edit"==e?"ke-icon-"+c:undefined})}),b.addContextmenu({title:"-"})}),b.plugin.getSelectedTable=function(){return b.cmd.commonAncestor("table")},b.plugin.getSelectedRow=function(){return b.cmd.commonAncestor("tr")},b.plugin.getSelectedCell=function(){return b.cmd.commonAncestor("td")},_each("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,insert,delete".split(","),function(a,c){var d=_inArray(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.getSelectedTable;b.addContextmenu({title:b.lang("table"+c),click:function(){b.loadPlugin("table",function(){b.plugin.table[c](),b.hideMenu()})},cond:d,width:170,iconClass:"ke-icon-table"+c})}),b.addContextmenu({title:"-"}),_each("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.cmd.selection(),b.clickToolbar(d)})}),b.clickToolbar(d,function(){b.focus().exec(d,null)})}),b.afterCreate(function(){function c(){d.range.moveToBookmark(e),d.select(),_WEBKIT&&(a("div."+h,f).each(function(){a(this).after("<br />").remove(!0)}),a("span.Apple-style-span",f).remove(!0),a("span.Apple-tab-span",f).remove(!0),a("span[style]",f).each(function(){"nowrap"==a(this).css("white-space")&&a(this).remove(!0)}),a("meta",f).remove());var c=f[0].innerHTML;f.remove(),""!==c&&(_WEBKIT&&(c=c.replace(/(<br>)\1/gi,"$1")),2===b.pasteType&&(c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(c)?c=_clearMsWord(c,b.filterMode?b.htmlTags:a.options.htmlTags):(c=_formatHtml(c,b.filterMode?b.htmlTags:null),c=b.beforeSetHtml(c))),1===b.pasteType&&(c=c.replace(/ /gi," "),c=c.replace(/\n\s*\n/g,"\n"),c=c.replace(/<br[^>]*>/gi,"\n"),c=c.replace(/<\/p><p[^>]*>/gi,"\n"),c=c.replace(/<[^>]+>/g,""),c=c.replace(/ {2}/g," "),"p"==b.newlineTag?/\n/.test(c)&&(c=c.replace(/^/,"<p>").replace(/$/,"<br /></p>").replace(/\n/g,"<br /></p><p>")):c=c.replace(/\n/g,"<br />$&")),b.insertHtml(c,!0))}var d,e,f,g=b.edit.doc,h="__kindeditor_paste__",i=!1;a(g.body).bind("paste",function(j){if(0===b.pasteType)return void j.stop();if(!i){if(i=!0,a("div."+h,g).remove(),d=b.cmd.selection(),e=d.range.createBookmark(),f=a('<div class="'+h+'"></div>',g).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(e.start).pos().y+"px","white-space":"nowrap"}),a(g.body).append(f),_IE){var k=d.range.get(!0);k.moveToElementText(f[0]),k.select(),k.execCommand("paste"),j.preventDefault()}else d.range.selectNodeContents(f[0]),d.select(),f[0].tabIndex=-1,f[0].focus();setTimeout(function(){c(),i=!1,this.remoteImages()},0)}})}),b.beforeGetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/<div\s+[^>]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b){return unescape(b)}),a=a.replace(/(<input)((?:\s+[^>]*)?>)/gi,function(a,b,c){return/\s+type="[^"]+"/i.test(a)?a:b+' type="text"'+c})),a.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/gi,function(a,b,c,d){return b+_unescape(c).replace(/\s+/g," ")+d}).replace(/<img[^>]*class="?ke-(flash|rm|media|video|audio)"?[^>]*>/gi,function(a,b){var c=_getAttrList(a),d=_getCssList(c.style||""),e=_mediaAttrs(c["data-ke-tag"]),f=_undef(d.width,""),g=_undef(d.height,"");return/px/i.test(f)&&(f=_removeUnit(f)),/px/i.test(g)&&(g=_removeUnit(g)),e.width=_undef(c.width,f),e.height=_undef(c.height,g),e.type=_undef(e.type,b),_mediaEmbed(e)}).replace(/<img[^>]*class="?ke-anchor"?[^>]*>/gi,function(a){var b=_getAttrList(a);return'<a name="'+unescape(b["data-ke-name"])+'"></a>'}).replace(/<div\s+[^>]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return"<script"+unescape(b)+">"+unescape(c)+"</script>"}).replace(/<div\s+[^>]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return"<noscript"+unescape(b)+">"+unescape(c)+"</noscript>"}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/gi,function(a,b,c,d){return a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(a,b,d){return b+_unescape(c)+d}),a=a.replace(/\s+data-ke-src="[^"]*"/i,"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/gi,function(a,b,c){return b+c})}),b.beforeSetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/<input[^>]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/gi,function(a){var b=_getAttrList(a),c=_getCssList(b.style||"");return"none"==c.display?'<div class="ke-display-none" data-ke-input-tag="'+escape(a)+'"></div>':a})),a.replace(/<(embed|video|audio)[^>]*type="([^"]+)"[^>]*>(?:<\/(embed|video|audio)>)?/gi,function(a){var c=_getAttrList(a);return c.src=_undef(c.src,""),c.width=_undef(c.width,0),c.height=_undef(c.height,0),c.type=_undef(c.type,""),_mediaImg(b.themesPath+"common/blank.gif",c)}).replace(/<a[^>]*name="([^"]+)"[^>]*>(?:<\/a>)?/gi,function(a){var c=_getAttrList(a);return c.href!==undefined?a:'<img class="ke-anchor" src="'+b.themesPath+'common/anchor.png" data-ke-name="'+escape(c.name)+'" />'}).replace(/<script([^>]*)>([\s\S]*?)<\/script>/gi,function(a,b,c){return'<div class="ke-script" data-ke-script-attr="'+escape(b)+'">'+escape(c)+"</div>"}).replace(/<noscript([^>]*)>([\s\S]*?)<\/noscript>/gi,function(a,b,c){return'<div class="ke-noscript" data-ke-noscript-attr="'+escape(b)+'">'+escape(c)+"</div>"}).replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/gi,function(a,b,c,d,e){return a.match(/\sdata-ke-src="[^"]*"/i)?a:a=b+c+'="'+d+'" data-ke-src="'+_escape(d)+'"'+e}).replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/gi,function(a,b,c){return b+"data-ke-"+c}).replace(/<table[^>]*\s+border="0"[^>]*>/gi,function(a){return a.indexOf("ke-zeroborder")>=0?a:_addClassToTag(a,"ke-zeroborder")})})})}}(window),KindEditor.lang({source:"Source",preview:"Preview",undo:"Undo(Ctrl+Z)",redo:"Redo(Ctrl+Y)",cut:"Cut(Ctrl+X)",copy:"Copy(Ctrl+C)",paste:"Paste(Ctrl+V)",plainpaste:"Paste as plain text",wordpaste:"Paste from Word",selectall:"Select all",justifyleft:"Align left",justifycenter:"Align center",justifyright:"Align right",justifyfull:"Align full",insertorderedlist:"Ordered list",insertunorderedlist:"Unordered list",indent:"Increase indent",outdent:"Decrease indent",subscript:"Subscript",superscript:"Superscript",formatblock:"Paragraph format",fontname:"Font family",fontsize:"Font size",forecolor:"Text color",hilitecolor:"Highlight color",bold:"Bold(Ctrl+B)",italic:"Italic(Ctrl+I)",underline:"Underline(Ctrl+U)",strikethrough:"Strikethrough",removeformat:"Remove format",image:"Image",multiimage:"Multi image",flash:"Flash",media:"Embeded media",table:"Table",tablecell:"Cell",hr:"Insert horizontal line",link:"Link",unlink:"Unlink",fullscreen:"Toggle fullscreen mode",about:"About",print:"Print",filemanager:"File Manager",code:"Insert code",map:"Google Maps",baidumap:"Baidu Maps",lineheight:"Line height",clearhtml:"Clear HTML code",pagebreak:"Insert Page Break",quickformat:"Quick Format",insertfile:"Insert file",template:"Insert Template",anchor:"Anchor",yes:"OK",no:"Cancel",close:"Close",editImage:"Image properties",deleteImage:"Delete image",editFlash:"Flash properties",deleteFlash:"Delete flash",editMedia:"Media properties",deleteMedia:"Delete media",editLink:"Link properties",deleteLink:"Unlink",editAnchor:"Anchor properties",deleteAnchor:"Delete Anchor",tableprop:"Table properties",tablecellprop:"Cell properties",tableinsert:"Insert table",tabledelete:"Delete table",tablecolinsertleft:"Insert column left",tablecolinsertright:"Insert column right",tablerowinsertabove:"Insert row above",tablerowinsertbelow:"Insert row below",tablerowmerge:"Merge down",tablecolmerge:"Merge right",tablerowsplit:"Split row",tablecolsplit:"Split column",tablecoldelete:"Delete column",tablerowdelete:"Delete row",noColor:"Default",pleaseSelectFile:"Please select file.",invalidImg:"Please type valid URL.\nAllowed file extension: jpg,gif,bmp,png",invalidMedia:"Please type valid URL.\nAllowed file extension: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb",invalidWidth:"The width must be number.",invalidHeight:"The height must be number.",invalidBorder:"The border must be number.",invalidUrl:"Please type valid URL.",invalidRows:"Invalid rows.",invalidCols:"Invalid columns.",invalidPadding:"The padding must be number.",invalidSpacing:"The spacing must be number.",invalidJson:"Invalid JSON string.",uploadSuccess:"Upload success.",cutError:"Currently not supported by your browser, use keyboard shortcut(Ctrl+X) instead.",copyError:"Currently not supported by your browser, use keyboard shortcut(Ctrl+C) instead.",pasteError:"Currently not supported by your browser, use keyboard shortcut(Ctrl+V) instead.",ajaxLoading:"Loading ...",uploadLoading:"Uploading ...",uploadError:"Upload Error",autoSave:"Contents of which have been saved",autoSaveError:"Temporary does not support automatic save",autoSaveTip:"Uncommitted data",autoSaveRestore:"restore",autoSaveUndo:"discarded","plainpaste.comment":"Use keyboard shortcut(Ctrl+V) to paste the text into the window.","wordpaste.comment":"Use keyboard shortcut(Ctrl+V) to paste the text into the window.","code.pleaseInput":"Please input code.","link.url":"URL","link.linkType":"Target","link.newWindow":"New window","link.selfWindow":"Same window","flash.url":"URL","flash.size":"Size","flash.width":"Width","flash.height":"Height","flash.upload":"Upload","flash.viewServer":"Browse","media.url":"URL","media.size":"Size","media.width":"Width","media.height":"Height","media.autostart":"Auto start","media.tip":"Only supports youtube and other common video web sites","video.size":"Size","video.tip":"Only supports mp4, webm, FLV format video","video.url":"URL","video.width":"Width","video.height":"Height","video.autostart":"Auto start","video.upload":"Upload","video.viewServer":"Browse","audio.url":"URL","audio.width":"Width","audio.autostart":"Height","audio.loop":"Loop","audio.upload":"Upload","audio.viewServer":"Browse","audio.tip":"Support mp3, wav, ogg vorbis audio only","image.remoteImage":"Insert URL","image.localImage":"Upload","image.remoteUrl":"URL","image.localUrl":"File","image.size":"Size","image.width":"Width","image.height":"Height","image.resetSize":"Reset dimensions","image.align":"Align","image.defaultAlign":"Default","image.leftAlign":"Left","image.rightAlign":"Right","image.imgTitle":"Title","image.upload":"Upload","image.viewServer":"Browse","multiimage.browse":"browse","multiimage.uploadDesc":"Allows users to upload <%=uploadLimit%> files, single files size not exceeding <%=sizeLimit%>","multiimage.startUpload":"Start upload","multiimage.clearAll":"Clear all","multiimage.insertAll":"Insert all","multiimage.pending":"Pending ...","multiimage.download":"diwnload","multiimage.file":"file","filemanager.emptyFolder":"Blank","filemanager.moveup":"Parent folder","filemanager.viewType":"Display: ","filemanager.viewImage":"Thumbnails","filemanager.listImage":"List","filemanager.orderType":"Sorting: ","filemanager.fileName":"By name","filemanager.fileSize":"By size","filemanager.fileType":"By type","insertfile.url":"URL","insertfile.title":"Title","insertfile.upload":"Upload","insertfile.viewServer":"Browse","table.cells":"Cells","table.rows":"Rows","table.cols":"Columns","table.size":"Dimensions","table.width":"Width","table.height":"Height","table.percent":"%","table.px":"px","table.space":"Space","table.padding":"Padding","table.spacing":"Spacing","table.align":"Align","table.textAlign":"Horizontal","table.verticalAlign":"Vertical","table.alignDefault":"Default","table.alignLeft":"Left","table.alignCenter":"Center","table.alignRight":"Right","table.alignTop":"Top","table.alignMiddle":"Middle","table.alignBottom":"Bottom","table.alignBaseline":"Baseline","table.border":"Border","table.borderWidth":"Width","table.borderColor":"Color","table.backgroundColor":"Background","map.address":"Address: ","map.search":"Search","baidumap.address":"Address: ","baidumap.search":"Search","baidumap.insertDynamicMap":"Dynamic Map","anchor.name":"Anchor name","formatblock.formatBlock":{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",p:"Normal"},"fontname.fontName":{Arial:"Arial","Arial Black":"Arial Black","Comic Sans MS":"Comic Sans MS","Courier New":"Courier New",Garamond:"Garamond",Georgia:"Georgia",Tahoma:"Tahoma","Times New Roman":"Times New Roman","Trebuchet MS":"Trebuchet MS",Verdana:"Verdana"},"lineheight.lineHeight":[{1:"Line height 1"},{1.5:"Line height 1.5"},{2:"Line height 2"},{2.5:"Line height 2.5"},{3:"Line height 3"}],"template.selectTemplate":"Template","template.replaceContent":"Replace current content","template.fileList":{"1.html":"Image and Text","2.html":"Table","3.html":"List"},words:"words",paths:"paths",xiumi:"xiumi",remoteimg:"远程图片保存"},"en"),KindEditor.options.langType="en",KindEditor.plugin("anchor",function(a){var b=this,c="anchor",d=b.lang(c+".");b.plugin.anchor={edit:function(){var e='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+d.name+'</label><div class="ke-form-controls"><div class="ke-flex-auto"><input type="text" class="ke-input" name="name" /></div></div></div>',f=b.createDialog({name:c,width:300,height:160,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(a){b.insertHtml('<a name="'+h.val()+'">').hideDialog().focus()}}}),g=f.div,h=a('input[name="name"]',g),i=b.plugin.getSelectedAnchor();i&&h.val(unescape(i.attr("data-ke-name"))),h[0].focus(),h[0].select()},"delete":function(){b.plugin.getSelectedAnchor().remove()}},b.clickToolbar(c,b.plugin.anchor.edit)}),KindEditor.plugin("autoheight",function(a){function b(){var a=e.edit,b=a.doc.body;a.iframe[0].scroll="no",b.style.overflowY="hidden"}function c(){if(!e.fullscreenMode){var b=e.edit,c=b.doc.body;b.iframe.height(f),e.resize(null,Math.max((a.IE?c.scrollHeight:c.offsetHeight)+76,f))}}function d(){f=a.removeUnit(e.height),e.edit.afterChange(c),e.fullscreenMode||b(),c()}var e=this;if(e.autoHeightMode){var f;e.isCreated?d():e.afterCreate(d)}}),KindEditor.plugin("baidumap",function(a){var b=this,c="baidumap",d=b.lang(c+"."),e=a.undef(b.mapWidth,558),f=a.undef(b.mapHeight,360);b.clickToolbar(c,function(){function g(){h=p[0].contentWindow,i=a.iframeDoc(p)}var h,i,j=['<div style="padding:10px 20px;">','<div class="ke-header ke-flex">','<div class="ke-flex-auto ke-flex"><div class="ke-margin-right">',d.address+' </div><div class="ke-margin-right"><input id="kindeditor_plugin_map_address" name="address" class="ke-input" value="" /> </div>','<div><button class="ke-button" name="searchBtn" type="button">'+d.search+"</button></div>","</div>","<div>",'<input type="checkbox" id="keInsertDynamicMap" name="insertDynamicMap" value="1" /> <label for="keInsertDynamicMap">'+d.insertDynamicMap+"</label>","</div>","</div>",'<div class="ke-map" style="width:'+e+"px;height:"+f+'px;"></div>',"</div>"].join(""),k=b.createDialog({name:c,width:e+42,title:b.lang(c),body:j,yesBtn:{name:b.lang("yes"),click:function(a){var c=h.map,d=c.getCenter(),g=d.lng+","+d.lat,i=c.getZoom(),j=[o[0].checked?b.pluginsPath+"baidumap/index.html":"//api.map.baidu.com/staticimage","?center="+encodeURIComponent(g),"&zoom="+encodeURIComponent(i),"&width="+e,"&height="+f,"&markers="+encodeURIComponent(g),"&markerStyles="+encodeURIComponent("l,A")].join("");o[0].checked?b.insertHtml('<iframe src="'+j+'" frameborder="0" style="width:'+(e+2)+"px;height:"+(f+2)+'px;"></iframe>'):b.exec("insertimage",j),b.hideDialog().focus()}},beforeRemove:function(){n.remove(),i&&i.write(""),p.remove()}}),l=k.div,m=a('[name="address"]',l),n=a('[name="searchBtn"]',l),o=a('[name="insertDynamicMap"]',k.div),p=a('<iframe class="ke-textarea" frameborder="0" src="'+b.pluginsPath+'baidumap/map.html" style="width:'+e+"px;height:"+f+'px;"></iframe>');p.bind("load",function(){p.unbind("load"),a.IE?g():setTimeout(g,0)}),a(".ke-map",l).replaceWith(p),n.click(function(){h.search(m.val())})})}),KindEditor.plugin("clearhtml",function(a){var b=this,c="clearhtml";b.clickToolbar(c,function(){b.focus();var c=b.html();c=c.replace(/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,""),c=c.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/gi,""),c=a.formatHtml(c,{a:["href","target"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],video:["id","class","src","width","height","type","loop","autostart","quality",".width",".height","align","poster"],img:["src","width","height","border","alt","title",".width",".height"],table:["border"],"td,th":["rowspan","colspan"],"div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":[]}),b.html(c),b.cmd.selection(!0),b.addBookmark()})}),KindEditor.plugin("code",function(a){var b=this,c="code";b.clickToolbar(c,function(){var d=b.lang(c+"."),e=['<div class="ke-form">','<div class="ke-form-group">','<select class="ke-code-type ke-select">','<option value="js">JavaScript</option>','<option value="html">HTML</option>','<option value="css">CSS</option>','<option value="php">PHP</option>','<option value="pl">Perl</option>','<option value="py">Python</option>','<option value="rb">Ruby</option>','<option value="java">Java</option>','<option value="vb">ASP/VB</option>','<option value="cpp">C/C++</option>','<option value="cs">C#</option>','<option value="xml">XML</option>','<option value="bsh">Shell</option>','<option value="">Other</option>',"</select>","</div>",'<div class="ke-form-group"><textarea class="ke-textarea" style="width:100%;height:240px;"></textarea></div>',"</div>"].join(""),f=b.createDialog({name:c,width:450,height:410,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(c){var e=a(".ke-code-type",f.div).val(),h=g.val(),i=""===e?"":" lang-"+e,j='<pre class="prettyprint'+i+'">\n'+a.escape(h)+"</pre> ";return""===a.trim(h)?(alert(d.pleaseInput),void g[0].focus()):void b.insertHtml(j).hideDialog().focus()}}}),g=a("textarea",f.div);g[0].focus()})}),KindEditor.plugin("filemanager",function(a){function b(a,b,c){return a+" ("+Math.ceil(b/1024)+"KB, "+c+")"}function c(a,c){c.is_dir?a.attr("title",c.filename):a.attr("title",b(c.filename,c.filesize,c.datetime))}var d=this,e="filemanager",f=a.undef(d.fileManagerJson,d.basePath+"php/file_manager_json.php"),g=d.pluginsPath+e+"/images/",h=d.lang(e+".");d.plugin.filemanagerDialog=function(b){function i(b,c,e){var g="path="+b+"&order="+c+"&dir="+p;t.showLoading(d.lang("ajaxLoading")),a.ajax(a.addParam(f,g+"&"+(new Date).getTime()),function(a){t.hideLoading(),e(a)})}function j(b,c,d,e){var f=a.formatUrl(c.current_url+d.filename,"absolute"),g=encodeURIComponent(c.current_dir_path+d.filename+"/");d.is_dir?b.click(function(a){i(g,y.val(),e)}):d.is_photo?b.click(function(a){r.call(this,f,d.filename)}):b.click(function(a){r.call(this,f,d.filename)}),z.push(b)}function k(b,c){function d(){"VIEW"==x.val()?i(b.current_dir_path,y.val(),m):i(b.current_dir_path,y.val(),l)}a.each(z,function(){this.unbind()}),w.unbind(),x.unbind(),y.unbind(),b.current_dir_path&&w.click(function(a){i(b.moveup_dir_path,y.val(),c)}),x.change(d),y.change(d),v.html("")}function l(b){k(b,l);var c=document.createElement("table");c.className="ke-table",c.cellPadding=0,c.cellSpacing=0,c.border=0,v.append(c);for(var d=b.file_list,e=0,f=d.length;f>e;e++){var i=d[e],m=a(c.insertRow(e));m.mouseover(function(b){a(this).addClass("ke-on")}).mouseout(function(b){a(this).removeClass("ke-on")});var n=g+(i.is_dir?"folder-16.gif":"file-16.gif"),o=a('<img src="'+n+'" width="16" height="16" alt="'+i.filename+'" align="absmiddle" />'),p=a(m[0].insertCell(0)).addClass("ke-cell ke-name").append(o).append(document.createTextNode(" "+i.filename));!i.is_dir||i.has_file?(m.css("cursor","pointer"),p.attr("title",i.filename),j(p,b,i,l)):p.attr("title",h.emptyFolder),a(m[0].insertCell(1)).addClass("ke-cell ke-size").html(i.is_dir?"-":Math.ceil(i.filesize/1024)+"KB"),a(m[0].insertCell(2)).addClass("ke-cell ke-datetime").html(i.datetime)}}function m(b){k(b,m);for(var d=b.file_list,e=0,f=d.length;f>e;e++){var i=d[e],l=a('<div class="ke-inline-block ke-item"></div>');v.append(l);var n=a('<div class="ke-inline-block ke-photo"></div>').mouseover(function(b){a(this).addClass("ke-on")}).mouseout(function(b){a(this).removeClass("ke-on")});l.append(n);var o=b.current_url+i.filename,p=i.is_dir?g+"folder-64.gif":i.is_photo?o:g+"file-64.gif",q=a('<img src="'+p+'" width="80" height="80" alt="'+i.filename+'" />');!i.is_dir||i.has_file?(n.css("cursor","pointer"),c(n,i),j(n,b,i,m)):n.attr("title",h.emptyFolder),n.append(q),l.append('<div class="ke-name" title="'+i.filename+'">'+i.filename+"</div>")}}var n=a.undef(b.width,670),o=a.undef(b.height,530),p=a.undef(b.dirName,""),q=a.undef(b.viewType,"VIEW").toUpperCase(),r=b.clickFn,s=['<div style="padding:10px;">','<div class="ke-plugin-filemanager-header ke-flex">','<div class="ke-flex-auto ke-margin-top">','<a name="moveupLink" class="" href="javascript:;">'+h.moveup+"</a>","</div>",'<div class="ke-flex ke-form-controls"><div>',h.viewType+'</div> <select class="ke-select" name="viewType">','<option value="VIEW">'+h.viewImage+"</option>",'<option value="LIST">'+h.listImage+"</option>","</select> <div>",h.orderType+'</div> <select class=" ke-select" name="orderType">','<option value="NAME">'+h.fileName+"</option>",'<option value="SIZE">'+h.fileSize+"</option>",'<option value="TYPE">'+h.fileType+"</option>","</select>","</div>",'<div class="ke-clearfix"></div>',"</div>",'<div class="ke-plugin-filemanager-body"></div>',"</div>"].join(""),t=d.createDialog({name:e,width:n,height:o,title:d.lang(e),body:s}),u=t.div,v=a(".ke-plugin-filemanager-body",u),w=(a('[name="moveupImg"]',u),a('[name="moveupLink"]',u)),x=(a('[name="viewServer"]',u),a('[name="viewType"]',u)),y=a('[name="orderType"]',u),z=[];return x.val(q),i("",y.val(),"VIEW"==q?m:l),t}}),KindEditor.plugin("image",function(a){var b=this,c="image",d=a.undef(b.allowImageUpload,!0),e=a.undef(b.allowImageRemote,!0),f=a.undef(b.formatUploadUrl,!0),g=a.undef(b.allowFileManager,!1),h=a.undef(b.uploadJson,b.basePath+"php/upload_json.php"),i=(a.undef(b.imageTabIndex,0),b.pluginsPath+"image/images/"),j=a.undef(b.extraFileUploadParams,{}),k=a.undef(b.filePostName,"imgFile"),l=(a.undef(b.fillDescAfterUploadImage,!1),b.lang(c+"."));b.plugin.imageDialog=function(e){function m(a,b){z.val(a),A.val(b),F=a,G=b}var n=(e.imageUrl,a.undef(e.imageWidth,""),a.undef(e.imageHeight,""),a.undef(e.imageTitle,""),a.undef(e.imageAlign,""),a.undef(e.showRemote,!0)),o=e.clickFn,p=("kindeditor_upload_iframe_"+(new Date).getTime(),[]);for(var q in j)p.push('<input type="hidden" name="'+q+'" value="'+j[q]+'" />');var r='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+l.remoteUrl+'</label><div class="ke-form-controls ke-flex"><input class="ke-input ke-flex-auto" type="text" name="url"><button name="upload" type="button" class="ke-button ke-upload-button">'+l.upload+'</button><button name="viewServer" type="button" class="ke-button">'+l.viewServer+'</button></div></div><div class="ke-form-group"><label class="ke-form-label">'+l.size+'</label><div class="ke-form-controls ke-flex"><div>'+l.width+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="" /></div><div>'+l.height+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="height" value="" /></div><div><img class="ke-refresh-btn" src="'+i+'refresh.png" width="16" height="16" alt="" style="cursor:pointer;" title="'+l.resetSize+'" /></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+l.align+'</label><div class="ke-form-controls ke-flex"><label class="ke-flex-auto"><input type="radio" name="align" value="" checked="checked" /> 居中对齐</label><label class="ke-flex-auto"><input type="radio" name="align" value="left" /> 左对齐</label><label class="ke-flex-auto"><input type="radio" name="align" value="right" /> 右对齐</label></div></div><div class="ke-form-group"><label class="ke-form-label">'+l.imgTitle+'</label><div class="ke-form-controls"><input class="ke-input ke-flex-auto" type="text" name="title"></div></div></div>',s=450,t=280,u=b.createDialog({
name:c,width:s,height:t,title:b.lang(c),body:r,yesBtn:{name:b.lang("yes"),click:function(c){if(!u.isLoading){var d=a.trim(w.val()),e=z.val(),f=A.val(),g=C.val(),h="";return D.each(function(){return this.checked?(h=this.value,!1):void 0}),"http://"==d||a.invalidUrl(d)?(alert(b.lang("invalidUrl")),void w[0].focus()):/^\d*$/.test(e)?/^\d*$/.test(f)?void o.call(b,d,g,e,f,0,h):(alert(b.lang("invalidHeight")),void A[0].focus()):(alert(b.lang("invalidWidth")),void z[0].focus())}}},beforeRemove:function(){y.unbind(),z.unbind(),A.unbind(),B.unbind()}}),v=u.div,w=a('[name="url"]',v),x=(a('[name="localUrl"]',v),a('[name="upload"]',v)),y=a('[name="viewServer"]',v),z=a('.[name="width"]',v),A=a('[name="height"]',v),B=a(".ke-refresh-btn",v),C=a('.[name="title"]',v),D=a('[name="align"]',v);if(d){var E=a.uploadbutton({button:x[0],fieldName:k,url:a.addParam(h,"dir=image"),extraParams:j,afterUpload:function(d){if(u.hideLoading(),0===d.error){var e=d.url;f&&(e=a.formatUrl(e,"absolute")),w.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){u.hideLoading(),b.errorDialog(a)}});E.fileBox.change(function(a){u.showLoading(b.lang("uploadLoading")),E.submit()})}else a(".ke-upload-button",v).hide();g?y.click(function(c){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"VIEW",dirName:"image",clickFn:function(c,d){b.dialogs.length>1&&(a('[name="url"]',v).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):y.hide();var F=0,G=0;return B.click(function(b){var c=a('<img src="'+w.val()+'" />',document).css({position:"absolute",visibility:"hidden",top:0,left:"-1000px"});c.bind("load",function(){m(c.width(),c.height()),c.remove()}),a(document.body).append(c)}),z.change(function(a){F>0&&A.val(Math.round(G/F*parseInt(this.value,10)))}),A.change(function(a){G>0&&z.val(Math.round(F/G*parseInt(this.value,10)))}),w.val(e.imageUrl),m(e.imageWidth,e.imageHeight),C.val(e.imageTitle),D.each(function(){return this.value===e.imageAlign?(this.checked=!0,!1):void 0}),n&&(w[0].focus(),w[0].select()),u},b.plugin.image={edit:function(){var a=b.plugin.getSelectedImage();b.plugin.imageDialog({imageUrl:a?a.attr("data-ke-src"):"http://",imageWidth:a?a.width():"",imageHeight:a?a.height():"",imageTitle:a?a.attr("title"):"",imageAlign:a?a.attr("align"):"",showRemote:e,clickFn:function(c,d,e,f,g,h){a?(a.attr("src",c),a.attr("data-ke-src",c),a.attr("width",e),a.attr("height",f),a.attr("title",d),a.attr("align",h),a.attr("alt",d)):b.exec("insertimage",c,d,e,f,g,h),setTimeout(function(){b.hideDialog().focus()},0)}})},"delete":function(){var a=b.plugin.getSelectedImage();"a"==a.parent().name&&(a=a.parent()),a.remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.image.edit)}),KindEditor.plugin("insertfile",function(a){var b=this,c="insertfile",d=a.undef(b.allowFileUpload,!0),e=a.undef(b.allowFileManager,!1),f=a.undef(b.formatUploadUrl,!0),g=a.undef(b.uploadJson,b.basePath+"php/upload_json.php"),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=b.lang(c+".");b.plugin.fileDialog=function(k){var l=a.undef(k.fileUrl,"http://"),m=a.undef(k.fileTitle,""),n=k.clickFn,o='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+j.url+'</label><div class="ke-form-controls ke-flex"><input class="ke-input ke-flex-auto" type="text" name="url"><button name="upload" type="button" class="ke-button ke-upload-button">'+j.upload+'</button><button name="viewServer" type="button" class="ke-button">'+j.viewServer+'</button></div></div><div class="ke-form-group"><label class="ke-form-label">'+j.title+'</label><div class="ke-form-controls"><input class="ke-input ke-flex-auto" type="text" name="title"></div></div></div>',p=b.createDialog({name:c,width:450,height:200,title:b.lang(c),body:o,yesBtn:{name:b.lang("yes"),click:function(c){var d=a.trim(r.val()),e=t.val();return"http://"==d||a.invalidUrl(d)?(alert(b.lang("invalidUrl")),void r[0].focus()):(""===a.trim(e)&&(e=d),void n.call(b,d,e))}}}),q=p.div,r=a('[name="url"]',q),s=a('[name="viewServer"]',q),t=a('[name="title"]',q);if(d){var u=a.uploadbutton({button:a(".ke-upload-button",q)[0],fieldName:i,url:a.addParam(g,"dir=file"),extraParams:h,afterUpload:function(d){if(p.hideLoading(),0===d.error){var e=d.url;f&&(e=a.formatUrl(e,"absolute")),r.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){p.hideLoading(),b.errorDialog(a)}});u.fileBox.change(function(a){p.showLoading(b.lang("uploadLoading")),u.submit()})}else a(".ke-upload-button",q).hide();e?s.click(function(c){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"file",clickFn:function(c,d){b.dialogs.length>1&&(a('[name="url"]',q).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):s.hide(),r.val(l),t.val(m),r[0].focus(),r[0].select()},b.clickToolbar(c,function(){b.plugin.fileDialog({clickFn:function(a,c){var d='<a class="ke-insertfile" href="'+a+'" data-ke-src="'+a+'" target="_blank">'+c+"</a>";b.insertHtml(d).hideDialog().focus()}})})}),KindEditor.plugin("lineheight",function(a){var b=this,c="lineheight",d=b.lang(c+".");b.clickToolbar(c,function(){var e="",f=b.cmd.commonNode({"*":".line-height"});f&&(e=f.css("line-height"));var g=b.createMenu({name:c,width:150});a.each(d.lineHeight,function(c,d){a.each(d,function(a,c){g.addItem({title:c,checked:e===a,click:function(){b.cmd.toggle('<span style="line-height:'+a+';"></span>',{span:".line-height="+a}),b.updateState(),b.addBookmark(),b.hideMenu()}})})})})}),KindEditor.plugin("link",function(a){var b=this,c="link";b.plugin.link={edit:function(){var d=b.lang(c+"."),e='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+d.url+'</label><div class="ke-form-controls"><input type="text" class="ke-input" name="url" /></div></div><div class="ke-form-group"><label class="ke-form-label">'+d.linkType+'</label><div class="ke-form-controls"><select class="ke-select" id="keType" name="type"></select></div></div></div>';dialog=b.createDialog({name:c,width:450,height:205,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(c){var d=a.trim(urlBox.val());return"http://"==d||a.invalidUrl(d)?(alert(b.lang("invalidUrl")),void urlBox[0].focus()):void b.exec("createlink",d,typeBox.val()).hideDialog().focus()}}}),div=dialog.div,urlBox=a('input[name="url"]',div),typeBox=a('select[name="type"]',div),urlBox.val("http://"),typeBox[0].options[0]=new Option(d.newWindow,"_blank"),typeBox[0].options[1]=new Option(d.selfWindow,""),b.cmd.selection();var f=b.plugin.getSelectedLink();f&&(b.cmd.range.selectNode(f[0]),b.cmd.select(),urlBox.val(f.attr("data-ke-src")),typeBox.val(f.attr("target"))),urlBox[0].focus(),urlBox[0].select()},"delete":function(){b.exec("unlink",null)}},b.clickToolbar(c,b.plugin.link.edit)}),KindEditor.plugin("media",function(a){var b=this,c="media",d=b.lang(c+".");b.plugin.media={edit:function(){var e='<div class="ke-form"><div class="ke-form-help">'+d.tip+'</div><div class="ke-form-group"><label class="ke-form-label">'+d.url+'</label><div class="ke-form-controls"><input class="ke-input ke-flex-auto" type="text" name="url"></div></div><div class="ke-form-group"><label class="ke-form-label">'+d.size+'</label><div class="ke-form-controls ke-flex"><div>'+d.width+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="550" /></div><div>'+d.height+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="height" value="400" /></div></div></div><div class="ke-form-group"><label class="ke-form-label" for="keAutostart">'+d.autostart+'</label><div class="ke-form-controls ke-flex"><input type="checkbox" class="ke-checkbox" id="keAutostart" name="autostart" value="" /></div></div></div>',f=function(b){return b?b=a.trim(b).replace(/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html.*$/i,"player.youku.com/player.php/sid/$1/v.swf").replace(/(www\.)?youtube\.com\/watch\?v=([\w\-]+)/i,"www.youtube.com/v/$2").replace(/youtu.be\/(\w+)$/i,"www.youtube.com/v/$1").replace(/v\.ku6\.com\/.+\/([\w\.]+)\.html.*$/i,"player.ku6.com/refer/$1/v.swf").replace(/www\.56\.com\/u\d+\/v_([\w\-]+)\.html/i,"player.56.com/v_$1.swf").replace(/www.56.com\/w\d+\/play_album\-aid\-\d+_vid\-([^.]+)\.html/i,"player.56.com/v_$1.swf").replace(/v\.pps\.tv\/play_([\w]+)\.html.*$/i,"player.pps.tv/player/sid/$1/v.swf").replace(/www\.letv\.com\/ptv\/vplay\/([\d]+)\.html.*$/i,"i7.imgs.letv.com/player/swfPlayer.swf?id=$1&autoplay=0").replace(/www\.tudou\.com\/programs\/view\/([\w\-]+)\/?/i,"www.tudou.com/v/$1").replace(/v\.qq\.com\/x\/cover\/([\w]+)\.html.*$/i,"imgcache.qq.com/tencentvideo_v1/playerv3/TPout.swf?vid=$1").replace(/v\.qq\.com\/.+[\?\&]vid=([^&]+).*$/i,"imgcache.qq.com/tencentvideo_v1/playerv3/TPout.swf?vid=$1").replace(/v\.qq\.com\/x\/page\/([\w]+)\.html.*$/i,"imgcache.qq.com/tencentvideo_v1/playerv3/TPout.swf?vid=$1").replace(/my\.tv\.sohu\.com\/[\w]+\/[\d]+\/([\d]+)\.shtml.*$/i,"share.vrs.sohu.com/my/v.swf&id=$1"):""},g=b.createDialog({name:c,width:450,height:290,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(c){var d=a.trim(i.val()),e=f(i.val()),g=j.val(),h=k.val();if("http://"==e||a.invalidUrl(e))return alert(b.lang("invalidUrl")),void i[0].focus();if(!/^\d*$/.test(g))return alert(b.lang("invalidWidth")),void j[0].focus();if(!/^\d*$/.test(h))return alert(b.lang("invalidHeight")),void k[0].focus();var m=a.mediaImg(b.themesPath+"common/blank.gif",{source:d,src:e,type:"application/x-shockwave-flash",width:g,height:h,autostart:l[0].checked?"true":"false",loop:"true"});b.insertHtml(m).hideDialog().focus()}}}),h=g.div,i=a('[name="url"]',h),j=a('[name="width"]',h),k=a('[name="height"]',h),l=a('[name="autostart"]',h);i.val("http://");var m=b.plugin.getSelectedMedia();if(m){var n=a.mediaAttrs(m.attr("data-ke-tag"));i.val(n.source),j.val(a.removeUnit(m.css("width"))||n.width||0),k.val(a.removeUnit(m.css("height"))||n.height||0),l[0].checked="true"===n.autostart}i[0].focus(),i[0].select()},"delete":function(){b.plugin.getSelectedMedia().remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.media.edit)}),KindEditor.plugin("video",function(a){var b=this,c="video",d=b.lang(c+"."),e=a.undef(b.allowVideoUpload,!0),f=a.undef(b.allowFileManager,!1),g=a.undef(b.formatUploadUrl,!0),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=a.undef(b.uploadJson,b.basePath+"php/upload_json.php");b.plugin.video={edit:function(){var k='<div class="ke-form"><div class="ke-form-help">'+d.tip+'</div><div class="ke-form-group"><label class="ke-form-label">'+d.url+'</label><div class="ke-form-controls ke-flex"><input class="ke-input ke-flex-auto" type="text" name="url"><button name="upload" type="button" class="ke-button ke-upload-button">'+d.upload+'</button><button name="viewServer" type="button" class="ke-button">'+d.viewServer+'</button></div></div><div class="ke-form-group"><label class="ke-form-label">'+d.size+'</label><div class="ke-form-controls ke-flex"><div>'+d.width+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="550" /></div><div>'+d.height+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="height" value="400" /></div></div></div><div class="ke-form-group"><label class="ke-form-label" for="keAutostart">'+d.autostart+'</label><div class="ke-form-controls ke-flex"><input type="checkbox" class="ke-checkbox" id="keAutostart" name="autostart" value="" /></div></div></div>',l=b.createDialog({name:c,width:450,height:290,title:b.lang(c),body:k,yesBtn:{name:b.lang("yes"),click:function(c){var e=a.trim(n.val()),f=p.val(),g=q.val();if("http://"==e||a.invalidUrl(e))return alert(b.lang("invalidUrl")),void n[0].focus();if(!/^\d*$/.test(f))return alert(b.lang("invalidWidth")),void p[0].focus();if(!/^\d*$/.test(g))return alert(b.lang("invalidHeight")),void q[0].focus();if(!/(mp4|webm|flv)(\?|$)/i.test(e))return n[0].focus(),void alert(d.tip);var h=a.mediaImg(b.themesPath+"common/blank.gif",{"data-src":e,"data-type":a.mediaType(e),"data-width":f,"data-height":g,"data-autostart":r[0].checked?"true":"false","data-loop":!0,type:a.mediaType(e),width:f,height:g,autostart:r[0].checked?"true":"false",loop:"true"});b.insertHtml(h).hideDialog().focus()}}}),m=l.div,n=a('[name="url"]',m),o=a('[name="viewServer"]',m),p=a('[name="width"]',m),q=a('[name="height"]',m),r=a('[name="autostart"]',m);if(n.val("http://"),e){var s=a.uploadbutton({button:a(".ke-upload-button",m)[0],fieldName:i,extraParams:h,url:a.addParam(j,"dir=video"),afterUpload:function(d){if(l.hideLoading(),0===d.error){var e=d.url;g&&(e=a.formatUrl(e,"absolute")),n.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){l.hideLoading(),b.errorDialog(a)}});s.fileBox.change(function(a){l.showLoading(b.lang("uploadLoading")),s.submit()})}else a(".ke-upload-button",m).hide();f?o.click(function(c){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"video",clickFn:function(c,d){b.dialogs.length>1&&(a('[name="url"]',m).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):o.hide();var t=b.plugin.getSelectedVideo();if(t){var u=a.mediaAttrs(t.attr("data-ke-tag"));n.val(u.src),p.val(a.removeUnit(t.css("width"))||u.width||0),q.val(a.removeUnit(t.css("height"))||u.height||0),r[0].checked="true"===u.autostart}n[0].focus(),n[0].select()},"delete":function(){b.plugin.getSelectedVideo().remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.video.edit)}),KindEditor.plugin("audio",function(a){var b=this,c="audio",d=b.lang(c+"."),e=a.undef(b.allowAudioUpload,!0),f=a.undef(b.allowFileManager,!1),g=a.undef(b.formatUploadUrl,!0),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=a.undef(b.uploadJson,b.basePath+"php/upload_json.php");b.plugin.audio={edit:function(){var k='<div class="ke-form"><div class="ke-form-help">'+d.tip+'</div><div class="ke-form-group"><label class="ke-form-label">'+d.url+'</label><div class="ke-form-controls ke-flex"><input class="ke-input ke-flex-auto" type="text" name="url"><button name="upload" type="button" class="ke-button ke-upload-button">'+d.upload+'</button><button name="viewServer" type="button" class="ke-button">'+d.viewServer+'</button></div></div><div class="ke-form-group"><label class="ke-form-label">'+d.width+'</label><div class="ke-form-controls"><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="300" /></div></div><div class="ke-form-group"><label class="ke-form-label" for="keAutostart">'+d.autostart+'</label><div class="ke-form-controls ke-flex"><input type="checkbox" class="ke-checkbox" id="keAutostart" name="autostart" value="" /></div></div><div class="ke-form-group"><label class="ke-form-label" for="keLoop">'+d.loop+'</label><div class="ke-form-controls ke-flex"><input type="checkbox" class="ke-checkbox" id="keLoop" name="loop" value="" /></div></div></div>',l=b.createDialog({name:c,width:450,height:310,title:b.lang(c),body:k,yesBtn:{name:b.lang("yes"),click:function(c){var e=a.trim(n.val()),f=p.val(),g=q.val();if("http://"==e||a.invalidUrl(e))return alert(b.lang("invalidUrl")),void n[0].focus();if(!/^\d*$/.test(f))return alert(b.lang("invalidWidth")),void p[0].focus();if(!/^\d*$/.test(g))return alert(b.lang("invalidHeight")),void q[0].focus();if(!/(mp3|wav|ogg)(\?|$)/i.test(e))return n[0].focus(),void alert(d.tip);var h=a.mediaImg(b.themesPath+"common/blank.gif",{src:e,type:a.mediaType(e),width:f,height:g,autostart:loopBox[0].checked?"true":"false",loop:r[0].checked?"true":"false"});b.insertHtml(h).hideDialog().focus()}}}),m=l.div,n=a('[name="url"]',m),o=a('[name="viewServer"]',m),p=a('[name="width"]',m),q=a('[name="height"]',m),r=a('[name="autostart"]',m);if(loopBox=a('[name="loop"]',m),n.val("http://"),e){var s=a.uploadbutton({button:a(".ke-upload-button",m)[0],fieldName:i,extraParams:h,url:a.addParam(j,"dir=audio"),afterUpload:function(d){if(l.hideLoading(),0===d.error){var e=d.url;g&&(e=a.formatUrl(e,"absolute")),n.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){l.hideLoading(),b.errorDialog(a)}});s.fileBox.change(function(a){l.showLoading(b.lang("uploadLoading")),s.submit()})}else a(".ke-upload-button",m).hide();f?o.click(function(c){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"audio",clickFn:function(c,d){b.dialogs.length>1&&(a('[name="url"]',m).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):o.hide();var t=b.plugin.getSelectedAudio();if(t){var u=a.mediaAttrs(t.attr("data-ke-tag"));n.val(u.src),p.val(a.removeUnit(t.css("width"))||u.width||0),q.val(a.removeUnit(t.css("height"))||u.height||0),r[0].checked="true"===u.autostart,loopBox[0].checked="true"===u.loop}n[0].focus(),n[0].select()},"delete":function(){b.plugin.getSelectedAudio().remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.audio.edit)}),!function(a,b){var c=function(){var a={};return b.apply(a,arguments),a.moxie};"function"==typeof define&&define.amd?define("moxie",[],c):"object"==typeof module&&module.exports?module.exports=c():a.moxie=c()}(this||window,function(){!function(a,b){"use strict";function c(a,b){for(var c,d=[],e=0;e<a.length;++e){if(c=h[a[e]]||f(a[e]),!c)throw"module definition dependecy not found: "+a[e];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){h[a]=e.apply(null,arguments)})}function e(a){return!!h[a]}function f(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function g(c){for(var d=0;d<c.length;d++){for(var e=a,f=c[d],g=f.split(/[.\/]/),i=0;i<g.length-1;++i)e[g[i]]===b&&(e[g[i]]={}),e=e[g[i]];e[g[g.length-1]]=h[f]}}var h={};d("moxie/core/utils/Basic",[],function(){function a(a){var b;return a===b?"undefined":null===a?"null":a.nodeType?"node":{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function b(){return h(!1,!1,arguments)}function c(){return h(!0,!1,arguments)}function d(){return h(!1,!0,arguments)}function e(){return h(!0,!0,arguments)}function f(b){switch(a(b)){case"array":return h(!1,!0,[[],b]);case"object":return h(!1,!0,[{},b]);default:return b}}function g(c){switch(a(c)){case"array":return Array.prototype.slice.call(c);case"object":return b({},c)}return c}function h(b,c,d){var e,f=d[0];return j(d,function(d,i){i>0&&j(d,function(d,i){var j=-1!==n(a(d),["array","object"]);return d===e||b&&f[i]===e?!0:(j&&c&&(d=g(d)),void(a(f[i])===a(d)&&j?h(b,c,[f[i],d]):f[i]=d))})}),f}function i(a,b){function c(){this.constructor=a}for(var d in b)({}).hasOwnProperty.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.parent=b.prototype,a}function j(a,b){var c,d,e,f;if(a){try{c=a.length}catch(g){c=f}if(c===f||"number"!=typeof c){for(d in a)if(a.hasOwnProperty(d)&&b(a[d],d)===!1)return}else for(e=0;c>e;e++)if(b(a[e],e)===!1)return}}function k(b){var c;if(!b||"object"!==a(b))return!0;for(c in b)return!1;return!0}function l(b,c){function d(e){"function"===a(b[e])&&b[e](function(a){++e<f&&!a?d(e):c(a)})}var e=0,f=b.length;"function"!==a(c)&&(c=function(){}),b&&b.length||c(),d(e)}function m(a,b){var c=0,d=a.length,e=new Array(d);j(a,function(a,f){a(function(a){if(a)return b(a);var g=[].slice.call(arguments);g.shift(),e[f]=g,c++,c===d&&(e.unshift(null),b.apply(this,e))})})}function n(a,b){if(b){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(b,a);for(var c=0,d=b.length;d>c;c++)if(b[c]===a)return c}return-1}function o(b,c){var d=[];"array"!==a(b)&&(b=[b]),"array"!==a(c)&&(c=[c]);for(var e in b)-1===n(b[e],c)&&d.push(b[e]);return d.length?d:!1}function p(a,b){var c=[];return j(a,function(a){-1!==n(a,b)&&c.push(a)}),c.length?c:null}function q(a){var b,c=[];for(b=0;b<a.length;b++)c[b]=a[b];return c}function r(a){return a?String.prototype.trim?String.prototype.trim.call(a):a.toString().replace(/^\s*/,"").replace(/\s*$/,""):a}function s(a){if("string"!=typeof a)return a;var b,c={t:1099511627776,g:1073741824,m:1048576,k:1024};return a=/^([0-9\.]+)([tmgk]?)$/.exec(a.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),b=a[2],a=+a[1],c.hasOwnProperty(b)&&(a*=c[b]),Math.floor(a)}function t(a){var b=[].slice.call(arguments,1);return a.replace(/%([a-z])/g,function(a,c){var d=b.shift();switch(c){case"s":return d+"";case"d":return parseInt(d,10);case"f":return parseFloat(d);case"c":return"";default:return d}})}function u(a,b){var c=this;setTimeout(function(){a.call(c)},b||1)}var v=function(){var a=0;return function(b){var c,d=(new Date).getTime().toString(32);for(c=0;5>c;c++)d+=Math.floor(65535*Math.random()).toString(32);return(b||"o_")+d+(a++).toString(32)}}();return{guid:v,typeOf:a,extend:b,extendIf:c,extendImmutable:d,extendImmutableIf:e,clone:f,inherit:i,each:j,isEmptyObj:k,inSeries:l,inParallel:m,inArray:n,arrayDiff:o,arrayIntersect:p,toArray:q,trim:r,sprintf:t,parseSizeStr:s,delay:u}}),d("moxie/core/utils/Encode",[],function(){var a=function(a){return unescape(encodeURIComponent(a))},b=function(a){return decodeURIComponent(escape(a))},c=function(a,c){if("function"==typeof window.atob)return c?b(window.atob(a)):window.atob(a);var d,e,f,g,h,i,j,k,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,n=0,o="",p=[];if(!a)return a;a+="";do g=l.indexOf(a.charAt(m++)),h=l.indexOf(a.charAt(m++)),i=l.indexOf(a.charAt(m++)),j=l.indexOf(a.charAt(m++)),k=g<<18|h<<12|i<<6|j,d=255&k>>16,e=255&k>>8,f=255&k,p[n++]=64==i?String.fromCharCode(d):64==j?String.fromCharCode(d,e):String.fromCharCode(d,e,f);while(m<a.length);return o=p.join(""),c?b(o):o},d=function(b,c){if(c&&(b=a(b)),"function"==typeof window.btoa)return window.btoa(b);var d,e,f,g,h,i,j,k,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,n=0,o="",p=[];if(!b)return b;do d=b.charCodeAt(m++),e=b.charCodeAt(m++),f=b.charCodeAt(m++),k=d<<16|e<<8|f,g=63&k>>18,h=63&k>>12,i=63&k>>6,j=63&k,p[n++]=l.charAt(g)+l.charAt(h)+l.charAt(i)+l.charAt(j);while(m<b.length);o=p.join("");var q=b.length%3;return(q?o.slice(0,q-3):o)+"===".slice(q||3)};return{utf8_encode:a,utf8_decode:b,atob:c,btoa:d}}),d("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(a){function c(a,b,c){var d=0,e=0,f=0,g={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},h=function(a){return a=(""+a).replace(/[_\-+]/g,"."),a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),a.length?a.split("."):[-8]},i=function(a){return a?isNaN(a)?g[a]||-7:parseInt(a,10):0};for(a=h(a),b=h(b),e=Math.max(a.length,b.length),d=0;e>d;d++)if(a[d]!=b[d]){if(a[d]=i(a[d]),b[d]=i(b[d]),a[d]<b[d]){f=-1;break}if(a[d]>b[d]){f=1;break}}if(!c)return f;switch(c){case">":case"gt":return f>0;case">=":case"ge":return f>=0;case"<=":case"le":return 0>=f;case"==":case"=":case"eq":return 0===f;case"<>":case"!=":case"ne":return 0!==f;case"":case"<":case"lt":return 0>f;default:return null}}var d=function(a){var b="",c="?",d="function",e="undefined",f="object",g="name",h="version",i={has:function(a,b){return-1!==b.toLowerCase().indexOf(a.toLowerCase())},lowerize:function(a){return a.toLowerCase()}},j={rgx:function(){for(var b,c,g,h,i,j,k,l=0,m=arguments;l<m.length;l+=2){var n=m[l],o=m[l+1];if(typeof b===e){b={};for(h in o)i=o[h],typeof i===f?b[i[0]]=a:b[i]=a}for(c=g=0;c<n.length;c++)if(j=n[c].exec(this.getUA())){for(h=0;h<o.length;h++)k=j[++g],i=o[h],typeof i===f&&i.length>0?2==i.length?b[i[0]]=typeof i[1]==d?i[1].call(this,k):i[1]:3==i.length?b[i[0]]=typeof i[1]!==d||i[1].exec&&i[1].test?k?k.replace(i[1],i[2]):a:k?i[1].call(this,k,i[2]):a:4==i.length&&(b[i[0]]=k?i[3].call(this,k.replace(i[1],i[2])):a):b[i]=k?k:a;break}if(j)break}return b},str:function(b,d){for(var e in d)if(typeof d[e]===f&&d[e].length>0){for(var g=0;g<d[e].length;g++)if(i.has(d[e][g],b))return e===c?a:e}else if(i.has(d[e],b))return e===c?a:e;return b}},k={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},l={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[g,h],[/\s(opr)\/([\w\.]+)/i],[[g,"Opera"],h],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[g,h],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[g,"IE"],h],[/(edge)\/((\d+)?[\w\.]+)/i],[g,h],[/(yabrowser)\/([\w\.]+)/i],[[g,"Yandex"],h],[/(comodo_dragon)\/([\w\.]+)/i],[[g,/_/g," "],h],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[g,h],[/(dolfin)\/([\w\.]+)/i],[[g,"Dolphin"],h],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[g,"Chrome"],h],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[h,[g,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[h,[g,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[h,[g,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[h,[g,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[h,g],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[g,[h,j.str,k.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[g,h],[/(navigator|netscape)\/([\w\.-]+)/i],[[g,"Netscape"],h],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[g,h]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[h,[g,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[g,h],[/rv\:([\w\.]+).*(gecko)/i],[h,g]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[g,h],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[g,[h,j.str,k.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[g,"Windows"],[h,j.str,k.os.windows.version]],[/\((bb)(10);/i],[[g,"BlackBerry"],h],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[g,h],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[g,"Symbian"],h],[/\((series40);/i],[g],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[g,"Firefox OS"],h],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[g,h],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[g,"Chromium OS"],h],[/(sunos)\s?([\w\.]+\d)*/i],[[g,"Solaris"],h],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[g,h],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[g,"iOS"],[h,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[g,"Mac OS"],[h,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[g,h]]},m=function(a){var c=a||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:b);this.getBrowser=function(){return j.rgx.apply(this,l.browser)},this.getEngine=function(){return j.rgx.apply(this,l.engine)},this.getOS=function(){return j.rgx.apply(this,l.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return c},this.setUA=function(a){return c=a,this},this.setUA(c)};return m}(),e=function(){var c={access_global_ns:function(){return!!window.moxie},define_property:function(){return!1}(),create_canvas:function(){var a=document.createElement("canvas"),b=!(!a.getContext||!a.getContext("2d"));return c.create_canvas=b,b},return_response_type:function(b){try{if(-1!==a.inArray(b,["","text","document"]))return!0;if(window.XMLHttpRequest){var c=new XMLHttpRequest;if(c.open("get","/"),"responseType"in c)return c.responseType=b,c.responseType!==b?!1:!0}}catch(d){}return!1},use_blob_uri:function(){var a=window.URL;return c.use_blob_uri=a&&"createObjectURL"in a&&"revokeObjectURL"in a&&("IE"!==g.browser||g.verComp(g.version,"11.0.46",">=")),c.use_blob_uri},use_data_uri:function(){var a=new Image;return a.onload=function(){c.use_data_uri=1===a.width&&1===a.height},setTimeout(function(){a.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return c.use_data_uri&&("IE"!==g.browser||g.version>=9)},use_data_uri_of:function(a){return c.use_data_uri&&33e3>a||c.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var a=document.createElement("input");return a.setAttribute("type","file"),c.use_fileinput=!a.disabled},use_webgl:function(){var a,d=document.createElement("canvas"),e=null;try{e=d.getContext("webgl")||d.getContext("experimental-webgl")}catch(f){}return e||(e=null),a=!!e,c.use_webgl=a,d=b,a}};return function(b){var d=[].slice.call(arguments);return d.shift(),"function"===a.typeOf(c[b])?c[b].apply(this,d):!!c[b]}}(),f=(new d).getResult(),g={can:e,uaParser:d,browser:f.browser.name,version:f.browser.version,os:f.os.name,osVersion:f.os.version,verComp:c,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return g.OS=g.os,g}),d("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(a){function b(a,b){var c;for(c in a)if(a[c]===b)return c;return null}return{RuntimeError:function(){function c(a,c){this.code=a,this.name=b(d,a),this.message=this.name+(c||": RuntimeError "+this.code)}var d={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return a.extend(c,d),c.prototype=Error.prototype,c}(),OperationNotAllowedException:function(){function b(a){this.code=a,this.name="OperationNotAllowedException"}return a.extend(b,{NOT_ALLOWED_ERR:1}),b.prototype=Error.prototype,b}(),ImageError:function(){function c(a){this.code=a,this.name=b(d,a),this.message=this.name+": ImageError "+this.code}var d={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return a.extend(c,d),c.prototype=Error.prototype,c}(),FileException:function(){function c(a){this.code=a,this.name=b(d,a),this.message=this.name+": FileException "+this.code}var d={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return a.extend(c,d),c.prototype=Error.prototype,c}(),DOMException:function(){function c(a){this.code=a,this.name=b(d,a),this.message=this.name+": DOMException "+this.code}var d={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,
WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return a.extend(c,d),c.prototype=Error.prototype,c}(),EventException:function(){function b(a){this.code=a,this.name="EventException"}return a.extend(b,{UNSPECIFIED_EVENT_TYPE_ERR:0}),b.prototype=Error.prototype,b}()}}),d("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(a){var b=function(a){return"string"!=typeof a?a:document.getElementById(a)},c=function(a,b){if(!a.className)return!1;var c=new RegExp("(^|\\s+)"+b+"(\\s+|$)");return c.test(a.className)},d=function(a,b){c(a,b)||(a.className=a.className?a.className.replace(/\s+$/,"")+" "+b:b)},e=function(a,b){if(a.className){var c=new RegExp("(^|\\s+)"+b+"(\\s+|$)");a.className=a.className.replace(c,function(a,b,c){return" "===b&&" "===c?" ":""})}},f=function(a,b){return a.currentStyle?a.currentStyle[b]:window.getComputedStyle?window.getComputedStyle(a,null)[b]:void 0},g=function(b,c){function d(a){var b,c,d=0,e=0;return a&&(c=a.getBoundingClientRect(),b="CSS1Compat"===j.compatMode?j.documentElement:j.body,d=c.left+b.scrollLeft,e=c.top+b.scrollTop),{x:d,y:e}}var e,f,g,h=0,i=0,j=document;if(b=b,c=c||j.body,b&&b.getBoundingClientRect&&"IE"===a.browser&&(!j.documentMode||j.documentMode<8))return f=d(b),g=d(c),{x:f.x-g.x,y:f.y-g.y};for(e=b;e&&e!=c&&e.nodeType;)h+=e.offsetLeft||0,i+=e.offsetTop||0,e=e.offsetParent;for(e=b.parentNode;e&&e!=c&&e.nodeType;)h-=e.scrollLeft||0,i-=e.scrollTop||0,e=e.parentNode;return{x:h,y:i}},h=function(a){return{w:a.offsetWidth||a.clientWidth,h:a.offsetHeight||a.clientHeight}};return{get:b,hasClass:c,addClass:d,removeClass:e,getStyle:f,getPos:g,getSize:h}}),d("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(a,b,c){function d(){this.uid=c.guid()}var e={};return c.extend(d.prototype,{init:function(){this.uid||(this.uid=c.guid("uid_"))},addEventListener:function(a,b,d,f){var g,h=this;return this.hasOwnProperty("uid")||(this.uid=c.guid("uid_")),a=c.trim(a),/\s/.test(a)?void c.each(a.split(/\s+/),function(a){h.addEventListener(a,b,d,f)}):(a=a.toLowerCase(),d=parseInt(d,10)||0,g=e[this.uid]&&e[this.uid][a]||[],g.push({fn:b,priority:d,scope:f||this}),e[this.uid]||(e[this.uid]={}),void(e[this.uid][a]=g))},hasEventListener:function(a){var b;return a?(a=a.toLowerCase(),b=e[this.uid]&&e[this.uid][a]):b=e[this.uid],b?b:!1},removeEventListener:function(a,b){var d,f,g=this;if(a=a.toLowerCase(),/\s/.test(a))return void c.each(a.split(/\s+/),function(a){g.removeEventListener(a,b)});if(d=e[this.uid]&&e[this.uid][a]){if(b){for(f=d.length-1;f>=0;f--)if(d[f].fn===b){d.splice(f,1);break}}else d=[];d.length||(delete e[this.uid][a],c.isEmptyObj(e[this.uid])&&delete e[this.uid])}},removeAllEventListeners:function(){e[this.uid]&&delete e[this.uid]},dispatchEvent:function(a){var d,f,g,h,i,j={},k=!0;if("string"!==c.typeOf(a)){if(h=a,"string"!==c.typeOf(h.type))throw new b.EventException(b.EventException.UNSPECIFIED_EVENT_TYPE_ERR);a=h.type,h.total!==i&&h.loaded!==i&&(j.total=h.total,j.loaded=h.loaded),j.async=h.async||!1}if(-1!==a.indexOf("::")?function(b){d=b[0],a=b[1]}(a.split("::")):d=this.uid,a=a.toLowerCase(),f=e[d]&&e[d][a]){f.sort(function(a,b){return b.priority-a.priority}),g=[].slice.call(arguments),g.shift(),j.type=a,g.unshift(j);var l=[];c.each(f,function(a){g[0].target=a.scope,j.async?l.push(function(b){setTimeout(function(){b(a.fn.apply(a.scope,g)===!1)},1)}):l.push(function(b){b(a.fn.apply(a.scope,g)===!1)})}),l.length&&c.inSeries(l,function(a){k=!a})}return k},bindOnce:function(a,b,c,d){var e=this;e.bind.call(this,a,function f(){return e.unbind(a,f),b.apply(this,arguments)},c,d)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(a){var b=this;this.bind(a.join(" "),function(a){var b="on"+a.type.toLowerCase();"function"===c.typeOf(this[b])&&this[b].apply(this,arguments)}),c.each(a,function(a){a="on"+a.toLowerCase(a),"undefined"===c.typeOf(b[a])&&(b[a]=null)})}}),d.instance=new d,d}),d("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(a,b,c,d){function e(a,d,f,h,i){var j,k=this,l=b.guid(d+"_"),m=i||"browser";a=a||{},g[l]=this,f=b.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},f),a.preferred_caps&&(m=e.getMode(h,a.preferred_caps,m)),j=function(){var a={};return{exec:function(b,c,d,e){return j[c]&&(a[b]||(a[b]={context:this,instance:new j[c]}),a[b].instance[d])?a[b].instance[d].apply(this,e):void 0},removeInstance:function(b){delete a[b]},removeAllInstances:function(){var c=this;b.each(a,function(a,d){"function"===b.typeOf(a.instance.destroy)&&a.instance.destroy.call(a.context),c.removeInstance(d)})}}}(),b.extend(this,{initialized:!1,uid:l,type:d,mode:e.getMode(h,a.required_caps,m),shimid:l+"_container",clients:0,options:a,can:function(a,c){var d=arguments[2]||f;if("string"===b.typeOf(a)&&"undefined"===b.typeOf(c)&&(a=e.parseCaps(a)),"object"===b.typeOf(a)){for(var g in a)if(!this.can(g,a[g],d))return!1;return!0}return"function"===b.typeOf(d[a])?d[a].call(this,c):c===d[a]},getShimContainer:function(){var a,d=c.get(this.shimid);return d||(a=c.get(this.options.container)||document.body,d=document.createElement("div"),d.id=this.shimid,d.className="moxie-shim moxie-shim-"+this.type,b.extend(d.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.appendChild(d),a=null),d},getShim:function(){return j},shimExec:function(a,b){var c=[].slice.call(arguments,2);return k.getShim().exec.call(this,this.uid,a,b,c)},exec:function(a,b){var c=[].slice.call(arguments,2);return k[a]&&k[a][b]?k[a][b].apply(this,c):k.shimExec.apply(this,arguments)},destroy:function(){if(k){var a=c.get(this.shimid);a&&a.parentNode.removeChild(a),j&&j.removeAllInstances(),this.unbindAll(),delete g[this.uid],this.uid=null,l=k=j=a=null}}}),this.mode&&a.required_caps&&!this.can(a.required_caps)&&(this.mode=!1)}var f={},g={};return e.order="html5,flash,silverlight,html4",e.getRuntime=function(a){return g[a]?g[a]:!1},e.addConstructor=function(a,b){b.prototype=d.instance,f[a]=b},e.getConstructor=function(a){return f[a]||null},e.getInfo=function(a){var b=e.getRuntime(a);return b?{uid:b.uid,type:b.type,mode:b.mode,can:function(){return b.can.apply(b,arguments)}}:null},e.parseCaps=function(a){var c={};return"string"!==b.typeOf(a)?a||{}:(b.each(a.split(","),function(a){c[a]=!0}),c)},e.can=function(a,b){var c,d,f=e.getConstructor(a);return f?(c=new f({required_caps:b}),d=c.mode,c.destroy(),!!d):!1},e.thatCan=function(a,b){var c=(b||e.order).split(/\s*,\s*/);for(var d in c)if(e.can(c[d],a))return c[d];return null},e.getMode=function(a,c,d){var e=null;if("undefined"===b.typeOf(d)&&(d="browser"),c&&!b.isEmptyObj(a)){if(b.each(c,function(c,d){if(a.hasOwnProperty(d)){var f=a[d](c);if("string"==typeof f&&(f=[f]),e){if(!(e=b.arrayIntersect(e,f)))return e=!1}else e=f}}),e)return-1!==b.inArray(d,e)?d:e[0];if(e===!1)return!1}return d},e.getGlobalEventTarget=function(){if(/^moxie\./.test(a.global_event_dispatcher)&&!a.can("access_global_ns")){var c=b.guid("moxie_event_target_");window[c]=function(a,b){d.instance.dispatchEvent(a,b)},a.global_event_dispatcher=c}return a.global_event_dispatcher},e.capTrue=function(){return!0},e.capFalse=function(){return!1},e.capTest=function(a){return function(){return!!a}},e}),d("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(a,b,c,d){return function(){var a;c.extend(this,{connectRuntime:function(e){function f(c){var g,i;return c.length?(g=c.shift().toLowerCase(),(i=d.getConstructor(g))?(a=new i(e),a.bind("Init",function(){a.initialized=!0,setTimeout(function(){a.clients++,h.ruid=a.uid,h.trigger("RuntimeInit",a)},1)}),a.bind("Error",function(){a.destroy(),f(c)}),a.bind("Exception",function(a,c){var d=c.name+"(#"+c.code+")"+(c.message?", from: "+c.message:"");h.trigger("RuntimeError",new b.RuntimeError(b.RuntimeError.EXCEPTION_ERR,d))}),a.mode?void a.init():void a.trigger("Error")):void f(c)):(h.trigger("RuntimeError",new b.RuntimeError(b.RuntimeError.NOT_INIT_ERR)),void(a=null))}var g,h=this;if("string"===c.typeOf(e)?g=e:"string"===c.typeOf(e.ruid)&&(g=e.ruid),g){if(a=d.getRuntime(g))return h.ruid=g,a.clients++,a;throw new b.RuntimeError(b.RuntimeError.NOT_INIT_ERR)}f((e.runtime_order||d.order).split(/\s*,\s*/))},disconnectRuntime:function(){a&&--a.clients<=0&&a.destroy(),a=null},getRuntime:function(){return a&&a.uid?a:a=null},exec:function(){return a?a.exec.apply(this,arguments):null},can:function(b){return a?a.can(b):!1}})}}),d("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(a,b,c){function d(f,g){function h(b,c,f){var g,h=e[this.uid];return"string"===a.typeOf(h)&&h.length?(g=new d(null,{type:f,size:c-b}),g.detach(h.substr(b,g.size)),g):null}c.call(this),f&&this.connectRuntime(f),g?"string"===a.typeOf(g)&&(g={data:g}):g={},a.extend(this,{uid:g.uid||a.guid("uid_"),ruid:f,size:g.size||0,type:g.type||"",slice:function(a,b,c){return this.isDetached()?h.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),a,b,c)},getSource:function(){return e[this.uid]?e[this.uid]:null},detach:function(a){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),a=a||"","data:"==a.substr(0,5)){var c=a.indexOf(";base64,");this.type=a.substring(5,c),a=b.atob(a.substring(c+8))}this.size=a.length,e[this.uid]=a},isDetached:function(){return!this.ruid&&"string"===a.typeOf(e[this.uid])},destroy:function(){this.detach(),delete e[this.uid]}}),g.data?this.detach(g.data):e[this.uid]=g}var e={};return d}),d("moxie/core/I18n",["moxie/core/utils/Basic"],function(a){var b={};return{addI18n:function(c){return a.extend(b,c)},translate:function(a){return b[a]||a},_:function(a){return this.translate(a)},sprintf:function(b){var c=[].slice.call(arguments,1);return b.replace(/%[a-z]/g,function(){var b=c.shift();return"undefined"!==a.typeOf(b)?b:""})}}}),d("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(a,b){var c="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",d={},e={},f=function(a){var b,c,f,g=a.split(/,/);for(b=0;b<g.length;b+=2){for(f=g[b+1].split(/ /),c=0;c<f.length;c++)d[f[c]]=g[b];e[g[b]]=f}},g=function(b,c){var d,e,f,g,h=[];for(e=0;e<b.length;e++)for(d=b[e].extensions.toLowerCase().split(/\s*,\s*/),f=0;f<d.length;f++){if("*"===d[f])return[];if(g=h[d[f]],c&&/^\w+$/.test(d[f]))h.push("."+d[f]);else if(g&&-1===a.inArray(g,h))h.push(g);else if(!g)return[]}return h},h=function(b){var c=[];return a.each(b,function(b){if(b=b.toLowerCase(),"*"===b)return c=[],!1;var d=b.match(/^(\w+)\/(\*|\w+)$/);d&&("*"===d[2]?a.each(e,function(a,b){new RegExp("^"+d[1]+"/").test(b)&&[].push.apply(c,e[b])}):e[b]&&[].push.apply(c,e[b]))}),c},i=function(c){var d=[],e=[];return"string"===a.typeOf(c)&&(c=a.trim(c).split(/\s*,\s*/)),e=h(c),d.push({title:b.translate("Files"),extensions:e.length?e.join(","):"*"}),d},j=function(a){var b=a&&a.match(/\.([^.]+)$/);return b?b[1].toLowerCase():""},k=function(a){return d[j(a)]||""};return f(c),{mimes:d,extensions:e,addMimeType:f,extList2mimes:g,mimes2exts:h,mimes2extList:i,getFileExtension:j,getFileMime:k}}),d("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(a,b,c,d,e,f,g,h,i){function j(b){var f,j,l;if(-1!==a.inArray(a.typeOf(b),["string","node"])&&(b={browse_button:b}),j=d.get(b.browse_button),!j)throw new e.DOMException(e.DOMException.NOT_FOUND_ERR);l={accept:[{title:g.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:j.parentNode||document.body},b=a.extend({},l,b),"string"==typeof b.required_caps&&(b.required_caps=h.parseCaps(b.required_caps)),"string"==typeof b.accept&&(b.accept=c.mimes2extList(b.accept)),f=d.get(b.container),f||(f=document.body),"static"===d.getStyle(f,"position")&&(f.style.position="relative"),f=j=null,i.call(this),a.extend(this,{uid:a.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var c=this;c.bind("RuntimeInit",function(e,f){c.ruid=f.uid,c.shimid=f.shimid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Refresh",function(){var c,e,g,h,i;g=d.get(b.browse_button),h=d.get(f.shimid),g&&(c=d.getPos(g,d.get(b.container)),e=d.getSize(g),i=parseInt(d.getStyle(g,"z-index"),10)||0,h&&a.extend(h.style,{top:c.y+"px",left:c.x+"px",width:e.w+"px",height:e.h+"px",zIndex:i+1})),h=g=null}),f.exec.call(c,"FileInput","init",b)}),c.connectRuntime(a.extend({},b,{required_caps:{select_file:!0}}))},getOption:function(a){return b[a]},setOption:function(a,d){if(b.hasOwnProperty(a)){var f=b[a];switch(a){case"accept":"string"==typeof d&&(d=c.mimes2extList(d));break;case"container":case"required_caps":throw new e.FileException(e.FileException.NO_MODIFICATION_ALLOWED_ERR)}b[a]=d,this.exec("FileInput","setOption",a,d),this.trigger("OptionChanged",a,d,f)}},disable:function(b){var c=this.getRuntime();c&&this.exec("FileInput","disable","undefined"===a.typeOf(b)?!0:b)},refresh:function(){this.trigger("Refresh")},destroy:function(){var b=this.getRuntime();b&&(b.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===a.typeOf(this.files)&&a.each(this.files,function(a){a.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(k)}var k=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return j.prototype=f.instance,j}),d("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(a,b,c){function d(d,e){e||(e={}),c.apply(this,arguments),this.type||(this.type=b.getFileMime(e.name));var f;if(e.name)f=e.name.replace(/\\/g,"/"),f=f.substr(f.lastIndexOf("/")+1);else if(this.type){var g=this.type.split("/")[0];f=a.guid((""!==g?g:"file")+"_"),b.extensions[this.type]&&(f+="."+b.extensions[this.type][0])}a.extend(this,{name:f||a.guid("file_"),relativePath:"",lastModifiedDate:e.lastModified?new Date(e.lastModified):e.lastModifiedDate||(new Date).toLocaleString()})}return d.prototype=c.prototype,d}),d("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(a,b,c,d,e,f,g,h,i){function j(c){var e,f=this;"string"==typeof c&&(c={drop_zone:c}),e={accept:[{title:a.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},c="object"==typeof c?d.extend({},e,c):e,c.container=b.get(c.drop_zone)||document.body,"static"===b.getStyle(c.container,"position")&&(c.container.style.position="relative"),"string"==typeof c.accept&&(c.accept=i.mimes2extList(c.accept)),g.call(f),d.extend(f,{uid:d.guid("uid_"),ruid:null,files:null,init:function(){f.bind("RuntimeInit",function(a,b){f.ruid=b.uid,b.exec.call(f,"FileDrop","init",c),f.dispatchEvent("ready")}),f.connectRuntime(c)},destroy:function(){var a=this.getRuntime();a&&(a.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(k)}var k=["ready","dragenter","dragleave","drop","error"];return j.prototype=h.instance,j}),d("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(a,b,c,d,e,f){function g(){function d(a,d){if(this.trigger("loadstart"),this.readyState===g.LOADING)return this.trigger("error",new c.DOMException(c.DOMException.INVALID_STATE_ERR)),void this.trigger("loadend");if(!(d instanceof e))return this.trigger("error",new c.DOMException(c.DOMException.NOT_FOUND_ERR)),void this.trigger("loadend");if(this.result=null,this.readyState=g.LOADING,d.isDetached()){var f=d.getSource();switch(a){case"readAsText":case"readAsBinaryString":this.result=f;break;case"readAsDataURL":this.result="data:"+d.type+";base64,"+b.btoa(f)}this.readyState=g.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(d.ruid),this.exec("FileReader","read",a,d)}f.call(this),a.extend(this,{uid:a.guid("uid_"),readyState:g.EMPTY,result:null,error:null,readAsBinaryString:function(a){d.call(this,"readAsBinaryString",a)},readAsDataURL:function(a){d.call(this,"readAsDataURL",a)},readAsText:function(a){d.call(this,"readAsText",a)},abort:function(){this.result=null,-1===a.inArray(this.readyState,[g.EMPTY,g.DONE])&&(this.readyState===g.LOADING&&(this.readyState=g.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(h),this.bind("Error",function(a,b){this.readyState=g.DONE,this.error=b},999),this.bind("Load",function(){this.readyState=g.DONE},999)}var h=["loadstart","progress","load","abort","error","loadend"];return g.EMPTY=0,g.LOADING=1,g.DONE=2,g.prototype=d.instance,g}),d("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(a){var b=function(c,d){var e,f=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],g=f.length,h={http:80,https:443},i={},j=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,k=j.exec(c||""),l=/^\/\/\w/.test(c);switch(a.typeOf(d)){case"undefined":d=b(document.location.href,!1);break;case"string":d=b(d,!1)}for(;g--;)k[g]&&(i[f[g]]=k[g]);if(e=!l&&!i.scheme,(l||e)&&(i.scheme=d.scheme),e){i.host=d.host,i.port=d.port;var m="";/^[^\/]/.test(i.path)&&(m=d.path,m=/\/[^\/]*\.[^\/]*$/.test(m)?m.replace(/\/[^\/]+$/,"/"):m.replace(/\/?$/,"/")),i.path=m+(i.path||"")}return i.port||(i.port=h[i.scheme]||80),i.port=parseInt(i.port,10),i.path||(i.path="/"),delete i.source,i},c=function(a){var c={http:80,https:443},d="object"==typeof a?a:b(a);return d.scheme+"://"+d.host+(d.port!==c[d.scheme]?":"+d.port:"")+d.path+(d.query?d.query:"")},d=function(a){function c(a){return[a.scheme,a.host,a.port].join("/")}return"string"==typeof a&&(a=b(a)),c(b())===c(a)};return{parseUrl:b,resolveUrl:c,hasSameOrigin:d}}),d("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(a,b,c){function d(){this.uid=a.guid("uid_"),b.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return d.prototype=c.instance,d}),d("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(a,b,c){return function(){function d(a,b){if(!b.isDetached()){var d=this.connectRuntime(b.ruid).exec.call(this,"FileReaderSync","read",a,b);return this.disconnectRuntime(),d}var e=b.getSource();switch(a){case"readAsBinaryString":return e;case"readAsDataURL":return"data:"+b.type+";base64,"+c.btoa(e);case"readAsText":for(var f="",g=0,h=e.length;h>g;g++)f+=String.fromCharCode(e[g]);return f}}b.call(this),a.extend(this,{uid:a.guid("uid_"),readAsBinaryString:function(a){return d.call(this,"readAsBinaryString",a)},readAsDataURL:function(a){return d.call(this,"readAsDataURL",a)},readAsText:function(a){return d.call(this,"readAsText",a)}})}}),d("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(a,b,c){function d(){var a,d=[];b.extend(this,{append:function(e,f){var g=this,h=b.typeOf(f);f instanceof c?a={name:e,value:f}:"array"===h?(e+="[]",b.each(f,function(a){g.append(e,a)})):"object"===h?b.each(f,function(a,b){g.append(e+"["+b+"]",a)}):"null"===h||"undefined"===h||"number"===h&&isNaN(f)?g.append(e,"false"):d.push({name:e,value:f.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return a&&a.value||null},getBlobName:function(){return a&&a.name||null},each:function(c){b.each(d,function(a){c(a.value,a.name)}),a&&c(a.value,a.name)},destroy:function(){a=null,d=[]}})}return d}),d("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(a,b,c,d,e,f,g,h,i,j,k,l){function m(){this.uid=a.guid("uid_")}function n(){function c(a,b){return A.hasOwnProperty(a)?1===arguments.length?k.can("define_property")?A[a]:z[a]:void(k.can("define_property")?A[a]=b:z[a]=b):void 0}function i(b){function d(){x&&(x.destroy(),x=null),h.dispatchEvent("loadend"),h=null}function e(e){x.bind("LoadStart",function(a){c("readyState",n.LOADING),h.dispatchEvent("readystatechange"),h.dispatchEvent(a),H&&h.upload.dispatchEvent(a)}),x.bind("Progress",function(a){c("readyState")!==n.LOADING&&(c("readyState",n.LOADING),h.dispatchEvent("readystatechange")),h.dispatchEvent(a)}),x.bind("UploadProgress",function(a){H&&h.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:a.total,loaded:a.loaded})}),x.bind("Load",function(b){c("readyState",n.DONE),c("status",Number(e.exec.call(x,"XMLHttpRequest","getStatus")||0)),c("statusText",o[c("status")]||""),c("response",e.exec.call(x,"XMLHttpRequest","getResponse",c("responseType"))),~a.inArray(c("responseType"),["text",""])?c("responseText",c("response")):"document"===c("responseType")&&c("responseXML",c("response")),O=e.exec.call(x,"XMLHttpRequest","getAllResponseHeaders"),h.dispatchEvent("readystatechange"),c("status")>0?(H&&h.upload.dispatchEvent(b),h.dispatchEvent(b)):(J=!0,h.dispatchEvent("error")),d()}),x.bind("Abort",function(a){h.dispatchEvent(a),d()}),x.bind("Error",function(a){J=!0,c("readyState",n.DONE),h.dispatchEvent("readystatechange"),I=!0,h.dispatchEvent(a),d()}),e.exec.call(x,"XMLHttpRequest","send",{url:r,method:s,async:B,user:t,password:u,headers:C,mimeType:E,encoding:D,responseType:h.responseType,withCredentials:h.withCredentials,options:N},b)}var h=this;v=(new Date).getTime(),x=new g,"string"==typeof N.required_caps&&(N.required_caps=f.parseCaps(N.required_caps)),N.required_caps=a.extend({},N.required_caps,{return_response_type:h.responseType}),b instanceof j&&(N.required_caps.send_multipart=!0),a.isEmptyObj(C)||(N.required_caps.send_custom_headers=!0),K||(N.required_caps.do_cors=!0),N.ruid?e(x.connectRuntime(N)):(x.bind("RuntimeInit",function(a,b){e(b)}),x.bind("RuntimeError",function(a,b){h.dispatchEvent("RuntimeError",b)}),x.connectRuntime(N))}function q(){c("responseText",""),c("responseXML",null),c("response",null),c("status",0),c("statusText",""),v=w=null}var r,s,t,u,v,w,x,y,z=this,A={timeout:0,readyState:n.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},B=!0,C={},D=null,E=null,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=null,M=null,N={},O="";a.extend(this,A,{uid:a.guid("uid_"),upload:new m,open:function(f,g,h,i,j){var k;if(!f||!g)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(f)||d.utf8_encode(f)!==f)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(~a.inArray(f.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(s=f.toUpperCase()),~a.inArray(s,["CONNECT","TRACE","TRACK"]))throw new b.DOMException(b.DOMException.SECURITY_ERR);if(g=d.utf8_encode(g),k=e.parseUrl(g),K=e.hasSameOrigin(k),r=e.resolveUrl(g),(i||j)&&!K)throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);if(t=i||k.user,u=j||k.pass,B=h||!0,B===!1&&(c("timeout")||c("withCredentials")||""!==c("responseType")))throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);F=!B,G=!1,C={},q.call(this),c("readyState",n.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(e,f){var g=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(c("readyState")!==n.OPENED||G)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(e)||d.utf8_encode(e)!==e)throw new b.DOMException(b.DOMException.SYNTAX_ERR);return e=a.trim(e).toLowerCase(),~a.inArray(e,g)||/^(proxy\-|sec\-)/.test(e)?!1:(C[e]?C[e]+=", "+f:C[e]=f,!0)},hasRequestHeader:function(a){return a&&C[a.toLowerCase()]||!1},getAllResponseHeaders:function(){return O||""},getResponseHeader:function(b){return b=b.toLowerCase(),J||~a.inArray(b,["set-cookie","set-cookie2"])?null:O&&""!==O&&(y||(y={},a.each(O.split(/\r\n/),function(b){var c=b.split(/:\s+/);2===c.length&&(c[0]=a.trim(c[0]),y[c[0].toLowerCase()]={header:c[0],value:a.trim(c[1])})})),y.hasOwnProperty(b))?y[b].header+": "+y[b].value:null},overrideMimeType:function(d){var e,f;if(~a.inArray(c("readyState"),[n.LOADING,n.DONE]))throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(d=a.trim(d.toLowerCase()),/;/.test(d)&&(e=d.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(d=e[1],e[2]&&(f=e[2])),!l.mimes[d])throw new b.DOMException(b.DOMException.SYNTAX_ERR);L=d,M=f},send:function(c,e){if(N="string"===a.typeOf(e)?{ruid:e}:e?e:{},this.readyState!==n.OPENED||G)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(c instanceof h)N.ruid=c.ruid,E=c.type||"application/octet-stream";else if(c instanceof j){if(c.hasBlob()){var f=c.getBlob();N.ruid=f.ruid,E=f.type||"application/octet-stream"}}else"string"==typeof c&&(D="UTF-8",E="text/plain;charset=UTF-8",c=d.utf8_encode(c));this.withCredentials||(this.withCredentials=N.required_caps&&N.required_caps.send_browser_cookies&&!K),H=!F&&this.upload.hasEventListener(),J=!1,I=!c,F||(G=!0),i.call(this,c)},abort:function(){if(J=!0,F=!1,~a.inArray(c("readyState"),[n.UNSENT,n.OPENED,n.DONE]))c("readyState",n.UNSENT);else{if(c("readyState",n.DONE),G=!1,!x)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);x.getRuntime().exec.call(x,"XMLHttpRequest","abort",I),I=!0}},destroy:function(){x&&("function"===a.typeOf(x.destroy)&&x.destroy(),x=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var o={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=c.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return n.UNSENT=0,n.OPENED=1,n.HEADERS_RECEIVED=2,n.LOADING=3,n.DONE=4,n.prototype=c.instance,n}),d("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(a,b,c,d){function e(){function d(){k=l=0,j=this.result=null}function f(b,c){var d=this;i=c,d.bind("TransportingProgress",function(b){l=b.loaded,k>l&&-1===a.inArray(d.state,[e.IDLE,e.DONE])&&g.call(d)},999),d.bind("TransportingComplete",function(){l=k,d.state=e.DONE,j=null,d.result=i.exec.call(d,"Transporter","getAsBlob",b||"")},999),d.state=e.BUSY,d.trigger("TransportingStarted"),g.call(d)}function g(){var a,c=this,d=k-l;m>d&&(m=d),a=b.btoa(j.substr(l,m)),i.exec.call(c,"Transporter","receive",a,k)}var h,i,j,k,l,m;c.call(this),a.extend(this,{uid:a.guid("uid_"),state:e.IDLE,result:null,transport:function(b,c,e){var g=this;if(e=a.extend({chunk_size:204798},e),(h=e.chunk_size%3)&&(e.chunk_size+=3-h),m=e.chunk_size,d.call(this),j=b,k=b.length,"string"===a.typeOf(e)||e.ruid)f.call(g,c,this.connectRuntime(e));else{var i=function(a,b){g.unbind("RuntimeInit",i),f.call(g,c,b)};this.bind("RuntimeInit",i),this.connectRuntime(e)}},abort:function(){var a=this;a.state=e.IDLE,i&&(i.exec.call(a,"Transporter","clear"),a.trigger("TransportingAborted")),d.call(a)},destroy:function(){this.unbindAll(),i=null,this.disconnectRuntime(),d.call(this)}})}return e.IDLE=0,e.BUSY=1,e.DONE=2,e.prototype=d.instance,e}),d("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){function d(a){try{return a||(a=this.exec("Image","getInfo")),this.size=a.size,this.width=a.width,
this.height=a.height,this.type=a.type,this.meta=a.meta,""===this.name&&(this.name=a.name),!0}catch(b){return this.trigger("error",b.code),!1}}function j(b){var d=a.typeOf(b);try{if(b instanceof n){if(!b.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(b instanceof k){if(!~a.inArray(b.type,["image/jpeg","image/png"]))throw new c.ImageError(c.ImageError.WRONG_FORMAT);q.apply(this,arguments)}else if(-1!==a.inArray(d,["blob","file"]))j.call(this,new l(null,b),arguments[1]);else if("string"===d)"data:"===b.substr(0,5)?j.call(this,new k(null,{data:b}),arguments[1]):r.apply(this,arguments);else{if("node"!==d||"img"!==b.nodeName.toLowerCase())throw new c.DOMException(c.DOMException.TYPE_MISMATCH_ERR);j.call(this,b.src,arguments[1])}}catch(e){this.trigger("error",e.code)}}function p(b,c){var d=this.connectRuntime(b.ruid);this.ruid=d.uid,d.exec.call(this,"Image","loadFromImage",b,"undefined"===a.typeOf(c)?!0:c)}function q(b,c){function d(a){e.ruid=a.uid,a.exec.call(e,"Image","loadFromBlob",b)}var e=this;e.name=b.name||"",b.isDetached()?(this.bind("RuntimeInit",function(a,b){d(b)}),c&&"string"==typeof c.required_caps&&(c.required_caps=f.parseCaps(c.required_caps)),this.connectRuntime(a.extend({required_caps:{access_image_binary:!0,resize_image:!0}},c))):d(this.connectRuntime(b.ruid))}function r(a,b){var c,d=this;c=new e,c.open("get",a),c.responseType="blob",c.onprogress=function(a){d.trigger(a)},c.onload=function(){q.call(d,c.response,!0)},c.onerror=function(a){d.trigger(a)},c.onloadend=function(){c.destroy()},c.bind("RuntimeError",function(a,b){d.trigger("RuntimeError",b)}),c.send(null,b)}g.call(this),a.extend(this,{uid:a.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){j.apply(this,arguments)},resize:function(b){var d,e,f=this,g={x:0,y:0,width:f.width,height:f.height},h=a.extendIf({width:f.width,height:f.height,type:f.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},b);try{if(!f.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);if(f.width>n.MAX_RESIZE_WIDTH||f.height>n.MAX_RESIZE_HEIGHT)throw new c.ImageError(c.ImageError.MAX_RESOLUTION_ERR);if(d=f.meta&&f.meta.tiff&&f.meta.tiff.Orientation||1,-1!==a.inArray(d,[5,6,7,8])){var i=h.width;h.width=h.height,h.height=i}if(h.crop){switch(e=Math.max(h.width/f.width,h.height/f.height),b.fit?(g.width=Math.min(Math.ceil(h.width/e),f.width),g.height=Math.min(Math.ceil(h.height/e),f.height),e=h.width/g.width):(g.width=Math.min(h.width,f.width),g.height=Math.min(h.height,f.height),e=1),"boolean"==typeof h.crop&&(h.crop="cc"),h.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":g.x=f.width-g.width,g.y=f.height-g.height;break;case"cb":case"center-bottom":g.x=Math.floor((f.width-g.width)/2),g.y=f.height-g.height;break;case"lb":case"left-bottom":g.x=0,g.y=f.height-g.height;break;case"lt":case"left-top":g.x=0,g.y=0;break;case"ct":case"center-top":g.x=Math.floor((f.width-g.width)/2),g.y=0;break;case"rt":case"right-top":g.x=f.width-g.width,g.y=0;break;case"rc":case"right-center":case"right-middle":g.x=f.width-g.width,g.y=Math.floor((f.height-g.height)/2);break;case"lc":case"left-center":case"left-middle":g.x=0,g.y=Math.floor((f.height-g.height)/2);break;case"cc":case"center-center":case"center-middle":default:g.x=Math.floor((f.width-g.width)/2),g.y=Math.floor((f.height-g.height)/2)}g.x=Math.max(g.x,0),g.y=Math.max(g.y,0)}else e=Math.min(h.width/f.width,h.height/f.height),e>1&&!h.fit&&(e=1);this.exec("Image","resize",g,e,h)}catch(j){f.trigger("error",j.code)}},downsize:function(b){var c,d={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,fit:!1,preserveHeaders:!0,resample:"default"};c="object"==typeof b?a.extend(d,b):a.extend(d,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(c)},crop:function(a,b,c){this.downsize(a,b,!0,c)},getAsCanvas:function(){if(!i.can("create_canvas"))throw new c.RuntimeError(c.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(a,b){if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",a||"image/jpeg",b||90)},getAsDataURL:function(a,b){if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",a||"image/jpeg",b||90)},getAsBinaryString:function(a,b){var c=this.getAsDataURL(a,b);return m.atob(c.substring(c.indexOf("base64,")+7))},embed:function(d,e){function f(b,e){var f=this;if(i.can("create_canvas")){var k=f.getAsCanvas();if(k)return d.appendChild(k),k=null,f.destroy(),void j.trigger("embedded")}var l=f.getAsDataURL(b,e);if(!l)throw new c.ImageError(c.ImageError.WRONG_FORMAT);if(i.can("use_data_uri_of",l.length))d.innerHTML='<img src="'+l+'" width="'+f.width+'" height="'+f.height+'" alt="" />',f.destroy(),j.trigger("embedded");else{var n=new h;n.bind("TransportingComplete",function(){g=j.connectRuntime(this.result.ruid),j.bind("Embedded",function(){a.extend(g.getShimContainer().style,{top:"0px",left:"0px",width:f.width+"px",height:f.height+"px"}),g=null},999),g.exec.call(j,"ImageView","display",this.result.uid,width,height),f.destroy()}),n.transport(m.atob(l.substring(l.indexOf("base64,")+7)),b,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:d})}}var g,j=this,k=a.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,fit:!0,resample:"nearest"},e);try{if(!(d=b.get(d)))throw new c.DOMException(c.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);this.width>n.MAX_RESIZE_WIDTH||this.height>n.MAX_RESIZE_HEIGHT;var l=new n;return l.bind("Resize",function(){f.call(this,k.type,k.quality)}),l.bind("Load",function(){this.downsize(k)}),this.meta.thumb&&this.meta.thumb.width>=k.width&&this.meta.thumb.height>=k.height?l.load(this.meta.thumb.data):l.clone(this,!1),l}catch(o){this.trigger("error",o.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(o),this.bind("Load Resize",function(){return d.call(this)},999)}var o=["progress","load","error","resize","embedded"];return n.MAX_RESIZE_WIDTH=8192,n.MAX_RESIZE_HEIGHT=8192,n.prototype=j.instance,n}),d("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(a,b,c,d){function f(b){var f=this,i=c.capTest,j=c.capTrue,k=a.extend({access_binary:i(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return f.can("access_binary")&&!!h.Image},display_media:i((d.can("create_canvas")||d.can("use_data_uri_over32kb"))&&e("moxie/image/Image")),do_cors:i(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:i(function(){var a=document.createElement("div");return("draggable"in a||"ondragstart"in a&&"ondrop"in a)&&("IE"!==d.browser||d.verComp(d.version,9,">"))}()),filter_by_extension:i(function(){return!("Chrome"===d.browser&&d.verComp(d.version,28,"<")||"IE"===d.browser&&d.verComp(d.version,10,"<")||"Safari"===d.browser&&d.verComp(d.version,11,"<=")||"Firefox"===d.browser&&d.verComp(d.version,37,"<")||"iOS"===d.os||"Android"===d.os)}()),return_response_headers:j,return_response_type:function(a){return"json"===a&&window.JSON?!0:d.can("return_response_type",a)},return_status_code:j,report_upload_progress:i(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return f.can("access_binary")&&d.can("create_canvas")},select_file:function(){return d.can("use_fileinput")&&window.File},select_folder:function(){return f.can("select_file")&&("Chrome"===d.browser&&d.verComp(d.version,21,">=")||"Firefox"===d.browser&&d.verComp(d.version,42,">="))},select_multiple:function(){return!(!f.can("select_file")||"Safari"===d.browser&&"Windows"===d.os||"iOS"===d.os&&d.verComp(d.osVersion,"7.0.0",">")&&d.verComp(d.osVersion,"8.0.0","<"))},send_binary_string:i(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:i(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||f.can("send_binary_string")},slice_blob:i(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return f.can("slice_blob")&&f.can("send_multipart")},summon_file_dialog:function(){return f.can("select_file")&&!("Firefox"===d.browser&&d.verComp(d.version,4,"<")||"Opera"===d.browser&&d.verComp(d.version,12,"<")||"IE"===d.browser&&d.verComp(d.version,10,"<"))},upload_filesize:j,use_http_method:j},arguments[2]);c.call(this,b,arguments[1]||g,k),a.extend(this,{init:function(){this.trigger("Init")},destroy:function(a){return function(){a.call(f),a=f=null}}(this.destroy)}),a.extend(this.getShim(),h)}var g="html5",h={};return c.addConstructor(g,f),h}),d("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(a,b){function c(){function a(a,b,c){var d;if(!window.File.prototype.slice)return(d=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?d.call(a,b,c):null;try{return a.slice(),a.slice(b,c)}catch(e){return a.slice(b,c-b)}}this.slice=function(){return new b(this.getRuntime().uid,a.apply(this,arguments))},this.destroy=function(){this.getRuntime().getShim().removeInstance(this.uid)}}return a.Blob=c}),d("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(a){function b(){this.returnValue=!1}function c(){this.cancelBubble=!0}var d={},e="moxie_"+a.guid(),f=function(f,g,h,i){var j,k;g=g.toLowerCase(),f.addEventListener?(j=h,f.addEventListener(g,j,!1)):f.attachEvent&&(j=function(){var a=window.event;a.target||(a.target=a.srcElement),a.preventDefault=b,a.stopPropagation=c,h(a)},f.attachEvent("on"+g,j)),f[e]||(f[e]=a.guid()),d.hasOwnProperty(f[e])||(d[f[e]]={}),k=d[f[e]],k.hasOwnProperty(g)||(k[g]=[]),k[g].push({func:j,orig:h,key:i})},g=function(b,c,f){var g,h;if(c=c.toLowerCase(),b[e]&&d[b[e]]&&d[b[e]][c]){g=d[b[e]][c];for(var i=g.length-1;i>=0&&(g[i].orig!==f&&g[i].key!==f||(b.removeEventListener?b.removeEventListener(c,g[i].func,!1):b.detachEvent&&b.detachEvent("on"+c,g[i].func),g[i].orig=null,g[i].func=null,g.splice(i,1),f===h));i--);if(g.length||delete d[b[e]][c],a.isEmptyObj(d[b[e]])){delete d[b[e]];try{delete b[e]}catch(j){b[e]=h}}}},h=function(b,c){b&&b[e]&&a.each(d[b[e]],function(a,d){g(b,d,c)})};return{addEvent:f,removeEvent:g,removeAllEvents:h}}),d("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g){function h(){var a,h;c.extend(this,{init:function(i){var j,k,l,m,n,o,p=this,q=p.getRuntime();a=i,l=f.extList2mimes(a.accept,q.can("filter_by_extension")),k=q.getShimContainer(),k.innerHTML='<input id="'+q.uid+'" type="file" style="font-size:999px;opacity:0;"'+(a.multiple&&q.can("select_multiple")?"multiple":"")+(a.directory&&q.can("select_folder")?"webkitdirectory directory":"")+(l?' accept="'+l.join(",")+'"':"")+" />",j=d.get(q.uid),c.extend(j.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=d.get(a.browse_button),h=d.getStyle(m,"z-index")||"auto",q.can("summon_file_dialog")&&("static"===d.getStyle(m,"position")&&(m.style.position="relative"),e.addEvent(m,"click",function(a){var b=d.get(q.uid);b&&!b.disabled&&b.click(),a.preventDefault()},p.uid),p.bind("Refresh",function(){n=parseInt(h,10)||1,d.get(a.browse_button).style.zIndex=n,this.getRuntime().getShimContainer().style.zIndex=n-1})),o=q.can("summon_file_dialog")?m:k,e.addEvent(o,"mouseover",function(){p.trigger("mouseenter")},p.uid),e.addEvent(o,"mouseout",function(){p.trigger("mouseleave")},p.uid),e.addEvent(o,"mousedown",function(){p.trigger("mousedown")},p.uid),e.addEvent(d.get(a.container),"mouseup",function(){p.trigger("mouseup")},p.uid),(q.can("summon_file_dialog")?j:m).setAttribute("tabindex",-1),j.onchange=function r(){if(p.files=[],c.each(this.files,function(c){var d="";return a.directory&&"."==c.name?!0:(c.webkitRelativePath&&(d="/"+c.webkitRelativePath.replace(/^\//,"")),c=new b(q.uid,c),c.relativePath=d,void p.files.push(c))}),"IE"!==g.browser&&"IEMobile"!==g.browser)this.value="";else{var d=this.cloneNode(!0);this.parentNode.replaceChild(d,this),d.onchange=r}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),k=null},setOption:function(a,b){var c=this.getRuntime(),e=d.get(c.uid);switch(a){case"accept":if(b){var g=b.mimes||f.extList2mimes(b,c.can("filter_by_extension"));e.setAttribute("accept",g.join(","))}else e.removeAttribute("accept");break;case"directory":b&&c.can("select_folder")?(e.setAttribute("directory",""),e.setAttribute("webkitdirectory","")):(e.removeAttribute("directory"),e.removeAttribute("webkitdirectory"));break;case"multiple":b&&c.can("select_multiple")?e.setAttribute("multiple",""):e.removeAttribute("multiple")}},disable:function(a){var b,c=this.getRuntime();(b=d.get(c.uid))&&(b.disabled=!!a)},destroy:function(){var b=this.getRuntime(),c=b.getShim(),f=b.getShimContainer(),g=a&&d.get(a.container),i=a&&d.get(a.browse_button);g&&e.removeAllEvents(g,this.uid),i&&(e.removeAllEvents(i,this.uid),i.style.zIndex=h),f&&(e.removeAllEvents(f,this.uid),f.innerHTML=""),c.removeInstance(this.uid),a=f=g=i=c=null}})}return a.FileInput=h}),d("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(a,b,c,d,e,f){function g(){function a(a){if(!a.dataTransfer||!a.dataTransfer.types)return!1;var b=c.toArray(a.dataTransfer.types||[]);return-1!==c.inArray("Files",b)||-1!==c.inArray("public.file-url",b)||-1!==c.inArray("application/x-moz-file",b)}function g(a,c){if(i(a)){var d=new b(o,a);d.relativePath=c||"",p.push(d)}}function h(a){for(var b=[],d=0;d<a.length;d++)[].push.apply(b,a[d].extensions.split(/\s*,\s*/));return-1===c.inArray("*",b)?b:[]}function i(a){if(!q.length)return!0;var b=f.getFileExtension(a.name);return!b||-1!==c.inArray(b,q)}function j(a,b){var d=[];c.each(a,function(a){var b=a.webkitGetAsEntry();b&&(b.isFile?g(a.getAsFile(),b.fullPath):d.push(b))}),d.length?k(d,b):b()}function k(a,b){var d=[];c.each(a,function(a){d.push(function(b){l(a,b)})}),c.inSeries(d,function(){b()})}function l(a,b){a.isFile?a.file(function(c){g(c,a.fullPath),b()},function(){b()}):a.isDirectory?m(a,b):b()}function m(a,b){function c(a){e.readEntries(function(b){b.length?([].push.apply(d,b),c(a)):a()},a)}var d=[],e=a.createReader();c(function(){k(d,b)})}var n,o,p=[],q=[];c.extend(this,{init:function(b){var d,f=this;n=b,o=f.ruid,q=h(n.accept),d=n.container,e.addEvent(d,"dragover",function(b){a(b)&&(b.preventDefault(),b.dataTransfer.dropEffect="copy")},f.uid),e.addEvent(d,"drop",function(b){a(b)&&(b.preventDefault(),p=[],b.dataTransfer.items&&b.dataTransfer.items[0].webkitGetAsEntry?j(b.dataTransfer.items,function(){f.files=p,f.trigger("drop")}):(c.each(b.dataTransfer.files,function(a){g(a)}),f.files=p,f.trigger("drop")))},f.uid),e.addEvent(d,"dragenter",function(){f.trigger("dragenter")},f.uid),e.addEvent(d,"dragleave",function(){f.trigger("dragleave")},f.uid)},destroy:function(){e.removeAllEvents(n&&d.get(n.container),this.uid),o=p=q=n=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return a.FileDrop=g}),d("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(a,b,c){function d(){function a(a){return b.atob(a.substring(a.indexOf("base64,")+7))}var d,e=!1;c.extend(this,{read:function(b,f){var g=this;g.result="",d=new window.FileReader,d.addEventListener("progress",function(a){g.trigger(a)}),d.addEventListener("load",function(b){g.result=e?a(d.result):d.result,g.trigger(b)}),d.addEventListener("error",function(a){g.trigger(a,d.error)}),d.addEventListener("loadend",function(a){d=null,g.trigger(a)}),"function"===c.typeOf(d[b])?(e=!1,d[b](f.getSource())):"readAsBinaryString"===b&&(e=!0,d.readAsDataURL(f.getSource()))},abort:function(){d&&d.abort()},destroy:function(){d=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return a.FileReader=d}),d("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(a,b,c,d,e,f,g,h,i){function j(){function a(a,b){var c,d,e=this;c=b.getBlob().getSource(),d=new window.FileReader,d.onload=function(){b.append(b.getBlobName(),new f(null,{type:c.type,data:d.result})),o.send.call(e,a,b)},d.readAsBinaryString(c)}function j(){return!window.XMLHttpRequest||"IE"===i.browser&&i.verComp(i.version,8,"<")?function(){for(var a=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],b=0;b<a.length;b++)try{return new ActiveXObject(a[b])}catch(c){}}():new window.XMLHttpRequest}function k(a){var b=a.responseXML,c=a.responseText;return"IE"===i.browser&&c&&b&&!b.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(a.getResponseHeader("Content-Type"))&&(b=new window.ActiveXObject("Microsoft.XMLDOM"),b.async=!1,b.validateOnParse=!1,b.loadXML(c)),b&&("IE"===i.browser&&0!==b.parseError||!b.documentElement||"parsererror"===b.documentElement.tagName)?null:b}function l(a){var b="----moxieboundary"+(new Date).getTime(),c="--",d="\r\n",e="",g=this.getRuntime();if(!g.can("send_binary_string"))throw new h.RuntimeError(h.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+b),a.each(function(a,g){e+=a instanceof f?c+b+d+'Content-Disposition: form-data; name="'+g+'"; filename="'+unescape(encodeURIComponent(a.name||"blob"))+'"'+d+"Content-Type: "+(a.type||"application/octet-stream")+d+d+a.getSource()+d:c+b+d+'Content-Disposition: form-data; name="'+g+'"'+d+d+unescape(encodeURIComponent(a))+d}),e+=c+b+c+d}var m,n,o=this;b.extend(this,{send:function(c,e){var h=this,k="Mozilla"===i.browser&&i.verComp(i.version,4,">=")&&i.verComp(i.version,7,"<"),o="Android Browser"===i.browser,p=!1;if(n=c.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=j(),m.open(c.method,c.url,c.async,c.user,c.password),e instanceof f)e.isDetached()&&(p=!0),e=e.getSource();else if(e instanceof g){if(e.hasBlob())if(e.getBlob().isDetached())e=l.call(h,e),p=!0;else if((k||o)&&"blob"===b.typeOf(e.getBlob().getSource())&&window.FileReader)return void a.call(h,c,e);if(e instanceof g){var q=new window.FormData;e.each(function(a,b){a instanceof f?q.append(b,a.getSource()):q.append(b,a)}),e=q}}m.upload?(c.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(a){h.trigger(a)}),m.addEventListener("error",function(a){h.trigger(a)}),m.addEventListener("progress",function(a){h.trigger(a)}),m.upload.addEventListener("progress",function(a){h.trigger({type:"UploadProgress",loaded:a.loaded,total:a.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var a,b;try{d.hasSameOrigin(c.url)&&(a=m.getResponseHeader("Content-Length")||0),m.responseText&&(b=m.responseText.length)}catch(e){a=b=0}h.trigger({type:"progress",lengthComputable:!!a,total:parseInt(a,10),loaded:b});break;case 4:m.onreadystatechange=function(){};try{if(m.status>=200&&m.status<400){h.trigger("load");break}}catch(e){}h.trigger("error")}},b.isEmptyObj(c.headers)||b.each(c.headers,function(a,b){m.setRequestHeader(b,a)}),""!==c.responseType&&"responseType"in m&&(m.responseType="json"!==c.responseType||i.can("return_response_type","json")?c.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(e):function(){for(var a=new Uint8Array(e.length),b=0;b<e.length;b++)a[b]=255&e.charCodeAt(b);m.send(a.buffer)}():m.send(e),h.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(a){}return 0},getResponse:function(a){var b=this.getRuntime();try{switch(a){case"blob":var d=new e(b.uid,m.response),f=m.getResponseHeader("Content-Disposition");if(f){var g=f.match(/filename=([\'\"'])([^\1]+)\1/);g&&(n=g[2])}return d.name=n,d.type||(d.type=c.getFileMime(n)),d;case"json":return i.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return k(m);default:return""!==m.responseText?m.responseText:null}}catch(h){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(a){}return""},abort:function(){m&&m.abort()},destroy:function(){o=n=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return a.XMLHttpRequest=j}),d("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(a){function b(a){a instanceof ArrayBuffer?c.apply(this,arguments):d.apply(this,arguments)}function c(b){var c=new DataView(b);a.extend(this,{readByteAt:function(a){return c.getUint8(a)},writeByteAt:function(a,b){c.setUint8(a,b)},SEGMENT:function(a,d,e){switch(arguments.length){case 2:return b.slice(a,a+d);case 1:return b.slice(a);case 3:if(null===e&&(e=new ArrayBuffer),e instanceof ArrayBuffer){var f=new Uint8Array(this.length()-d+e.byteLength);a>0&&f.set(new Uint8Array(b.slice(0,a)),0),f.set(new Uint8Array(e),a),f.set(new Uint8Array(b.slice(a+d)),a+e.byteLength),this.clear(),b=f.buffer,c=new DataView(b);break}default:return b}},length:function(){return b?b.byteLength:0},clear:function(){c=b=null}})}function d(b){function c(a,c,d){d=3===arguments.length?d:b.length-c-1,b=b.substr(0,c)+a+b.substr(d+c)}a.extend(this,{readByteAt:function(a){return b.charCodeAt(a)},writeByteAt:function(a,b){c(String.fromCharCode(b),a,1)},SEGMENT:function(a,d,e){switch(arguments.length){case 1:return b.substr(a);case 2:return b.substr(a,d);case 3:c(null!==e?e:"",a,d);break;default:return b}},length:function(){return b?b.length:0},clear:function(){b=null}})}return a.extend(b.prototype,{littleEndian:!1,read:function(a,b){var c,d,e;if(a+b>this.length())throw new Error("You are trying to read outside the source boundaries.");for(d=this.littleEndian?0:-8*(b-1),e=0,c=0;b>e;e++)c|=this.readByteAt(a+e)<<Math.abs(d+8*e);return c},write:function(a,b,c){var d,e;if(a>this.length())throw new Error("You are trying to write outside the source boundaries.");for(d=this.littleEndian?0:-8*(c-1),e=0;c>e;e++)this.writeByteAt(a+e,255&b>>Math.abs(d+8*e))},BYTE:function(a){return this.read(a,1)},SHORT:function(a){return this.read(a,2)},LONG:function(a){return this.read(a,4)},SLONG:function(a){var b=this.read(a,4);return b>2147483647?b-4294967296:b},CHAR:function(a){return String.fromCharCode(this.read(a,1))},STRING:function(a,b){return this.asArray("CHAR",a,b).join("")},asArray:function(a,b,c){for(var d=[],e=0;c>e;e++)d[e]=this[a](b+e);return d}}),b}),d("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,b){return function c(d){var e,f,g,h=[],i=0;if(e=new a(d),65496!==e.SHORT(0))throw e.clear(),new b.ImageError(b.ImageError.WRONG_FORMAT);for(f=2;f<=e.length();)if(g=e.SHORT(f),g>=65488&&65495>=g)f+=2;else{if(65498===g||65497===g)break;i=e.SHORT(f+2)+2,g>=65505&&65519>=g&&h.push({hex:g,name:"APP"+(15&g),start:f,length:i,segment:e.SEGMENT(f,i)}),f+=i}return e.clear(),{headers:h,restore:function(b){var c,d,e;for(e=new a(b),f=65504==e.SHORT(2)?4+e.SHORT(4):2,d=0,c=h.length;c>d;d++)e.SEGMENT(f,0,h[d].segment),f+=h[d].length;return b=e.SEGMENT(),e.clear(),b},strip:function(b){var d,e,f,g;for(f=new c(b),e=f.headers,f.purge(),d=new a(b),g=e.length;g--;)d.SEGMENT(e[g].start,e[g].length,"");return b=d.SEGMENT(),d.clear(),b},get:function(a){for(var b=[],c=0,d=h.length;d>c;c++)h[c].name===a.toUpperCase()&&b.push(h[c].segment);return b},set:function(a,b){var c,d,e,f=[];for("string"==typeof b?f.push(b):f=b,c=d=0,e=h.length;e>c&&(h[c].name===a.toUpperCase()&&(h[c].segment=f[d],h[c].length=f[d].length,d++),!(d>=f.length));c++);},purge:function(){this.headers=h=[]}}}}),d("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,c,d){function e(f){function g(c,e){var f,g,h,i,j,m,n,o,p=this,q=[],r={},s={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},t={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(f=p.SHORT(c),g=0;f>g;g++)if(q=[],n=c+2+12*g,h=e[p.SHORT(n)],h!==b){if(i=s[p.SHORT(n+=2)],j=p.LONG(n+=2),m=t[i],!m)throw new d.ImageError(d.ImageError.INVALID_META_ERR);if(n+=4,m*j>4&&(n=p.LONG(n)+l.tiffHeader),n+m*j>=this.length())throw new d.ImageError(d.ImageError.INVALID_META_ERR);"ASCII"!==i?(q=p.asArray(i,n,j),o=1==j?q[0]:q,r[h]=k.hasOwnProperty(h)&&"object"!=typeof o?k[h][o]:o):r[h]=a.trim(p.STRING(n,j).replace(/\0$/,""))}return r}function h(a,b,c){var d,e,f,g=0;if("string"==typeof b){var h=j[a.toLowerCase()];for(var i in h)if(h[i]===b){b=i;break}}d=l[a.toLowerCase()+"IFD"],e=this.SHORT(d);for(var k=0;e>k;k++)if(f=d+12*k+2,this.SHORT(f)==b){g=f+8;break}if(!g)return!1;try{this.write(g,c,4)}catch(m){return!1}return!0}var i,j,k,l,m,n;if(c.call(this,f),j={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},k={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},l={tiffHeader:10},m=l.tiffHeader,i={clear:this.clear},a.extend(this,{read:function(){try{return e.prototype.read.apply(this,arguments)}catch(a){throw new d.ImageError(d.ImageError.INVALID_META_ERR)}},write:function(){try{return e.prototype.write.apply(this,arguments)}catch(a){throw new d.ImageError(d.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(a){return this.LONG(a)/this.LONG(a+4)},SRATIONAL:function(a){return this.SLONG(a)/this.SLONG(a+4)},ASCII:function(a){return this.CHAR(a)},TIFF:function(){return n||null},EXIF:function(){var b=null;if(l.exifIFD){try{b=g.call(this,l.exifIFD,j.exif)}catch(c){return null}if(b.ExifVersion&&"array"===a.typeOf(b.ExifVersion)){for(var d=0,e="";d<b.ExifVersion.length;d++)e+=String.fromCharCode(b.ExifVersion[d]);b.ExifVersion=e}}return b},GPS:function(){var b=null;if(l.gpsIFD){try{b=g.call(this,l.gpsIFD,j.gps)}catch(c){return null}b.GPSVersionID&&"array"===a.typeOf(b.GPSVersionID)&&(b.GPSVersionID=b.GPSVersionID.join("."))}return b},thumb:function(){if(l.IFD1)try{var a=g.call(this,l.IFD1,j.thumb);if("JPEGInterchangeFormat"in a)return this.SEGMENT(l.tiffHeader+a.JPEGInterchangeFormat,a.JPEGInterchangeFormatLength)}catch(b){}return null},setExif:function(a,b){return"PixelXDimension"!==a&&"PixelYDimension"!==a?!1:h.call(this,"exif",a,b)},clear:function(){i.clear(),f=j=k=n=l=i=null}}),65505!==this.SHORT(0)||"EXIF\x00"!==this.STRING(4,5).toUpperCase())throw new d.ImageError(d.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new d.ImageError(d.ImageError.INVALID_META_ERR);l.IFD0=l.tiffHeader+this.LONG(m+=2),n=g.call(this,l.IFD0,j.tiff),"ExifIFDPointer"in n&&(l.exifIFD=l.tiffHeader+n.ExifIFDPointer,delete n.ExifIFDPointer),"GPSInfoIFDPointer"in n&&(l.gpsIFD=l.tiffHeader+n.GPSInfoIFDPointer,delete n.GPSInfoIFDPointer),a.isEmptyObj(n)&&(n=null);var o=this.LONG(l.IFD0+12*this.SHORT(l.IFD0)+2);o&&(l.IFD1=l.tiffHeader+o)}return e.prototype=c.prototype,e}),d("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(a,b,c,d,e){function f(f){function g(a){var b,c,d=0;for(a||(a=j);d<=a.length();){if(b=a.SHORT(d+=2),b>=65472&&65475>=b)return d+=5,{height:a.SHORT(d),width:a.SHORT(d+=2)};c=a.SHORT(d+=2),d+=c-2}return null}function h(){var a,b,c=l.thumb();return c&&(a=new d(c),b=g(a),a.clear(),b)?(b.data=c,b):null}function i(){l&&k&&j&&(l.clear(),k.purge(),j.clear(),m=k=l=j=null)}var j,k,l,m;if(j=new d(f),65496!==j.SHORT(0))throw new b.ImageError(b.ImageError.WRONG_FORMAT);k=new c(f);try{l=new e(k.get("app1")[0])}catch(n){}m=g.call(this),a.extend(this,{type:"image/jpeg",size:j.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(b,c){return l?("object"===a.typeOf(b)?a.each(b,function(a,b){l.setExif(b,a)}):l.setExif(b,c),void k.set("app1",l.SEGMENT())):!1},writeHeaders:function(){return arguments.length?k.restore(arguments[0]):k.restore(f)},stripHeaders:function(a){return k.strip(a)},purge:function(){i.call(this)}}),l&&(this.meta={tiff:l.TIFF(),exif:l.EXIF(),gps:l.GPS(),thumb:h()})}return f}),d("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(a,b,c){function d(d){function e(){var a,b;return a=g.call(this,8),"IHDR"==a.type?(b=a.start,{width:h.LONG(b),height:h.LONG(b+=4)}):null}function f(){h&&(h.clear(),d=k=i=j=h=null)}function g(a){var b,c,d,e;return b=h.LONG(a),c=h.STRING(a+=4,4),d=a+=4,e=h.LONG(a+b),{length:b,type:c,
start:d,CRC:e}}var h,i,j,k;h=new c(d),function(){var b=0,c=0,d=[35152,20039,3338,6666];for(c=0;c<d.length;c++,b+=2)if(d[c]!=h.SHORT(b))throw new a.ImageError(a.ImageError.WRONG_FORMAT)}(),k=e.call(this),b.extend(this,{type:"image/png",size:h.length(),width:k.width,height:k.height,purge:function(){f.call(this)}}),f.call(this)}return d}),d("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(a,b,c,d){return function(e){var f,g=[c,d];f=function(){for(var a=0;a<g.length;a++)try{return new g[a](e)}catch(c){}throw new b.ImageError(b.ImageError.WRONG_FORMAT)}(),a.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(a){return a},stripHeaders:function(a){return a},purge:function(){e=null}}),a.extend(this,f),this.purge=function(){f.purge(),f=null}}}),d("moxie/runtime/html5/image/ResizerCanvas",[],function(){function a(c,d,e){var f=c.width>c.height?"width":"height",g=Math.round(c[f]*d),h=!1;"nearest"!==e&&(.5>d||d>2)&&(d=.5>d?.5:2,h=!0);var i=b(c,d);return h?a(i,g/i[f],e):i}function b(a,b){var c=a.width,d=a.height,e=Math.round(c*b),f=Math.round(d*b),g=document.createElement("canvas");return g.width=e,g.height=f,g.getContext("2d").drawImage(a,0,0,c,d,0,0,e,f),a=null,g}return{scale:a}}),d("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g,h,i){function j(){function a(){if(!s&&!q)throw new c.ImageError(c.DOMException.INVALID_STATE_ERR);return s||q}function j(){var b=a();return"canvas"==b.nodeName.toLowerCase()?b:(s=document.createElement("canvas"),s.width=b.width,s.height=b.height,s.getContext("2d").drawImage(b,0,0),s)}function k(a){return d.atob(a.substring(a.indexOf("base64,")+7))}function l(a,b){return"data:"+(b||"")+";base64,"+d.btoa(a)}function m(a){var b=this;q=new Image,q.onerror=function(){p.call(this),b.trigger("error",c.ImageError.WRONG_FORMAT)},q.onload=function(){b.trigger("load")},q.src="data:"==a.substr(0,5)?a:l(a,u.type)}function n(a,b){var d,e=this;return window.FileReader?(d=new FileReader,d.onload=function(){b.call(e,this.result)},d.onerror=function(){e.trigger("error",c.ImageError.WRONG_FORMAT)},void d.readAsDataURL(a)):b.call(this,a.getAsDataURL())}function o(a,c){var d=Math.PI/180,e=document.createElement("canvas"),f=e.getContext("2d"),g=a.width,h=a.height;switch(b.inArray(c,[5,6,7,8])>-1?(e.width=h,e.height=g):(e.width=g,e.height=h),c){case 2:f.translate(g,0),f.scale(-1,1);break;case 3:f.translate(g,h),f.rotate(180*d);break;case 4:f.translate(0,h),f.scale(1,-1);break;case 5:f.rotate(90*d),f.scale(1,-1);break;case 6:f.rotate(90*d),f.translate(0,-h);break;case 7:f.rotate(90*d),f.translate(g,-h),f.scale(-1,1);break;case 8:f.rotate(-90*d),f.translate(-g,0)}return f.drawImage(a,0,0,g,h),e}function p(){r&&(r.purge(),r=null),t=q=s=u=null,w=!1}var q,r,s,t,u,v=this,w=!1,x=!0;b.extend(this,{loadFromBlob:function(a){var b=this.getRuntime(),d=arguments.length>1?arguments[1]:!0;if(!b.can("access_binary"))throw new c.RuntimeError(c.RuntimeError.NOT_SUPPORTED_ERR);return u=a,a.isDetached()?(t=a.getSource(),void m.call(this,t)):void n.call(this,a.getSource(),function(a){d&&(t=k(a)),m.call(this,a)})},loadFromImage:function(a,b){this.meta=a.meta,u=new f(null,{name:a.name,size:a.size,type:a.type}),m.call(this,b?t=a.getAsBinaryString():a.getAsDataURL())},getInfo:function(){var b,c=this.getRuntime();return!r&&t&&c.can("access_image_binary")&&(r=new g(t)),b={width:a().width||0,height:a().height||0,type:u.type||i.getFileMime(u.name),size:t&&t.length||u.size||0,name:u.name||"",meta:null},x&&(b.meta=r&&r.meta||this.meta||{},!b.meta||!b.meta.thumb||b.meta.thumb.data instanceof e||(b.meta.thumb.data=new e(null,{type:"image/jpeg",data:b.meta.thumb.data}))),b},resize:function(b,c,d){var e=document.createElement("canvas");if(e.width=b.width,e.height=b.height,e.getContext("2d").drawImage(a(),b.x,b.y,b.width,b.height,0,0,e.width,e.height),s=h.scale(e,c),x=d.preserveHeaders,!x){var f=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;s=o(s,f)}this.width=s.width,this.height=s.height,w=!0,this.trigger("Resize")},getAsCanvas:function(){return s||(s=j()),s.id=this.uid+"_canvas",s},getAsBlob:function(a,b){return a!==this.type?(w=!0,new f(null,{name:u.name||"",type:a,data:v.getAsDataURL(a,b)})):new f(null,{name:u.name||"",type:a,data:v.getAsBinaryString(a,b)})},getAsDataURL:function(a){var b=arguments[1]||90;if(!w)return q.src;if(j(),"image/jpeg"!==a)return s.toDataURL("image/png");try{return s.toDataURL("image/jpeg",b/100)}catch(c){return s.toDataURL("image/jpeg")}},getAsBinaryString:function(a,b){if(!w)return t||(t=k(v.getAsDataURL(a,b))),t;if("image/jpeg"!==a)t=k(v.getAsDataURL(a,b));else{var c;b||(b=90),j();try{c=s.toDataURL("image/jpeg",b/100)}catch(d){c=s.toDataURL("image/jpeg")}t=k(c),r&&(t=r.stripHeaders(t),x&&(r.meta&&r.meta.exif&&r.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),t=r.writeHeaders(t)),r.purge(),r=null)}return w=!1,t},destroy:function(){v=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return a.Image=j}),d("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(a,b,c,d,f){function g(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1])}function h(a){var d=c.get(a);d&&"OBJECT"==d.nodeName&&("IE"===b.browser?(d.style.display="none",function e(){4==d.readyState?i(a):setTimeout(e,10)}()):d.parentNode.removeChild(d))}function i(a){var b=c.get(a);if(b){for(var d in b)"function"==typeof b[d]&&(b[d]=null);b.parentNode.removeChild(b)}}function j(i){var j,m=this;i=a.extend({swf_url:b.swf_url},i),f.call(this,i,k,{access_binary:function(a){return a&&"browser"===m.mode},access_image_binary:function(a){return a&&"browser"===m.mode},display_media:f.capTest(e("moxie/image/Image")),do_cors:f.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:f.capTrue,return_response_headers:!1,return_response_type:function(b){return"json"===b&&window.JSON?!0:!a.arrayDiff(b,["","text","document"])||"browser"===m.mode},return_status_code:function(b){return"browser"===m.mode||!a.arrayDiff(b,[200,404])},select_file:f.capTrue,select_multiple:f.capTrue,send_binary_string:function(a){return a&&"browser"===m.mode},send_browser_cookies:function(a){return a&&"browser"===m.mode},send_custom_headers:function(a){return a&&"browser"===m.mode},send_multipart:f.capTrue,slice_blob:function(a){return a&&"browser"===m.mode},stream_upload:function(a){return a&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(b){return a.parseSizeStr(b)<=2097152||"client"===m.mode},use_http_method:function(b){return!a.arrayDiff(b,["GET","POST"])}},{access_binary:function(a){return a?"browser":"client"},access_image_binary:function(a){return a?"browser":"client"},report_upload_progress:function(a){return a?"browser":"client"},return_response_type:function(b){return a.arrayDiff(b,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(b){return a.arrayDiff(b,[200,404])?"browser":["client","browser"]},send_binary_string:function(a){return a?"browser":"client"},send_browser_cookies:function(a){return a?"browser":"client"},send_custom_headers:function(a){return a?"browser":"client"},slice_blob:function(a){return a?"browser":"client"},stream_upload:function(a){return a?"client":"browser"},upload_filesize:function(b){return a.parseSizeStr(b)>=2097152?"client":"browser"}},"client"),g()<11.3&&(this.mode=!1),a.extend(this,{getShim:function(){return c.get(this.uid)},shimExec:function(a,b){var c=[].slice.call(arguments,2);return m.getShim().exec(this.uid,a,b,c)},init:function(){var c,e,g;g=this.getShimContainer(),a.extend(g.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),c='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+i.swf_url+'" ',"IE"===b.browser&&(c+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),c+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+i.swf_url+'" /><param name="flashvars" value="uid='+escape(this.uid)+"&target="+f.getGlobalEventTarget()+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',"IE"===b.browser?(e=document.createElement("div"),g.appendChild(e),e.outerHTML=c,e=g=null):g.innerHTML=c,j=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new d.RuntimeError(d.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(a){return function(){h(m.uid),a.call(m),clearTimeout(j),i=j=a=m=null}}(this.destroy)},l)}var k="flash",l={};return f.addConstructor(k,j),l}),d("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(a,b){var c={slice:function(a,c,d,e){var f=this.getRuntime();return 0>c?c=Math.max(a.size+c,0):c>0&&(c=Math.min(c,a.size)),0>d?d=Math.max(a.size+d,0):d>0&&(d=Math.min(d,a.size)),a=f.shimExec.call(this,"Blob","slice",c,d,e||""),a&&(a=new b(f.uid,a)),a}};return a.Blob=c}),d("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(a,b,c,d){var e={init:function(a){var e=this,f=this.getRuntime(),g=c.get(a.browse_button);g&&(g.setAttribute("tabindex",-1),g=null),this.bind("Change",function(){var a=f.shimExec.call(e,"FileInput","getFiles");e.files=[],d.each(a,function(a){e.files.push(new b(f.uid,a))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:a.accept,multiple:a.multiple}),this.trigger("ready")}};return a.FileInput=e}),d("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(a,b){function c(a,c){switch(c){case"readAsText":return b.atob(a,"utf8");case"readAsBinaryString":return b.atob(a);case"readAsDataURL":return a}return null}var d={read:function(a,b){var d=this;return d.result="","readAsDataURL"===a&&(d.result="data:"+(b.type||"")+";base64,"),d.bind("Progress",function(b,e){e&&(d.result+=c(e,a))},999),d.getRuntime().shimExec.call(this,"FileReader","readAsBase64",b.uid)}};return a.FileReader=d}),d("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(a,b){function c(a,c){switch(c){case"readAsText":return b.atob(a,"utf8");case"readAsBinaryString":return b.atob(a);case"readAsDataURL":return a}return null}var d={read:function(a,b){var d,e=this.getRuntime();return(d=e.shimExec.call(this,"FileReaderSync","readAsBase64",b.uid))?("readAsDataURL"===a&&(d="data:"+(b.type||"")+";base64,"+d),c(d,a,b.type)):null}};return a.FileReaderSync=d}),d("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(a,b){var c={getAsBlob:function(a){var c=this.getRuntime(),d=c.shimExec.call(this,"Transporter","getAsBlob",a);return d?new b(c.uid,d):null}};return a.Transporter=c}),d("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(a,b,c,d,e,f,g,h){var i={send:function(a,d){function e(){a.transport=k.mode,k.shimExec.call(j,"XMLHttpRequest","send",a,d)}function f(a,b){k.shimExec.call(j,"XMLHttpRequest","appendBlob",a,b.uid),d=null,e()}function i(a,b){var c=new h;c.bind("TransportingComplete",function(){b(this.result)}),c.transport(a.getSource(),a.type,{ruid:k.uid})}var j=this,k=j.getRuntime();if(b.isEmptyObj(a.headers)||b.each(a.headers,function(a,b){k.shimExec.call(j,"XMLHttpRequest","setRequestHeader",b,a.toString())}),d instanceof g){var l;if(d.each(function(a,b){a instanceof c?l=b:k.shimExec.call(j,"XMLHttpRequest","append",b,a)}),d.hasBlob()){var m=d.getBlob();m.isDetached()?i(m,function(a){m.destroy(),f(l,a)}):f(l,m)}else d=null,e()}else d instanceof c?d.isDetached()?i(d,function(a){d.destroy(),d=a.uid,e()}):(d=d.uid,e()):e()},getResponse:function(a){var c,f,g=this.getRuntime();if(f=g.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(f=new d(g.uid,f),"blob"===a)return f;try{if(c=new e,~b.inArray(a,["","text"]))return c.readAsText(f);if("json"===a&&window.JSON)return JSON.parse(c.readAsText(f))}finally{f.destroy()}}return null},abort:function(){var a=this.getRuntime();a.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return a.XMLHttpRequest=i}),d("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(a,b,c,d,e){var f={loadFromBlob:function(a){function b(a){e.shimExec.call(d,"Image","loadFromBlob",a.uid),d=e=null}var d=this,e=d.getRuntime();if(a.isDetached()){var f=new c;f.bind("TransportingComplete",function(){b(f.result.getSource())}),f.transport(a.getSource(),a.type,{ruid:e.uid})}else b(a.getSource())},loadFromImage:function(a){var b=this.getRuntime();return b.shimExec.call(this,"Image","loadFromImage",a.uid)},getInfo:function(){var a=this.getRuntime(),b=a.shimExec.call(this,"Image","getInfo");return b.meta&&b.meta.thumb&&b.meta.thumb.data&&!(a.meta.thumb.data instanceof d)&&(b.meta.thumb.data=new d(a.uid,b.meta.thumb.data)),b},getAsBlob:function(a,b){var c=this.getRuntime(),e=c.shimExec.call(this,"Image","getAsBlob",a,b);return e?new d(c.uid,e):null},getAsDataURL:function(){var a,b=this.getRuntime(),c=b.Image.getAsBlob.apply(this,arguments);return c?(a=new e,a.readAsDataURL(c)):null}};return a.Image=f}),d("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(a,b,c,d,f){function g(a){var b,c,d,e,f,g=!1,h=null,i=0;try{try{h=new ActiveXObject("AgControl.AgControl"),h.IsVersionSupported(a)&&(g=!0),h=null}catch(j){var k=navigator.plugins["Silverlight Plug-In"];if(k){for(b=k.description,"1.0.30226.2"===b&&(b="2.0.30226.2"),c=b.split(".");c.length>3;)c.pop();for(;c.length<4;)c.push(0);for(d=a.split(".");d.length>4;)d.pop();do e=parseInt(d[i],10),f=parseInt(c[i],10),i++;while(i<d.length&&e===f);f>=e&&!isNaN(e)&&(g=!0)}}}catch(l){g=!1}return g}function h(h){var k,l=this;h=a.extend({xap_url:b.xap_url},h),f.call(this,h,i,{access_binary:f.capTrue,access_image_binary:f.capTrue,display_media:f.capTest(e("moxie/image/Image")),do_cors:f.capTrue,drag_and_drop:!1,report_upload_progress:f.capTrue,resize_image:f.capTrue,return_response_headers:function(a){return a&&"client"===l.mode},return_response_type:function(a){return"json"!==a?!0:!!window.JSON},return_status_code:function(b){return"client"===l.mode||!a.arrayDiff(b,[200,404])},select_file:f.capTrue,select_multiple:f.capTrue,send_binary_string:f.capTrue,send_browser_cookies:function(a){return a&&"browser"===l.mode},send_custom_headers:function(a){return a&&"client"===l.mode},send_multipart:f.capTrue,slice_blob:f.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:f.capTrue,use_http_method:function(b){return"client"===l.mode||!a.arrayDiff(b,["GET","POST"])}},{return_response_headers:function(a){return a?"client":"browser"},return_status_code:function(b){return a.arrayDiff(b,[200,404])?"client":["client","browser"]},send_browser_cookies:function(a){return a?"browser":"client"},send_custom_headers:function(a){return a?"client":"browser"},use_http_method:function(b){return a.arrayDiff(b,["GET","POST"])?"client":["client","browser"]}}),g("2.0.31005.0")&&"Opera"!==b.browser||(this.mode=!1),a.extend(this,{getShim:function(){return c.get(this.uid).content.Moxie},shimExec:function(a,b){var c=[].slice.call(arguments,2);return l.getShim().exec(this.uid,a,b,c)},init:function(){var a;a=this.getShimContainer(),a.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;"><param name="source" value="'+h.xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="uid='+this.uid+",target="+f.getGlobalEventTarget()+'"/></object>',k=setTimeout(function(){l&&!l.initialized&&l.trigger("Error",new d.RuntimeError(d.RuntimeError.NOT_INIT_ERR))},"Windows"!==b.OS?1e4:5e3)},destroy:function(a){return function(){a.call(l),clearTimeout(k),h=k=a=l=null}}(this.destroy)},j)}var i="silverlight",j={};return f.addConstructor(i,h),j}),d("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(a,b,c){return a.Blob=b.extend({},c)}),d("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(a,b,c,d){function e(a){for(var b="",c=0;c<a.length;c++)b+=(""!==b?"|":"")+a[c].title+" | *."+a[c].extensions.replace(/,/g,";*.");return b}var f={init:function(a){var f=this,g=this.getRuntime(),h=c.get(a.browse_button);h&&(h.setAttribute("tabindex",-1),h=null),this.bind("Change",function(){var a=g.shimExec.call(f,"FileInput","getFiles");f.files=[],d.each(a,function(a){f.files.push(new b(g.uid,a))})},999),g.shimExec.call(this,"FileInput","init",e(a.accept),a.multiple),this.trigger("ready")},setOption:function(a,b){"accept"==a&&(b=e(b)),this.getRuntime().shimExec.call(this,"FileInput","setOption",a,b)}};return a.FileInput=f}),d("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(a,b,c){var d={init:function(){var a,d=this,e=d.getRuntime();return a=e.getShimContainer(),c.addEvent(a,"dragover",function(a){a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy"},d.uid),c.addEvent(a,"dragenter",function(a){a.preventDefault();var c=b.get(e.uid).dragEnter(a);c&&a.stopPropagation()},d.uid),c.addEvent(a,"drop",function(a){a.preventDefault();var c=b.get(e.uid).dragDrop(a);c&&a.stopPropagation()},d.uid),e.shimExec.call(this,"FileDrop","init")}};return a.FileDrop=d}),d("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(a,b,c){return a.FileReader=b.extend({},c)}),d("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(a,b,c){return a.FileReaderSync=b.extend({},c)}),d("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(a,b,c){return a.Transporter=b.extend({},c)}),d("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(a,b,c){return a.XMLHttpRequest=b.extend({},c)}),d("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(a,b,c,d){return a.Image=b.extend({},d,{getInfo:function(){var a=this.getRuntime(),d=["tiff","exif","gps","thumb"],e={meta:{}},f=a.shimExec.call(this,"Image","getInfo");return f.meta&&(b.each(d,function(a){var b,c,d,g,h=f.meta[a];if(h&&h.keys)for(e.meta[a]={},c=0,d=h.keys.length;d>c;c++)b=h.keys[c],g=h[b],g&&(/^(\d|[1-9]\d+)$/.test(g)?g=parseInt(g,10):/^\d*\.\d+$/.test(g)&&(g=parseFloat(g)),e.meta[a][b]=g)}),e.meta&&e.meta.thumb&&e.meta.thumb.data&&!(a.meta.thumb.data instanceof c)&&(e.meta.thumb.data=new c(a.uid,e.meta.thumb.data))),e.width=parseInt(f.width,10),e.height=parseInt(f.height,10),e.size=parseInt(f.size,10),e.type=f.type,e.name=f.name,e},resize:function(a,b,c){this.getRuntime().shimExec.call(this,"Image","resize",a.x,a.y,a.width,a.height,b,c.preserveHeaders,c.resample)}})}),d("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(a,b,c,d){function f(b){var f=this,i=c.capTest,j=c.capTrue;c.call(this,b,g,{access_binary:i(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:i((d.can("create_canvas")||d.can("use_data_uri_over32kb"))&&e("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:i(function(){return!("Chrome"===d.browser&&d.verComp(d.version,28,"<")||"IE"===d.browser&&d.verComp(d.version,10,"<")||"Safari"===d.browser&&d.verComp(d.version,11,"<=")||"Firefox"===d.browser&&d.verComp(d.version,37,"<")||"iOS"===d.os||"Android"===d.os)}()),resize_image:function(){return h.Image&&f.can("access_binary")&&d.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(b){return"json"===b&&window.JSON?!0:!!~a.inArray(b,["text","document",""])},return_status_code:function(b){return!a.arrayDiff(b,[200,404])},select_file:function(){return d.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return f.can("select_file")},summon_file_dialog:function(){return f.can("select_file")&&!("Firefox"===d.browser&&d.verComp(d.version,4,"<")||"Opera"===d.browser&&d.verComp(d.version,12,"<")||"IE"===d.browser&&d.verComp(d.version,10,"<"))},upload_filesize:j,use_http_method:function(b){return!a.arrayDiff(b,["GET","POST"])}}),a.extend(this,{init:function(){this.trigger("Init")},destroy:function(a){return function(){a.call(f),a=f=null}}(this.destroy)}),a.extend(this.getShim(),h)}var g="html4",h={};return c.addConstructor(g,f),h}),d("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g){function h(){function a(){var f,j,l,m,n,o,p=this,q=p.getRuntime();o=c.guid("uid_"),f=q.getShimContainer(),h&&(l=d.get(h+"_form"),l&&(c.extend(l.style,{top:"100%"}),l.firstChild.setAttribute("tabindex",-1))),m=document.createElement("form"),m.setAttribute("id",o+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),c.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),n=document.createElement("input"),n.setAttribute("id",o),n.setAttribute("type","file"),n.setAttribute("accept",k.join(",")),q.can("summon_file_dialog")&&n.setAttribute("tabindex",-1),c.extend(n.style,{fontSize:"999px",opacity:0}),m.appendChild(n),f.appendChild(m),c.extend(n.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===g.browser&&g.verComp(g.version,10,"<")&&c.extend(n.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),n.onchange=function(){var c;this.value&&(c=this.files?this.files[0]:{name:this.value},c=new b(q.uid,c),this.onchange=function(){},a.call(p),p.files=[c],n.setAttribute("id",c.uid),m.setAttribute("id",c.uid+"_form"),p.trigger("change"),n=m=null)},q.can("summon_file_dialog")&&(j=d.get(i.browse_button),e.removeEvent(j,"click",p.uid),e.addEvent(j,"click",function(a){n&&!n.disabled&&n.click(),a.preventDefault()},p.uid)),h=o,f=l=j=null}var h,i,j,k=[];c.extend(this,{init:function(b){var c,g=this,h=g.getRuntime();i=b,k=f.extList2mimes(b.accept,h.can("filter_by_extension")),c=h.getShimContainer(),function(){var a,f,k;a=d.get(b.browse_button),j=d.getStyle(a,"z-index")||"auto",h.can("summon_file_dialog")?("static"===d.getStyle(a,"position")&&(a.style.position="relative"),g.bind("Refresh",function(){f=parseInt(j,10)||1,d.get(i.browse_button).style.zIndex=f,this.getRuntime().getShimContainer().style.zIndex=f-1})):a.setAttribute("tabindex",-1),k=h.can("summon_file_dialog")?a:c,e.addEvent(k,"mouseover",function(){g.trigger("mouseenter")},g.uid),e.addEvent(k,"mouseout",function(){g.trigger("mouseleave")},g.uid),e.addEvent(k,"mousedown",function(){g.trigger("mousedown")},g.uid),e.addEvent(d.get(b.container),"mouseup",function(){g.trigger("mouseup")},g.uid),a=null}(),a.call(this),c=null,g.trigger({type:"ready",async:!0})},setOption:function(a,b){var c,e=this.getRuntime();"accept"==a&&(k=b.mimes||f.extList2mimes(b,e.can("filter_by_extension"))),c=d.get(h),c&&c.setAttribute("accept",k.join(","))},disable:function(a){var b;(b=d.get(h))&&(b.disabled=!!a)},destroy:function(){var a=this.getRuntime(),b=a.getShim(),c=a.getShimContainer(),f=i&&d.get(i.container),g=i&&d.get(i.browse_button);f&&e.removeAllEvents(f,this.uid),g&&(e.removeAllEvents(g,this.uid),g.style.zIndex=j),c&&(e.removeAllEvents(c,this.uid),c.innerHTML=""),b.removeInstance(this.uid),h=k=i=c=f=g=b=null}})}return a.FileInput=h}),d("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(a,b){return a.FileReader=b}),d("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(a,b,c,d,e,f,g,h){function i(){function a(a){var b,d,e,g,h=this,i=!1;if(k){if(b=k.id.replace(/_iframe$/,""),d=c.get(b+"_form")){for(e=d.getElementsByTagName("input"),g=e.length;g--;)switch(e[g].getAttribute("type")){case"hidden":e[g].parentNode.removeChild(e[g]);break;case"file":i=!0}e=[],i||d.parentNode.removeChild(d),d=null}setTimeout(function(){f.removeEvent(k,"load",h.uid),k.parentNode&&k.parentNode.removeChild(k);var b=h.getRuntime().getShimContainer();b.children.length||b.parentNode.removeChild(b),b=k=null,a()},1)}}var i,j,k;b.extend(this,{send:function(l,m){function n(){var c=t.getShimContainer()||document.body,e=document.createElement("div");e.innerHTML='<iframe id="'+o+'_iframe" name="'+o+'_iframe" src="javascript:""" style="display:none"></iframe>',k=e.firstChild,c.appendChild(k),f.addEvent(k,"load",function(){var c;try{c=k.contentWindow.document||k.contentDocument||window.frames[k.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(c.title)?i=c.title.replace(/^(\d+).*$/,"$1"):(i=200,j=b.trim(c.body.innerHTML),s.trigger({type:"progress",loaded:j.length,total:j.length}),r&&s.trigger({type:"uploadprogress",loaded:r.size||1025,total:r.size||1025}))}catch(e){if(!d.hasSameOrigin(l.url))return void a.call(s,function(){s.trigger("error")});i=404}a.call(s,function(){s.trigger("load")})},s.uid)}var o,p,q,r,s=this,t=s.getRuntime();if(i=j=null,m instanceof h&&m.hasBlob()){if(r=m.getBlob(),o=r.uid,q=c.get(o),p=c.get(o+"_form"),!p)throw new e.DOMException(e.DOMException.NOT_FOUND_ERR)}else o=b.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",o+"_form"),p.setAttribute("method",l.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),t.getShimContainer().appendChild(p);p.setAttribute("target",o+"_iframe"),m instanceof h&&m.each(function(a,c){if(a instanceof g)q&&q.setAttribute("name",c);else{var d=document.createElement("input");b.extend(d,{type:"hidden",name:c,value:a}),q?p.insertBefore(d,q):p.appendChild(d)}}),p.setAttribute("action",l.url),n(),p.submit(),s.trigger("loadstart")},getStatus:function(){return i},getResponse:function(a){if("json"===a&&"string"===b.typeOf(j)&&window.JSON)try{return JSON.parse(j.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(c){return null}return j},abort:function(){var b=this;k&&k.contentWindow&&(k.contentWindow.stop?k.contentWindow.stop():k.contentWindow.document.execCommand?k.contentWindow.document.execCommand("Stop"):k.src="about:blank"),a.call(this,function(){b.dispatchEvent("abort")})},destroy:function(){this.getRuntime().getShim().removeInstance(this.uid)}})}return a.XMLHttpRequest=i}),d("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(a,b){return a.Image=b}),g(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)}),!function(a,b){var c=function(){var a={};return b.apply(a,arguments),a.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],c):"object"==typeof module&&module.exports?module.exports=c(require("./moxie")):a.plupload=c(a.moxie)}(this||window,function(a){!function(b,c){"use strict";function d(a,b){for(var c,d=[],e=0;e<a.length;++e){if(c=h[a[e]]||f(a[e]),!c)throw"module definition dependecy not found: "+a[e];d.push(c)}b.apply(null,d)}function e(a,b,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(b===c)throw"invalid module definition, dependencies must be specified";if(e===c)throw"invalid module definition, definition function must be specified";d(b,function(){h[a]=e.apply(null,arguments)})}function f(a){for(var c=b,d=a.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function g(a){for(var d=0;d<a.length;d++){for(var e=b,f=a[d],g=f.split(/[.\/]/),i=0;i<g.length-1;++i)e[g[i]]===c&&(e[g[i]]={}),e=e[g[i]];e[g[g.length-1]]=h[f]}}var h={};e("plupload",[],function(){var b=a,c=b.core.utils;return c.Env.global_event_dispatcher="plupload.EventTarget.instance.dispatchEvent",{VERSION:"3.1.2",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,OPTION_ERROR:-800,moxie:b,ua:c.Env,typeOf:c.Basic.typeOf,clone:c.Basic.clone,inherit:c.Basic.inherit,extend:c.Basic.extend,extendImmutable:c.Basic.extendImmutable,extendIf:c.Basic.extendIf,inSeries:c.Basic.inSeries,inParallel:c.Basic.inParallel,guid:c.Basic.guid,getAll:function(a){var b,d=[];"array"!==c.Basic.typeOf(a)&&(a=[a]);for(var e=a.length;e--;)b=c.Dom.get(a[e]),b&&d.push(b);return d.length?d:null},get:c.Dom.get,each:c.Basic.each,getPos:c.Dom.getPos,getSize:c.Dom.getSize,xmlEncode:function(a){var b={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},c=/[<>&\"\']/g;return a?(""+a).replace(c,function(a){return b[a]?"&"+b[a]+";":a}):a},toArray:c.Basic.toArray,inArray:c.Basic.inArray,addI18n:b.core.I18n.addI18n,translate:b.core.I18n.translate,sprintf:c.Basic.sprintf,isEmptyObj:c.Basic.isEmptyObj,hasClass:c.Dom.hasClass,addClass:c.Dom.addClass,removeClass:c.Dom.removeClass,getStyle:c.Dom.getStyle,addEvent:c.Events.addEvent,removeEvent:c.Events.removeEvent,removeAllEvents:c.Events.removeAllEvents,cleanName:function(a){var b,c;for(c=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a=a.replace(/\s+/g,"_"),a=a.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(a,b){var d="";
return c.Basic.each(b,function(a,b){d+=(d?"&":"")+encodeURIComponent(b)+"="+encodeURIComponent(a)}),d&&(a+=(a.indexOf("?")>0?"&":"?")+d),a},formatSize:function(a){function b(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)}var c=this;if(a=parseInt(a,10),isNaN(a))return c.translate("N/A");var d=Math.pow(1024,4);return a>d?b(a/d,1)+" "+c.translate("tb"):a>(d/=1024)?b(a/d,1)+" "+c.translate("gb"):a>(d/=1024)?b(a/d,1)+" "+c.translate("mb"):a>1024?Math.round(a/1024)+" "+c.translate("kb"):a+" "+c.translate("b")},mimes2extList:a.core.utils.Mime.mimes2extList,resolveUrl:c.Url.resolveUrl,parseSize:c.Basic.parseSizeStr,delay:c.Basic.delay,EventTarget:a.core.EventTarget,Runtime:a.runtime.Runtime,FileInput:a.file.FileInput,FileReader:a.file.FileReader}}),e("plupload/core/Collection",["plupload"],function(){var a=function(){function b(){var a;for(a in d);return d[a]}var c,d={},e=0;plupload.extend(this,{count:function(){return e},hasKey:function(a){return d.hasOwnProperty(a)},get:function(a){return d[a]},first:function(){for(var a in d)return d[a]},last:function(){return c},toObject:function(){return d},add:function(a,b){var f=this;return"object"!=typeof a||b?d.hasOwnProperty(a)?f.update.apply(f,arguments):(d[a]=c=b,void e++):plupload.each(a,function(a,b){f.add(b,a)})},remove:function(a){if(this.hasKey(a)){var f=d[a];delete d[a],e--,c===f&&(c=b())}},extract:function(a){var b=this.get(a);return this.remove(a),b},shift:function(){var a,b,c=this;for(b in d)return a=d[b],c.remove(b),a},update:function(a,b){d[a]=b},each:function(a){plupload.each(d,a)},combineWith:function(){var b=new a;return b.add(d),plupload.each(arguments,function(c){c instanceof a&&b.add(c.toObject())}),b},clear:function(){d={},c=null,e=0}})};return a}),e("plupload/core/ArrCollection",["plupload"],function(a){var b=function(){var b=[];a.extend(this,{count:function(){return b.length},hasKey:function(a){return this.getIdx(a)>-1},get:function(a){var c=this.getIdx(a);return c>-1?b[c]:null},getIdx:function(a){for(var c=0,d=b.length;d>c;c++)if(b[c].uid===a)return c;return-1},getByIdx:function(a){return b[a]},first:function(){return b[0]},last:function(){return b[b.length-1]},add:function(a){a=arguments[1]||a;var c=this.getIdx(a.uid);return c>-1?(b[c]=a,c):(b.push(a),b.length-1)},remove:function(a){return!!this.extract(a)},splice:function(c,d){return c="undefinded"===a.typeOf(c)?0:Math.max(c,0),d="undefinded"!==a.typeOf(d)&&c+d<b.length?d:b.length-c,b.splice(c,d)},extract:function(a){var c=this.getIdx(a);return c>-1?b.splice(c,1):null},shift:function(){return b.shift()},update:function(a,c){var d=this.getIdx(a);return d>-1?(b[d]=c,!0):!1},each:function(c){a.each(b,c)},combineWith:function(){return Array.prototype.concat.apply(this.toArray(),arguments)},sort:function(a){b.sort(a||function(a,b){return a.priority-b.priority})},clear:function(){b=[]},toObject:function(){for(var a={},c=0,d=b.length;d>c;c++)a[b[c].uid]=b[c];return a},toArray:function(){return Array.prototype.slice.call(b)}})};return b}),e("plupload/core/Optionable",["plupload"],function(b){var c=a.core.EventTarget;return function(a){function c(){a.apply(this,arguments),this._options={}}return b.inherit(c,a),b.extend(c.prototype,{setOption:function(a,c,d){var e,f=this;return"object"==typeof a?(d=c,void b.each(a,function(a,b){f.setOption(b,a,d)})):void((!d||f._options.hasOwnProperty(a))&&(e=b.clone(f._options[a]),"object"===b.typeOf(c)&&"object"===b.typeOf(f._options[a])?b.extend(f._options[a],c):f._options[a]=c,f.trigger("OptionChanged",a,c,e)))},getOption:function(a){if(!a)return this._options;var c=this._options[a];return b.inArray(b.typeOf(c),["array","object"])>-1?b.extendImmutable({},c):c},setOptions:function(a,b){"object"==typeof a&&this.setOption(a,b)},getOptions:function(){return this.getOption()}}),c}(c)}),e("plupload/core/Queueable",["plupload","plupload/core/Optionable"],function(a,b){return function(b){function c(){b.apply(this,arguments),this.uid=a.guid(),this.state=c.IDLE,this.processed=0,this.total=0,this.percent=0,this.retries=0,this.priority=0,this.startedTimestamp=0,this.processedTimestamp=0}return c.IDLE=1,c.PROCESSING=2,c.PAUSED=6,c.RESUMED=7,c.DONE=5,c.FAILED=4,c.DESTROYED=8,a.inherit(c,b),a.extend(c.prototype,{start:function(){var a=this.state;return this.state===c.PROCESSING?!1:(this.startedTimestamp||(this.startedTimestamp=+new Date),this.state=c.PROCESSING,this.trigger("statechanged",this.state,a),this.trigger("started"),!0)},pause:function(){var b=this.state;return-1===a.inArray(this.state,[c.IDLE,c.RESUMED,c.PROCESSING])?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.state=c.PAUSED,this.trigger("statechanged",this.state,b),this.trigger("paused"),!0)},resume:function(){var a=this.state;return this.state!==c.PAUSED&&this.state!==c.RESUMED?!1:(this.state=c.RESUMED,this.trigger("statechanged",this.state,a),this.trigger("resumed"),!0)},stop:function(){var a=this.state;return this.state===c.IDLE?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.startedTimestamp=0,this.state=c.IDLE,this.trigger("statechanged",this.state,a),this.trigger("stopped"),!0)},done:function(a){var b=this.state;return this.state===c.DONE?!1:(this.processed=this.total,this.loaded=this.processed,this.percent=100,this.processedTimestamp=+new Date,this.state=c.DONE,this.trigger("statechanged",this.state,b),this.trigger("done",a),this.trigger("processed"),!0)},failed:function(a){var b=this.state;return this.state===c.FAILED?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.processedTimestamp=+new Date,this.state=c.FAILED,this.trigger("statechanged",this.state,b),this.trigger("failed",a),this.trigger("processed"),!0)},progress:function(a,b){b&&(this.total=b),this.processed=Math.min(a,this.total),this.loaded=this.processed,this.percent=Math.ceil(100*(this.processed/this.total)),this.trigger({type:"progress",loaded:this.processed,total:this.total})},destroy:function(){var a=this.state;return this.state===c.DESTROYED?!1:(this.state=c.DESTROYED,this.trigger("statechanged",this.state,a),this.trigger("destroy"),this.unbindAll(),!0)}}),c}(b)}),e("plupload/core/Stats",[],function(){return function(){var a=this;a.size=0,a.total=0,a.loaded=0,a.uploaded=0,a.done=0,a.failed=0,a.queued=0,a.paused=0,a.processing=0,a.paused=0,a.percent=0,a.bytesPerSec=0,a.processedPerSec=0,a.reset=function(){a.size=a.total=a.loaded=a.processed=a.uploaded=a.done=a.failed=a.queued=a.processing=a.paused=a.percent=a.bytesPerSec=a.processedPerSec=0}}}),e("plupload/core/Queue",["plupload","plupload/core/ArrCollection","plupload/core/Queueable","plupload/core/Stats"],function(a,b,c,d){return function(e){function f(c){e.apply(this,arguments),this._queue=new b,this.stats=new d,this._options=a.extend({},this._options,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1},c)}function g(){var a;return this.forEachItem(function(b){return b.state===c.IDLE||b.state===c.RESUMED?(a=b,!1):void 0}),a?a:null}function h(){var a;if(this.state!==c.PROCESSING&&this.state!==c.PAUSED)return!1;if(this.stats.processing<this.getOption("max_slots")&&(a=g.call(this))){if(a.trigger("beforestart"))return a.setOptions(this.getOptions()),a.start();a.pause(),h.call(this)}return!1}return a.inherit(f,e),a.extend(f.prototype,{count:function(){return this._queue.count()},start:function(){return f.parent.start.call(this)?h.call(this):!1},pause:function(){return f.parent.pause.call(this)?void this.forEachItem(function(a){a.pause()}):!1},stop:function(){return!f.parent.stop.call(this)||this.getOption("finish_active")?!1:void(this.isActive()&&this.forEachItem(function(a){a.stop()}))},forEachItem:function(a){this._queue.each(a)},getItem:function(a){return this._queue.get(a)},addItem:function(b){var d=this;b.bind("Started",function(){d.calcStats()&&a.delay.call(d,h)}),b.bind("Resumed",function(){d.start()}),b.bind("Paused",function(){d.calcStats()&&a.delay.call(d,function(){h.call(d)||d.stats.processing||d.pause()})}),b.bind("Processed Stopped",function(){d.calcStats()&&a.delay.call(d,function(){h.call(d)||this.isStopped()||this.isActive()||d.stop()})}),b.bind("Progress",function(){d.calcStats()&&d.trigger("Progress",d.stats.processed,d.stats.total,d.stats)}),b.bind("Failed",function(){d.getOption("max_retries")&&this.retries<d.getOption("max_retries")&&(this.stop(),this.retries++)}),this._queue.add(b.uid,b),this.calcStats(),b.trigger("Queued"),(d.getOption("auto_start")||d.state===c.PAUSED)&&a.delay.call(this,this.start)},extractItem:function(a){var b=this._queue.get(a);return b&&(this.stopItem(b.uid),this._queue.remove(a),this.calcStats()),b},removeItem:function(a){var b=this.extractItem(a);return b?(b.destroy(),!0):!1},stopItem:function(a){var b=this._queue.get(a);return b?b.stop():!1},pauseItem:function(a){var b=this._queue.get(a);return b?b.pause():!1},resumeItem:function(b){var c=this._queue.get(b);return c?(a.delay.call(this,function(){this.start()}),c.resume()):!1},splice:function(a,b){return this._queue.splice(a,b)},isActive:function(){return this.stats&&(this.stats.processing||this.stats.paused)},isStopped:function(){return this.state===c.IDLE||this.state===c.DESTROYED},countSpareSlots:function(){return Math.max(this.getOption("max_slots")-this.stats.processing,0)},toArray:function(){return this._queue.toArray()},clear:function(){var a=this;return a.state!==c.IDLE?(a.bindOnce("Stopped",function(){a.clear()}),a.stop()):(a._queue.clear(),void a.stats.reset())},calcStats:function(){var a=this,b=a.stats,d=0,e=0;return b?(b.reset(),a.forEachItem(function(f){switch(f.state){case c.DONE:b.done++,b.uploaded=b.done;break;case c.FAILED:b.failed++;break;case c.PROCESSING:b.processing++;break;case c.PAUSED:b.paused++;break;default:b.queued++}d+=f.processed,(!f.processedTimestamp||f.processedTimestamp>a.startedTimestamp)&&(e+=d),b.processedPerSec=Math.ceil(e/((+new Date-a.startedTimestamp||1)/1e3)),b.processed=d,b.total+=f.total,b.total&&(b.percent=Math.ceil(100*(b.processed/b.total)))}),a.percent=b.percent,b.loaded=b.processed,b.size=b.total,b.bytesPerSec=b.processedPerSec,!0):!1},destroy:function(){var b=this;return b.state===c.DESTROYED?!1:b.state!==c.IDLE?(b.bindOnce("Stopped",function(){a.delay.call(b,b.destroy)}),b.stop()):(b.clear(),f.parent.destroy.call(this),b._queue=b.stats=null,!0)}}),f}(c)}),e("plupload/QueueUpload",["plupload","plupload/core/Queue"],function(a,b){return function(c){function d(a){b.call(this,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1,url:!1,chunk_size:0,multipart:!0,http_method:"POST",params:{},headers:!1,file_data_name:"file",send_file_name:!0,stop_on_fail:!0}),this.setOption=function(a,b){"object"!=typeof a&&"max_upload_slots"==a&&(a="max_slots"),d.prototype.setOption.call(this,a,b,!0)},this.setOptions(a)}return a.inherit(d,c),d}(b)}),e("plupload/QueueResize",["plupload","plupload/core/Queue"],function(a,b){return function(c){function d(a){b.call(this,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1,resize:{}}),this.setOption=function(a,b){"object"!=typeof a&&"max_resize_slots"==a&&(a="max_slots"),d.prototype.setOption.call(this,a,b,!0)},this.setOptions(a)}return a.inherit(d,c),d}(b)}),e("plupload/ChunkUploader",["plupload","plupload/core/Collection","plupload/core/Queueable"],function(b,c,d){function e(a){function c(a,c){var d="";return b.each(c,function(a,b){d+=(d?"&":"")+encodeURIComponent(b)+"="+encodeURIComponent(a)}),d&&(a+=(a.indexOf("?")>0?"&":"?")+d),a}var h;d.call(this),this._options={file_data_name:"file",headers:!1,http_method:"POST",multipart:!0,params:{},send_file_name:!0,url:!1},b.extend(this,{start:function(){var e,i,j=this,k=this.state,l=j._options;if(this.state===d.PROCESSING)return!1;this.startedTimestamp||(this.startedTimestamp=+new Date),this.state=d.PROCESSING,this.trigger("statechanged",this.state,k),h=new f,h.upload&&(h.upload.onprogress=function(a){j.progress(a.loaded,a.total)}),h.onload=function(){var a={response:this.responseText,status:this.status,responseHeaders:this.getAllResponseHeaders()};return this.status<200||this.status>=400?j.failed(a):void j.done(a)},h.onerror=function(){j.failed()},h.onloadend=function(){setTimeout(function(){h&&(h.destroy(),h=null)},1)};try{e=l.multipart?l.url:c(l.url,l.params),h.open(l.http_method,e,!0),b.isEmptyObj(l.headers)||b.each(l.headers,function(a,b){h.setRequestHeader(b,a)}),l.multipart?(i=new g,b.isEmptyObj(l.params)||b.each(l.params,function(a,b){i.append(b,a)}),i.append(l.file_data_name,a),h.send(i)):((b.isEmptyObj(l.headers)||!h.hasRequestHeader("content-type"))&&h.setRequestHeader("content-type","application/octet-stream"),h.send(a)),this.trigger("started")}catch(m){j.failed()}},stop:function(){h&&(h.abort(),h.destroy(),h=null),e.prototype.stop.call(this)},setOption:function(a,b){e.prototype.setOption.call(this,a,b,!0)},setOptions:function(a){e.prototype.setOption.call(this,a,!0)},destroy:function(){this.stop(),e.prototype.destroy.call(this)}})}var f=a.xhr.XMLHttpRequest,g=a.xhr.FormData;return b.inherit(e,d),e}),e("plupload/FileUploader",["plupload","plupload/core/Collection","plupload/core/Queueable","plupload/ChunkUploader"],function(a,b,c,d){function e(f,g){function h(){var a=0;return j.each(function(b){b.state===c.DONE&&(a+=b.end-b.start)}),a}function i(){for(var a=0;k>a&&j.hasKey(a);)a++;return a}var j=new b,k=1;c.call(this),this._options={chunk_size:0,params:{},send_file_name:!0,stop_on_fail:!0},a.extend(this,{name:f.name,start:function(){var a,b=this,e=this.state;return this.state===c.PROCESSING?!1:(this.startedTimestamp||(this.startedTimestamp=+new Date),this.state=c.PROCESSING,this.trigger("statechanged",this.state,e),b._options.send_file_name&&(b._options.params.name=b.target_name||b.name),b._options.chunk_size?(k=Math.ceil(f.size/b._options.chunk_size),b.uploadChunk(!1,!0)):(a=new d(f),a.bind("progress",function(a){b.progress(a.loaded,a.total)}),a.bind("done",function(a,c){b.done(c)}),a.bind("failed",function(a,c){b.failed(c)}),a.setOptions(b._options),g.addItem(a)),void this.trigger("started"))},uploadChunk:function(b,e){var l,m,n=this,o=this.getOption("chunk_size"),p={};return p.seq=parseInt(b,10)||i(),p.start=p.seq*o,p.end=Math.min(p.start+o,f.size),p.total=f.size,p.start<0||p.start>=f.size?!1:(m=a.extendImmutable({},this.getOptions(),{params:{chunk:p.seq,chunks:k}}),l=new d(f.slice(p.start,p.end,f.type)),l.bind("progress",function(a){n.progress(h()+a.loaded,f.size)}),l.bind("failed",function(b,d){j.add(p.seq,a.extend({state:c.FAILED},p)),n.trigger("chunkuploadfailed",a.extendImmutable({},p,d)),m.stop_on_fail&&n.failed(d)}),l.bind("done",function(b,d){j.add(p.seq,a.extend({state:c.DONE},p)),n.trigger("chunkuploaded",a.extendImmutable({},p,d)),h()>=f.size?(n.progress(f.size,f.size),n.done(d)):e&&a.delay(function(){n.uploadChunk(i(),e)})}),l.bind("processed",function(){this.destroy()}),l.setOptions(m),j.add(p.seq,a.extend({state:c.PROCESSING},p)),g.addItem(l),e&&g.countSpareSlots()&&n.uploadChunk(i(),e),!0)},destroy:function(){e.prototype.destroy.call(this),j.clear()}})}return a.inherit(e,c),e}),e("plupload/ImageResizer",["plupload","plupload/core/Queueable"],function(b,c){function d(a){c.call(this),this._options={type:"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},this.setOption=function(a){("object"==typeof a||this._options.hasOwnProperty(a))&&d.prototype.setOption.apply(this,arguments)},this.start=function(b){var c,d=this;b&&this.setOptions(b.resize),c=new e,c.bind("load",function(){this.resize(d.getOptions())}),c.bind("resize",function(){d.done(this.getAsBlob(d.getOption("type"),d.getOption("quality"))),this.destroy()}),c.bind("error",function(){d.failed(),this.destroy()}),c.load(a,d.getOption("runtimeOptions"))}}var e=a.image.Image;return b.inherit(d,c),b.Image=e,d}),e("plupload/File",["plupload","plupload/core/Queueable","plupload/FileUploader","plupload/ImageResizer"],function(a,b,c,d){function e(h,i,j){b.call(this),a.extend(this,{id:this.uid,name:h.name,target_name:null,type:h.type,size:h.size,origSize:h.size,start:function(){var c=this.state;return this.state===b.PROCESSING?!1:(this.state=b.PROCESSING,this.trigger("statechanged",this.state,c),this.trigger("started"),!a.isEmptyObj(this._options.resize)&&f(this.type)&&g(h,"send_binary_string")?this.resizeAndUpload():this.upload(),!0)},getSource:function(){return h},getNative:function(){return this.getFile().getSource()},resizeAndUpload:function(){var a=this,b=a.getOptions(),c=new d(h);c.bind("progress",function(b){a.progress(b.loaded,b.total)}),c.bind("done",function(b,c){c=c,a.upload()}),c.bind("failed",function(){a.upload()}),c.setOption("runtimeOptions",{runtime_order:b.runtimes,required_caps:b.required_features,preferred_caps:b.preferred_caps,swf_url:b.flash_swf_url,xap_url:b.silverlight_xap_url}),j.addItem(c)},upload:function(){var a=this,b=new c(h,i);b.bind("paused",function(){a.pause()}),b.bind("resumed",function(){this.start()}),b.bind("started",function(){a.trigger("startupload")}),b.bind("progress",function(b){a.progress(b.loaded,b.total)}),b.bind("done",function(b,c){a.done(c)}),b.bind("failed",function(b,c){a.failed(c)}),b.setOptions(a.getOptions()),b.start()},destroy:function(){e.prototype.destroy.call(this),h=null}})}function f(b){return a.inArray(b,["image/jpeg","image/png"])>-1}function g(b,c){if(b.ruid){var d=a.Runtime.getInfo(b.ruid);if(d)return d.can(c)}return!1}return a.inherit(e,b),e}),e("plupload/Uploader",["plupload","plupload/core/Collection","plupload/core/Queue","plupload/QueueUpload","plupload/QueueResize","plupload/File"],function(b,c,d,e,f,g){function h(c){function i(){var a=u[0]||v[0];return a?a.getRuntime().uid:!1}function l(){this.bind("FilesAdded FilesRemoved",function(a){a.trigger("QueueChanged"),a.refresh()},this,999),this.bind("BeforeUpload",p),this.bind("Stopped",function(a){a.trigger("UploadComplete")}),this.bind("Error",q),this.bind("Destroy",r)}function m(c){var d=this,e=0,f=[],g={runtime_order:d.getOption("runtimes"),required_caps:d.getOption("required_features"),preferred_caps:d.getOption("preferred_caps"),swf_url:d.getOption("flash_swf_url"),xap_url:d.getOption("silverlight_xap_url")};b.each(d.getOption("runtimes").split(/\s*,\s*/),function(a){d.getOption(a)&&(g[a]=d.getOption(a))}),d.getOption("browse_button")&&b.each(d.getOption("browse_button"),function(c){f.push(function(f){var h=new a.file.FileInput(b.extend({},g,{accept:d.getOption("filters").mime_types,name:d.getOption("file_data_name"),multiple:d.getOption("multi_selection"),container:d.getOption("container"),browse_button:c}));h.onready=function(){var a=b.Runtime.getInfo(this.ruid);b.extend(d.features,{chunks:a.can("slice_blob"),multipart:a.can("send_multipart"),multi_selection:a.can("select_multiple")}),e++,u.push(this),f()},h.onchange=function(){d.addFile(this.files)},h.bind("mouseenter mouseleave mousedown mouseup",function(a){x||(d.getOption("browse_button_hover")&&("mouseenter"===a.type?b.addClass(c,d.getOption("browse_button_hover")):"mouseleave"===a.type&&b.removeClass(c,d.getOption("browse_button_hover"))),d.getOption("browse_button_active")&&("mousedown"===a.type?b.addClass(c,d.getOption("browse_button_active")):"mouseup"===a.type&&b.removeClass(c,d.getOption("browse_button_active"))))}),h.bind("mousedown",function(){d.trigger("Browse")}),h.bind("error runtimeerror",function(){h=null,f()}),h.init()})}),d.getOption("drop_element")&&b.each(d.getOption("drop_element"),function(c){f.push(function(f){var h=new a.file.FileDrop(b.extend({},g,{drop_zone:c}));h.onready=function(){var a=b.Runtime.getInfo(this.ruid);b.extend(d.features,{chunks:a.can("slice_blob"),multipart:a.can("send_multipart"),dragdrop:a.can("drag_and_drop")}),e++,v.push(this),f()},h.ondrop=function(){d.addFile(this.files)},h.bind("error runtimeerror",function(){h=null,f()}),h.init()})}),b.inParallel(f,function(){"function"==typeof c&&c(e)})}function p(a,b){if(a.getOption("unique_names")){var c=b.name.match(/\.([^.]+)$/),d="part";c&&(d=c[1]),b.target_name=b.id+"."+d}}function q(a,c){c.code===b.INIT_ERROR?a.destroy():c.code===b.HTTP_ERROR&&a.state==b.STARTED&&a.trigger("CancelUpload")}function r(a){a.forEachItem(function(a){a.destroy()}),u.length&&(b.each(u,function(a){a.destroy()}),u=[]),v.length&&(b.each(v,function(a){a.destroy()}),v=[]),w=!1,s&&s.destroy(),t&&t.destroy(),y=s=t=null}var s,t,u=[],v=[],w=!1,x=!1,y=j(b.extend({backward_compatibility:!0,chunk_size:0,file_data_name:"file",filters:{mime_types:"*",prevent_duplicates:!1,max_file_size:0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_resize_slots:1,max_retries:0,max_upload_slots:1,multipart:!0,multipart_params:{},multi_selection:!0,params:{},resize:!1,runtimes:b.Runtime.order,send_chunk_number:!0,send_file_name:!0,silverlight_xap_url:"js/Moxie.xap",required_features:!1,preferred_caps:!1},c));d.call(this),b.extend(this,{_options:y,id:this.uid,state:b.STOPPED,features:{},settings:y,runtime:null,files:[],total:this.stats,init:function(){var a,c,d=this;return a=d.getOption("preinit"),"function"==typeof a?a(d):b.each(a,function(a,b){d.bind(b,a)}),l.call(d),b.each(["container","browse_button","drop_element"],function(a){return null===d.getOption(a)?(c={code:b.INIT_ERROR,message:b.sprintf(b.translate("%s specified, but cannot be found."),a)},!1):void 0}),c?d.trigger("Error",c):d.getOption("browse_button")||d.getOption("drop_element")?void m.call(d,function(a){var c,g=d.getOption("init"),h=b.extendImmutable({},d.getOption(),{auto_start:!0});"function"==typeof g?g(d):b.each(g,function(a,b){d.bind(b,a)}),a?(w=!0,c=b.Runtime.getInfo(i()),s=new e(h),t=new f(h),d.trigger("Init",{ruid:c.uid,runtime:d.runtime=c.type}),d.trigger("PostInit")):d.trigger("Error",{code:b.INIT_ERROR,message:b.translate("Init error.")})}):d.trigger("Error",{code:b.INIT_ERROR,message:b.translate("You must specify either browse_button or drop_element.")})},setOption:function(a,c){return w&&b.inArray(a,["container","browse_button","drop_element","runtimes","multi_selection","flash_swf_url","silverlight_xap_url"])>-1?this.trigger("Error",{code:b.OPTION_ERROR,message:b.sprintf(b.translate("%s option cannot be changed.")),option:a}):("object"!=typeof a&&(c=k(a,c,this._options),s&&s.setOption(a,c),t&&t.setOption(a,c)),void h.prototype.setOption.call(this,a,c))},refresh:function(){u.length&&b.each(u,function(a){a.trigger("Refresh")}),v.length&&b.each(v,function(a){a.trigger("Refresh")}),this.trigger("Refresh")},stop:function(){h.prototype.stop.call(this)&&this.state!=b.STOPPED&&this.trigger("CancelUpload")},disableBrowse:function(){x=arguments[0]!==n?arguments[0]:!0,u.length&&b.each(u,function(a){a.disable(x)}),this.trigger("DisableBrowse",x)},getFile:function(a){return this.getItem(a)},addFile:function(c,d){function e(a){a.bind("beforestart",function(a){return k.trigger("BeforeUpload",a.target)}),a.bind("startupload",function(){k.trigger("UploadFile",this)}),a.bind("progress",function(){k.trigger("UploadProgress",this)}),a.bind("done",function(a,b){k.trigger("FileUploaded",this,b)}),a.bind("failed",function(a,c){k.trigger("Error",b.extend({code:b.HTTP_ERROR,message:b.translate("HTTP Error."),file:this},c))})}function f(a,c){var d=[];b.each(k.getOption("filters"),function(b,c){o[c]&&d.push(function(d){o[c].call(k,b,a,function(a){d(!a)})})}),b.inParallel(d,c)}function h(c){var i=b.typeOf(c);if(c instanceof a.file.File){if(!c.ruid&&!c.isDetached()){if(!j)return!1;c.ruid=j,c.connectRuntime(j)}l.push(function(a){f(c,function(f){var h;f||(h=new g(c,s,t),d&&(h.name=d),e(h),k.addItem(h),m.push(h),k.trigger("FileFiltered",h)),b.delay(a)})})}else c instanceof a.file.Blob?(h(c.getSource()),c.destroy()):-1!==b.inArray(i,["file","blob"])?h(new a.file.File(null,c)):"node"===i&&"filelist"===b.typeOf(c.files)?b.each(c.files,h):"array"===i&&(d=null,b.each(c,h))}var j,k=this,l=[],m=[];j=i(),h(c),l.length&&b.inParallel(l,function(){m.length&&k.trigger("FilesAdded",m)})},removeFile:function(a){var b=this.extractItem("string"==typeof a?a:a.uid);b&&(this.trigger("FilesRemoved",[b]),b.destroy())},splice:function(){var a=0,c=b.STARTED==this.state,e=d.prototype.splice.apply(this,arguments);if(e.length){for(this.trigger("FilesRemoved",e),c&&this.stop(),a=0;a<e.length;a++)e[a].destroy();c&&this.start()}},dispatchEvent:function(a){var b,c;if(a=a.toLowerCase(),b=this.hasEventListener(a)){b.sort(function(a,b){return b.priority-a.priority}),c=[].slice.call(arguments),c.shift(),c.unshift(this);for(var d=0;d<b.length;d++)if(b[d].fn.apply(b[d].scope,c)===!1)return!1}return!0},bind:function(a,c,d,e){b.Uploader.prototype.bind.call(this,a,c,e,d)}}),y.backward_compatibility&&(this.bind("FilesAdded FilesRemoved",function(a){a.files=a.toArray()},this,999),this.bind("OptionChanged",function(a,c,d){a.settings[c]="object"==typeof d?b.extend({},d):d},this,999))}function i(a){function c(a,b,c){var d={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};d[a]?e[d[a]]=b:c||(e[a]=b)}var d=a.required_features,e={};return"string"==typeof d?b.each(d.split(/\s*,\s*/),function(a){c(a,!0)}):"object"==typeof d?b.each(d,function(a,b){c(b,a)}):d===!0&&(a.chunk_size&&a.chunk_size>0&&(e.slice_blob=!0),b.isEmptyObj(a.resize)&&a.multipart!==!1||(e.send_binary_string=!0),a.http_method&&(e.use_http_method=a.http_method),b.each(a,function(a,b){c(b,!!a,!0)})),e}function j(a){return b.each(a,function(b,c){a[c]=k(c,b,a)}),a}function k(a,c,d){switch(a){case"chunk_size":(c=b.parseSize(c))&&(d.send_file_name=!0);break;case"headers":var e={};return"object"==typeof c&&b.each(c,function(a,b){e[b.toLowerCase()]=a}),e;case"http_method":return"PUT"===c.toUpperCase()?"PUT":"POST";case"filters":return"array"===b.typeOf(c)&&(c={mime_types:c}),c.mime_types&&("string"===b.typeOf(c.mime_types)&&(c.mime_types=b.mimes2extList(c.mime_types)),d.re_ext_filter=function(a){var c=[];return b.each(a,function(a){b.each(a.extensions.split(/,/),function(a){/^\s*\*\s*$/.test(a)?c.push("\\.*"):c.push("\\."+a.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+c.join("|")+")$","i")}(c.mime_types)),c;case"max_file_size":d&&!d.filters&&(d.filters={}),d.filters.max_file_size=c;break;case"multipart":c||(d.send_file_name=!0);break;case"multipart_params":d.params=d.multipart_params=c;break;case"resize":return c?b.extend({preserve_headers:!0,crop:!1},c):!1;case"prevent_duplicates":d&&!d.filters&&(d.filters={}),d.filters.prevent_duplicates=!!c;break;case"unique_names":c&&(d.send_file_name=!0);break;case"required_features":return i(b.extend({},d));case"preferred_caps":return i(b.extend({},d,{required_features:!0}));case"container":case"browse_button":case"drop_element":return"container"===a?b.get(c):b.getAll(c)}return c}function l(a,b){o[a]=b}function m(a,c){var d,e;return d=new h(a),e=b.Runtime.thatCan(d.getOption("required_features"),c||a.runtimes),d.destroy(),e}var n,o={};return l("mime_types",function(a,c,d){a.length&&!this.getOption("re_ext_filter").test(c.name)?(this.trigger("Error",{code:b.FILE_EXTENSION_ERROR,message:b.translate("File extension error."),file:c}),d(!1)):d(!0)}),l("max_file_size",function(a,c,d){var e;a=b.parseSize(a),c.size!==e&&a&&c.size>a?(this.trigger("Error",{code:b.FILE_SIZE_ERROR,message:b.translate("File size error."),file:c}),d(!1)):d(!0)}),l("prevent_duplicates",function(a,c,d){var e=this;a&&this.forEachItem(function(a){return c.name===a.name&&c.size===a.size?(e.trigger("Error",{code:b.FILE_DUPLICATE_ERROR,message:b.translate("Duplicate file error."),file:c}),void d(!1)):void 0}),d(!0)}),l("prevent_empty",function(a,c,d){a&&!c.size&&c.size!==n?(this.trigger("Error",{code:b.FILE_SIZE_ERROR,message:b.translate("File size error."),file:c}),d(!1)):d(!0)}),h.addFileFilter=l,b.inherit(h,d),b.addFileFilter=l,b.predictRuntime=m,h}),g(["plupload","plupload/core/Collection","plupload/core/ArrCollection","plupload/core/Optionable","plupload/core/Queueable","plupload/core/Stats","plupload/core/Queue","plupload/QueueUpload","plupload/QueueResize","plupload/ChunkUploader","plupload/FileUploader","plupload/ImageResizer","plupload/File","plupload/Uploader"])}(this)}),function(a){function b(a){this.init(a)}a.extend(b,{init:function(b){function c(b,c){return b?(a(".ke-status > div",b).hide(),void a(".ke-message",b).addClass("ke-error").show().html(c)):void alert(c)}function d(a,b){if(a&&/image\//.test(a.type))if("image/gif"==a.type){var c=new moxie.file.FileReader;c.onload=function(){b(c.result),c.destroy(),c=null},c.readAsDataURL(a.getSource())}else{var d=new moxie.image.Image;d.onload=function(){d.downsize(150,150);var c="image/jpeg"==d.type?d.getAsDataURL("image/jpeg",80):d.getAsDataURL();b&&b(c,a),d.destroy(),d=null},d.load(a.getSource())}}var e=this;b.afterError=b.afterError||function(a){alert(a)},e.options=b,e.progressbars={},e.div=a(b.container).html(['<div class="ke-plupload">','<div class="ke-plupload-top ke-flex">','<div class="ke-inline-block ke-plupload-button">','<button type="button" class="ke-button">'+b.browse+"</button>","</div>",'<div class="ke-inline-block ke-plupload-desc ke-flex-auto">'+b.uploadDesc+"</div>",'<span class="ke-plupload-startupload">','<button type="button" class="ke-button">'+b.startButtonValue+"</button>","</span>","</div>",'<div class="ke-plupload-body"></div>',"</div>"].join("")),e.bodyDiv=a(".ke-plupload-body",e.div),e.swfu=new plupload.Uploader({browse_button:a(".ke-plupload-button > button",e.div)[0],url:b.uploadUrl,file_data_name:b.filePostName,runtimes:"html5,html4",filters:{max_file_size:b.fileSizeLimit},multipart_params:b.postParams,init:{FilesAdded:function(b,c){for(var f in c){var g=c[f];g.url=e.options.fileIconUrl,e.appendFile(g)}for(var f in c){var g=c[f];d(g,function(b,c,d){a('div[data-id="'+c.id+'"] img',e.bodyDiv).attr("src",b)})}},BeforeUpload:function(b,c){var d=a('div[data-id="'+c.id+'"]',e.bodyDiv);a(".ke-status > div",d).hide(),a(".ke-progressbar",d).show()},UploadProgress:function(a,b){var c=b.percent,d=e.progressbars[b.id];d.bar.css("width",Math.round(80*c/100)+"px"),d.percent.html(c+"%")},Error:function(b,d){var f=a('div[data-id="'+b.id+'"]',e.bodyDiv).eq(0);c(f,d.message)},FileUploaded:function(b,d,f){var g=f.response,h=a('div[data-id="'+d.id+'"]',e.bodyDiv).eq(0),i={};try{i=a.json(g)}catch(j){e.options.afterError.call(this,"<!doctype html><html>"+g+"</html>")}return 0!==i.error?void c(h,i.message):(d.url=i.url,a(".ke-img",h).attr("data-status",i.error?!1:!0).data("data",i),void a(".ke-status > div",h).hide())}}}),e.swfu.init(),a(".ke-plupload-startupload button",e.div).click(function(){e.swfu.start()})},srartUpload:function(){this.swfu.start()},getUrlList:function(){var b=[];return a(".ke-img",self.bodyDiv).each(function(){var c=a(this),d=c.attr("data-status");console.log(d),"true"==d&&b.push(c.data("data"))}),b},removeFile:function(b){var c=this;c.swfu.removeFile(b);var d=a('div[data-id="'+b+'"]',c.bodyDiv);a(".ke-photo",d).unbind(),a(".ke-delete",d).unbind(),d.remove()},removeFiles:function(){var b=this;a(".ke-item",b.bodyDiv).each(function(){b.removeFile(a(this).attr("data-id"))})},appendFile:function(b){var c=this,d=a('<div class="ke-inline-block ke-item" data-id="'+b.id+'"></div>');c.bodyDiv.append(d);var e=a('<div class="ke-inline-block ke-photo"></div>').mouseover(function(b){a(this).addClass("ke-on")}).mouseout(function(b){a(this).removeClass("ke-on")});d.append(e);var f=a('<img src="'+b.url+'" class="ke-img" data-status="false" width="80" height="80" alt="'+b.name+'" />');e.append(f),a('<span class="ke-delete"></span>').appendTo(e).click(function(){c.removeFile(b.id)});var g=a('<div class="ke-status"></div>').appendTo(e);return a(['<div class="ke-progressbar">','<div class="ke-progressbar-bar"><div class="ke-progressbar-bar-inner"></div></div>','<div class="ke-progressbar-percent">0%</div></div>'].join("")).hide().appendTo(g),a('<div class="ke-message">'+c.options.pendingMessage+"</div>").appendTo(g),
d.append('<div class="ke-name">'+b.name+"</div>"),c.progressbars[b.id]={bar:a(".ke-progressbar-bar-inner",e),percent:a(".ke-progressbar-percent",e)},!0},remove:function(){this.removeFiles(),this.div.html("")}}),a.plupload=function(a,c){return new b(a,c)}}(KindEditor),KindEditor.plugin("multiupload",function(a){var b=this,c="multiupload",d=(a.undef(b.formatUploadUrl,!0),a.undef(b.uploadJson,b.basePath+"php/upload_json.php")),e=b.pluginsPath+"multiupload/images/",f=a.undef(b.imageSizeLimit,"1MB"),g=(a.undef(b.imageFileTypes,"*.jpg;*.gif;*.png"),a.undef(b.imageUploadLimit,20)),h=a.undef(b.filePostName,"imgFile"),i=b.lang(c+".");b.plugin.multiImageDialog=function(j){var k=j.clickFn,l=a.tmpl(i.uploadDesc,{uploadLimit:g,sizeLimit:f}),m=["<div>",'<div class="plupload">',"</div>","</div>"].join(""),n=b.createDialog({name:c,width:650,height:520,title:b.lang(c),body:m,previewBtn:{name:i.insertAll,click:function(a){k.call(b,p.getUrlList())}},yesBtn:{name:i.clearAll,click:function(a){p.removeFiles()}},beforeRemove:function(){p.remove()}}),o=n.div,p=a.plupload({container:a(".plupload",o),buttonHeight:23,fileIconUrl:e+"image.png",browse:i.browse,uploadDesc:l,startButtonValue:i.startUpload,uploadUrl:a.addParam(d,"dir=files"),filePostName:h,fileSizeLimit:f,postParams:a.undef(b.extraFileUploadParams,{}),pendingMessage:i.pending,afterError:function(a){b.errorDialog(a)}});return n},b.clickToolbar(c,function(){b.plugin.multiImageDialog({clickFn:function(c){0!==c.length&&(a.each(c,function(c,d){if(b.afterUpload&&b.afterUpload.call(b,d.url,d,"multiupload"),/\.(swf)(\?|$)/i.test(d.url)){var e=a.mediaImg(b.themesPath+"common/blank.gif",{src:d.url,type:a.mediaType(".swf"),width:400,height:400,quality:"high"});b.exec("insertHtml",e)}else if(/\.(mp4|webm|flv)(\?|$)/i.test(d.url)){var e=a.mediaImg(b.themesPath+"common/blank.gif",{"data-src":url,"data-type":a.mediaType(url),"data-width":width,"data-height":height,type:a.mediaType(d.type),width:width,height:height});b.exec("insertHtml",e)}else if(/\.(mp3|wav|ogg)(\?|$)/i.test(d.url)){var e=a.mediaImg(b.themesPath+"common/blank.gif",{src:url,type:a.mediaType(url),width:width,height:height});b.exec("insertHtml",e)}else/\.(jpg|gif|jpeg|png|bmp)(\?|$)/i.test(d.url)?b.exec("insertimage",d.url,d.title,d.width,d.height,d.border,d.align):b.exec("insertHtml",'<a href="'+d.url+'">'+d.url+"</a>");b.exec("insertHtml","<br>")}),setTimeout(function(){b.hideDialog().focus()},100))}})})}),KindEditor.plugin("pagebreak",function(a){var b=this,c="pagebreak",d=a.undef(b.pagebreakHtml,'<hr style="page-break-after: always;" class="ke-pagebreak" />');b.clickToolbar(c,function(){var c=b.cmd,e=c.range;b.focus();var f="br"==b.newlineTag||a.WEBKIT?"":'<span id="__kindeditor_tail_tag__"></span>';if(b.insertHtml(d+f),""!==f){var g=a("#__kindeditor_tail_tag__",b.edit.doc);e.selectNodeContents(g[0]),g.removeAttr("id"),c.select()}})}),KindEditor.plugin("plainpaste",function(a){var b=this,c="plainpaste";b.clickToolbar(c,function(){var d=b.lang(c+"."),e='<div style="padding:10px 20px;"><div style="margin-bottom:10px;">'+d.comment+'</div><textarea class="ke-textarea" style="width:408px;height:260px;"></textarea></div>',f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(c){var d=g.val();d=a.escape(d),d=d.replace(/ {2}/g," "),d="p"==b.newlineTag?d.replace(/^/,"<p>").replace(/$/,"</p>").replace(/\n/g,"</p><p>"):d.replace(/\n/g,"<br />$&"),b.insertHtml(d).hideDialog().focus()}}}),g=a("textarea",f.div);g[0].focus()})}),KindEditor.plugin("preview",function(a){var b=this,c="preview";b.clickToolbar(c,function(){var d=(b.lang(c+"."),'<div style="padding:10px 20px;"><iframe class="ke-textarea" frameborder="0" style="width:708px;height:400px;"></iframe></div>'),e=b.createDialog({name:c,width:750,title:b.lang(c),body:d}),f=a("iframe",e.div),g=a.iframeDoc(f);g.open(),g.write(b.fullHtml()),g.close(),a(g.body).css("background-color","#FFF"),f[0].contentWindow.focus()})}),KindEditor.plugin("quickformat",function(a){function b(a){for(var b=a.first();b&&b.first();)b=b.first();return b}var c=this,d="quickformat",e=a.toMap("blockquote,center,div,h1,h2,h3,h4,h5,h6,p");c.clickToolbar(d,function(){c.focus();for(var d,f=c.edit.doc,g=c.cmd.range,h=a(f.body).first(),i=[],j=[],k=g.createBookmark(!0);h;){d=h.next();var l=b(h);l&&"img"==l.name||(e[h.name]?(h.html(h.html().replace(/^(\s| | )+/gi,"")),h.css("text-indent","2em")):j.push(h),(!d||e[d.name]||e[h.name]&&!e[d.name])&&(j.length>0&&i.push(j),j=[])),h=d}a.each(i,function(b,c){var d=a('<p style="text-indent:2em;"></p>',f);c[0].before(d),a.each(c,function(a,b){d.append(b)})}),g.moveToBookmark(k),c.addBookmark()})}),KindEditor.plugin("table",function(a){function b(a,b){b=b.toUpperCase(),a.css("background-color",b),a.css("color","#000000"===b?"#FFFFFF":"#000000"),a.html(b)}function c(c,d){function f(){a.each(i,function(){this.remove()}),i=[],a(document).unbind("click,mousedown",f),c.unbind("click,mousedown",f)}d.bind("click,mousedown",function(a){a.stopPropagation()}),d.click(function(d){f();var g=a(this),h=g.pos(),j=a.colorpicker({x:h.x,y:h.y+g.height(),z:811214,selectedColor:a(this).html(),colors:e.colorTable,noColor:e.lang("noColor"),shadowMode:e.shadowMode,click:function(a){b(g,a),f()}});i.push(j),a(document).bind("click,mousedown",f),c.bind("click,mousedown",f)})}function d(a,b,c){for(var d=0,e=0,f=b.cells.length;f>e&&b.cells[e]!=c;e++)d+=b.cells[e].rowSpan-1;return c.cellIndex-d}var e=this,f="table",g=e.lang(f+"."),h="ke-zeroborder",i=[];e.plugin.table={prop:function(d){var i='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+g.cells+'</label><div class="ke-form-controls ke-flex"><div>'+g.rows+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="rows" value="4" /></div><div>'+g.cols+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="cols" value="4" /></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.size+'</label><div class="ke-form-controls ke-flex"><div>'+g.width+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="4" /></div><div><select class="ke-select" name="widthType"><option value="%">'+g.percent+'</option><option value="px">'+g.px+"</option></select></div><div>"+g.height+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="height" value="4" /></div><div><select class="ke-select" name="heightType"><option value="%">'+g.percent+'</option><option value="px">'+g.px+'</option></select></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.space+'</label><div class="ke-form-controls ke-flex"><div>'+g.padding+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="padding" value="4" /></div><div>'+g.spacing+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="spacing" value="4" /></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.align+'</label><div class="ke-form-controls"><select class="ke-select" name="align"><option value="">'+g.alignDefault+'</option><option value="left">'+g.alignLeft+'</option><option value="center">'+g.alignCenter+'</option><option value="right">'+g.alignRight+'</option></select></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.border+'</label><div class="ke-form-controls ke-flex"><div>'+g.borderWidth+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="border" value="1" /></div><div>'+g.borderColor+'</div><div class="ke-flex-auto"><span class="ke-color"></span></div><div>'+g.backgroundColor+'</div><div class="ke-flex-auto"><span class="ke-color"></span></div></div></div></div>',j=e.cmd.range.createBookmark(),k=e.createDialog({name:f,width:500,height:330,title:e.lang(f),body:i,beforeRemove:function(){w.unbind()},yesBtn:{name:e.lang("yes"),click:function(b){var c=m.val(),d=n.val(),f=o.val(),g=p.val(),i=q.val(),k=r.val(),l=s.val(),y=t.val(),z=u.val(),A=v.val(),B=a(w[0]).html()||"",C=a(w[1]).html()||"";if(0==c||!/^\d+$/.test(c))return alert(e.lang("invalidRows")),void m[0].focus();if(0==d||!/^\d+$/.test(d))return alert(e.lang("invalidRows")),void n[0].focus();if(!/^\d*$/.test(f))return alert(e.lang("invalidWidth")),void o[0].focus();if(!/^\d*$/.test(g))return alert(e.lang("invalidHeight")),void p[0].focus();if(!/^\d*$/.test(l))return alert(e.lang("invalidPadding")),void s[0].focus();if(!/^\d*$/.test(y))return alert(e.lang("invalidSpacing")),void t[0].focus();if(!/^\d*$/.test(A))return alert(e.lang("invalidBorder")),void v[0].focus();if(x)return""!==f?x.width(f+i):x.css("width",""),void 0!==x[0].width&&x.removeAttr("width"),""!==g?x.height(g+k):x.css("height",""),void 0!==x[0].height&&x.removeAttr("height"),x.css("background-color",C),void 0!==x[0].bgColor&&x.removeAttr("bgColor"),""!==l?x[0].cellPadding=l:x.removeAttr("cellPadding"),""!==y?x[0].cellSpacing=y:x.removeAttr("cellSpacing"),""!==z?x[0].align=z:x.removeAttr("align"),""!==A?x.attr("border",A):x.removeAttr("border"),""===A||"0"===A?x.addClass(h):x.removeClass(h),""!==B?x.attr("borderColor",B):x.removeAttr("borderColor"),e.hideDialog().focus(),e.cmd.range.moveToBookmark(j),e.cmd.select(),void e.addBookmark();var D="";""!==f&&(D+="width:"+f+i+";"),""!==g&&(D+="height:"+g+k+";"),""!==C&&(D+="background-color:"+C+";");var E="<table";""!==D&&(E+=' style="'+D+'"'),""!==l&&(E+=' cellpadding="'+l+'"'),""!==y&&(E+=' cellspacing="'+y+'"'),""!==z&&(E+=' align="'+z+'"'),""!==A&&(E+=' border="'+A+'"'),(""===A||"0"===A)&&(E+=' class="'+h+'"'),""!==B&&(E+=' bordercolor="'+B+'"'),E+=">";for(var F=0;c>F;F++){E+="<tr>";for(var G=0;d>G;G++)E+="<td>"+(a.IE?" ":"<br />")+"</td>";E+="</tr>"}E+="</table>",a.IE||(E+="<br />"),e.insertHtml(E),e.select().hideDialog().focus(),e.addBookmark()}}}),l=k.div,m=a('[name="rows"]',l).val(3),n=a('[name="cols"]',l).val(2),o=a('[name="width"]',l).val(100),p=a('[name="height"]',l),q=a('[name="widthType"]',l),r=a('[name="heightType"]',l),s=a('[name="padding"]',l).val(2),t=a('[name="spacing"]',l).val(0),u=a('[name="align"]',l),v=a('[name="border"]',l).val(1),w=a(".ke-color",l);c(l,w.eq(0)),c(l,w.eq(1)),b(w.eq(0),"#000000"),b(w.eq(1),""),m[0].focus(),m[0].select();var x;if(!d&&(x=e.plugin.getSelectedTable())){m.val(x[0].rows.length),n.val(x[0].rows.length>0?x[0].rows[0].cells.length:0),m.attr("disabled",!0),n.attr("disabled",!0);var y,z=x[0].style.width||x[0].width,A=x[0].style.height||x[0].height;void 0!==z&&(y=/^(\d+)((?:px|%)*)$/.exec(z))?(o.val(y[1]),q.val(y[2])):o.val(""),void 0!==A&&(y=/^(\d+)((?:px|%)*)$/.exec(A))&&(p.val(y[1]),r.val(y[2])),s.val(x[0].cellPadding||""),t.val(x[0].cellSpacing||""),u.val(x[0].align||""),v.val(void 0===x[0].border?"":x[0].border),b(w.eq(0),a.toHex(x.attr("borderColor")||"")),b(w.eq(1),a.toHex(x[0].style.backgroundColor||x[0].bgColor||"")),o[0].focus(),o[0].select()}},cellprop:function(){var d='<div class="ke-form"><div class="ke-form-group"><label class="ke-form-label">'+g.size+'</label><div class="ke-form-controls ke-flex"><div>'+g.width+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="width" value="4" /></div><div><select class="ke-select" name="widthType"><option value="%">'+g.percent+'</option><option value="px">'+g.px+"</option></select></div><div>"+g.height+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="height" value="4" /></div><div><select class="ke-select" name="heightType"><option value="%">'+g.percent+'</option><option value="px">'+g.px+'</option></select></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.align+'</label><div class="ke-form-controls ke-flex"><div>'+g.textAlign+'</div><div class="ke-flex-auto"><select class="ke-select" name="textAlign"><option value="">'+g.alignDefault+'</option><option value="left">'+g.alignLeft+'</option><option value="center">'+g.alignCenter+'</option><option value="right">'+g.alignRight+"</option></select></div><div>"+g.verticalAlign+'</div><div class="ke-flex-auto"><select class="ke-select" name="verticalAlign"><option value="">'+g.alignDefault+'</option><option value="top">'+g.alignTop+'</option><option value="middle">'+g.alignMiddle+'</option><option value="bottom">'+g.alignBottom+'</option><option value="baseline">'+g.alignBaseline+'</option></select></div></div></div><div class="ke-form-group"><label class="ke-form-label">'+g.border+'</label><div class="ke-form-controls ke-flex"><div>'+g.borderWidth+'</div><div class="ke-flex-auto"><input type="text" class="ke-input" name="border" value="1" /></div><div>'+g.borderColor+'</div><div class="ke-flex-auto"><span class="ke-color"></span></div><div>'+g.backgroundColor+'</div><div class="ke-flex-auto"><span class="ke-color"></span></div></div></div></div>',h=e.cmd.range.createBookmark(),i=e.createDialog({name:f,width:500,height:250,title:e.lang("tablecell"),body:d,beforeRemove:function(){t.unbind()},yesBtn:{name:e.lang("yes"),click:function(b){var c=k.val(),d=l.val(),f=m.val(),g=n.val(),i=(o.val(),p.val(),q.val()),j=r.val(),u=s.val(),w=a(t[0]).html()||"",x=a(t[1]).html()||"";return/^\d*$/.test(c)?/^\d*$/.test(d)?/^\d*$/.test(u)?(v.css({width:""!==c?c+f:"",height:""!==d?d+g:"","background-color":x,"text-align":i,"vertical-align":j,"border-width":u,"border-style":""!==u?"solid":"","border-color":w}),e.hideDialog().focus(),e.cmd.range.moveToBookmark(h),e.cmd.select(),void e.addBookmark()):(alert(e.lang("invalidBorder")),void s[0].focus()):(alert(e.lang("invalidHeight")),void l[0].focus()):(alert(e.lang("invalidWidth")),void k[0].focus())}}}),j=i.div,k=a('[name="width"]',j).val(100),l=a('[name="height"]',j),m=a('[name="widthType"]',j),n=a('[name="heightType"]',j),o=a('[name="padding"]',j).val(2),p=a('[name="spacing"]',j).val(0),q=a('[name="textAlign"]',j),r=a('[name="verticalAlign"]',j),s=a('[name="border"]',j).val(1),t=a(".ke-color",j);c(j,t.eq(0)),c(j,t.eq(1)),b(t.eq(0),"#000000"),b(t.eq(1),""),k[0].focus(),k[0].select();var u,v=e.plugin.getSelectedCell(),w=v[0].style.width||v[0].width||"",x=v[0].style.height||v[0].height||"";(u=/^(\d+)((?:px|%)*)$/.exec(w))?(k.val(u[1]),m.val(u[2])):k.val(""),(u=/^(\d+)((?:px|%)*)$/.exec(x))&&(l.val(u[1]),n.val(u[2])),q.val(v[0].style.textAlign||""),r.val(v[0].style.verticalAlign||"");var y=v[0].style.borderWidth||"";y&&(y=parseInt(y)),s.val(y),b(t.eq(0),a.toHex(v[0].style.borderColor||"")),b(t.eq(1),a.toHex(v[0].style.backgroundColor||"")),k[0].focus(),k[0].select()},insert:function(){this.prop(!0)},"delete":function(){var a=e.plugin.getSelectedTable();e.cmd.range.setStartBefore(a[0]).collapse(!0),e.cmd.select(),a.remove(),e.addBookmark()},colinsert:function(b){var c=e.plugin.getSelectedTable()[0],f=e.plugin.getSelectedRow()[0],g=e.plugin.getSelectedCell()[0],h=g.cellIndex+b;h+=c.rows[0].cells.length-f.cells.length;for(var i=0,j=c.rows.length;j>i;i++){var k=c.rows[i],l=k.insertCell(h);l.innerHTML=a.IE?"":"<br />",h=d(c,k,l)}e.cmd.range.selectNodeContents(g).collapse(!0),e.cmd.select(),e.addBookmark()},colinsertleft:function(){this.colinsert(0)},colinsertright:function(){this.colinsert(1)},rowinsert:function(b){var c=e.plugin.getSelectedTable()[0],d=e.plugin.getSelectedRow()[0],f=e.plugin.getSelectedCell()[0],g=d.rowIndex;1===b&&(g=d.rowIndex+(f.rowSpan-1)+b);for(var h=c.insertRow(g),i=0,j=d.cells.length;j>i;i++){d.cells[i].rowSpan>1&&(j-=d.cells[i].rowSpan-1);var k=h.insertCell(i);1===b&&d.cells[i].colSpan>1&&(k.colSpan=d.cells[i].colSpan),k.innerHTML=a.IE?"":"<br />"}for(var l=g;l>=0;l--){var m=c.rows[l].cells;if(m.length>i){for(var n=f.cellIndex;n>=0;n--)m[n].rowSpan>1&&(m[n].rowSpan+=1);break}}e.cmd.range.selectNodeContents(f).collapse(!0),e.cmd.select(),e.addBookmark()},rowinsertabove:function(){this.rowinsert(0)},rowinsertbelow:function(){this.rowinsert(1)},rowmerge:function(){var a=e.plugin.getSelectedTable()[0],b=e.plugin.getSelectedRow()[0],c=e.plugin.getSelectedCell()[0],d=b.rowIndex,f=d+c.rowSpan,g=a.rows[f];if(!(a.rows.length<=f)){var h=c.cellIndex;if(!(g.cells.length<=h)){var i=g.cells[h];c.colSpan===i.colSpan&&(c.rowSpan+=i.rowSpan,g.deleteCell(h),e.cmd.range.selectNodeContents(c).collapse(!0),e.cmd.select(),e.addBookmark())}}},colmerge:function(){var a=(e.plugin.getSelectedTable()[0],e.plugin.getSelectedRow()[0]),b=e.plugin.getSelectedCell()[0],c=(a.rowIndex,b.cellIndex),d=c+1;if(!(a.cells.length<=d)){var f=a.cells[d];b.rowSpan===f.rowSpan&&(b.colSpan+=f.colSpan,a.deleteCell(d),e.cmd.range.selectNodeContents(b).collapse(!0),e.cmd.select(),e.addBookmark())}},rowsplit:function(){var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],f=e.plugin.getSelectedCell()[0],g=c.rowIndex;if(1!==f.rowSpan){for(var h=d(b,c,f),i=1,j=f.rowSpan;j>i;i++){var k=b.rows[g+i],l=k.insertCell(h);f.colSpan>1&&(l.colSpan=f.colSpan),l.innerHTML=a.IE?"":"<br />",h=d(b,k,l)}a(f).removeAttr("rowSpan"),e.cmd.range.selectNodeContents(f).collapse(!0),e.cmd.select(),e.addBookmark()}},colsplit:function(){var b=(e.plugin.getSelectedTable()[0],e.plugin.getSelectedRow()[0]),c=e.plugin.getSelectedCell()[0],d=c.cellIndex;if(1!==c.colSpan){for(var f=1,g=c.colSpan;g>f;f++){var h=b.insertCell(d+f);c.rowSpan>1&&(h.rowSpan=c.rowSpan),h.innerHTML=a.IE?"":"<br />"}a(c).removeAttr("colSpan"),e.cmd.range.selectNodeContents(c).collapse(!0),e.cmd.select(),e.addBookmark()}},coldelete:function(){for(var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],d=e.plugin.getSelectedCell()[0],f=d.cellIndex,g=0,h=b.rows.length;h>g;g++){var i=b.rows[g],j=i.cells[f];j.colSpan>1?(j.colSpan-=1,1===j.colSpan&&a(j).removeAttr("colSpan")):i.deleteCell(f),j.rowSpan>1&&(g+=j.rowSpan-1)}0===c.cells.length?(e.cmd.range.setStartBefore(b).collapse(!0),e.cmd.select(),a(b).remove()):e.cmd.selection(!0),e.addBookmark()},rowdelete:function(){for(var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],d=e.plugin.getSelectedCell()[0],f=c.rowIndex,g=d.rowSpan-1;g>=0;g--)b.deleteRow(f+g);0===b.rows.length?(e.cmd.range.setStartBefore(b).collapse(!0),e.cmd.select(),a(b).remove()):e.cmd.selection(!0),e.addBookmark()}},e.clickToolbar(f,e.plugin.table.prop)}),KindEditor.plugin("template",function(a){function b(b){return e+b+"?ver="+encodeURIComponent(a.DEBUG?a.TIME:a.VERSION)}var c=this,d="template",e=(c.lang(d+"."),c.pluginsPath+d+"/html/");c.clickToolbar(d,function(){var e=c.lang(d+"."),f=['<div style="padding:10px 20px;">','<div class="ke-header ke-flex">','<div class="ke-flex-auto ke-flex"><div class="ke-margin-right">',e.selectTemplate+' </div><div> <select class="ke-select">'];a.each(e.fileList,function(a,b){f.push('<option value="'+a+'">'+b+"</option>")}),html=[f.join(""),"</select></div>","</div>","<div>",'<input type="checkbox" id="keReplaceFlag" name="replaceFlag" value="1" /> <label for="keReplaceFlag">'+e.replaceContent+"</label>","</div>","</div>",'<iframe class="ke-textarea" frameborder="0" style="width:458px;height:260px;background-color:#FFF;"></iframe>',"</div>"].join("");var g=c.createDialog({name:d,width:500,title:c.lang(d),body:html,yesBtn:{name:c.lang("yes"),click:function(b){var d=a.iframeDoc(j);c[i[0].checked?"html":"insertHtml"](d.body.innerHTML).hideDialog().focus()}}}),h=a("select",g.div),i=a('[name="replaceFlag"]',g.div),j=a("iframe",g.div);i[0].checked=!0,j.attr("src",b(h.val())),h.change(function(){j.attr("src",b(this.value))})})}),KindEditor.plugin("wordpaste",function(a){var b=this,c="wordpaste";b.clickToolbar(c,function(){var d=b.lang(c+"."),e='<div style="padding:10px 20px;"><div style="margin-bottom:10px;">'+d.comment+'</div><iframe class="ke-textarea" frameborder="0" style="width:408px;height:260px;"></iframe></div>',f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(c){var d=i.body.innerHTML;d=a.clearMsWord(d,b.filterMode?b.htmlTags:a.options.htmlTags),b.insertHtml(d).hideDialog().focus()}}}),g=f.div,h=a("iframe",g),i=a.iframeDoc(h);a.IE||(i.designMode="on"),i.open(),i.write("<!doctype html><html><head><title>WordPaste</title></head>"),i.write('<body style="background-color:#FFF;font-size:12px;margin:2px;">'),a.IE||i.write("<br />"),i.write("</body></html>"),i.close(),a.IE&&(i.body.contentEditable="true"),h[0].contentWindow.focus()})}),KindEditor.plugin("fixtoolbar",function(a){function b(){var b=a(".ke-toolbar"),c=b.pos().y;a(window).bind("scroll",function(){"fixed"==b.css("position")?document.body.scrollTop-c<0&&(b.css("position","static"),b.css("top","auto")):b.pos().y-document.body.scrollTop<0&&(b.css("position","fixed"),b.css("top",0))})}var c=this;c.fixToolBar&&(c.isCreated?b():c.afterCreate(b))}),KindEditor.plugin("xiumi",function(a){var b=this,c="xiumi";b.clickToolbar(c,function(){var d=['<div style="padding:10px 20px;">','<div class="ke-xiumi" style="width:1200px;height:800px;"></div>',"</div>"].join(""),e=b.createDialog({name:c,width:1200,title:b.lang(c),body:d}),f=e.div,g=b.pluginsPath+"xiumi/xiumi.html",h=a('<iframe id="xiumi-iframe" frameborder="0" src="'+g+'" style="width:100%;height:800px;"></iframe>');console.log("window",b),h.bind("load",function(){win=h[0].contentWindow,win.setEdit(b)}),a(".ke-xiumi",f).replaceWith(h)})});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。