1234567891011121314151617181920212223242526272829303132333435 |
- /*!
- * ====================================================
- * kityminder - v1.3.5 - 2015-05-15
- * https://github.com/fex-team/kityminder
- * GitHub: https://github.com/fex-team/kityminder.git
- * Copyright (c) 2015 f-cube @ FEX; Licensed MIT
- * ====================================================
- */
- SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(toElement) { return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM()); };
- !function(window){function getMetaKeyCode(a){var b=4096,c=8192,d=16384,e=0;return"string"==typeof a?a.toLowerCase().split(/\+\s*/).forEach(function(a){switch(a){case"ctrl":case"cmd":e|=b;break;case"alt":e|=c;break;case"shift":e|=d;break;default:e|=keymap[a]}}):((a.ctrlKey||a.metaKey)&&(e|=b),a.altKey&&(e|=c),a.shiftKey&&(e|=d),e|=a.keyCode),e}function updateCircle(a,b,c){var d=b.getStyle("padding-left"),e=b.getStyle("padding-right"),f=b.getStyle("padding-top"),g=b.getStyle("padding-bottom"),h=Math.max(c.width,c.height),i={x:c.x-d,y:c.y-f,width:h+d+e,height:h+f+g},j=b.isSelected()?"selected-":"";return h=Math.max(i.width,i.height),a.setPosition(i.x,i.y).setSize(h,h).setRadius(h/2).fill(b.getData("background")||b.getStyle(j+"background")||b.getStyle("background")).stroke(b.getStyle(j+"stroke"||b.getStyle("stroke")),b.getStyle(j+"stroke-width")),new kity.Box(i)}function asc(a,b){return a.getIndex()-b.getIndex()}function desc(a,b){return-asc(a,b)}function canArrange(a){var b=a.getSelectedNode();return b&&b.parent&&b.parent.children.length>1}!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=Na[0].contentDocument,b.write(),b.close(),c=t(a,b),Na.detach()),Oa[a]=c),c}function v(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||_.contains(a.ownerDocument,a)||(g=_.style(a,b)),Qa.test(g)&&Pa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function w(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}function x(a,b){if(b in a)return b;for(var c=b[0].toUpperCase()+b.slice(1),d=b,e=Xa.length;e--;)if(b=Xa[e]+c,b in a)return b;return d}function y(a,b,c){var d=Ta.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function z(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=_.css(a,c+wa[f],!0,e)),d?("content"===c&&(g-=_.css(a,"padding"+wa[f],!0,e)),"margin"!==c&&(g-=_.css(a,"border"+wa[f]+"Width",!0,e))):(g+=_.css(a,"padding"+wa[f],!0,e),"padding"!==c&&(g+=_.css(a,"border"+wa[f]+"Width",!0,e)));return g}function A(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g="border-box"===_.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=v(a,b,f),(0>e||null==e)&&(e=a.style[b]),Qa.test(e))return e;d=g&&(Y.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+z(a,b,c||(g?"border":"content"),d,f)+"px"}function B(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=ra.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&xa(d)&&(f[g]=ra.access(d,"olddisplay",u(d.nodeName)))):(e=xa(d),"none"===c&&e||ra.set(d,"olddisplay",e?c:_.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function C(a,b,c,d,e){return new C.prototype.init(a,b,c,d,e)}function D(){return setTimeout(function(){Ya=void 0}),Ya=_.now()}function E(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=wa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function F(a,b,c){for(var d,e=(cb[b]||[]).concat(cb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function G(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},n=a.style,o=a.nodeType&&xa(a),p=ra.get(a,"fxshow");c.queue||(h=_._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,_.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[n.overflow,n.overflowX,n.overflowY],j=_.css(a,"display"),k="none"===j?ra.get(a,"olddisplay")||u(a.nodeName):j,"inline"===k&&"none"===_.css(a,"float")&&(n.display="inline-block")),c.overflow&&(n.overflow="hidden",l.always(function(){n.overflow=c.overflow[0],n.overflowX=c.overflow[1],n.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],$a.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(o?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;o=!0}m[d]=p&&p[d]||_.style(a,d)}else j=void 0;if(_.isEmptyObject(m))"inline"===("none"===j?u(a.nodeName):j)&&(n.display=j);else{p?"hidden"in p&&(o=p.hidden):p=ra.access(a,"fxshow",{}),f&&(p.hidden=!o),o?_(a).show():l.done(function(){_(a).hide()}),l.done(function(){var b;ra.remove(a,"fxshow");for(b in m)_.style(a,b,m[b])});for(d in m)g=F(o?p[d]:0,d,l),d in p||(p[d]=g.start,o&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function H(a,b){var c,d,e,f,g;for(c in a)if(d=_.camelCase(c),e=b[d],f=a[c],_.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=_.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function I(a,b,c){var d,e,f=0,g=bb.length,h=_.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||D(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:_.extend({},b),opts:_.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Ya||D(),duration:c.duration,tweens:[],createTween:function(b,c){var d=_.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(H(k,j.opts.specialEasing);g>f;f++)if(d=bb[f].call(j,a,k,j.opts))return d;return _.map(k,F,j),_.isFunction(j.opts.start)&&j.opts.start.call(a,j),_.fx.timer(_.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function J(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(na)||[];if(_.isFunction(c))for(;d=f[e++];)"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function K(a,b,c,d){function e(h){var i;return f[h]=!0,_.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===vb;return e(b.dataTypes[0])||!f["*"]&&e("*")}function L(a,b){var c,d,e=_.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&_.extend(!0,a,d),a}function M(a,b,c){for(var d,e,f,g,h=a.contents,i=a.dataTypes;"*"===i[0];)i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function N(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];for(f=k.shift();f;)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}function O(a,b,c,d){var e;if(_.isArray(b))_.each(b,function(b,e){c||zb.test(a)?d(a,e):O(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==_.type(b))d(a,b);else for(e in b)O(a+"["+e+"]",b[e],c,d)}function P(a){return _.isWindow(a)?a:9===a.nodeType&&a.defaultView}var Q=[],R=Q.slice,S=Q.concat,T=Q.push,U=Q.indexOf,V={},W=V.toString,X=V.hasOwnProperty,Y={},Z=a.document,$="2.1.1",_=function(a,b){return new _.fn.init(a,b)},aa=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ba=/^-ms-/,ca=/-([\da-z])/gi,da=function(a,b){return b.toUpperCase()};_.fn=_.prototype={jquery:$,constructor:_,selector:"",length:0,toArray:function(){return R.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:R.call(this)},pushStack:function(a){var b=_.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return _.each(this,a,b)},map:function(a){return this.pushStack(_.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(R.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:T,sort:Q.sort,splice:Q.splice},_.extend=_.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||_.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(_.isPlainObject(d)||(e=_.isArray(d)))?(e?(e=!1,f=c&&_.isArray(c)?c:[]):f=c&&_.isPlainObject(c)?c:{},g[b]=_.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},_.extend({expando:"jQuery"+($+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===_.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!_.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==_.type(a)||a.nodeType||_.isWindow(a)?!1:a.constructor&&!X.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?V[W.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=_.trim(a),a&&(1===a.indexOf("use strict")?(b=Z.createElement("script"),b.text=a,Z.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(ba,"ms-").replace(ca,da)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;g>f&&(e=b.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=b.apply(a[f],d),e===!1)break}else if(h)for(;g>f&&(e=b.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),e===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(aa,"")},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?_.merge(d,"string"==typeof a?[a]:a):T.call(d,a)),d},inArray:function(a,b,c){return null==b?-1:U.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h)for(;g>f;f++)e=b(a[f],f,d),null!=e&&i.push(e);else for(f in a)e=b(a[f],f,d),null!=e&&i.push(e);return S.apply([],i)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),_.isFunction(a)?(d=R.call(arguments,2),e=function(){return a.apply(b||this,d.concat(R.call(arguments)))},e.guid=a.guid=a.guid||_.guid++,e):void 0},now:Date.now,support:Y}),_.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){V["[object "+b+"]"]=b.toLowerCase()});var ea=function(a){function b(a,b,c,d){var e,f,g,h,i,j,l,n,o,p;if((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(I&&!d){if(e=sa.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&M(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return _.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&v.getElementsByClassName&&b.getElementsByClassName)return _.apply(c,b.getElementsByClassName(g)),c}if(v.qsa&&(!J||!J.test(a))){if(n=l=N,o=b,p=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=z(a),(l=b.getAttribute("id"))?n=l.replace(ua,"\\$&"):b.setAttribute("id",n),n="[id='"+n+"'] ",i=j.length;i--;)j[i]=n+m(j[i]);o=ta.test(a)&&k(b.parentNode)||b,p=j.join(",")}if(p)try{return _.apply(c,o.querySelectorAll(p)),c}catch(q){}finally{l||b.removeAttribute("id")}}}return B(a.replace(ia,"$1"),b,c,d)}function c(){function a(c,d){return b.push(c+" ")>w.cacheLength&&delete a[b.shift()],a[c+" "]=d}var b=[];return a}function d(a){return a[N]=!0,a}function e(a){var b=G.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function f(a,b){for(var c=a.split("|"),d=a.length;d--;)w.attrHandle[c[d]]=b}function g(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function h(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function i(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function j(a){return d(function(b){return b=+b,d(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function k(a){return a&&typeof a.getElementsByTagName!==V&&a}function l(){}function m(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function n(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[P,f];if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e){if(i=b[N]||(b[N]={}),(h=i[d])&&h[0]===P&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function o(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function p(a,c,d){for(var e=0,f=c.length;f>e;e++)b(a,c[e],d);return d}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function r(a,b,c,e,f,g){return e&&!e[N]&&(e=r(e)),f&&!f[N]&&(f=r(f,g)),d(function(d,g,h,i){var j,k,l,m=[],n=[],o=g.length,r=d||p(b||"*",h.nodeType?[h]:h,[]),s=!a||!d&&b?r:q(r,m,a,h,i),t=c?f||(d?a:o||e)?[]:g:s;if(c&&c(s,t,h,i),e)for(j=q(t,n),e(j,[],h,i),k=j.length;k--;)(l=j[k])&&(t[n[k]]=!(s[n[k]]=l));if(d){if(f||a){if(f){for(j=[],k=t.length;k--;)(l=t[k])&&j.push(s[k]=l);f(null,t=[],j,i)}for(k=t.length;k--;)(l=t[k])&&(j=f?ba.call(d,l):m[k])>-1&&(d[j]=!(g[j]=l))}}else t=q(t===g?t.splice(o,t.length):t),f?f(null,g,t,i):_.apply(g,t)})}function s(a){for(var b,c,d,e=a.length,f=w.relative[a[0].type],g=f||w.relative[" "],h=f?1:0,i=n(function(a){return a===b},g,!0),j=n(function(a){return ba.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==C)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++)if(c=w.relative[a[h].type])k=[n(o(k),c)];else{if(c=w.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!w.relative[a[d].type];d++);return r(h>1&&o(k),h>1&&m(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ia,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&m(a))}k.push(c)}return o(k)}function t(a,c){var e=c.length>0,f=a.length>0,g=function(d,g,h,i,j){var k,l,m,n=0,o="0",p=d&&[],r=[],s=C,t=d||f&&w.find.TAG("*",j),u=P+=null==s?1:Math.random()||.1,v=t.length;for(j&&(C=g!==G&&g);o!==v&&null!=(k=t[o]);o++){if(f&&k){for(l=0;m=a[l++];)if(m(k,g,h)){i.push(k);break}j&&(P=u)}e&&((k=!m&&k)&&n--,d&&p.push(k))}if(n+=o,e&&o!==n){for(l=0;m=c[l++];)m(p,r,g,h);if(d){if(n>0)for(;o--;)p[o]||r[o]||(r[o]=Z.call(i));r=q(r)}_.apply(i,r),j&&!d&&r.length>0&&n+c.length>1&&b.uniqueSort(i)}return j&&(P=u,C=s),p};return e?d(g):g}var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=c(),S=c(),T=c(),U=function(a,b){return a===b&&(E=!0),0},V="undefined",W=1<<31,X={}.hasOwnProperty,Y=[],Z=Y.pop,$=Y.push,_=Y.push,aa=Y.slice,ba=Y.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},ca="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",da="[\\x20\\t\\r\\n\\f]",ea="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",fa=ea.replace("w","w#"),ga="\\["+da+"*("+ea+")(?:"+da+"*([*^$|!~]?=)"+da+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+fa+"))|)"+da+"*\\]",ha=":("+ea+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ga+")*)|.*)\\)|)",ia=new RegExp("^"+da+"+|((?:^|[^\\\\])(?:\\\\.)*)"+da+"+$","g"),ja=new RegExp("^"+da+"*,"+da+"*"),ka=new RegExp("^"+da+"*([>+~]|"+da+")"+da+"*"),la=new RegExp("="+da+"*([^\\]'\"]*?)"+da+"*\\]","g"),ma=new RegExp(ha),na=new RegExp("^"+fa+"$"),oa={ID:new RegExp("^#("+ea+")"),CLASS:new RegExp("^\\.("+ea+")"),TAG:new RegExp("^("+ea.replace("w","w*")+")"),ATTR:new RegExp("^"+ga),PSEUDO:new RegExp("^"+ha),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+da+"*(even|odd|(([+-]|)(\\d*)n|)"+da+"*(?:([+-]|)"+da+"*(\\d+)|))"+da+"*\\)|)","i"),bool:new RegExp("^(?:"+ca+")$","i"),needsContext:new RegExp("^"+da+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+da+"*((?:-\\d)?\\d*)"+da+"*\\)|)(?=[^-]|$)","i")},pa=/^(?:input|select|textarea|button)$/i,qa=/^h\d$/i,ra=/^[^{]+\{\s*\[native \w/,sa=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ta=/[+~]/,ua=/'|\\/g,va=new RegExp("\\\\([\\da-f]{1,6}"+da+"?|("+da+")|.)","ig"),wa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{_.apply(Y=aa.call(O.childNodes),O.childNodes),Y[O.childNodes.length].nodeType}catch(xa){_={apply:Y.length?function(a,b){$.apply(a,aa.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}v=b.support={},y=b.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},F=b.setDocument=function(a){var b,c=a?a.ownerDocument||a:O,d=c.defaultView;return c!==G&&9===c.nodeType&&c.documentElement?(G=c,H=c.documentElement,I=!y(c),d&&d!==d.top&&(d.addEventListener?d.addEventListener("unload",function(){F()},!1):d.attachEvent&&d.attachEvent("onunload",function(){F()})),v.attributes=e(function(a){return a.className="i",!a.getAttribute("className")}),v.getElementsByTagName=e(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),v.getElementsByClassName=ra.test(c.getElementsByClassName)&&e(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),v.getById=e(function(a){return H.appendChild(a).id=N,!c.getElementsByName||!c.getElementsByName(N).length}),v.getById?(w.find.ID=function(a,b){if(typeof b.getElementById!==V&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},w.filter.ID=function(a){var b=a.replace(va,wa);return function(a){return a.getAttribute("id")===b}}):(delete w.find.ID,w.filter.ID=function(a){var b=a.replace(va,wa);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),w.find.TAG=v.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==V?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},w.find.CLASS=v.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==V&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(v.qsa=ra.test(c.querySelectorAll))&&(e(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&J.push("[*^$]="+da+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||J.push("\\["+da+"*(?:value|"+ca+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),e(function(a){var b=c.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&J.push("name"+da+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(v.matchesSelector=ra.test(L=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&e(function(a){v.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",ha)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),b=ra.test(H.compareDocumentPosition),M=b||ra.test(H.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},U=b?function(a,b){if(a===b)return E=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!v.sortDetached&&b.compareDocumentPosition(a)===d?a===c||a.ownerDocument===O&&M(O,a)?-1:b===c||b.ownerDocument===O&&M(O,b)?1:D?ba.call(D,a)-ba.call(D,b):0:4&d?-1:1)}:function(a,b){if(a===b)return E=!0,0;var d,e=0,f=a.parentNode,h=b.parentNode,i=[a],j=[b];if(!f||!h)return a===c?-1:b===c?1:f?-1:h?1:D?ba.call(D,a)-ba.call(D,b):0;if(f===h)return g(a,b);for(d=a;d=d.parentNode;)i.unshift(d);for(d=b;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?g(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},c):G},b.matches=function(a,c){return b(a,null,null,c)},b.matchesSelector=function(a,c){if((a.ownerDocument||a)!==G&&F(a),c=c.replace(la,"='$1']"),!(!v.matchesSelector||!I||K&&K.test(c)||J&&J.test(c)))try{var d=L.call(a,c);if(d||v.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return b(c,G,null,[a]).length>0},b.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},b.attr=function(a,b){(a.ownerDocument||a)!==G&&F(a);var c=w.attrHandle[b.toLowerCase()],d=c&&X.call(w.attrHandle,b.toLowerCase())?c(a,b,!I):void 0;return void 0!==d?d:v.attributes||!I?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},b.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},b.uniqueSort=function(a){var b,c=[],d=0,e=0;if(E=!v.detectDuplicates,D=!v.sortStable&&a.slice(0),a.sort(U),E){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return D=null,a},x=b.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=x(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d++];)c+=x(b);return c},w=b.selectors={cacheLength:50,createPseudo:d,match:oa,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(va,wa),a[3]=(a[3]||a[4]||a[5]||"").replace(va,wa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||b.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&b.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return oa.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&ma.test(c)&&(b=z(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(va,wa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+da+")"+a+"("+da+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,c,d){return function(e){var f=b.attr(e,a);return null==f?"!="===c:c?(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"~="===c?(" "+f+" ").indexOf(d)>-1:"|="===c?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,c){var e,f=w.pseudos[a]||w.setFilters[a.toLowerCase()]||b.error("unsupported pseudo: "+a);return f[N]?f(c):f.length>1?(e=[a,a,"",c],w.setFilters.hasOwnProperty(a.toLowerCase())?d(function(a,b){for(var d,e=f(a,c),g=e.length;g--;)d=ba.call(a,e[g]),a[d]=!(b[d]=e[g])}):function(a){return f(a,0,e)}):f}},pseudos:{not:d(function(a){var b=[],c=[],e=A(a.replace(ia,"$1"));return e[N]?d(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,d,f){return b[0]=a,e(b,null,f,c),!c.pop()}}),has:d(function(a){return function(c){return b(a,c).length>0}}),contains:d(function(a){return function(b){return(b.textContent||b.innerText||x(b)).indexOf(a)>-1}}),lang:d(function(a){return na.test(a||"")||b.error("unsupported lang: "+a),a=a.replace(va,wa).toLowerCase(),function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!w.pseudos.empty(a)},header:function(a){return qa.test(a.nodeName)},input:function(a){return pa.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:j(function(){return[0]}),last:j(function(a,b){return[b-1]}),eq:j(function(a,b,c){return[0>c?c+b:c]}),even:j(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:j(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:j(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:j(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},w.pseudos.nth=w.pseudos.eq;for(u in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[u]=h(u);for(u in{submit:!0,reset:!0})w.pseudos[u]=i(u);return l.prototype=w.filters=w.pseudos,w.setFilters=new l,z=b.tokenize=function(a,c){var d,e,f,g,h,i,j,k=S[a+" "];if(k)return c?0:k.slice(0);for(h=a,i=[],j=w.preFilter;h;){(!d||(e=ja.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=ka.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(ia," ")}),h=h.slice(d.length));for(g in w.filter)!(e=oa[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return c?h.length:h?b.error(a):S(a,i).slice(0)},A=b.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=z(a)),c=b.length;c--;)f=s(b[c]),f[N]?d.push(f):e.push(f);f=T(a,t(e,d)),f.selector=a}return f},B=b.select=function(a,b,c,d){var e,f,g,h,i,j="function"==typeof a&&a,l=!d&&z(a=j.selector||a);if(c=c||[],1===l.length){if(f=l[0]=l[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&v.getById&&9===b.nodeType&&I&&w.relative[f[1].type]){if(b=(w.find.ID(g.matches[0].replace(va,wa),b)||[])[0],!b)return c;j&&(b=b.parentNode),a=a.slice(f.shift().value.length)}for(e=oa.needsContext.test(a)?0:f.length;e--&&(g=f[e],!w.relative[h=g.type]);)if((i=w.find[h])&&(d=i(g.matches[0].replace(va,wa),ta.test(f[0].type)&&k(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&m(f),!a)return _.apply(c,d),c;break}}return(j||A(a,l))(d,b,!I,c,ta.test(a)&&k(b.parentNode)||b),c},v.sortStable=N.split("").sort(U).join("")===N,v.detectDuplicates=!!E,F(),v.sortDetached=e(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),e(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||f("type|href|height|width",function(a,b,c){
- return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),v.attributes&&e(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||f("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),e(function(a){return null==a.getAttribute("disabled")})||f(ca,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),b}(a);_.find=ea,_.expr=ea.selectors,_.expr[":"]=_.expr.pseudos,_.unique=ea.uniqueSort,_.text=ea.getText,_.isXMLDoc=ea.isXML,_.contains=ea.contains;var fa=_.expr.match.needsContext,ga=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ha=/^.[^:#\[\.,]*$/;_.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?_.find.matchesSelector(d,a)?[d]:[]:_.find.matches(a,_.grep(b,function(a){return 1===a.nodeType}))},_.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(_(a).filter(function(){for(b=0;c>b;b++)if(_.contains(e[b],this))return!0}));for(b=0;c>b;b++)_.find(a,e[b],d);return d=this.pushStack(c>1?_.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(d(this,a||[],!1))},not:function(a){return this.pushStack(d(this,a||[],!0))},is:function(a){return!!d(this,"string"==typeof a&&fa.test(a)?_(a):a||[],!1).length}});var ia,ja=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ka=_.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:ja.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||ia).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof _?b[0]:b,_.merge(this,_.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:Z,!0)),ga.test(c[1])&&_.isPlainObject(b))for(c in b)_.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=Z.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=Z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):_.isFunction(a)?"undefined"!=typeof ia.ready?ia.ready(a):a(_):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),_.makeArray(a,this))};ka.prototype=_.fn,ia=_(Z);var la=/^(?:parents|prev(?:Until|All))/,ma={children:!0,contents:!0,next:!0,prev:!0};_.extend({dir:function(a,b,c){for(var d=[],e=void 0!==c;(a=a[b])&&9!==a.nodeType;)if(1===a.nodeType){if(e&&_(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),_.fn.extend({has:function(a){var b=_(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(_.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=fa.test(a)||"string"!=typeof a?_(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&_.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?_.unique(f):f)},index:function(a){return a?"string"==typeof a?U.call(_(a),this[0]):U.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(_.unique(_.merge(this.get(),_(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),_.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return _.dir(a,"parentNode")},parentsUntil:function(a,b,c){return _.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return _.dir(a,"nextSibling")},prevAll:function(a){return _.dir(a,"previousSibling")},nextUntil:function(a,b,c){return _.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return _.dir(a,"previousSibling",c)},siblings:function(a){return _.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return _.sibling(a.firstChild)},contents:function(a){return a.contentDocument||_.merge([],a.childNodes)}},function(a,b){_.fn[a]=function(c,d){var e=_.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=_.filter(d,e)),this.length>1&&(ma[a]||_.unique(e),la.test(a)&&e.reverse()),this.pushStack(e)}});var na=/\S+/g,oa={};_.Callbacks=function(a){a="string"==typeof a?oa[a]||f(a):_.extend({},a);var b,c,d,e,g,h,i=[],j=!a.once&&[],k=function(f){for(b=a.memory&&f,c=!0,h=e||0,e=0,g=i.length,d=!0;i&&g>h;h++)if(i[h].apply(f[0],f[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,i&&(j?j.length&&k(j.shift()):b?i=[]:l.disable())},l={add:function(){if(i){var c=i.length;!function f(b){_.each(b,function(b,c){var d=_.type(c);"function"===d?a.unique&&l.has(c)||i.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),d?g=i.length:b&&(e=c,k(b))}return this},remove:function(){return i&&_.each(arguments,function(a,b){for(var c;(c=_.inArray(b,i,c))>-1;)i.splice(c,1),d&&(g>=c&&g--,h>=c&&h--)}),this},has:function(a){return a?_.inArray(a,i)>-1:!(!i||!i.length)},empty:function(){return i=[],g=0,this},disable:function(){return i=j=b=void 0,this},disabled:function(){return!i},lock:function(){return j=void 0,b||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return!i||c&&!j||(b=b||[],b=[a,b.slice?b.slice():b],d?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!c}};return l},_.extend({Deferred:function(a){var b=[["resolve","done",_.Callbacks("once memory"),"resolved"],["reject","fail",_.Callbacks("once memory"),"rejected"],["notify","progress",_.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return _.Deferred(function(c){_.each(b,function(b,f){var g=_.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&_.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?_.extend(a,d):d}},e={};return d.pipe=d.then,_.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=R.call(arguments),g=f.length,h=1!==g||a&&_.isFunction(a.promise)?g:0,i=1===h?a:_.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?R.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&_.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}});var pa;_.fn.ready=function(a){return _.ready.promise().done(a),this},_.extend({isReady:!1,readyWait:1,holdReady:function(a){a?_.readyWait++:_.ready(!0)},ready:function(a){(a===!0?--_.readyWait:_.isReady)||(_.isReady=!0,a!==!0&&--_.readyWait>0||(pa.resolveWith(Z,[_]),_.fn.triggerHandler&&(_(Z).triggerHandler("ready"),_(Z).off("ready"))))}}),_.ready.promise=function(b){return pa||(pa=_.Deferred(),"complete"===Z.readyState?setTimeout(_.ready):(Z.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1))),pa.promise(b)},_.ready.promise();var qa=_.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===_.type(c)){e=!0;for(h in c)_.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,_.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(_(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};_.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType},h.uid=1,h.accepts=_.acceptData,h.prototype={key:function(a){if(!h.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=h.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,_.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(_.isEmptyObject(f))_.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,_.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{_.isArray(b)?d=b.concat(b.map(_.camelCase)):(e=_.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(na)||[])),c=d.length;for(;c--;)delete g[d[c]]}},hasData:function(a){return!_.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var ra=new h,sa=new h,ta=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ua=/([A-Z])/g;_.extend({hasData:function(a){return sa.hasData(a)||ra.hasData(a)},data:function(a,b,c){return sa.access(a,b,c)},removeData:function(a,b){sa.remove(a,b)},_data:function(a,b,c){return ra.access(a,b,c)},_removeData:function(a,b){ra.remove(a,b)}}),_.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=sa.get(f),1===f.nodeType&&!ra.get(f,"hasDataAttrs"))){for(c=g.length;c--;)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=_.camelCase(d.slice(5)),i(f,d,e[d])));ra.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){sa.set(this,a)}):qa(this,function(b){var c,d=_.camelCase(a);if(f&&void 0===b){if(c=sa.get(f,a),void 0!==c)return c;if(c=sa.get(f,d),void 0!==c)return c;if(c=i(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=sa.get(this,d);sa.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&sa.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){sa.remove(this,a)})}}),_.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=ra.get(a,b),c&&(!d||_.isArray(c)?d=ra.access(a,b,_.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=_.queue(a,b),d=c.length,e=c.shift(),f=_._queueHooks(a,b),g=function(){_.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return ra.get(a,c)||ra.access(a,c,{empty:_.Callbacks("once memory").add(function(){ra.remove(a,[b+"queue",c])})})}}),_.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?_.queue(this[0],a):void 0===b?this:this.each(function(){var c=_.queue(this,a,b);_._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&_.dequeue(this,a)})},dequeue:function(a){return this.each(function(){_.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=_.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};for("string"!=typeof a&&(b=a,a=void 0),a=a||"fx";g--;)c=ra.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var va=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,wa=["Top","Right","Bottom","Left"],xa=function(a,b){return a=b||a,"none"===_.css(a,"display")||!_.contains(a.ownerDocument,a)},ya=/^(?:checkbox|radio)$/i;!function(){var a=Z.createDocumentFragment(),b=a.appendChild(Z.createElement("div")),c=Z.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),Y.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",Y.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var za="undefined";Y.focusinBubbles="onfocusin"in a;var Aa=/^key/,Ba=/^(?:mouse|pointer|contextmenu)|click/,Ca=/^(?:focusinfocus|focusoutblur)$/,Da=/^([^.]*)(?:\.(.+)|)$/;_.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=ra.get(a);if(q)for(c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=_.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return typeof _!==za&&_.event.triggered!==b.type?_.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(na)||[""],j=b.length;j--;)h=Da.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=_.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=_.event.special[n]||{},k=_.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&_.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),_.event.global[n]=!0)},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=ra.hasData(a)&&ra.get(a);if(q&&(i=q.events)){for(b=(b||"").match(na)||[""],j=b.length;j--;)if(h=Da.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=_.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;f--;)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||_.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)_.event.remove(a,n+b[j],c,d,!0);_.isEmptyObject(i)&&(delete q.handle,ra.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,j,k,l,m=[d||Z],n=X.call(b,"type")?b.type:b,o=X.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||Z,3!==d.nodeType&&8!==d.nodeType&&!Ca.test(n+_.event.triggered)&&(n.indexOf(".")>=0&&(o=n.split("."),n=o.shift(),o.sort()),j=n.indexOf(":")<0&&"on"+n,b=b[_.expando]?b:new _.Event(n,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=o.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:_.makeArray(c,[b]),l=_.event.special[n]||{},e||!l.trigger||l.trigger.apply(d,c)!==!1)){if(!e&&!l.noBubble&&!_.isWindow(d)){for(i=l.delegateType||n,Ca.test(i+n)||(g=g.parentNode);g;g=g.parentNode)m.push(g),h=g;h===(d.ownerDocument||Z)&&m.push(h.defaultView||h.parentWindow||a)}for(f=0;(g=m[f++])&&!b.isPropagationStopped();)b.type=f>1?i:l.bindType||n,k=(ra.get(g,"events")||{})[b.type]&&ra.get(g,"handle"),k&&k.apply(g,c),k=j&&g[j],k&&k.apply&&_.acceptData(g)&&(b.result=k.apply(g,c),b.result===!1&&b.preventDefault());return b.type=n,e||b.isDefaultPrevented()||l._default&&l._default.apply(m.pop(),c)!==!1||!_.acceptData(d)||j&&_.isFunction(d[n])&&!_.isWindow(d)&&(h=d[j],h&&(d[j]=null),_.event.triggered=n,d[n](),_.event.triggered=void 0,h&&(d[j]=h)),b.result}},dispatch:function(a){a=_.event.fix(a);var b,c,d,e,f,g=[],h=R.call(arguments),i=(ra.get(this,"events")||{})[a.type]||[],j=_.event.special[a.type]||{};if(h[0]=a,a.delegateTarget=this,!j.preDispatch||j.preDispatch.call(this,a)!==!1){for(g=_.event.handlers.call(this,a,i),b=0;(e=g[b++])&&!a.isPropagationStopped();)for(a.currentTarget=e.elem,c=0;(f=e.handlers[c++])&&!a.isImmediatePropagationStopped();)(!a.namespace_re||a.namespace_re.test(f.namespace))&&(a.handleObj=f,a.data=f.data,d=((_.event.special[f.origType]||{}).handle||f.handler).apply(e.elem,h),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()));return j.postDispatch&&j.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?_(e,this).index(i)>=0:_.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||Z,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[_.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Ba.test(e)?this.mouseHooks:Aa.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new _.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=Z),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==l()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===l()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&_.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return _.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=_.extend(new _.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?_.event.trigger(e,null,b):_.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},_.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},_.Event=function(a,b){return this instanceof _.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?j:k):this.type=a,b&&_.extend(this,b),this.timeStamp=a&&a.timeStamp||_.now(),void(this[_.expando]=!0)):new _.Event(a,b)},_.Event.prototype={isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=j,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=j,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=j,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},_.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){_.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!_.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),Y.focusinBubbles||_.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){_.event.simulate(b,a.target,_.event.fix(a),!0)};_.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=ra.access(d,b);e||d.addEventListener(a,c,!0),ra.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=ra.access(d,b)-1;e?ra.access(d,b,e):(d.removeEventListener(a,c,!0),ra.remove(d,b))}}}),_.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=k;else if(!d)return this;return 1===e&&(f=d,d=function(a){return _().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=_.guid++)),this.each(function(){_.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,_(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=k),this.each(function(){_.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){_.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?_.event.trigger(a,b,c,!0):void 0}});var Ea=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Fa=/<([\w:]+)/,Ga=/<|&#?\w+;/,Ha=/<(?:script|style|link)/i,Ia=/checked\s*(?:[^=]|=\s*.checked.)/i,Ja=/^$|\/(?:java|ecma)script/i,Ka=/^true\/(.*)/,La=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ma={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ma.optgroup=Ma.option,Ma.tbody=Ma.tfoot=Ma.colgroup=Ma.caption=Ma.thead,Ma.th=Ma.td,_.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=_.contains(a.ownerDocument,a);if(!(Y.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||_.isXMLDoc(a)))for(g=r(h),f=r(a),d=0,e=f.length;e>d;d++)s(f[d],g[d]);if(b)if(c)for(f=f||r(a),g=g||r(h),d=0,e=f.length;e>d;d++)q(f[d],g[d]);else q(a,h);return g=r(h,"script"),g.length>0&&p(g,!i&&r(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===_.type(e))_.merge(l,e.nodeType?[e]:e);else if(Ga.test(e)){for(f=f||k.appendChild(b.createElement("div")),g=(Fa.exec(e)||["",""])[1].toLowerCase(),h=Ma[g]||Ma._default,f.innerHTML=h[1]+e.replace(Ea,"<$1></$2>")+h[2],j=h[0];j--;)f=f.lastChild;_.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));for(k.textContent="",m=0;e=l[m++];)if((!d||-1===_.inArray(e,d))&&(i=_.contains(e.ownerDocument,e),f=r(k.appendChild(e),"script"),i&&p(f),c))for(j=0;e=f[j++];)Ja.test(e.type||"")&&c.push(e);return k},cleanData:function(a){for(var b,c,d,e,f=_.event.special,g=0;void 0!==(c=a[g]);g++){if(_.acceptData(c)&&(e=c[ra.expando],e&&(b=ra.cache[e]))){if(b.events)for(d in b.events)f[d]?_.event.remove(c,d):_.removeEvent(c,d,b.handle);ra.cache[e]&&delete ra.cache[e]}delete sa.cache[c[sa.expando]]}}}),_.fn.extend({text:function(a){return qa(this,function(a){return void 0===a?_.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?_.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||_.cleanData(r(c)),c.parentNode&&(b&&_.contains(c.ownerDocument,c)&&p(r(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(_.cleanData(r(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return _.clone(this,a,b)})},html:function(a){return qa(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Ha.test(a)&&!Ma[(Fa.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ea,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(_.cleanData(r(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,_.cleanData(r(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=S.apply([],a);var c,d,e,f,g,h,i=0,j=this.length,k=this,l=j-1,m=a[0],p=_.isFunction(m);if(p||j>1&&"string"==typeof m&&!Y.checkClone&&Ia.test(m))return this.each(function(c){var d=k.eq(c);p&&(a[0]=m.call(this,c,d.html())),d.domManip(a,b)});if(j&&(c=_.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(e=_.map(r(c,"script"),n),f=e.length;j>i;i++)g=c,i!==l&&(g=_.clone(g,!0,!0),f&&_.merge(e,r(g,"script"))),b.call(this[i],g,i);if(f)for(h=e[e.length-1].ownerDocument,_.map(e,o),i=0;f>i;i++)g=e[i],Ja.test(g.type||"")&&!ra.access(g,"globalEval")&&_.contains(h,g)&&(g.src?_._evalUrl&&_._evalUrl(g.src):_.globalEval(g.textContent.replace(La,"")))}return this}}),_.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){_.fn[a]=function(a){for(var c,d=[],e=_(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),_(e[g])[b](c),T.apply(d,c.get());return this.pushStack(d)}});var Na,Oa={},Pa=/^margin/,Qa=new RegExp("^("+va+")(?!px)[a-z%]+$","i"),Ra=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};!function(){function b(){g.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",g.innerHTML="",e.appendChild(f);var b=a.getComputedStyle(g,null);c="1%"!==b.top,d="4px"===b.width,e.removeChild(f)}var c,d,e=Z.documentElement,f=Z.createElement("div"),g=Z.createElement("div");g.style&&(g.style.backgroundClip="content-box",g.cloneNode(!0).style.backgroundClip="",Y.clearCloneStyle="content-box"===g.style.backgroundClip,f.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",f.appendChild(g),a.getComputedStyle&&_.extend(Y,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return null==d&&b(),d},reliableMarginRight:function(){var b,c=g.appendChild(Z.createElement("div"));return c.style.cssText=g.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",g.style.width="1px",e.appendChild(f),b=!parseFloat(a.getComputedStyle(c,null).marginRight),e.removeChild(f),b}}))}(),_.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Sa=/^(none|table(?!-c[ea]).+)/,Ta=new RegExp("^("+va+")(.*)$","i"),Ua=new RegExp("^([+-])=("+va+")","i"),Va={position:"absolute",visibility:"hidden",display:"block"},Wa={letterSpacing:"0",fontWeight:"400"},Xa=["Webkit","O","Moz","ms"];_.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=v(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=_.camelCase(b),i=a.style;return b=_.cssProps[h]||(_.cssProps[h]=x(i,h)),g=_.cssHooks[b]||_.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ua.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(_.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||_.cssNumber[h]||(c+="px"),Y.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=_.camelCase(b);return b=_.cssProps[h]||(_.cssProps[h]=x(a.style,h)),g=_.cssHooks[b]||_.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=v(a,b,d)),"normal"===e&&b in Wa&&(e=Wa[b]),""===c||c?(f=parseFloat(e),c===!0||_.isNumeric(f)?f||0:e):e}}),_.each(["height","width"],function(a,b){_.cssHooks[b]={get:function(a,c,d){return c?Sa.test(_.css(a,"display"))&&0===a.offsetWidth?_.swap(a,Va,function(){return A(a,b,d)}):A(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return y(a,c,d?z(a,b,d,"border-box"===_.css(a,"boxSizing",!1,e),e):0)}}}),_.cssHooks.marginRight=w(Y.reliableMarginRight,function(a,b){return b?_.swap(a,{display:"inline-block"},v,[a,"marginRight"]):void 0}),_.each({margin:"",padding:"",border:"Width"},function(a,b){_.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+wa[d]+b]=f[d]||f[d-2]||f[0];return e}},Pa.test(a)||(_.cssHooks[a+b].set=y)}),_.fn.extend({css:function(a,b){return qa(this,function(a,b,c){var d,e,f={},g=0;if(_.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=_.css(a,b[g],!1,d);return f}return void 0!==c?_.style(a,b,c):_.css(a,b)},a,b,arguments.length>1)},show:function(){return B(this,!0)},hide:function(){return B(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){xa(this)?_(this).show():_(this).hide()})}}),_.Tween=C,C.prototype={constructor:C,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(_.cssNumber[c]?"":"px")},cur:function(){var a=C.propHooks[this.prop];return a&&a.get?a.get(this):C.propHooks._default.get(this)},run:function(a){var b,c=C.propHooks[this.prop];return this.options.duration?this.pos=b=_.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):C.propHooks._default.set(this),this}},C.prototype.init.prototype=C.prototype,C.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=_.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){_.fx.step[a.prop]?_.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[_.cssProps[a.prop]]||_.cssHooks[a.prop])?_.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},C.propHooks.scrollTop=C.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},_.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},_.fx=C.prototype.init,_.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=new RegExp("^(?:([+-])=|)("+va+")([a-z%]*)$","i"),ab=/queueHooks$/,bb=[G],cb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=_a.exec(b),f=e&&e[3]||(_.cssNumber[a]?"":"px"),g=(_.cssNumber[a]||"px"!==f&&+d)&&_a.exec(_.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,_.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};_.Animation=_.extend(I,{tweener:function(a,b){_.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],cb[c]=cb[c]||[],cb[c].unshift(b)},prefilter:function(a,b){b?bb.unshift(a):bb.push(a)}}),_.speed=function(a,b,c){var d=a&&"object"==typeof a?_.extend({},a):{complete:c||!c&&b||_.isFunction(a)&&a,duration:a,easing:c&&b||b&&!_.isFunction(b)&&b};return d.duration=_.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in _.fx.speeds?_.fx.speeds[d.duration]:_.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){_.isFunction(d.old)&&d.old.call(this),d.queue&&_.dequeue(this,d.queue)},d},_.fn.extend({fadeTo:function(a,b,c,d){return this.filter(xa).css("opacity",0).show().end().animate({
- opacity:b},a,c,d)},animate:function(a,b,c,d){var e=_.isEmptyObject(a),f=_.speed(b,c,d),g=function(){var b=I(this,_.extend({},a),f);(e||ra.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=_.timers,g=ra.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&_.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=ra.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=_.timers,g=d?d.length:0;for(c.finish=!0,_.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),_.each(["toggle","show","hide"],function(a,b){var c=_.fn[b];_.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(E(b,!0),a,d,e)}}),_.each({slideDown:E("show"),slideUp:E("hide"),slideToggle:E("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){_.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),_.timers=[],_.fx.tick=function(){var a,b=0,c=_.timers;for(Ya=_.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||_.fx.stop(),Ya=void 0},_.fx.timer=function(a){_.timers.push(a),a()?_.fx.start():_.timers.pop()},_.fx.interval=13,_.fx.start=function(){Za||(Za=setInterval(_.fx.tick,_.fx.interval))},_.fx.stop=function(){clearInterval(Za),Za=null},_.fx.speeds={slow:600,fast:200,_default:400},_.fn.delay=function(a,b){return a=_.fx?_.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=Z.createElement("input"),b=Z.createElement("select"),c=b.appendChild(Z.createElement("option"));a.type="checkbox",Y.checkOn=""!==a.value,Y.optSelected=c.selected,b.disabled=!0,Y.optDisabled=!c.disabled,a=Z.createElement("input"),a.value="t",a.type="radio",Y.radioValue="t"===a.value}();var db,eb,fb=_.expr.attrHandle;_.fn.extend({attr:function(a,b){return qa(this,_.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){_.removeAttr(this,a)})}}),_.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===za?_.prop(a,b,c):(1===f&&_.isXMLDoc(a)||(b=b.toLowerCase(),d=_.attrHooks[b]||(_.expr.match.bool.test(b)?eb:db)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=_.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void _.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(na);if(f&&1===a.nodeType)for(;c=f[e++];)d=_.propFix[c]||c,_.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!Y.radioValue&&"radio"===b&&_.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),eb={set:function(a,b,c){return b===!1?_.removeAttr(a,c):a.setAttribute(c,c),c}},_.each(_.expr.match.bool.source.match(/\w+/g),function(a,b){var c=fb[b]||_.find.attr;fb[b]=function(a,b,d){var e,f;return d||(f=fb[b],fb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,fb[b]=f),e}});var gb=/^(?:input|select|textarea|button)$/i;_.fn.extend({prop:function(a,b){return qa(this,_.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[_.propFix[a]||a]})}}),_.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!_.isXMLDoc(a),f&&(b=_.propFix[b]||b,e=_.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||gb.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),Y.optSelected||(_.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),_.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){_.propFix[this.toLowerCase()]=this});var hb=/[\t\r\n\f]/g;_.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(_.isFunction(a))return this.each(function(b){_(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(na)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(hb," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=_.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(_.isFunction(a))return this.each(function(b){_(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(na)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(hb," "):"")){for(f=0;e=b[f++];)for(;d.indexOf(" "+e+" ")>=0;)d=d.replace(" "+e+" "," ");g=a?_.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(_.isFunction(a)?function(c){_(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c)for(var b,d=0,e=_(this),f=a.match(na)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else(c===za||"boolean"===c)&&(this.className&&ra.set(this,"__className__",this.className),this.className=this.className||a===!1?"":ra.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(hb," ").indexOf(b)>=0)return!0;return!1}});var ib=/\r/g;_.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=_.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,_(this).val()):a,null==e?e="":"number"==typeof e?e+="":_.isArray(e)&&(e=_.map(e,function(a){return null==a?"":a+""})),b=_.valHooks[this.type]||_.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=_.valHooks[e.type]||_.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ib,""):null==c?"":c)}}}),_.extend({valHooks:{option:{get:function(a){var b=_.find.attr(a,"value");return null!=b?b:_.trim(_.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(Y.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&_.nodeName(c.parentNode,"optgroup"))){if(b=_(c).val(),f)return b;g.push(b)}return g},set:function(a,b){for(var c,d,e=a.options,f=_.makeArray(b),g=e.length;g--;)d=e[g],(d.selected=_.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),_.each(["radio","checkbox"],function(){_.valHooks[this]={set:function(a,b){return _.isArray(b)?a.checked=_.inArray(_(a).val(),b)>=0:void 0}},Y.checkOn||(_.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),_.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){_.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),_.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var jb=_.now(),kb=/\?/;_.parseJSON=function(a){return JSON.parse(a+"")},_.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&_.error("Invalid XML: "+a),b};var lb,mb,nb=/#.*$/,ob=/([?&])_=[^&]*/,pb=/^(.*?):[ \t]*([^\r\n]*)$/gm,qb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rb=/^(?:GET|HEAD)$/,sb=/^\/\//,tb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,ub={},vb={},wb="*/".concat("*");try{mb=location.href}catch(xb){mb=Z.createElement("a"),mb.href="",mb=mb.href}lb=tb.exec(mb.toLowerCase())||[],_.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:mb,type:"GET",isLocal:qb.test(lb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":wb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":_.parseJSON,"text xml":_.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?L(L(a,_.ajaxSettings),b):L(_.ajaxSettings,a)},ajaxPrefilter:J(ub),ajaxTransport:J(vb),ajax:function(a,b){function c(a,b,c,g){var i,k,r,s,u,w=b;2!==t&&(t=2,h&&clearTimeout(h),d=void 0,f=g||"",v.readyState=a>0?4:0,i=a>=200&&300>a||304===a,c&&(s=M(l,v,c)),s=N(l,s,v,i),i?(l.ifModified&&(u=v.getResponseHeader("Last-Modified"),u&&(_.lastModified[e]=u),u=v.getResponseHeader("etag"),u&&(_.etag[e]=u)),204===a||"HEAD"===l.type?w="nocontent":304===a?w="notmodified":(w=s.state,k=s.data,r=s.error,i=!r)):(r=w,(a||!w)&&(w="error",0>a&&(a=0))),v.status=a,v.statusText=(b||w)+"",i?o.resolveWith(m,[k,w,v]):o.rejectWith(m,[v,w,r]),v.statusCode(q),q=void 0,j&&n.trigger(i?"ajaxSuccess":"ajaxError",[v,l,i?k:r]),p.fireWith(m,[v,w]),j&&(n.trigger("ajaxComplete",[v,l]),--_.active||_.event.trigger("ajaxStop")))}"object"==typeof a&&(b=a,a=void 0),b=b||{};var d,e,f,g,h,i,j,k,l=_.ajaxSetup({},b),m=l.context||l,n=l.context&&(m.nodeType||m.jquery)?_(m):_.event,o=_.Deferred(),p=_.Callbacks("once memory"),q=l.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!g)for(g={};b=pb.exec(f);)g[b[1].toLowerCase()]=b[2];b=g[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return d&&d.abort(b),c(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,l.url=((a||l.url||mb)+"").replace(nb,"").replace(sb,lb[1]+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=_.trim(l.dataType||"*").toLowerCase().match(na)||[""],null==l.crossDomain&&(i=tb.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]===lb[1]&&i[2]===lb[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(lb[3]||("http:"===lb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=_.param(l.data,l.traditional)),K(ub,l,b,v),2===t)return v;j=l.global,j&&0===_.active++&&_.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rb.test(l.type),e=l.url,l.hasContent||(l.data&&(e=l.url+=(kb.test(e)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=ob.test(e)?e.replace(ob,"$1_="+jb++):e+(kb.test(e)?"&":"?")+"_="+jb++)),l.ifModified&&(_.lastModified[e]&&v.setRequestHeader("If-Modified-Since",_.lastModified[e]),_.etag[e]&&v.setRequestHeader("If-None-Match",_.etag[e])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",l.contentType),v.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+wb+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)v.setRequestHeader(k,l.headers[k]);if(l.beforeSend&&(l.beforeSend.call(m,v,l)===!1||2===t))return v.abort();u="abort";for(k in{success:1,error:1,complete:1})v[k](l[k]);if(d=K(vb,l,b,v)){v.readyState=1,j&&n.trigger("ajaxSend",[v,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){v.abort("timeout")},l.timeout));try{t=1,d.send(r,c)}catch(w){if(!(2>t))throw w;c(-1,w)}}else c(-1,"No Transport");return v},getJSON:function(a,b,c){return _.get(a,b,c,"json")},getScript:function(a,b){return _.get(a,void 0,b,"script")}}),_.each(["get","post"],function(a,b){_[b]=function(a,c,d,e){return _.isFunction(c)&&(e=e||d,d=c,c=void 0),_.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),_.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){_.fn[b]=function(a){return this.on(b,a)}}),_._evalUrl=function(a){return _.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},_.fn.extend({wrapAll:function(a){var b;return _.isFunction(a)?this.each(function(b){_(this).wrapAll(a.call(this,b))}):(this[0]&&(b=_(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstElementChild;)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(_.isFunction(a)?function(b){_(this).wrapInner(a.call(this,b))}:function(){var b=_(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=_.isFunction(a);return this.each(function(c){_(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){_.nodeName(this,"body")||_(this).replaceWith(this.childNodes)}).end()}}),_.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},_.expr.filters.visible=function(a){return!_.expr.filters.hidden(a)};var yb=/%20/g,zb=/\[\]$/,Ab=/\r?\n/g,Bb=/^(?:submit|button|image|reset|file)$/i,Cb=/^(?:input|select|textarea|keygen)/i;_.param=function(a,b){var c,d=[],e=function(a,b){b=_.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=_.ajaxSettings&&_.ajaxSettings.traditional),_.isArray(a)||a.jquery&&!_.isPlainObject(a))_.each(a,function(){e(this.name,this.value)});else for(c in a)O(c,a[c],b,e);return d.join("&").replace(yb,"+")},_.fn.extend({serialize:function(){return _.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=_.prop(this,"elements");return a?_.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!_(this).is(":disabled")&&Cb.test(this.nodeName)&&!Bb.test(a)&&(this.checked||!ya.test(a))}).map(function(a,b){var c=_(this).val();return null==c?null:_.isArray(c)?_.map(c,function(a){return{name:b.name,value:a.replace(Ab,"\r\n")}}):{name:b.name,value:c.replace(Ab,"\r\n")}}).get()}}),_.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Db=0,Eb={},Fb={0:200,1223:204},Gb=_.ajaxSettings.xhr();a.ActiveXObject&&_(a).on("unload",function(){for(var a in Eb)Eb[a]()}),Y.cors=!!Gb&&"withCredentials"in Gb,Y.ajax=Gb=!!Gb,_.ajaxTransport(function(a){var b;return Y.cors||Gb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Db;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Eb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Fb[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Eb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),_.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return _.globalEval(a),a}}}),_.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),_.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=_("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),Z.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Hb=[],Ib=/(=)\?(?=&|$)|\?\?/;_.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Hb.pop()||_.expando+"_"+jb++;return this[a]=!0,a}}),_.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ib.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ib.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=_.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ib,"$1"+e):b.jsonp!==!1&&(b.url+=(kb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||_.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Hb.push(e)),g&&_.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),_.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||Z;var d=ga.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=_.buildFragment([a],b,e),e&&e.length&&_(e).remove(),_.merge([],d.childNodes))};var Jb=_.fn.load;_.fn.load=function(a,b,c){if("string"!=typeof a&&Jb)return Jb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=_.trim(a.slice(h)),a=a.slice(0,h)),_.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&_.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?_("<div>").append(_.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},_.expr.filters.animated=function(a){return _.grep(_.timers,function(b){return a===b.elem}).length};var Kb=a.document.documentElement;_.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=_.css(a,"position"),l=_(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=_.css(a,"top"),i=_.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),_.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},_.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){_.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,_.contains(b,d)?(typeof d.getBoundingClientRect!==za&&(e=d.getBoundingClientRect()),c=P(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===_.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),_.nodeName(a[0],"html")||(d=a.offset()),d.top+=_.css(a[0],"borderTopWidth",!0),d.left+=_.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-_.css(c,"marginTop",!0),left:b.left-d.left-_.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||Kb;a&&!_.nodeName(a,"html")&&"static"===_.css(a,"position");)a=a.offsetParent;return a||Kb})}}),_.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;_.fn[b]=function(e){return qa(this,function(b,e,f){var g=P(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),_.each(["top","left"],function(a,b){_.cssHooks[b]=w(Y.pixelPosition,function(a,c){return c?(c=v(a,b),Qa.test(c)?_(a).position()[b]+"px":c):void 0})}),_.each({Height:"height",Width:"width"},function(a,b){_.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){_.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return qa(this,function(b,c,d){var e;return _.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?_.css(b,c,g):_.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),_.fn.size=function(){return this.length},_.fn.andSelf=_.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return _});var Lb=a.jQuery,Mb=a.$;return _.noConflict=function(b){return a.$===_&&(a.$=Mb),b&&a.jQuery===_&&(a.jQuery=Lb),_},typeof b===za&&(a.jQuery=a.$=_),_}),function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:void 0===this?window:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a;a="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;"Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();a.Promise=e}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}(),window.jQuery&&function(a){a.extend({xml2json:function(b,c){function d(b,g){if(!b)return null;var h="",i=null,j=null;b.nodeType,e(b.localName||b.nodeName),b.text||b.nodeValue||"";b.childNodes&&b.childNodes.length>0&&a.each(b.childNodes,function(a,b){var c=b.nodeType,g=e(b.localName||b.nodeName),j=b.text||b.nodeValue||"";if(8!=c)if(3!=c&&4!=c&&g)i=i||{},i[g]?(i[g].length||(i[g]=f(i[g])),i[g]=f(i[g]),i[g][i[g].length]=d(b,!0),i[g].length=i[g].length):i[g]=d(b);else{if(j.match(/^\s+$/))return;h+=j.replace(/^\s+/,"").replace(/\s+$/,"")}}),b.attributes&&b.attributes.length>0&&(j={},i=i||{},a.each(b.attributes,function(a,b){var c=e(b.name),d=b.value;j[c]=d,i[c]?(i[cnn]=f(i[cnn]),i[c][i[c].length]=d,i[c].length=i[c].length):i[c]=d})),i&&(i=a.extend(""!=h?new String(h):{},i||{}),h=i.text?[i.text||""].concat([h]):h,h&&(i.text=h),h="");var k=i||h;return c&&(h&&(k={}),h=k.text||h||"",h&&(k.text=h),g||(k=f(k))),k}if(!b)return{};var e=function(a){return String(a||"").replace(/-/g,"_")},f=function(b){return a.isArray(b)||(b=[b]),b.length=b.length,b};if("string"==typeof b&&(b=a.text2xml(b)),b.nodeType){if(3==b.nodeType||4==b.nodeType)return b.nodeValue;var g=9==b.nodeType?b.documentElement:b,h=d(g,!0);return b=null,g=null,h}},text2xml:function(b){return a.parseXML(b)}})}(jQuery),function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){function b(a){if(a in l.style)return a;for(var b=["Moz","Webkit","O","ms"],c=a.charAt(0).toUpperCase()+a.substr(1),d=0;d<b.length;++d){var e=b[d]+c;if(e in l.style)return e}}function c(){return l.style[m.transform]="",l.style[m.transform]="rotateY(90deg)",""!==l.style[m.transform]}function d(a){return"string"==typeof a&&this.parse(a),this}function e(a,b,c){b===!0?a.queue(c):b?a.queue(b,c):a.each(function(){c.call(this)})}function f(b){var c=[];return a.each(b,function(b){b=a.camelCase(b),b=a.transit.propertyMap[b]||a.cssProps[b]||b,b=i(b),m[b]&&(b=i(m[b])),-1===a.inArray(b,c)&&c.push(b)}),c}function g(b,c,d,e){var g=f(b);a.cssEase[d]&&(d=a.cssEase[d]);var h=""+k(c)+" "+d;parseInt(e,10)>0&&(h+=" "+k(e));var i=[];return a.each(g,function(a,b){i.push(b+" "+h)}),i.join(", ")}function h(b,c){c||(a.cssNumber[b]=!0),a.transit.propertyMap[b]=m.transform,a.cssHooks[b]={get:function(c){var d=a(c).css("transit:transform");return d.get(b)},set:function(c,d){var e=a(c).css("transit:transform");e.setFromString(b,d),a(c).css({"transit:transform":e})}}}function i(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function j(a,b){return"string"!=typeof a||a.match(/^[\-0-9\.]+$/)?""+a+b:a}function k(b){var c=b;return"string"!=typeof c||c.match(/^[\-0-9\.]+/)||(c=a.fx.speeds[c]||a.fx.speeds._default),j(c,"ms")}a.transit={version:"0.9.12",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var l=document.createElement("div"),m={},n=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;m.transition=b("transition"),m.transitionDelay=b("transitionDelay"),m.transform=b("transform"),m.transformOrigin=b("transformOrigin"),m.filter=b("Filter"),m.transform3d=c();var o={transition:"transitionend",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"},p=m.transitionEnd=o[m.transition]||null;for(var q in m)m.hasOwnProperty(q)&&"undefined"==typeof a.support[q]&&(a.support[q]=m[q]);return l=null,a.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeInCubic:"cubic-bezier(.550,.055,.675,.190)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"},a.cssHooks["transit:transform"]={get:function(b){return a(b).data("transform")||new d},set:function(b,c){var e=c;e instanceof d||(e=new d(e)),"WebkitTransform"!==m.transform||n?b.style[m.transform]=e.toString():b.style[m.transform]=e.toString(!0),a(b).data("transform",e)}},a.cssHooks.transform={set:a.cssHooks["transit:transform"].set},a.cssHooks.filter={get:function(a){return a.style[m.filter]},set:function(a,b){a.style[m.filter]=b}},a.fn.jquery<"1.8"&&(a.cssHooks.transformOrigin={get:function(a){return a.style[m.transformOrigin]},set:function(a,b){a.style[m.transformOrigin]=b}},a.cssHooks.transition={get:function(a){return a.style[m.transition]},set:function(a,b){a.style[m.transition]=b}}),h("scale"),h("scaleX"),h("scaleY"),h("translate"),h("rotate"),h("rotateX"),h("rotateY"),h("rotate3d"),h("perspective"),h("skewX"),h("skewY"),h("x",!0),h("y",!0),d.prototype={setFromString:function(a,b){var c="string"==typeof b?b.split(","):b.constructor===Array?b:[b];
- c.unshift(a),d.prototype.set.apply(this,c)},set:function(a){var b=Array.prototype.slice.apply(arguments,[1]);this.setter[a]?this.setter[a].apply(this,b):this[a]=b.join(",")},get:function(a){return this.getter[a]?this.getter[a].apply(this):this[a]||0},setter:{rotate:function(a){this.rotate=j(a,"deg")},rotateX:function(a){this.rotateX=j(a,"deg")},rotateY:function(a){this.rotateY=j(a,"deg")},scale:function(a,b){void 0===b&&(b=a),this.scale=a+","+b},skewX:function(a){this.skewX=j(a,"deg")},skewY:function(a){this.skewY=j(a,"deg")},perspective:function(a){this.perspective=j(a,"px")},x:function(a){this.set("translate",a,null)},y:function(a){this.set("translate",null,a)},translate:function(a,b){void 0===this._translateX&&(this._translateX=0),void 0===this._translateY&&(this._translateY=0),null!==a&&void 0!==a&&(this._translateX=j(a,"px")),null!==b&&void 0!==b&&(this._translateY=j(b,"px")),this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var a=(this.scale||"1,1").split(",");return a[0]&&(a[0]=parseFloat(a[0])),a[1]&&(a[1]=parseFloat(a[1])),a[0]===a[1]?a[0]:a},rotate3d:function(){for(var a=(this.rotate3d||"0,0,0,0deg").split(","),b=0;3>=b;++b)a[b]&&(a[b]=parseFloat(a[b]));return a[3]&&(a[3]=j(a[3],"deg")),a}},parse:function(a){var b=this;a.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(a,c,d){b.setFromString(c,d)})},toString:function(a){var b=[];for(var c in this)if(this.hasOwnProperty(c)){if(!m.transform3d&&("rotateX"===c||"rotateY"===c||"perspective"===c||"transformOrigin"===c))continue;"_"!==c[0]&&b.push(a&&"scale"===c?c+"3d("+this[c]+",1)":a&&"translate"===c?c+"3d("+this[c]+",0)":c+"("+this[c]+")")}return b.join(" ")}},a.fn.transition=a.fn.transit=function(b,c,d,f){var h=this,i=0,j=!0,l=a.extend(!0,{},b);"function"==typeof c&&(f=c,c=void 0),"object"==typeof c&&(d=c.easing,i=c.delay||0,j="undefined"==typeof c.queue?!0:c.queue,f=c.complete,c=c.duration),"function"==typeof d&&(f=d,d=void 0),"undefined"!=typeof l.easing&&(d=l.easing,delete l.easing),"undefined"!=typeof l.duration&&(c=l.duration,delete l.duration),"undefined"!=typeof l.complete&&(f=l.complete,delete l.complete),"undefined"!=typeof l.queue&&(j=l.queue,delete l.queue),"undefined"!=typeof l.delay&&(i=l.delay,delete l.delay),"undefined"==typeof c&&(c=a.fx.speeds._default),"undefined"==typeof d&&(d=a.cssEase._default),c=k(c);var n=g(l,c,d,i),o=a.transit.enabled&&m.transition,q=o?parseInt(c,10)+parseInt(i,10):0;if(0===q){var r=function(a){h.css(l),f&&f.apply(h),a&&a()};return e(h,j,r),h}var s={},t=function(b){var c=!1,d=function(){c&&h.unbind(p,d),q>0&&h.each(function(){this.style[m.transition]=s[this]||null}),"function"==typeof f&&f.apply(h),"function"==typeof b&&b()};q>0&&p&&a.transit.useTransitionEnd?(c=!0,h.bind(p,d)):window.setTimeout(d,q),h.each(function(){q>0&&(this.style[m.transition]=n),a(this).css(l)})},u=function(a){this.offsetWidth,t(a)};return e(h,j,u),this},a.transit.getTransitionValue=g,a}),function(a){a.ajaxTransport("+*",function(a,b,c){return window.FormData&&(a.dataType&&("blob"===a.dataType||"arraybuffer"===a.dataType)||a.data&&(window.Blob&&a.data instanceof Blob||window.ArrayBuffer&&a.data instanceof ArrayBuffer))?{send:function(b,c){var d,e=new XMLHttpRequest,f=a.url||window.location.href,g=a.type||"GET",h=a.dataType||"text",i=a.data||null,j=a.async||!0;e.addEventListener("load",function(){var a,b={};a=e.status>=200&&e.status<300||304===e.status,a?b[h]=e.response:b.text=String.fromCharCode.apply(null,new Uint8Array(e.response)),c(e.status,e.statusText,b,e.getAllResponseHeaders())}),e.open(g,f,j),e.responseType=h;for(d in b)b.hasOwnProperty(d)&&e.setRequestHeader(d,b[d]);e.send(i)},abort:function(){c.abort()}}:void 0})}(window.jQuery),function(a){function b(){var a=-1,b=this;b.append=function(c){var d,e=b.table;for(d=0;d<c.length;d++)a=a>>>8^e[255&(a^c[d])]},b.get=function(){return~a}}function c(a,b,c){return a.slice?a.slice(b,b+c):a.webkitSlice?a.webkitSlice(b,b+c):a.mozSlice?a.mozSlice(b,b+c):a.msSlice?a.msSlice(b,b+c):void 0}function d(a,b){var c,d;return c=new ArrayBuffer(a),d=new Uint8Array(c),b&&d.set(b,0),{buffer:c,array:d,view:new DataView(c)}}function e(){}function f(a){function b(b,c){var f=new Blob([a],{type:"text/plain"});d=new h(f),d.init(function(){e.size=d.size,b()},c)}function c(a,b,c,e){d.readUint8Array(a,b,c,e)}var d,e=this;e.size=0,e.init=b,e.readUint8Array=c}function g(b){function c(a){for(var c=b.length;"="==b.charAt(c-1);)c--;f=b.indexOf(",")+1,g.size=Math.floor(.75*(c-f)),a()}function e(c,e,g){var h,i=d(e),j=4*Math.floor(c/3),k=4*Math.ceil((c+e)/3),l=a.atob(b.substring(j+f,k+f)),m=c-3*Math.floor(j/4);for(h=m;m+e>h;h++)i.array[h-m]=l.charCodeAt(h);g(i.array)}var f,g=this;g.size=0,g.init=c,g.readUint8Array=e}function h(a){function b(b){this.size=a.size,b()}function d(b,d,e,f){var g=new FileReader;g.onload=function(a){e(new Uint8Array(a.target.result))},g.onerror=f,g.readAsArrayBuffer(c(a,b,d))}var e=this;e.size=0,e.init=b,e.readUint8Array=d}function i(a){function b(b,c){var d;e.data?b():(d=new XMLHttpRequest,d.addEventListener("load",function(){e.size||(e.size=Number(d.getResponseHeader("Content-Length"))),e.data=new Uint8Array(d.response),b()},!1),d.addEventListener("error",c,!1),d.open("GET",a),d.responseType="arraybuffer",d.send())}function c(b,c){var d=new XMLHttpRequest;d.addEventListener("load",function(){e.size=Number(d.getResponseHeader("Content-Length")),b()},!1),d.addEventListener("error",c,!1),d.open("HEAD",a),d.send()}function d(a,c,d,f){b(function(){d(new Uint8Array(e.data.subarray(a,a+c)))},f)}var e=this;e.size=0,e.init=c,e.readUint8Array=d}function j(a){function b(b,c){var d=new XMLHttpRequest;d.addEventListener("load",function(){e.size=Number(d.getResponseHeader("Content-Length")),"bytes"==d.getResponseHeader("Accept-Ranges")?b():c(M)},!1),d.addEventListener("error",c,!1),d.open("HEAD",a),d.send()}function c(b,c,d,e){var f=new XMLHttpRequest;f.open("GET",a),f.responseType="arraybuffer",f.setRequestHeader("Range","bytes="+b+"-"+(b+c-1)),f.addEventListener("load",function(){d(f.response)},!1),f.addEventListener("error",e,!1),f.send()}function d(a,b,d,e){c(a,b,function(a){d(new Uint8Array(a))},e)}var e=this;e.size=0,e.init=b,e.readUint8Array=d}function k(){}function l(){function a(a){d=new Blob([],{type:"text/plain"}),a()}function b(a,b){d=new Blob([d,D?a:a.buffer],{type:"text/plain"}),b()}function c(a,b){var c=new FileReader;c.onload=function(b){a(b.target.result)},c.onerror=b,c.readAsText(d)}var d,e=this;e.init=a,e.writeUint8Array=b,e.getData=c}function m(b){function c(a){g+="data:"+(b||"")+";base64,",a()}function d(b,c){var d,e=h.length,f=h;for(h="",d=0;d<3*Math.floor((e+b.length)/3)-e;d++)f+=String.fromCharCode(b[d]);for(;d<b.length;d++)h+=String.fromCharCode(b[d]);f.length>2?g+=a.btoa(f):h=f,c()}function e(b){b(g+a.btoa(h))}var f=this,g="",h="";f.init=c,f.writeUint8Array=d,f.getData=e}function n(a,b){function c(b,c){a.createWriter(function(a){f=a,b()},c)}function d(a,c,d){var e=new Blob([D?a:a.buffer],{type:b});f.onwrite=function(){f.onwrite=null,c()},f.onerror=d,f.write(e)}function e(b){a.file(b)}var f,g=this;g.init=c,g.writeUint8Array=d,g.getData=e}function o(a){function b(b){e=new Blob([],{type:a}),b()}function c(b,c){e=new Blob([e,D?b:b.buffer],{type:a}),c()}function d(a){a(e)}var e,f=this;f.init=b,f.writeUint8Array=c,f.getData=d}function p(a,b,c,d,e,f,g,h,i,j){function k(){a.removeEventListener("message",l,!1),h(o)}function l(a){var b=a.data,d=b.data;b.onappend&&(o+=d.length,c.writeUint8Array(d,function(){f(!1,d),m()},j)),b.onflush&&(d?(o+=d.length,c.writeUint8Array(d,function(){f(!1,d),k()},j)):k()),b.progress&&g&&g(n+b.current,e)}function m(){n=p*N,e>n?b.readUint8Array(d+n,Math.min(N,e-n),function(b){a.postMessage({append:!0,data:b}),p++,g&&g(n,e),f(!0,b)},i):a.postMessage({flush:!0})}var n,o,p=0;o=0,a.addEventListener("message",l,!1),m()}function q(a,b,c,d,e,f,g,h,i,j){function k(){var o;l=m*N,e>l?b.readUint8Array(d+l,Math.min(N,e-l),function(b){var h=a.append(b,function(){g&&g(d+l,e)});n+=h.length,f(!0,b),c.writeUint8Array(h,function(){f(!1,h),m++,setTimeout(k,1)},j),g&&g(l,e)},i):(o=a.flush(),o?(n+=o.length,c.writeUint8Array(o,function(){f(!1,o),h(n)},j)):h(n))}var l,m=0,n=0;k()}function r(c,d,e,f,g,h,i,j,k){function l(a,b){g&&!a&&o.append(b)}function m(a){h(a,o.get())}var n,o=new b;return a.zip.useWebWorkers?(n=new Worker(a.zip.inflateJSPath||O),p(n,c,d,e,f,l,i,m,j,k)):q(new a.zip.Inflater,c,d,e,f,l,i,m,j,k),n}function s(c,d,e,f,g,h,i){function j(a,b){a&&n.append(b)}function k(a){f(a,n.get())}function l(){m.removeEventListener("message",l,!1),p(m,c,d,0,c.size,j,g,k,h,i)}var m,n=new b;return a.zip.useWebWorkers?(m=new Worker(a.zip.workerScriptsPath+P),m.addEventListener("message",l,!1),m.postMessage({init:!0,level:e})):q(new a.zip.Deflater,c,d,0,c.size,j,g,k,h,i),m}function t(a,c,d,e,f,g,h,i,j){function k(){var b=l*N;e>b?a.readUint8Array(d+b,Math.min(N,e-b),function(a){f&&m.append(a),h&&h(b,e,a),c.writeUint8Array(a,function(){l++,k()},j)},i):g(e,m.get())}var l=0,m=new b;k()}function u(a){var b,c,d="",e=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];for(b=0;b<a.length;b++)c=255&a.charCodeAt(b),d+=c>127?e[c-128]:String.fromCharCode(c);return d}function v(a){var b=[],c=0,d=0,e=0,f=0,g=0;for(a+="";c<a.length;)e=a.charCodeAt(c),128>e?(b[d++]=String.fromCharCode(e),c++):e>191&&224>e?(f=a.charCodeAt(c+1),b[d++]=String.fromCharCode((31&e)<<6|63&f),c+=2):(f=a.charCodeAt(c+1),g=a.charCodeAt(c+2),b[d++]=String.fromCharCode((15&e)<<12|(63&f)<<6|63&g),c+=3);return b.join("")}function w(a){var b,c="";for(b=0;b<a.length;b++)c+=String.fromCharCode(a[b]);return c}function x(a){var b=(4294901760&a)>>16,c=65535&a;try{return new Date(1980+((65024&b)>>9),((480&b)>>5)-1,31&b,(63488&c)>>11,(2016&c)>>5,2*(31&c),0)}catch(d){}}function y(a,b,c,d,e){return a.version=b.view.getUint16(c,!0),a.bitFlag=b.view.getUint16(c+2,!0),a.compressionMethod=b.view.getUint16(c+4,!0),a.lastModDateRaw=b.view.getUint32(c+6,!0),a.lastModDate=x(a.lastModDateRaw),1===(1&a.bitFlag)?void e(F):((d||8!=(8&a.bitFlag))&&(a.crc32=b.view.getUint32(c+10,!0),a.compressedSize=b.view.getUint32(c+14,!0),a.uncompressedSize=b.view.getUint32(c+18,!0)),4294967295===a.compressedSize||4294967295===a.uncompressedSize?void e(G):(a.filenameLength=b.view.getUint16(c+22,!0),void(a.extraFieldLength=b.view.getUint16(c+24,!0))))}function z(a,b){function c(){}function e(c,f){a.readUint8Array(a.size-c,c,function(a){var g=d(a.length,a).view;try{1347093766!=g.getUint32(0)?e(c+1,f):f(g)}catch(h){b(H)}},function(){b(H)})}return c.prototype.getData=function(c,e,f,g){function h(a,b){m&&m.terminate(),m=null,a&&a(b)}function i(a){var b=d(4);return b.view.setUint32(0,a),n.crc32==b.view.getUint32(0)}function j(a,b){g&&!i(b)?k():c.getData(function(a){h(e,a)})}function k(){h(b,K)}function l(){h(b,J)}var m,n=this;a.readUint8Array(n.offset,30,function(e){var h,i=d(e.length,e);return 1347093252!=i.view.getUint32(0)?void b(E):(y(n,i,4,!1,function(a){b(a)}),h=n.offset+30+n.filenameLength+n.extraFieldLength,void c.init(function(){0===n.compressionMethod?t(a,c,h,n.compressedSize,g,j,f,k,l):m=r(a,c,h,n.compressedSize,g,j,f,k,l)},l))},k)},{getEntries:function(f){return a.size<22?void b(E):void e(22,function(e){var g,h;g=e.getUint32(16,!0),h=e.getUint16(8,!0),a.readUint8Array(g,a.size-g,function(a){var e,g,i,j,k=0,l=[],m=d(a.length,a);for(e=0;h>e;e++){if(g=new c,1347092738!=m.view.getUint32(k))return void b(E);y(g,m,k+6,!0,function(a){b(a)}),g.commentLength=m.view.getUint16(k+32,!0),g.directory=16==(16&m.view.getUint8(k+38)),g.offset=m.view.getUint32(k+42,!0),i=w(m.array.subarray(k+46,k+46+g.filenameLength)),g.filename=2048===(2048&g.bitFlag)?v(i):u(i),g.directory||"/"!=g.filename.charAt(g.filename.length-1)||(g.directory=!0),j=w(m.array.subarray(k+46+g.filenameLength+g.extraFieldLength,k+46+g.filenameLength+g.extraFieldLength+g.commentLength)),g.comment=2048===(2048&g.bitFlag)?v(j):u(j),l.push(g),k+=46+g.filenameLength+g.extraFieldLength+g.commentLength}f(l)},function(){b(H)})})},close:function(a){a&&a()}}}function A(a){var b,c,d,e=[],f=0,g=0,h=a.length;for(b=0;h>b;b++)c=a.charCodeAt(b),d=null,128>c?g++:d=c>127&&2048>c?String.fromCharCode(c>>6|192)+String.fromCharCode(63&c|128):String.fromCharCode(c>>12|224)+String.fromCharCode(c>>6&63|128)+String.fromCharCode(63&c|128),null!=d&&(g>f&&(e+=a.slice(f,g)),e+=d,f=g=b+1);return g>f&&(e+=a.slice(f,h)),e}function B(a){var b,c=[];for(b=0;b<a.length;b++)c.push(a.charCodeAt(b));return c}function C(a,b,c){function e(a,b){h&&h.terminate(),h=null,a&&a(b)}function f(){e(b,I)}function g(){e(b,K)}var h,i=[],j=[],k=0;return{add:function(b,l,m,n,o){function p(e){var g;w=o.lastModDate||new Date,u=d(26),i[b]={headerArray:u.array,directory:o.directory,filename:v,offset:k,comment:B(A(o.comment||""))},u.view.setUint32(0,335546376),o.version&&u.view.setUint8(0,o.version),c||0==o.level||o.directory||u.view.setUint16(4,2048),u.view.setUint16(6,(w.getHours()<<6|w.getMinutes())<<5|w.getSeconds()/2,!0),u.view.setUint16(8,(w.getFullYear()-1980<<4|w.getMonth()+1)<<5|w.getDate(),!0),u.view.setUint16(22,v.length,!0),g=d(30+v.length),g.view.setUint32(0,1347093252),g.array.set(u.array,4),g.array.set(v,30),k+=g.array.length,a.writeUint8Array(g.array,e,f)}function q(b,c){var g=d(16);k+=b||0,g.view.setUint32(0,1347094280),"undefined"!=typeof c&&(u.view.setUint32(10,c,!0),g.view.setUint32(4,c,!0)),l&&(g.view.setUint32(8,b,!0),u.view.setUint32(14,b,!0),g.view.setUint32(12,l.size,!0),u.view.setUint32(18,l.size,!0)),a.writeUint8Array(g.array,function(){k+=16,e(m)},f)}function r(){if(o=o||{},b=b.trim(),o.directory&&"/"!=b.charAt(b.length-1)&&(b+="/"),i[b])throw L;v=B(A(b)),j.push(b),p(function(){l?c||0==o.level?t(l,a,0,l.size,!0,q,n,g,f):h=s(l,a,o.level,q,n,g,f):q()},f)}var u,v,w;l?l.init(r,g):r()},close:function(b){var c,g=0,h=0;j.forEach(function(a){var b=i[a];g+=46+b.filename.length+b.comment.length}),c=d(g+22),j.forEach(function(a){var b=i[a];c.view.setUint32(h,1347092738),c.view.setUint16(h+4,5120),c.array.set(b.headerArray,h+6),c.view.setUint16(h+32,b.comment.length,!0),b.directory&&c.view.setUint8(h+38,16),c.view.setUint32(h+42,b.offset,!0),c.array.set(b.filename,h+46),c.array.set(b.comment,h+46+b.filename.length),h+=46+b.filename.length+b.comment.length}),c.view.setUint32(h,1347093766),c.view.setUint16(h+8,j.length,!0),c.view.setUint16(h+10,j.length,!0),c.view.setUint32(h+12,g,!0),c.view.setUint32(h+16,k,!0),a.writeUint8Array(c.array,function(){e(function(){a.getData(b)})},f)}}}var D,E="File format is not recognized.",F="File contains encrypted entry.",G="File is using Zip64 (4gb+ file size).",H="Error while reading zip file.",I="Error while writing zip file.",J="Error while writing file data.",K="Error while reading file data.",L="File already exists.",M="HTTP Range not supported.",N=524288,O="inflate.js",P="deflate.js";try{D=0==new Blob([d(0).view]).size}catch(Q){}b.prototype.table=function(){var a,b,c,d=[];for(a=0;256>a;a++){for(c=a,b=0;8>b;b++)1&c?c=c>>>1^3988292384:c>>>=1;d[a]=c}return d}(),f.prototype=new e,f.prototype.constructor=f,g.prototype=new e,g.prototype.constructor=g,h.prototype=new e,h.prototype.constructor=h,i.prototype=new e,i.prototype.constructor=i,j.prototype=new e,j.prototype.constructor=j,k.prototype.getData=function(a){a(this.data)},l.prototype=new k,l.prototype.constructor=l,m.prototype=new k,m.prototype.constructor=m,n.prototype=new k,n.prototype.constructor=n,o.prototype=new k,o.prototype.constructor=o,a.zip={Reader:e,Writer:k,BlobReader:h,HttpReader:i,HttpRangeReader:j,Data64URIReader:g,TextReader:f,BlobWriter:o,FileWriter:n,Data64URIWriter:m,TextWriter:l,createReader:function(a,b,c){a.init(function(){b(z(a,c))},c)},createWriter:function(a,b,c,d){a.init(function(){b(C(a,c,d))},c)},workerScriptsPath:"",inflateJSPath:"",useWebWorkers:!0}}(this),!function(a,b){"use strict";var c,d,e=a,f=e.document,g=e.navigator,h=e.setTimeout,i=e.encodeURIComponent,j=e.ActiveXObject,k=e.Error,l=e.Number.parseInt||e.parseInt,m=e.Number.parseFloat||e.parseFloat,n=e.Number.isNaN||e.isNaN,o=e.Math.round,p=e.Date.now,q=e.Object.keys,r=e.Object.defineProperty,s=e.Object.prototype.hasOwnProperty,t=e.Array.prototype.slice,u=function(){var a=function(a){return a};if("function"==typeof e.wrap&&"function"==typeof e.unwrap)try{var b=f.createElement("div"),c=e.unwrap(b);1===b.nodeType&&c&&1===c.nodeType&&(a=e.unwrap)}catch(d){}return a}(),v=function(a){return t.call(a,0)},w=function(){var a,c,d,e,f,g,h=v(arguments),i=h[0]||{};for(a=1,c=h.length;c>a;a++)if(null!=(d=h[a]))for(e in d)s.call(d,e)&&(f=i[e],g=d[e],i!==g&&g!==b&&(i[e]=g));return i},x=function(a){var b,c,d,e;if("object"!=typeof a||null==a)b=a;else if("number"==typeof a.length)for(b=[],c=0,d=a.length;d>c;c++)s.call(a,c)&&(b[c]=x(a[c]));else{b={};for(e in a)s.call(a,e)&&(b[e]=x(a[e]))}return b},y=function(a,b){for(var c={},d=0,e=b.length;e>d;d++)b[d]in a&&(c[b[d]]=a[b[d]]);return c},z=function(a,b){var c={};for(var d in a)-1===b.indexOf(d)&&(c[d]=a[d]);return c},A=function(a){if(a)for(var b in a)s.call(a,b)&&delete a[b];return a},B=function(a,b){if(a&&1===a.nodeType&&a.ownerDocument&&b&&(1===b.nodeType&&b.ownerDocument&&b.ownerDocument===a.ownerDocument||9===b.nodeType&&!b.ownerDocument&&b===a.ownerDocument))do{if(a===b)return!0;a=a.parentNode}while(a);return!1},C=function(a){var b;return"string"==typeof a&&a&&(b=a.split("#")[0].split("?")[0],b=a.slice(0,a.lastIndexOf("/")+1)),b},D=function(a){var b,c;return"string"==typeof a&&a&&(c=a.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]?b=c[1]:(c=a.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]&&(b=c[1]))),b},E=function(){var a,b;try{throw new k}catch(c){b=c}return b&&(a=b.sourceURL||b.fileName||D(b.stack)),a},F=function(){var a,c,d;if(f.currentScript&&(a=f.currentScript.src))return a;if(c=f.getElementsByTagName("script"),1===c.length)return c[0].src||b;if("readyState"in c[0])for(d=c.length;d--;)if("interactive"===c[d].readyState&&(a=c[d].src))return a;return"loading"===f.readyState&&(a=c[c.length-1].src)?a:(a=E())?a:b},G=function(){var a,c,d,e=f.getElementsByTagName("script");for(a=e.length;a--;){if(!(d=e[a].src)){c=null;break}if(d=C(d),null==c)c=d;else if(c!==d){c=null;break}}return c||b},H=function(){var a=C(F())||G()||"";return a+"ZeroClipboard.swf"},I={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,deactivated:null,overdue:null,ready:null},J="11.0.0",K={},L={},M=null,N={ready:"Flash communication is established",error:{"flash-disabled":"Flash is disabled or not installed","flash-outdated":"Flash is too outdated to support ZeroClipboard","flash-unavailable":"Flash is unable to communicate bidirectionally with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate","flash-overdue":"Flash communication was established but NOT within the acceptable time limit"}},O={swfPath:H(),trustedDomains:a.location.host?[a.location.host]:[],cacheBust:!0,forceEnhancedClipboard:!1,flashLoadTimeout:3e4,autoActivate:!0,bubbleEvents:!0,containerId:"global-zeroclipboard-html-bridge",containerClass:"global-zeroclipboard-container",swfObjectId:"global-zeroclipboard-flash-bridge",hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",forceHandCursor:!1,title:null,zIndex:999999999},P=function(a){if("object"==typeof a&&null!==a)for(var b in a)if(s.call(a,b))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(b))O[b]=a[b];else if(null==I.bridge)if("containerId"===b||"swfObjectId"===b){if(!ca(a[b]))throw new Error("The specified `"+b+"` value is not valid as an HTML4 Element ID");O[b]=a[b]}else O[b]=a[b];return"string"==typeof a&&a?s.call(O,a)?O[a]:void 0:x(O)},Q=function(){return{browser:y(g,["userAgent","platform","appName"]),flash:z(I,["bridge"]),zeroclipboard:{version:Fa.version,config:Fa.config()}}},R=function(){return!!(I.disabled||I.outdated||I.unavailable||I.deactivated)},S=function(a,b){var c,d,e,f={};if("string"==typeof a&&a)e=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Fa.on(c,a[c]);if(e&&e.length){for(c=0,d=e.length;d>c;c++)a=e[c].replace(/^on/,""),f[a]=!0,K[a]||(K[a]=[]),K[a].push(b);if(f.ready&&I.ready&&Fa.emit({type:"ready"}),f.error){var g=["disabled","outdated","unavailable","deactivated","overdue"];for(c=0,d=g.length;d>c;c++)if(I[g[c]]===!0){Fa.emit({type:"error",name:"flash-"+g[c]});break}}}return Fa},T=function(a,b){var c,d,e,f,g;if(0===arguments.length)f=q(K);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Fa.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=K[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return Fa},U=function(a){var b;return b="string"==typeof a&&a?x(K[a])||null:x(K)},V=function(a){var b,c,d;return a=da(a),a&&!ja(a)?"ready"===a.type&&I.overdue===!0?Fa.emit({type:"error",name:"flash-overdue"}):(b=w({},a),ia.call(this,b),"copy"===a.type&&(d=pa(L),c=d.data,M=d.formatMap),c):void 0},W=function(){if("boolean"!=typeof I.ready&&(I.ready=!1),!Fa.isFlashUnusable()&&null===I.bridge){var a=O.flashLoadTimeout;"number"==typeof a&&a>=0&&h(function(){"boolean"!=typeof I.deactivated&&(I.deactivated=!0),I.deactivated===!0&&Fa.emit({type:"error",name:"flash-deactivated"})},a),I.overdue=!1,na()}},X=function(){Fa.clearData(),Fa.blur(),Fa.emit("destroy"),oa(),Fa.off()},Y=function(a,b){var c;if("object"==typeof a&&a&&"undefined"==typeof b)c=a,Fa.clearData();else{if("string"!=typeof a||!a)return;c={},c[a]=b}for(var d in c)"string"==typeof d&&d&&s.call(c,d)&&"string"==typeof c[d]&&c[d]&&(L[d]=c[d])},Z=function(a){"undefined"==typeof a?(A(L),M=null):"string"==typeof a&&s.call(L,a)&&delete L[a]},$=function(a){return"undefined"==typeof a?x(L):"string"==typeof a&&s.call(L,a)?L[a]:void 0},_=function(a){if(a&&1===a.nodeType){c&&(xa(c,O.activeClass),c!==a&&xa(c,O.hoverClass)),c=a,wa(a,O.hoverClass);var b=a.getAttribute("title")||O.title;if("string"==typeof b&&b){var d=ma(I.bridge);d&&d.setAttribute("title",b)}var e=O.forceHandCursor===!0||"pointer"===ya(a,"cursor");Ca(e),Ba()}},aa=function(){var a=ma(I.bridge);a&&(a.removeAttribute("title"),a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.top="1px"),c&&(xa(c,O.hoverClass),xa(c,O.activeClass),c=null)},ba=function(){return c||null},ca=function(a){return"string"==typeof a&&a&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(a)},da=function(a){var b;if("string"==typeof a&&a?(b=a,a={}):"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(b=a.type),b){!a.target&&/^(copy|aftercopy|_click)$/.test(b.toLowerCase())&&(a.target=d),w(a,{type:b.toLowerCase(),target:a.target||c||null,relatedTarget:a.relatedTarget||null,currentTarget:I&&I.bridge||null,timeStamp:a.timeStamp||p()||null});var e=N[a.type];return"error"===a.type&&a.name&&e&&(e=e[a.name]),e&&(a.message=e),"ready"===a.type&&w(a,{target:null,version:I.version}),"error"===a.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(a.name)&&w(a,{target:null,minimumVersion:J}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(a.name)&&w(a,{version:I.version})),"copy"===a.type&&(a.clipboardData={setData:Fa.setData,clearData:Fa.clearData}),"aftercopy"===a.type&&(a=qa(a,M)),a.target&&!a.relatedTarget&&(a.relatedTarget=ea(a.target)),a=fa(a)}},ea=function(a){var b=a&&a.getAttribute&&a.getAttribute("data-clipboard-target");return b?f.getElementById(b):null},fa=function(a){if(a&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)){var c=a.target,d="_mouseover"===a.type&&a.relatedTarget?a.relatedTarget:b,g="_mouseout"===a.type&&a.relatedTarget?a.relatedTarget:b,h=Aa(c),i=e.screenLeft||e.screenX||0,j=e.screenTop||e.screenY||0,k=f.body.scrollLeft+f.documentElement.scrollLeft,l=f.body.scrollTop+f.documentElement.scrollTop,m=h.left+("number"==typeof a._stageX?a._stageX:0),n=h.top+("number"==typeof a._stageY?a._stageY:0),o=m-k,p=n-l,q=i+o,r=j+p,s="number"==typeof a.movementX?a.movementX:0,t="number"==typeof a.movementY?a.movementY:0;delete a._stageX,delete a._stageY,w(a,{srcElement:c,fromElement:d,toElement:g,screenX:q,screenY:r,pageX:m,pageY:n,clientX:o,clientY:p,x:o,y:p,movementX:s,movementY:t,offsetX:0,offsetY:0,layerX:0,layerY:0})}return a},ga=function(a){var b=a&&"string"==typeof a.type&&a.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(b)},ha=function(a,b,c,d){d?h(function(){a.apply(b,c)},0):a.apply(b,c)},ia=function(a){if("object"==typeof a&&a&&a.type){var b=ga(a),c=K["*"]||[],d=K[a.type]||[],f=c.concat(d);if(f&&f.length){var g,h,i,j,k,l=this;for(g=0,h=f.length;h>g;g++)i=f[g],j=l,"string"==typeof i&&"function"==typeof e[i]&&(i=e[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=w({},a),ha(i,j,[k],b))}return this}},ja=function(a){var b=a.target||c||null,e="swf"===a._source;delete a._source;var f=["flash-disabled","flash-outdated","flash-unavailable","flash-deactivated","flash-overdue"];switch(a.type){case"error":-1!==f.indexOf(a.name)&&w(I,{disabled:"flash-disabled"===a.name,outdated:"flash-outdated"===a.name,unavailable:"flash-unavailable"===a.name,deactivated:"flash-deactivated"===a.name,overdue:"flash-overdue"===a.name,ready:!1});break;case"ready":var g=I.deactivated===!0;w(I,{disabled:!1,outdated:!1,unavailable:!1,deactivated:!1,overdue:g,ready:!g});break;case"beforecopy":d=b;break;case"copy":var h,i,j=a.relatedTarget;!L["text/html"]&&!L["text/plain"]&&j&&(i=j.value||j.outerHTML||j.innerHTML)&&(h=j.value||j.textContent||j.innerText)?(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",h),i!==h&&a.clipboardData.setData("text/html",i)):!L["text/plain"]&&a.target&&(h=a.target.getAttribute("data-clipboard-text"))&&(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",h));break;case"aftercopy":Fa.clearData(),b&&b!==va()&&b.focus&&b.focus();break;case"_mouseover":Fa.focus(b),O.bubbleEvents===!0&&e&&(b&&b!==a.relatedTarget&&!B(a.relatedTarget,b)&&ka(w({},a,{type:"mouseenter",bubbles:!1,cancelable:!1})),ka(w({},a,{type:"mouseover"})));break;case"_mouseout":Fa.blur(),O.bubbleEvents===!0&&e&&(b&&b!==a.relatedTarget&&!B(a.relatedTarget,b)&&ka(w({},a,{type:"mouseleave",bubbles:!1,cancelable:!1})),ka(w({},a,{type:"mouseout"})));break;case"_mousedown":wa(b,O.activeClass),O.bubbleEvents===!0&&e&&ka(w({},a,{type:a.type.slice(1)}));break;case"_mouseup":xa(b,O.activeClass),O.bubbleEvents===!0&&e&&ka(w({},a,{type:a.type.slice(1)}));break;case"_click":d=null,O.bubbleEvents===!0&&e&&ka(w({},a,{type:a.type.slice(1)}));break;case"_mousemove":O.bubbleEvents===!0&&e&&ka(w({},a,{type:a.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)?!0:void 0},ka=function(a){if(a&&"string"==typeof a.type&&a){var b,c=a.target||null,d=c&&c.ownerDocument||f,g={view:d.defaultView||e,canBubble:!0,cancelable:!0,detail:"click"===a.type?1:0,button:"number"==typeof a.which?a.which-1:"number"==typeof a.button?a.button:d.createEvent?0:1},h=w(g,a);c&&d.createEvent&&c.dispatchEvent&&(h=[h.type,h.canBubble,h.cancelable,h.view,h.detail,h.screenX,h.screenY,h.clientX,h.clientY,h.ctrlKey,h.altKey,h.shiftKey,h.metaKey,h.button,h.relatedTarget],b=d.createEvent("MouseEvents"),b.initMouseEvent&&(b.initMouseEvent.apply(b,h),b._source="js",c.dispatchEvent(b)))}},la=function(){var a=f.createElement("div");return a.id=O.containerId,a.className=O.containerClass,a.style.position="absolute",a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.height="1px",a.style.zIndex=""+Da(O.zIndex),a},ma=function(a){for(var b=a&&a.parentNode;b&&"OBJECT"===b.nodeName&&b.parentNode;)b=b.parentNode;return b||null},na=function(){var a,b=I.bridge,c=ma(b);if(!b){var d=ua(e.location.host,O),g="never"===d?"none":"all",h=sa(O),i=O.swfPath+ra(O.swfPath,O);c=la();var j=f.createElement("div");c.appendChild(j),f.body.appendChild(c);var k=f.createElement("div"),l="activex"===I.pluginType;k.innerHTML='<object id="'+O.swfObjectId+'" name="'+O.swfObjectId+'" width="100%" height="100%" '+(l?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+i+'"')+">"+(l?'<param name="movie" value="'+i+'"/>':"")+'<param name="allowScriptAccess" value="'+d+'"/><param name="allowNetworking" value="'+g+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+h+'"/></object>',b=k.firstChild,k=null,u(b).ZeroClipboard=Fa,c.replaceChild(b,j)}return b||(b=f[O.swfObjectId],b&&(a=b.length)&&(b=b[a-1]),!b&&c&&(b=c.firstChild)),I.bridge=b||null,b},oa=function(){var a=I.bridge;if(a){var b=ma(a);b&&("activex"===I.pluginType&&"readyState"in a?(a.style.display="none",function c(){if(4===a.readyState){for(var d in a)"function"==typeof a[d]&&(a[d]=null);a.parentNode&&a.parentNode.removeChild(a),b.parentNode&&b.parentNode.removeChild(b)}else h(c,10)}()):(a.parentNode&&a.parentNode.removeChild(a),b.parentNode&&b.parentNode.removeChild(b))),I.ready=null,I.bridge=null,I.deactivated=null}},pa=function(a){var b={},c={};if("object"==typeof a&&a){for(var d in a)if(d&&s.call(a,d)&&"string"==typeof a[d]&&a[d])switch(d.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":b.text=a[d],c.text=d;break;case"text/html":case"html":case"air:html":case"flash:html":b.html=a[d],c.html=d;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":b.rtf=a[d],c.rtf=d}return{data:b,formatMap:c}}},qa=function(a,b){if("object"!=typeof a||!a||"object"!=typeof b||!b)return a;var c={};for(var d in a)if(s.call(a,d)){if("success"!==d&&"data"!==d){c[d]=a[d];continue}c[d]={};var e=a[d];for(var f in e)f&&s.call(e,f)&&s.call(b,f)&&(c[d][b[f]]=e[f])}return c},ra=function(a,b){var c=null==b||b&&b.cacheBust===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+p():""},sa=function(a){var b,c,d,f,g="",h=[];if(a.trustedDomains&&("string"==typeof a.trustedDomains?f=[a.trustedDomains]:"object"==typeof a.trustedDomains&&"length"in a.trustedDomains&&(f=a.trustedDomains)),f&&f.length)for(b=0,c=f.length;c>b;b++)if(s.call(f,b)&&f[b]&&"string"==typeof f[b]){if(d=ta(f[b]),!d)continue;if("*"===d){h.length=0,h.push(d);break}h.push.apply(h,[d,"//"+d,e.location.protocol+"//"+d])}return h.length&&(g+="trustedOrigins="+i(h.join(","))),a.forceEnhancedClipboard===!0&&(g+=(g?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof a.swfObjectId&&a.swfObjectId&&(g+=(g?"&":"")+"swfObjectId="+i(a.swfObjectId)),g},ta=function(a){if(null==a||""===a)return null;if(a=a.replace(/^\s+|\s+$/g,""),""===a)return null;var b=a.indexOf("//");a=-1===b?a:a.slice(b+2);var c=a.indexOf("/");return a=-1===c?a:-1===b||0===c?null:a.slice(0,c),a&&".swf"===a.slice(-4).toLowerCase()?null:a||null},ua=function(){var a=function(a){var b,c,d,e=[];if("string"==typeof a&&(a=[a]),"object"!=typeof a||!a||"number"!=typeof a.length)return e;for(b=0,c=a.length;c>b;b++)if(s.call(a,b)&&(d=ta(a[b]))){if("*"===d){e.length=0,e.push("*");break}-1===e.indexOf(d)&&e.push(d)}return e};return function(b,c){var d=ta(c.swfPath);null===d&&(d=b);var e=a(c.trustedDomains),f=e.length;if(f>0){if(1===f&&"*"===e[0])return"always";if(-1!==e.indexOf(b))return 1===f&&b===d?"sameDomain":"always"}return"never"}}(),va=function(){try{return f.activeElement;
- }catch(a){return null}},wa=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)||a.classList.add(b),a;if(b&&"string"==typeof b){var c=(b||"").split(/\s+/);if(1===a.nodeType)if(a.className){for(var d=" "+a.className+" ",e=a.className,f=0,g=c.length;g>f;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}else a.className=b}return a},xa=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)&&a.classList.remove(b),a;if("string"==typeof b&&b){var c=b.split(/\s+/);if(1===a.nodeType&&a.className){for(var d=(" "+a.className+" ").replace(/[\n\t]/g," "),e=0,f=c.length;f>e;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}}return a},ya=function(a,b){var c=e.getComputedStyle(a,null).getPropertyValue(b);return"cursor"!==b||c&&"auto"!==c||"A"!==a.nodeName?c:"pointer"},za=function(){var a,b,c,d=1;return"function"==typeof f.body.getBoundingClientRect&&(a=f.body.getBoundingClientRect(),b=a.right-a.left,c=f.body.offsetWidth,d=o(b/c*100)/100),d},Aa=function(a){var b={left:0,top:0,width:0,height:0};if(a.getBoundingClientRect){var c,d,g,h=a.getBoundingClientRect();"pageXOffset"in e&&"pageYOffset"in e?(c=e.pageXOffset,d=e.pageYOffset):(g=za(),c=o(f.documentElement.scrollLeft/g),d=o(f.documentElement.scrollTop/g));var i=f.documentElement.clientLeft||0,j=f.documentElement.clientTop||0;b.left=h.left+c-i,b.top=h.top+d-j,b.width="width"in h?h.width:h.right-h.left,b.height="height"in h?h.height:h.bottom-h.top}return b},Ba=function(){var a;if(c&&(a=ma(I.bridge))){var b=Aa(c);w(a.style,{width:b.width+"px",height:b.height+"px",top:b.top+"px",left:b.left+"px",zIndex:""+Da(O.zIndex)})}},Ca=function(a){I.ready===!0&&(I.bridge&&"function"==typeof I.bridge.setHandCursor?I.bridge.setHandCursor(a):I.ready=!1)},Da=function(a){if(/^(?:auto|inherit)$/.test(a))return a;var b;return"number"!=typeof a||n(a)?"string"==typeof a&&(b=Da(l(a,10))):b=a,"number"==typeof b?b:"auto"},Ea=function(a){function b(a){var b=a.match(/[\d]+/g);return b.length=3,b.join(".")}function c(a){return!!a&&(a=a.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a)||"chrome.plugin"===a.slice(-13))}function d(a){a&&(i=!0,a.version&&(l=b(a.version)),!l&&a.description&&(l=b(a.description)),a.filename&&(k=c(a.filename)))}var e,f,h,i=!1,j=!1,k=!1,l="";if(g.plugins&&g.plugins.length)e=g.plugins["Shockwave Flash"],d(e),g.plugins["Shockwave Flash 2.0"]&&(i=!0,l="2.0.0.11");else if(g.mimeTypes&&g.mimeTypes.length)h=g.mimeTypes["application/x-shockwave-flash"],e=h&&h.enabledPlugin,d(e);else if("undefined"!=typeof a){j=!0;try{f=new a("ShockwaveFlash.ShockwaveFlash.7"),i=!0,l=b(f.GetVariable("$version"))}catch(n){try{f=new a("ShockwaveFlash.ShockwaveFlash.6"),i=!0,l="6.0.21"}catch(o){try{f=new a("ShockwaveFlash.ShockwaveFlash"),i=!0,l=b(f.GetVariable("$version"))}catch(p){j=!1}}}}I.disabled=i!==!0,I.outdated=l&&m(l)<m(J),I.version=l||"0.0.0",I.pluginType=k?"pepper":j?"activex":i?"netscape":"unknown"};Ea(j);var Fa=function(){return this instanceof Fa?void("function"==typeof Fa._createClient&&Fa._createClient.apply(this,v(arguments))):new Fa};r(Fa,"version",{value:"2.1.6",writable:!1,configurable:!0,enumerable:!0}),Fa.config=function(){return P.apply(this,v(arguments))},Fa.state=function(){return Q.apply(this,v(arguments))},Fa.isFlashUnusable=function(){return R.apply(this,v(arguments))},Fa.on=function(){return S.apply(this,v(arguments))},Fa.off=function(){return T.apply(this,v(arguments))},Fa.handlers=function(){return U.apply(this,v(arguments))},Fa.emit=function(){return V.apply(this,v(arguments))},Fa.create=function(){return W.apply(this,v(arguments))},Fa.destroy=function(){return X.apply(this,v(arguments))},Fa.setData=function(){return Y.apply(this,v(arguments))},Fa.clearData=function(){return Z.apply(this,v(arguments))},Fa.getData=function(){return $.apply(this,v(arguments))},Fa.focus=Fa.activate=function(){return _.apply(this,v(arguments))},Fa.blur=Fa.deactivate=function(){return aa.apply(this,v(arguments))},Fa.activeElement=function(){return ba.apply(this,v(arguments))};var Ga=0,Ha={},Ia=0,Ja={},Ka={};w(O,{autoActivate:!0});var La=function(a){var b=this;b.id=""+Ga++,Ha[b.id]={instance:b,elements:[],handlers:{}},a&&b.clip(a),Fa.on("*",function(a){return b.emit(a)}),Fa.on("destroy",function(){b.destroy()}),Fa.create()},Ma=function(a,b){var c,d,e,f={},g=Ha[this.id]&&Ha[this.id].handlers;if("string"==typeof a&&a)e=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.on(c,a[c]);if(e&&e.length){for(c=0,d=e.length;d>c;c++)a=e[c].replace(/^on/,""),f[a]=!0,g[a]||(g[a]=[]),g[a].push(b);if(f.ready&&I.ready&&this.emit({type:"ready",client:this}),f.error){var h=["disabled","outdated","unavailable","deactivated","overdue"];for(c=0,d=h.length;d>c;c++)if(I[h[c]]){this.emit({type:"error",name:"flash-"+h[c],client:this});break}}}return this},Na=function(a,b){var c,d,e,f,g,h=Ha[this.id]&&Ha[this.id].handlers;if(0===arguments.length)f=q(h);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=h[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return this},Oa=function(a){var b=null,c=Ha[this.id]&&Ha[this.id].handlers;return c&&(b="string"==typeof a&&a?c[a]?c[a].slice(0):[]:x(c)),b},Pa=function(a){if(Ua.call(this,a)){"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(a=w({},a));var b=w({},da(a),{client:this});Va.call(this,b)}return this},Qa=function(a){a=Wa(a);for(var b=0;b<a.length;b++)if(s.call(a,b)&&a[b]&&1===a[b].nodeType){a[b].zcClippingId?-1===Ja[a[b].zcClippingId].indexOf(this.id)&&Ja[a[b].zcClippingId].push(this.id):(a[b].zcClippingId="zcClippingId_"+Ia++,Ja[a[b].zcClippingId]=[this.id],O.autoActivate===!0&&Xa(a[b]));var c=Ha[this.id]&&Ha[this.id].elements;-1===c.indexOf(a[b])&&c.push(a[b])}return this},Ra=function(a){var b=Ha[this.id];if(!b)return this;var c,d=b.elements;a="undefined"==typeof a?d.slice(0):Wa(a);for(var e=a.length;e--;)if(s.call(a,e)&&a[e]&&1===a[e].nodeType){for(c=0;-1!==(c=d.indexOf(a[e],c));)d.splice(c,1);var f=Ja[a[e].zcClippingId];if(f){for(c=0;-1!==(c=f.indexOf(this.id,c));)f.splice(c,1);0===f.length&&(O.autoActivate===!0&&Ya(a[e]),delete a[e].zcClippingId)}}return this},Sa=function(){var a=Ha[this.id];return a&&a.elements?a.elements.slice(0):[]},Ta=function(){this.unclip(),this.off(),delete Ha[this.id]},Ua=function(a){if(!a||!a.type)return!1;if(a.client&&a.client!==this)return!1;var b=Ha[this.id]&&Ha[this.id].elements,c=!!b&&b.length>0,d=!a.target||c&&-1!==b.indexOf(a.target),e=a.relatedTarget&&c&&-1!==b.indexOf(a.relatedTarget),f=a.client&&a.client===this;return d||e||f?!0:!1},Va=function(a){if("object"==typeof a&&a&&a.type){var b=ga(a),c=Ha[this.id]&&Ha[this.id].handlers["*"]||[],d=Ha[this.id]&&Ha[this.id].handlers[a.type]||[],f=c.concat(d);if(f&&f.length){var g,h,i,j,k,l=this;for(g=0,h=f.length;h>g;g++)i=f[g],j=l,"string"==typeof i&&"function"==typeof e[i]&&(i=e[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=w({},a),ha(i,j,[k],b))}return this}},Wa=function(a){return"string"==typeof a&&(a=[]),"number"!=typeof a.length?[a]:a},Xa=function(a){if(a&&1===a.nodeType){var b=function(a){(a||(a=e.event))&&("js"!==a._source&&(a.stopImmediatePropagation(),a.preventDefault()),delete a._source)},c=function(c){(c||(c=e.event))&&(b(c),Fa.focus(a))};a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",b,!1),a.addEventListener("mouseenter",b,!1),a.addEventListener("mouseleave",b,!1),a.addEventListener("mousemove",b,!1),Ka[a.zcClippingId]={mouseover:c,mouseout:b,mouseenter:b,mouseleave:b,mousemove:b}}},Ya=function(a){if(a&&1===a.nodeType){var b=Ka[a.zcClippingId];if("object"==typeof b&&b){for(var c,d,e=["move","leave","enter","out","over"],f=0,g=e.length;g>f;f++)c="mouse"+e[f],d=b[c],"function"==typeof d&&a.removeEventListener(c,d,!1);delete Ka[a.zcClippingId]}}};Fa._createClient=function(){La.apply(this,v(arguments))},Fa.prototype.on=function(){return Ma.apply(this,v(arguments))},Fa.prototype.off=function(){return Na.apply(this,v(arguments))},Fa.prototype.handlers=function(){return Oa.apply(this,v(arguments))},Fa.prototype.emit=function(){return Pa.apply(this,v(arguments))},Fa.prototype.clip=function(){return Qa.apply(this,v(arguments))},Fa.prototype.unclip=function(){return Ra.apply(this,v(arguments))},Fa.prototype.elements=function(){return Sa.apply(this,v(arguments))},Fa.prototype.destroy=function(){return Ta.apply(this,v(arguments))},Fa.prototype.setText=function(a){return Fa.setData("text/plain",a),this},Fa.prototype.setHtml=function(a){return Fa.setData("text/html",a),this},Fa.prototype.setRichText=function(a){return Fa.setData("application/rtf",a),this},Fa.prototype.setData=function(){return Fa.setData.apply(this,v(arguments)),this},Fa.prototype.clearData=function(){return Fa.clearData.apply(this,v(arguments)),this},Fa.prototype.getData=function(){return Fa.getData.apply(this,v(arguments))},"function"==typeof define&&define.amd?define(function(){return Fa}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Fa:a.ZeroClipboard=Fa}(function(){return this||window}()),function(){function a(a){this.mode=j.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=0,c=this.data.length;c>b;b++){var d=[],e=this.data.charCodeAt(b);e>65536?(d[0]=240|(1835008&e)>>>18,d[1]=128|(258048&e)>>>12,d[2]=128|(4032&e)>>>6,d[3]=128|63&e):e>2048?(d[0]=224|(61440&e)>>>12,d[1]=128|(4032&e)>>>6,d[2]=128|63&e):e>128?(d[0]=192|(1984&e)>>>6,d[1]=128|63&e):d[0]=e,this.parsedData.push(d)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function c(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function d(a,b){this.totalCount=a,this.dataCount=b}function e(){this.buffer=[],this.length=0}function f(){return"undefined"!=typeof CanvasRenderingContext2D}function g(){var a=!1,b=navigator.userAgent;return/android/i.test(b)&&(a=!0,aMat=b.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(a=parseFloat(aMat[1]))),a}function h(a,b){for(var c=1,d=i(a),e=0,f=p.length;f>=e;e++){var g=0;switch(b){case k.L:g=p[e][0];break;case k.M:g=p[e][1];break;case k.Q:g=p[e][2];break;case k.H:g=p[e][3]}if(g>=d)break;c++}if(c>p.length)throw new Error("Too long data");return c}function i(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(a){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?this.modules[a+c][b+d]=!0:this.modules[a+c][b+d]=!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=m.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=a%2==0);for(var b=8;b<this.moduleCount-8;b++)null==this.modules[6][b]&&(this.modules[6][b]=b%2==0)},setupPositionAdjustPattern:function(){for(var a=m.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var f=-2;2>=f;f++)for(var g=-2;2>=g;g++)-2==f||2==f||-2==g||2==g||0==f&&0==g?this.modules[d+f][e+g]=!0:this.modules[d+f][e+g]=!1}},setupTypeNumber:function(a){for(var b=m.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(b>>c&1);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(b>>c&1);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=m.getBCHTypeInfo(c),e=0;15>e;e++){var f=!a&&1==(d>>e&1);6>e?this.modules[e][8]=f:8>e?this.modules[e+1][8]=f:this.modules[this.moduleCount-15+e][8]=f}for(var e=0;15>e;e++){var f=!a&&1==(d>>e&1);8>e?this.modules[8][this.moduleCount-e-1]=f:9>e?this.modules[8][15-e-1+1]=f:this.modules[8][15-e-1]=f}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,f=0,g=this.moduleCount-1;g>0;g-=2)for(6==g&&g--;;){for(var h=0;2>h;h++)if(null==this.modules[d][g-h]){var i=!1;f<a.length&&(i=1==(a[f]>>>e&1));var j=m.getMask(b,d,g-h);j&&(i=!i),this.modules[d][g-h]=i,e--,-1==e&&(f++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,f){for(var g=d.getRSBlocks(a,c),h=new e,i=0;i<f.length;i++){var j=f[i];h.put(j.mode,4),h.put(j.getLength(),m.getLengthInBits(j.mode,a)),j.write(h)}for(var k=0,i=0;i<g.length;i++)k+=g[i].dataCount;if(h.getLengthInBits()>8*k)throw new Error("code length overflow. ("+h.getLengthInBits()+">"+8*k+")");for(h.getLengthInBits()+4<=8*k&&h.put(0,4);h.getLengthInBits()%8!=0;)h.putBit(!1);for(;;){if(h.getLengthInBits()>=8*k)break;if(h.put(b.PAD0,8),h.getLengthInBits()>=8*k)break;h.put(b.PAD1,8)}return b.createBytes(h,g)},b.createBytes=function(a,b){for(var d=0,e=0,f=0,g=new Array(b.length),h=new Array(b.length),i=0;i<b.length;i++){var j=b[i].dataCount,k=b[i].totalCount-j;e=Math.max(e,j),f=Math.max(f,k),g[i]=new Array(j);for(var l=0;l<g[i].length;l++)g[i][l]=255&a.buffer[l+d];d+=j;var n=m.getErrorCorrectPolynomial(k),o=new c(g[i],n.getLength()-1),p=o.mod(n);h[i]=new Array(n.getLength()-1);for(var l=0;l<h[i].length;l++){var q=l+p.getLength()-h[i].length;h[i][l]=q>=0?p.get(q):0}}for(var r=0,l=0;l<b.length;l++)r+=b[l].totalCount;for(var s=new Array(r),t=0,l=0;e>l;l++)for(var i=0;i<b.length;i++)l<g[i].length&&(s[t++]=g[i][l]);for(var l=0;f>l;l++)for(var i=0;i<b.length;i++)l<h[i].length&&(s[t++]=h[i][l]);return s};for(var j={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},k={L:1,M:0,Q:3,H:2},l={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},m={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var b=a<<10;m.getBCHDigit(b)-m.getBCHDigit(m.G15)>=0;)b^=m.G15<<m.getBCHDigit(b)-m.getBCHDigit(m.G15);return(a<<10|b)^m.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;m.getBCHDigit(b)-m.getBCHDigit(m.G18)>=0;)b^=m.G18<<m.getBCHDigit(b)-m.getBCHDigit(m.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return m.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case l.PATTERN000:return(b+c)%2==0;case l.PATTERN001:return b%2==0;case l.PATTERN010:return c%3==0;case l.PATTERN011:return(b+c)%3==0;case l.PATTERN100:return(Math.floor(b/2)+Math.floor(c/3))%2==0;case l.PATTERN101:return b*c%2+b*c%3==0;case l.PATTERN110:return(b*c%2+b*c%3)%2==0;case l.PATTERN111:return(b*c%3+(b+c)%2)%2==0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new c([1],0),d=0;a>d;d++)b=b.multiply(new c([1,n.gexp(d)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case j.MODE_NUMBER:return 10;case j.MODE_ALPHA_NUM:return 9;case j.MODE_8BIT_BYTE:return 8;case j.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case j.MODE_NUMBER:return 12;case j.MODE_ALPHA_NUM:return 11;case j.MODE_8BIT_BYTE:return 16;case j.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case j.MODE_NUMBER:return 14;case j.MODE_ALPHA_NUM:return 13;case j.MODE_8BIT_BYTE:return 16;case j.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},n={glog:function(a){if(1>a)throw new Error("glog("+a+")");return n.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return n.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},o=0;8>o;o++)n.EXP_TABLE[o]=1<<o;for(var o=8;256>o;o++)n.EXP_TABLE[o]=n.EXP_TABLE[o-4]^n.EXP_TABLE[o-5]^n.EXP_TABLE[o-6]^n.EXP_TABLE[o-8];for(var o=0;255>o;o++)n.LOG_TABLE[n.EXP_TABLE[o]]=o;c.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var e=0;e<a.getLength();e++)b[d+e]^=n.gexp(n.glog(this.get(d))+n.glog(a.get(e)));return new c(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var b=n.glog(this.get(0))-n.glog(a.get(0)),d=new Array(this.getLength()),e=0;e<this.getLength();e++)d[e]=this.get(e);for(var e=0;e<a.getLength();e++)d[e]^=n.gexp(n.glog(a.get(e))+b);return new c(d,0).mod(a)}},d.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],d.getRSBlocks=function(a,b){var c=d.getRsBlockTable(a,b);if(void 0==c)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);for(var e=c.length/3,f=[],g=0;e>g;g++)for(var h=c[3*g+0],i=c[3*g+1],j=c[3*g+2],k=0;h>k;k++)f.push(new d(i,j));return f},d.getRsBlockTable=function(a,b){switch(b){case k.L:return d.RS_BLOCK_TABLE[4*(a-1)+0];case k.M:return d.RS_BLOCK_TABLE[4*(a-1)+1];case k.Q:return d.RS_BLOCK_TABLE[4*(a-1)+2];case k.H:return d.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},e.prototype={get:function(a){var b=Math.floor(a/8);return 1==(this.buffer[b]>>>7-a%8&1)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(a>>>b-c-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var p=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],q=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function b(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var c=this._htOption,d=this._el,e=a.getModuleCount();Math.floor(c.width/e),Math.floor(c.height/e);this.clear();var f=b("svg",{viewBox:"0 0 "+String(e)+" "+String(e),width:"100%",height:"100%",fill:c.colorLight});f.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),d.appendChild(f),f.appendChild(b("rect",{fill:c.colorDark,width:"1",height:"1",id:"template"}));for(var g=0;e>g;g++)for(var h=0;e>h;h++)if(a.isDark(g,h)){var i=b("use",{x:String(g),y:String(h)});i.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),f.appendChild(i)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),r="svg"===document.documentElement.tagName.toLowerCase(),s=r?q:f()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function b(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,void(d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==")}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var c=1/window.devicePixelRatio,d=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,b,e,f,g,h,i,j,k){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*c;else"undefined"==typeof j&&(arguments[1]*=c,arguments[2]*=c,arguments[3]*=c,arguments[4]*=c);d.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=g(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.alt="Scan me!",this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&b.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=['<table style="border:0;border-collapse:collapse;">'],h=0;d>h;h++){g.push("<tr>");for(var i=0;d>i;i++)g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+e+"px;height:"+f+"px;background-color:"+(a.isDark(h,i)?b.colorDark:b.colorLight)+';"></td>');g.push("</tr>")}g.push("</table>"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();window.QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:k.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=g(),this._el=a,this._oQRCode=null,this._oDrawing=new s(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(h(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=k}();var jhtmls="undefined"==typeof exports?jhtmls||{}:exports;void function(a){"use strict";function b(a){return String(a).replace(/["<>& ]/g,function(a){return"&"+e[a]+";"})}function c(a){var b=[];return b.push("with(this){"),b.push(a.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,function(a){return['!#{unescape("',escape(a),'")}'].join("")}).replace(/[\r\n]+/g,"\n").replace(/^\n+|\s+$/gm,"").replace(/^([ \w\t_$]*([^&\^?|\n\w\/'"{}\[\]+\-():; \t=\.$_]|:\/\/).*$|^(?!\s*(else|do|try|finally|void|typeof\s[\w$_]*)\s*$)[^'":;{}()\n|=&\/^?]+$)\s?/gm,function(a){return a=a.replace(/&none;/g,"").replace(/["'\\]/g,"\\$&").replace(/\n/g,"\\n").replace(/(!?#)\{(.*?)\}|(!?\$)([a-z_]+\w*(?:\.[a-z_]+\w*)*)/g,function(a,b,c,d,e){if(d&&(b=d,c=e),!c)return"";c=c.replace(/\\n/g,"\n").replace(/\\([\\'"])/g,"$1");var f=/^[a-z$][\w+$]+$/i.test(c)&&!/^(true|false|NaN|null|this)$/.test(c);return["',",f?["typeof ",c,"==='undefined'?'':"].join(""):"","#"===b||"$"===b?"_encode_":"","(",c,"),'"].join("")}),a=["'",a,"'"].join("").replace(/^'',|,''$/g,""),a?["_output_.push(",a,");"].join(""):""})),b.push("}"),new Function("_output_","_encode_","helper","jhtmls",b.join(""))}function d(d,e,f){"function"==typeof d&&(d=String(d).replace(/^[^\{]*\{\s*\/\*!?[ \f\t\v]*\n?|[ \f\t\v]*\*\/[;|\s]*\}$/g,""));var g=c(d),h=function(c,d){d=d||a;var e=[];return g.call(c,e,b,d,a),e.join("")};return arguments.length<=1?h:h(e,f)}var e={'"':"quot","<":"lt",">":"gt","&":"amp"," ":"nbsp"};a.render=d}(jhtmls),function(){function use(a){_p.r([moduleMapping[a]])}var _p={r:function(a){if(_p[a].inited)return _p[a].value;if("function"!=typeof _p[a].value)return _p[a].inited=!0,_p[a].value;var b={exports:{}},c=_p[a].value(null,b.exports,b);if(_p[a].inited=!0,_p[a].value=c,void 0!==c)return c;for(var d in b.exports)if(b.exports.hasOwnProperty(d))return _p[a].inited=!0,_p[a].value=b.exports,b.exports}};_p[0]={value:function(a){function b(a){var b=e[a.clazz];return b?new b(a):null}var c={},d=_p.r(4),e=_p.r(11);return d.extend(c,{parse:function(a){var c=[];return d.isArray(a)?(d.each(a,function(a,d){c.push(b(d))}),c):b(a)}}),c}},_p[1]={value:function(a){var b=_p.r(11);b.___register({ALLOW_FOCUS:!0}),b.___register({Widget:_p.r(60),Icon:_p.r(42),Label:_p.r(48),Button:_p.r(37),ToggleButton:_p.r(59),Buttonset:_p.r(36),Separator:_p.r(56),Item:_p.r(46),Input:_p.r(45),InputButton:_p.r(43),Mask:_p.r(49),ColorPicker:_p.r(38),Tabs:_p.r(58),SpinButton:_p.r(57),
- Container:_p.r(39),Panel:_p.r(51),PPanel:_p.r(54),LabelPanel:_p.r(47),Menu:_p.r(50),InputMenu:_p.r(44),ButtonMenu:_p.r(34),DropPanel:_p.r(41),Popup:_p.r(53),PopupMenu:_p.r(52),SelectMenu:_p.r(55),Dialog:_p.r(40),Utils:_p.r(13),Creator:_p.r(0)}),b.__export()}},_p[2]={value:function(a){var b=_p.r(11);b.___register({TablePicker:_p.r(17)})}},_p[3]={value:function(){return jhtmls}},_p[4]={value:function(a){return window.jQuery}},_p[5]={value:function(require,exports){function Class(){}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})||0");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}Function.prototype.bind=Function.prototype.bind||function(a){var b=Array.prototype.slice.call(arguments,1);return this.apply(a,b)},Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;Class.prototype._accessProperty=function(){return this._propertyRawData||(this._propertyRawData={})},exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,d=extend(d,b)},exports.extendClass=extend}},_p[6]={value:function(a){var b=_p.r(4),c="__fui__marker__"+ +new Date;return{isElement:function(a){return 1===a.nodeType},getMarker:function(){return c},getRect:function(a){var b=a.getBoundingClientRect();return{width:b.width,height:b.height,top:b.top,bottom:b.bottom,left:b.left,right:b.right}},getBound:function(a){var c=0,d=0;return"body"===a.tagName.toLowerCase()?(d=b(this.getView(a)),c=d.width(),d=d.height(),{top:0,left:0,bottom:d,right:c,width:c,height:d}):this.getRect(a)},getView:function(a){return a.ownerDocument.defaultView||a.ownerDocument.parentWindow}}}},_p[7]={value:function(a){var b=_p.r(3),c=_p.r(4),d={forEach:function(a,b){c.each(a,function(a,c){b.call(null,a,c)})}};return{compile:function(a,e){return a=c.trim(a),0===a.length?"":b.render(a,e,d)}}}},_p[8]={value:function(a,b){function c(a){this.__options=d.extend({},f,a),this.__started=!1,this.__point={x:0,y:0},this.__location={x:0,y:0},this.__range={top:0,left:0,bottom:0,right:0}}var d=_p.r(4),e=_p.r(6),f={handler:null,target:null,axis:"all",range:null};return d.extend(c.prototype,{bind:function(a){if(a&&(this.__options.target=a),!this.__options.target)throw new Error("target unset");this.__target=this.__options.target,this.__handler=this.__options.handler,this.__rangeNode=this.__options.range,this.__initOptions(),this.__initEnv(),this.__initEvent()},__initEvent:function(){var a=this.__handler,b=this;d(a).on("mousedown",function(c){if(1===c.which){var d=e.getRect(a);c.preventDefault(),b.__started=!0,b.__point={x:c.clientX,y:c.clientY},b.__location={x:d.left,y:d.top},b.__range=b.__getRange()}}),d(a.ownerDocument).on("mousemove",function(a){if(b.__started){var c=a.clientX,d=a.clientY;b.__allowAxisX&&b.__xMove(c),b.__allowAxisY&&b.__yMove(d)}}).on("mouseup",function(a){b.__started=!1})},__xMove:function(a){var b=a-this.__point.x;b=this.__location.x+b,b<this.__range.left?b=this.__range.left:b>this.__range.right&&(b=this.__range.right),this.__target.style.left=b+"px"},__yMove:function(a){var b=a-this.__point.y;b=this.__location.y+b,b<this.__range.top?b=this.__range.top:b>this.__range.bottom&&(b=this.__range.bottom),this.__target.style.top=b+"px"},__initEnv:function(){var a=d(this.__handler);a.css("cursor","move")},__initOptions:function(){this.__handler||(this.__handler=this.__target),this.__rangeNode||(this.__rangeNode=this.__options.target.ownerDocument.body),this.__allowAxisX="y"!==this.__options.axis,this.__allowAxisY="x"!==this.__options.axis},__getRange:function(){var a=this.__rangeNode,b=e.getRect(this.__target);return"body"===a.tagName.toLowerCase()?(a=d(this.__rangeNode.ownerDocument),a={top:0,left:0,bottom:a.height(),right:a.width()}):a=e.getRect(a),{top:a.top,left:a.left,bottom:a.bottom-b.height,right:a.right-b.width}}}),function(a){return new c(a)}}},_p[9]={value:function(a){function b(a){var e=!1,f=!1,g=null;return 1===arguments.length?c(a):(d.each([].slice.call(arguments,1),function(c,h){for(var i in h)g=h[i],h.hasOwnProperty(i)&&(e=d.isPlainObject(g),f=d.isArray(g),e||f?e?(d.isPlainObject(a[i])||(a[i]={}),a[i]=b(a[i],g)):f&&(a[i]=b(g)):a[i]=h[i])}),a)}function c(a){var e=null;return d.isPlainObject(a)?b({},a):d.isArray(a)?(e=[],d.each(a,function(a,b){e.push(d.isPlainObject(b)||d.isArray(b)?c(b):b)}),e):a}var d=_p.r(4);return b}},_p[10]={value:function(a){return{isContainer:function(a){return"container"===a.__widgetType}}}},_p[11]={value:function(){var a={};return{widgets:a,__export:function(){window.FUI=this},___register:function(a,b){if("string"==typeof a)this[a]=b;else{b=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])}},__registerInstance:function(b){a[b.getId()]=b}}}},_p[12]={value:function(a){var b=_p.r(11);return{classPrefix:"fui-",layout:{TOP:"top",LEFT:"left",BOTTOM:"bottom",RIGHT:"right",CENTER:"center",MIDDLE:"middle",LEFT_TOP:"left-top",RIGHT_TOP:"right-top",LEFT_BOTTOM:"left-bottom",RIGHT_BOTTOM:"right-bottom"},allowFocus:!!b.ALLOW_FOCUS,control:{input:1,textarea:1,button:1,select:1,option:1,object:1,embed:1}}}},_p[13]={value:function(a){var b=_p.r(4),c={Tpl:_p.r(7),Widget:_p.r(10),createDraggable:_p.r(8)};return b.extend(c,_p.r(6),_p.r(5))}},_p[14]={value:function(){return'<div unselectable="on" class="fui-t-picker"></div>\n'}},_p[15]={value:function(){return'<div unselectable="on" class="fui-table-picker"></div>\n'}},_p[16]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(14);return _p.r(13).createClass("TPicker",{base:_p.r(60),constructor:function(a){var c={row:10,col:10};a=b.extend({},c,a),this.callBase(a)},__initOptions:function(){this.callBase(),this.widgetName="TPicker",this.__tpl=d,this.__backplane=null},__render:function(){this.callBase(),this.__backplane=this.__createBackplane(),this.__element.appendChild(this.__backplane)},__initEvent:function(){var a=this,c={};this.callBase(),b(this.__backplane).delegate("td","mousemove",function(b){c=b.target.getAttribute("data-index").split(","),c={row:parseInt(c[0],10),col:parseInt(c[1],10)},a.__update(c.row,c.col)}),b(this.__backplane).on("click",function(b){a.__select(c.row,c.col)})},__select:function(a,b){this.trigger("pickerselect",{row:a,col:b})},__update:function(a,b){for(var d=null,e=this.__options.row,f=this.__options.col,g=c.classPrefix+"table-picker-hoverin",h=0;e>h;h++){d=this.__backplane.rows[h];for(var i=0;f>i;i++)a>=h&&b>=i?d.cells[i].className=g:d.cells[i].className=""}this.trigger("pickerhover",{row:a,col:b})},__createBackplane:function(){for(var a=[],d=null,e=0,f=this.__options.row;f>e;e++){d=[];for(var g=0,h=this.__options.col;h>g;g++)d.push('<td data-index="'+e+","+g+'"></td>');a.push("<tr>"+d.join("")+"</tr>")}return a=b("<table><tbody>"+a.join("")+"</tbody></table>"),a.addClass(c.classPrefix+"t-picker-table"),a[0]}})}},_p[17]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(15),e=_p.r(48),f=_p.r(16),g=_p.r(37),h=_p.r(54),i=_p.r(49);return _p.r(13).createClass("TablePicker",{base:_p.r(60),constructor:function(a){var c={button:null,row:10,col:10};a=b.extend({},c,a),this.callBase(a)},open:function(){this.__panelWidget.show(),this.__maskWidget.show()},close:function(){this.__panelWidget.hide(),this.__maskWidget.hide()},appendTo:function(a){a.appendChild(this.__buttonWidget.getElement())},getButton:function(){return this.__buttonWidget},__initOptions:function(){this.callBase(),this.widgetName="TablePicker",this.__tpl=d,this.__pickerWidget=null,this.__labelWidget=null,this.__buttonWidget=null,this.__panelWidget=null,this.__maskWidget=null},__render:function(){this.callBase(),this.__pickerWidget=new f(this.__options),this.__labelWidget=new e({text:"插入表格"}),this.__buttonWidget=new g(this.__options.button),this.__panelWidget=new h({className:c.classPrefix+"table-picker-panel",column:!0,resize:"none"}),this.__maskWidget=new i,this.__panelWidget.appendWidget(this.__labelWidget),this.__panelWidget.appendWidget(this.__pickerWidget),this.__panelWidget.positionTo(this.__buttonWidget)},__initEvent:function(){var a=this;this.callBase(),this.__buttonWidget.on("btnclick",function(b){a.open()}),this.__maskWidget.on("maskclick",function(b){a.close()}),this.__pickerWidget.on("pickerhover",function(b,c){var d=c.row+1,e=c.col+1;a.__labelWidget.setText(d+"x"+e+" 表格")}).on("pickerselect",function(b,c){var d=c.row+1,e=c.col+1;a.close(),a.trigger("pickerselect",{row:d,col:e})})},__createBackplane:function(){for(var a=[],d=null,e=0,f=this.__options.row;f>e;e++){d=[];for(var g=0,h=this.__options.col;h>g;g++)d.push('<td data-index="'+e+","+g+'"></td>');a.push("<tr>"+d.join("")+"</tr>")}return a=b("<table><tbody>"+a.join("")+"</tbody></table>"),a.addClass(c.classPrefix+"t-picker-table"),a[0]}})}},_p[18]={value:function(){return'<div unselectable="on" class="fui-button-menu"></div>\n'}},_p[19]={value:function(){return'<div unselectable="on" class="fui-button"></div>\n'}},_p[20]={value:function(){return'<div unselectable="on" class="fui-colorpicker-container">\n<div unselectable="on" class="fui-colorpicker-toolbar">\n<div unselectable="on" class="fui-colorpicker-preview"></div>\n<div unselectable="on" class="fui-colorpicker-clear">$clearText</div>\n</div>\n<div unselectable="on" class="fui-colorpicker-title">$commonText</div>\n<div unselectable="on" class="fui-colorpicker-commoncolor">\nhelper.forEach( commonColor, function ( index, colors ) {\n<div unselectable="on" class="fui-colorpicker-colors fui-colorpicker-colors-line$index">\nhelper.forEach( colors, function( i, color ) {\n<span unselectable="on" class="fui-colorpicker-item" style="background-color: $color; border-color: #{color.toLowerCase() == \'#ffffff\' ? \'#eeeeee\': color};" data-color="$color"></span>\n});\n</div>\n} );\n</div>\n<div unselectable="on" class="fui-colorpicker-title">$standardText</div>\n<div unselectable="on" class="fui-colorpicker-standardcolor fui-colorpicker-colors">\nhelper.forEach( standardColor, function ( i, color ) {\n<span unselectable="on" class="fui-colorpicker-item" style="background-color: $color; border-color: $color;" data-color="$color"></span>\n} );\n</div>\n</div>\n'}},_p[21]={value:function(){return'<div unselectable="on" class="fui-dialog-wrap">\n<div unselectable="on" class="fui-dialog-head">\n<h1 unselectable="on" class="fui-dialog-caption">$caption</h1>\n</div>\n<div unselectable="on" class="fui-dialog-body"></div>\n<div unselectable="on" class="fui-dialog-foot"></div>\n</div>\n'}},_p[22]={value:function(){return"<div unselectable=\"on\" class=\"fui-drop-panel\" #{ text ? 'title=\"' + m.text + '\"' : '' }></div>\n"}},_p[23]={value:function(){return'<div unselectable="on" class="fui-icon" >\nif ( this.img ) {\n<img unselectable="on" src="#{this.img}" >\n}\n</div>\n'}},_p[24]={value:function(){return'<div unselectable="on" class="fui-input-button"></div>\n'}},_p[25]={value:function(){return'<div unselectable="on" class="fui-input-menu"></div>\n'}},_p[26]={value:function(){return'<input unselectable="on" class="fui-input" autocomplete="off" !#{ value ? \'value="\' + value + \'"\' : \'\'}>\n'}},_p[27]={value:function(){return"<div unselectable=\"on\" class=\"fui-item!#{ selected ? ' fui-item-selected': '' }\" ></div>\n"}},_p[28]={value:function(){return'<div unselectable="on" class="fui-label">$text</div>\n'}},_p[29]={value:function(){return'<div unselectable="on" class="fui-mask" style="background-color: $bgcolor; opacity: $opacity;"></div>\n'}},_p[30]={value:function(){return'<div unselectable="on" class="fui-panel"></div>\n'}},_p[31]={value:function(){return'<div unselectable="on" class="fui-separator"></div>\n'}},_p[32]={value:function(){return'<div unselectable="on" class="fui-spin-button"></div>\n'}},_p[33]={value:function(){return'<div unselectable="on" class="fui-tabs">\n<div unselectable="on" class="fui-tabs-button-wrap"></div>\n<div unselectable="on" class="fui-tabs-panel-wrap"></div>\n</div>\n'}},_p[34]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(18),e=_p.r(37),f=_p.r(50),g=_p.r(49),h=c.layout;return _p.r(13).createClass("ButtonMenu",{base:_p.r(60),constructor:function(a){var c={menu:null,mask:null,buttons:[],selected:-1,layout:h.RIGHT};a=b.extend({},c,a),this.callBase(a)},open:function(){this.__openState=!0,this.__maskWidget.show(),this.__menuWidget.show(),this.addClass(c.classPrefix+"button-active")},close:function(){this.__openState=!1,this.__maskWidget.hide(),this.__menuWidget.hide(),this.removeClass(c.classPrefix+"button-active")},isOpen:function(){return!!this.__openState},getSelected:function(){return this.__menuWidget.getSelected()},getSelectedItem:function(){return this.__menuWidget.getSelectedItem()},getValue:function(){return this.getSelectedItem().getValue()},__render:function(){this.callBase(),this.__initButtons(),this.__menuWidget=new f(this.__options.menu),this.__maskWidget=new g(this.__options.mask),this.__menuWidget.positionTo(this.__element),this.__menuWidget.appendTo(this.__element.ownerDocument.body)},__initOptions:function(){this.callBase(),this.widgetName="ButtonMenu",this.__tpl=d,this.__buttonWidgets=null,this.__menuWidget=null,this.__maskWidget=null,this.__openState=!1,-1!==this.__options.selected&&(this.__options.menu.selected=this.__options.selected)},__initButtons:function(){var a=[],d=this.__element,f=null,g=this.__options.buttons.length-1;this.__options.layout===h.TOP||this.__options.layout===h.LEFT?(f=new e(this.__options.buttons[g]),f.appendTo(d)):g=-1,b.each(this.__options.buttons,function(b,c){if(g!==b){var h=new e(c);h.appendTo(d),a.push(h)}else a.push(f)}),this.addClass(c.classPrefix+"layout-"+this.__options.layout),a[a.length-1].addClass(c.classPrefix+"open-btn"),this.__buttonWidgets=a},__initEvent:function(){var a=this.__buttonWidgets[this.__buttonWidgets.length-1],c=this;this.callBase(),a.on("click",function(a){c.open()}),this.__maskWidget.on("maskclick",function(){c.close()}),this.__menuWidget.on("select",function(a,b){a.stopPropagation(),c.close(),c.trigger("select",b)}).on("change",function(a,b){c.trigger("change",b)}),this.on("btnclick",function(a){a.stopPropagation();var c=b.inArray(a.widget,this.__buttonWidgets);c>-1&&c<this.__buttonWidgets.length-1&&this.trigger("buttonclick",{button:this.__buttonWidgets[c]})})}})}},_p[35]={value:function(a){var b=_p.r(4),c=_p.r(25),d=_p.r(43),e=_p.r(50),f=_p.r(49),g=_p.r(13);return _p.r(13).createClass("InputMenu",{base:_p.r(60),constructor:function(a){var b=g.getMarker();this.callBase(b);var d={input:null,menu:null,mask:null};this.__extendOptions(d,a),this.widgetName="InputMenu",this.__tpl=c,this.__lastTime=0,this.__lastSelect=null,this.__inputWidget=null,this.__menuWidget=null,this.__maskWidget=null,this.__menuState=!1,a!==b&&this.__render()},select:function(a){this.__menuWidget.select(a)},setValue:function(a){return this.__inputWidget.setValue(a),this},getValue:function(){return this.__inputWidget.getValue()},__render:function(){return this.__rendered?this:(this.__inputWidget=new d(this.__options.input),this.__menuWidget=new e(this.__options.menu),this.__maskWidget=new f(this.__options.mask),this.callBase(),this.__inputWidget.appendTo(this.__element),this.__menuWidget.positionTo(this.__inputWidget),void this.__initInputMenuEvent())},open:function(){this.__maskWidget.show(),this.__menuWidget.show()},close:function(){this.__maskWidget.hide(),this.__menuWidget.hide()},__initInputMenuEvent:function(){var a=this;this.on("buttonclick",function(){this.__menuState||(this.__appendMenu(),this.__menuState=!0),this.__inputWidget.unfocus(),this.open()}),this.on("keypress",function(a){this.__lastTime=new Date}),this.on("keyup",function(a){8!==a.keyCode&&13!==a.keyCode&&new Date-this.__lastTime<500&&this.__update()}),this.on("inputcomplete",function(){this.__inputWidget.selectRange(99999999),this.__inputComplete()}),this.__menuWidget.on("select",function(b,c){b.stopPropagation(),a.setValue(c.value),a.trigger("select",c),a.close()}),this.__menuWidget.on("change",function(b,c){b.stopPropagation(),a.trigger("change",c)}),this.__inputWidget.on("select change",function(a){a.stopPropagation()}),this.__maskWidget.on("maskclick",function(){a.close()}),this.on("select",function(a,b){this.__lastSelect=b})},__update:function(){var a=this.getValue(),c=a.toLowerCase(),d=this.__getItemValues(),e=null;a&&(b.each(d,function(a,b){return 0===b.toLowerCase().indexOf(c)?(e=b,!1):void 0}),e&&(this.__inputWidget.setValue(e),this.__inputWidget.selectRange(a.length)))},__getItemValues:function(){var a=[];return b.each(this.__menuWidget.getWidgets(),function(b,c){a.push(c.getValue())}),a},__inputComplete:function(){var a=this.__getItemValues(),c=-1,d=this.getValue(),e=this.__lastSelect;b.each(a,function(a,b){return b===d?(c=a,!1):void 0}),this.trigger("select",{index:c,value:d}),e&&e.value===d||this.trigger("change",{from:e||{index:-1,value:null},to:{index:c,value:d}})},__appendMenu:function(){this.__menuWidget.appendTo(this.__inputWidget.getElement().ownerDocument.body)}})}},_p[36]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(59);return _p.r(13).createClass("Buttonset",{base:_p.r(51),constructor:function(a){var c={selected:-1};a=b.extend({},c,a),this.callBase(a)},getButtons:function(){return this.getWidgets()},getButton:function(a){return this.getWidgets()[a]||null},getValue:function(){return this.__currentIndex>-1?this.__widgets[this.__currentIndex].getValue():null},getSelectedIndex:function(){return this.__currentIndex},appendButton:function(){return this.appendWidget.apply(this,arguments)},insertButton:function(){return this.insertWidget.apply(this,arguments)},select:function(a){return this.__options.disabled?this:(a instanceof d&&(a=b.inArray(a,this.__widgets)),0>a?this.clearSelect():(a=this.__widgets[a],this.__pressButton(a),this))},selectByValue:function(a){var b=this.__widgets.map(function(a){return a.getValue()});return this.select(b.indexOf(a))},clearSelect:function(){return this.__pressButton(null),this},removeButton:function(){return this.removeWidget.apply(this,arguments)},insertWidget:function(a,b){var c=this.callBase(a,b);return null===c?c:(a<=this.__currentIndex&&this.__currentIndex++,a<=this.__prevIndex&&this.__prevIndex++,c)},removeWidget:function(a){var b=a;return"number"!=typeof b&&(b=this.indexOf(a)),a=this.callBase(a),b===this.__currentIndex?this.__currentIndex=-1:b<this.__currentIndex&&this.__currentIndex--,b===this.__prevIndex?this.__prevIndex=-1:b<this.__prevIndex&&this.__prevIndex--,a},__initOptions:function(){this.callBase(),this.widgetName="Buttonset",this.__currentIndex=this.__options.selected,this.__prevIndex=-1},__render:function(){return this.callBase(),b(this.__element).addClass(c.classPrefix+"buttonset"),this.__initButtons(),this},__initButtons:function(){var a=this,c=null;b.each(this.__options.buttons,function(e,f){c=new d(b.extend({},f,{pressed:e===a.__options.selected,preventDefault:!0})),c.__on("click",function(b){a.isDisabled()||a.__pressButton(this)}),c.__on("change",function(a){a.stopPropagation()}),a.appendButton(c)})},__pressButton:function(a){this.__prevIndex=this.__currentIndex,this.__currentIndex=this.indexOf(a),this.__currentIndex!==this.__prevIndex&&(a&&a.press(),b.each(this.__widgets,function(b,c){c!==a&&c.bounce()}),this.trigger("change",{currentIndex:this.__currentIndex,prevIndex:this.__prevIndex}))},__valid:function(a){return a instanceof d}})}},_p[37]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(19),e=_p.r(42),f=_p.r(48);return _p.r(13).createClass("Button",{base:_p.r(60),constructor:function(a){var c={label:null,text:null,icon:null,layout:"right"};a=b.extend({},c,a),this.callBase(a)},getLabel:function(){return this.__labelWidget.getText()},setLabel:function(a){return this.__labelWidget.setText(a)},getLabelWidget:function(){return this.__labelWidget},getIconWidget:function(){return this.__iconWidget},__render:function(){switch(this.callBase(),this.__iconWidget=new e(this.__options.icon),this.__labelWidget=new f(this.__options.label),this.__options.layout){case"left":case"top":this.__element.appendChild(this.__labelWidget.getElement()),this.__element.appendChild(this.__iconWidget.getElement());break;case"right":case"bottom":default:this.__element.appendChild(this.__iconWidget.getElement()),this.__element.appendChild(this.__labelWidget.getElement())}b(this.__element).addClass(c.classPrefix+"button-layout-"+this.__options.layout)},__initOptions:function(){this.callBase(),this.widgetName="Button",this.__tpl=d,this.__iconWidget=null,this.__labelWidget=null,"object"!=typeof this.__options.label&&(this.__options.label={text:this.__options.label}),"object"!=typeof this.__options.icon&&(this.__options.icon={img:this.__options.icon})},__initEvent:function(){this.callBase(),this.on("click",function(){this.__trigger("btnclick")})}})}},_p[38]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(49),e=_p.r(20),f=_p.r(4);return b.createClass("ColorPicker",{base:_p.r(54),constructor:function(a){var b={clearText:"",commonText:"",commonColor:[["#ffffff","#000000","#eeece1","#1f497d","#4f81bd","#c0504d","#9bbb59","#8064a2","#4bacc6","#f79646"],["#f2f2f2","#808080","#ddd8c2","#c6d9f1","#dbe5f1","#f2dbdb","#eaf1dd","#e5dfec","#daeef3","#fde9d9"],["#d9d9d9","#595959","#c4bc96","#8db3e2","#b8cce4","#e5b8b7","#d6e3bc","#ccc0d9","#b6dde8","#fbd4b4"],["#bfbfbf","#404040","#938953","#548dd4","#95b3d7","#d99594","#c2d69b","#b2a1c7","#92cddc","#fabf8f"],["#a6a6a6","#262626","#4a442a","#17365d","#365f91","#943634","#76923c","#5f497a","#31849b","#e36c0a"],["#7f7f7f","#0d0d0d","#1c1a10","#0f243e","#243f60","#622423","#4e6128","#3f3151","#205867","#974706"]],standardText:"",standardColor:["#c00000","#ff0000","#ffc000","#ffff00","#92d050","#00b050","#00b0f0","#0070c0","#002060","#7030a0"]};a=f.extend({},b,a),this.callBase(a)},show:function(){return this.__inDoc||(this.__inDoc=!0,this.appendTo(this.__element.ownerDocument.body)),this.__maskWidget.show(),this.callBase(),this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this},attachTo:function(a){var b=this;a.on("click",function(){b.appendTo(a.getElement().ownerDocument.body),b.positionTo(a),b.show()})},__initOptions:function(){this.callBase(),this.widgetName="ColorPicker",this.__contentElement=null,this.__maskWidget=null,this.__inDoc=!1},__render:function(){this.callBase(),f(this.__element).addClass(c.classPrefix+"colorpicker");var a=b.Tpl.compile(e,this.__options);this.__contentElement.appendChild(f(a)[0]),this.__previewElement=f(this.__contentElement).find("."+c.classPrefix+"colorpicker-preview"),this.__clearElement=f(this.__contentElement).find("."+c.classPrefix+"colorpicker-clear"),this.__maskWidget=new d(this.__options.mask)},__initEvent:function(){var a=this;this.callBase(),this.on("click",function(b){var d,e=f(b.target);e.hasClass(c.classPrefix+"colorpicker-item")?(d=e.attr("data-color"),a.trigger("selectcolor",d),a.hide()):e.hasClass(c.classPrefix+"colorpicker-clear")&&(a.trigger("selectcolor",""),a.hide())}),this.on("mouseover",function(b){var d,e=f(b.target);e.hasClass(c.classPrefix+"colorpicker-item")&&(d=e.attr("data-color"),f(a.__element).find("."+c.classPrefix+"colorpicker-preview").css({"background-color":d,"border-color":d}))}),this.__maskWidget.on("click",function(){a.hide()})}})}},_p[39]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(60),e=_p.r(0),f=_p.r(4);return b.createClass("Container",{base:d,constructor:function(a){var b={column:!1,widgets:null};a=f.extend({},b,a),this.callBase(a)},indexOf:function(a){return f.inArray(a,this.__widgets)},disable:function(){this.callBase(),f.each(this.__widgets,function(a,b){b.disable()})},enable:function(){this.callBase(),f.each(this.__widgets,function(a,b){b.enable()})},getWidgets:function(){return this.__widgets},getWidget:function(a){return this.__widgets[a]||null},getWidgetByValue:function(a){var b=null;return f.each(this.__widgets,function(c,d){return d.getValue()===a?(b=d,!1):void 0}),b},appendWidget:function(a){return this.__valid(a)?(this.__options.disabled&&a.disable(),this.__widgets.push(a),a.appendTo(this.__contentElement),this.__options.column?(this.__widgets.length>0&&this.__widgets.length%this.__options.column===0&&this.__contentElement.appendChild(f('<span class="fui-column"></span>')[0]),f(a.getElement()).addClass(c.classPrefix+"panel-column-widget"),a):a):null},appendWidgets:function(a){var b=this,c=a;return f.isArray(a)||(c=arguments),f.each(c,function(a,c){b.appendWidget(c)}),this},insertWidget:function(a,b){var d=null;return 0===this.__widgets.length?this.appendWidget(b):this.__valid(b)?(this.__options.disabled&&b.disable(),d=this.__widgets[a],this.__widgets.splice(a,0,b),this.__contentElement.insertBefore(b.getElement(),d.getElement()),this.__options.column===!1?b:(this.__contentElement.insertBefore(f('<span class="fui-column"></span>')[0],d.getElement()),f(b.getElement()).addClass(c.classPrefix+"panel-column-widget"),b)):null},insertWidgets:function(a,b){var c=this,d=b;return f.isArray(b)||(d=[].slice.call(arguments,1)),f.each(d,function(b,d){c.insertWidget(a,d),a++}),this},getContentElement:function(){return this.__contentElement},removeWidget:function(a){return"number"==typeof a?a=this.__widgets.splice(a,1)[0]:this.__widgets.splice(this.indexOf(a),1),this.__contentElement.removeChild(a.getElement()),f(a.getElement()).removeClass(c.classPrefix+"panel-column-widget"),a},__initOptions:function(){this.widgetName="Container",this.__widgets=[],this.__contentElement=null,this.__options.column-=0},__render:function(){return this.callBase(),this.__contentElement=this.__element,f(this.__element).addClass(c.classPrefix+"container"),this.__options.column&&f(this.__element).addClass(c.classPrefix+"container-column"),this},__appendChild:function(a){return this.appendWidget(a)},__initWidgets:function(){if(this.__options.widgets){var a=e.parse(this.__options.widgets),b=this;f.isArray(a)||(a=[a]),f.each(a,function(a,c){b.appendWidget(c)})}},__valid:function(a){return a instanceof d}})}},_p[40]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(60),e=_p.r(49),f=_p.r(21),g=_p.r(37),h=c.layout,i=_p.r(4),j={CANCEL:"cancel",OK:"ok"};return b.createClass("Dialog",{base:_p.r(54),constructor:function(a){var b={layout:h.CENTER,caption:null,resize:"height",draggable:!0,closeButton:!0,mask:{color:"#000",opacity:.2},prompt:!1,buttons:[{className:c.classPrefix+"xdialog-ok-btn",action:"ok",label:"确定"},{className:c.classPrefix+"xdialog-cancel-btn",action:"cancel",label:"取消"}]};a=i.extend({},b,a),this.callBase(a)},open:function(){return this.__fire("open",function(){this.show()}),this},close:function(){return this.__fire("close",function(){this.hide()}),this},getButtons:function(){return this.__buttons},getButton:function(a){return this.__buttons[a]},appendTo:function(a){return this.callBase(a),this.__maskWidget.appendTo(a),this.__inDoc=!0,this},show:function(){return this.__target||(this.__target=this.__element.ownerDocument.body),this.__inDoc||this.appendTo(this.__element.ownerDocument.body),this.__maskWidget.show(),this.callBase(),this.__openState=!0,this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this.__openState=!1,this},toggle:function(){return this.isOpen()?this.close():this.open(),this},isOpen:function(){return this.__openState},getHeadElement:function(){return this.__headElement},getBodyElement:function(){return this.getContentElement()},getFootElement:function(){return this.__footElement},__initOptions:function(){this.callBase(),this.widgetName="Dialog",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__inDoc=!1,this.__hinting=!1,this.__openState=!1,this.__headElement=null,this.__bodyElement=null,this.__footElement=null,this.__maskWidget=null,this.__buttons=[],this.__target instanceof d&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),this.__innerTpl=b.Tpl.compile(f,this.__options),this.__contentElement.appendChild(i(this.__innerTpl)[0]),i(this.__element).addClass(c.classPrefix+"dialog"),this.__headElement=i(".fui-dialog-head",this.__contentElement)[0],this.__bodyElement=i(".fui-dialog-body",this.__contentElement)[0],this.__footElement=i(".fui-dialog-foot",this.__contentElement)[0],this.__maskWidget=new e(this.__options.mask),this.__contentElement=this.__bodyElement,this.__options.draggable&&this.__initDraggable(),this.__options.closeButton&&this.__initCloseButton(),this.__initButtons(),this.__initMaskLint()},__action:function(a,b){switch(a){case j.OK:this.__triggerHandler(a)!==!1&&this.close();break;case j.CANCEL:this.__triggerHandler(a),this.close()}},__initButtons:function(){var a=this,b=null,c=this.__footElement;i.each(this.__options.buttons,function(d,e){b=new g(e),b.appendTo(c),a.__buttons.push(b)})},__initEvent:function(){var a=this;this.callBase(),i([this.__footElement,this.__headElement]).on("btnclick",function(b,c){a.__action(c.getOptions().action,c)}),this.__options.prompt&&i(this.__element).on("keydown",function(b){switch(b.keyCode){case 13:a.__action(j.OK);break;case 27:a.__action(j.CANCEL)}})},__initDraggable:function(){b.createDraggable({handler:this.__headElement,target:this.__element}).bind()},__initCloseButton:function(){var a=new g({className:"fui-close-button",action:"cancel",icon:{className:"fui-close-button-icon"}});a.appendTo(this.__headElement)},__initMaskLint:function(){var a=this;this.__maskWidget.on("click",function(){a.__hint()})},__hint:function(){if(!this.__hinting){this.__hinting=!0;var a=i(this.__element),b=this,d=[c.classPrefix+"mask-hint",c.classPrefix+"mask-animate"];a.addClass(d.join(" ")),window.setTimeout(function(){
- a.removeClass(d[0]),window.setTimeout(function(){a.removeClass(d[1]),b.__hinting=!1},200)},200)}}})}},_p[41]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(22),e=_p.r(37),f=_p.r(51),g=_p.r(54),h=_p.r(49);return _p.r(13).createClass("DropPanel",{base:_p.r(60),constructor:function(a){var c={button:null,panel:null,width:null,height:null};a=b.extend({},c,a),this.callBase(a)},disable:function(){this.callBase()},enable:function(){this.callBase()},open:function(){this.__popupWidget.appendWidget(this.__panelWidget),this.__maskWidget.show(),this.__popupWidget.show();var a=b(this.__popupWidget.getElement());a.css("top",parseInt(a.css("top"))-b(this.__element).outerHeight()),a.css("min-width",b(this.__element).outerWidth()),a.css("min-height",b(this.__element).height())},close:function(){this.__maskWidget.hide(),this.__popupWidget.hide(),this.__panelWidget.appendTo(this.__contentElement)},getPanelElement:function(){return this.__panelWidget.getElement()},appendWidget:function(a){this.__panelWidget.appendWidget(a)},getWidgets:function(){return this.__panelWidget.getWidgets()},getWidget:function(a){return this.__panelWidget.getWidget(a)},appendWidgets:function(a){return this.__panelWidget.appendWidgets.apply(this,arguments),this},insertWidget:function(a,b){this.__panelWidget.insertWidget(a,b)},insertWidgets:function(a,b){return this.__panelWidget.insertWidgets.apply(this,arguments),this},removeWidget:function(a){return this.__panelWidget.removeWidget(a)},__render:function(){this.__initOptions(),this.__buttonWidget=new e(this.__options.button),this.__panelWidget=new f(this.__options.content),this.__popupWidget=new g,this.__maskWidget=new h(this.__options.mask),this.callBase(),this.__popupWidget.positionTo(this.__element),b(this.__popupWidget.getElement()).addClass(c.classPrefix+"drop-panel-popup");var a=b('<div class="'+c.classPrefix+'drop-panel-content"></div>').append(this.__panelWidget.getElement());this.__contentElement=a[0],b(this.__element).append(a).append(this.__buttonWidget.getElement()),this.__initDropPanelEvent()},__initOptions:function(){this.widgetName="DropPanel",this.__tpl=d,this.__buttonWidget=null,this.__popupWidget=null,this.__panelWidget=null,this.__contentElement=null,this.__maskWidget=null,this.__popupState=!1,"object"!=typeof this.__options.button&&(this.__options.input={icon:this.__options.button})},__initDropPanelEvent:function(){var a=this;this.__buttonWidget.on("click",function(){a.__popupState||(a.__appendPopup(),a.__popupState=!0),a.trigger("buttonclick"),a.open()}),this.__panelWidget.on("click",function(){a.trigger("panelclick")}),this.__maskWidget.on("maskclick",function(){a.close()})},__appendPopup:function(){this.__popupWidget.appendTo(this.__element.ownerDocument.body)}})}},_p[42]={value:function(a){var b=_p.r(4),c=_p.r(23);return _p.r(13).createClass("Icon",{base:_p.r(60),constructor:function(a){var c={img:null};a=b.extend({},c,a),this.callBase(a)},getValue:function(){return this.__options.value||this.__options.img},setImage:function(a){return this.__options.img===a?this:(this.__image&&(this.__image.src=a),void this.trigger("iconchange",{prevImage:this.__prevIcon,currentImage:this.__currentIcon}))},getImage:function(){return this.__currentIcon},__initOptions:function(){this.callBase(),this.widgetName="Icon",this.__tpl=c,this.__prevIcon=null,this.__currentIcon=this.__options.img,this.__image=null},__render:function(){this.__options.__width=this.__options.width,this.__options.__height=this.__options.height,this.__options.width=null,this.__options.height=null,this.callBase(),this.__options.img&&(this.__image=b("img",this.__element)[0],null!==this.__options.__width&&(this.__image.width=this.__options.__width),null!==this.__options.__height&&(this.__image.height=this.__options.__height))}})}},_p[43]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(24),e=_p.r(37),f=_p.r(45);return _p.r(13).createClass("InputButton",{base:_p.r(60),constructor:function(a){var c={button:null,input:null,placeholder:null,layout:"right"};a=b.extend({},c,a),this.callBase(a)},getValue:function(){return this.__inputWidget.getValue()},setValue:function(a){return this.__inputWidget.setValue(a),this},reset:function(){this.__inputWidget.reset()},selectAll:function(){return this.__inputWidget.selectAll(),this},selectRange:function(a,b){return this.__inputWidget.selectRange(a,b),this},focus:function(){return this.__inputWidget.focus(),this},unfocus:function(){return this.__inputWidget.unfocus(),this},__initOptions:function(){this.callBase(),this.widgetName="InputButton",this.__tpl=d,this.__inputWidget=null,this.__buttonWidget=null,"object"!=typeof this.__options.input&&(this.__options.input={placeholder:this.__options.input}),this.__options.input=b.extend({},this.__options.input,{placeholder:this.__options.placeholder}),"object"!=typeof this.__options.button&&(this.__options.button={icon:this.__options.button})},__render:function(){var a=this;switch(this.callBase(),this.__buttonWidget=new e(this.__options.button),this.__inputWidget=new f(this.__options.input),this.__options.layout){case"left":case"top":this.__buttonWidget.appendTo(this.__element),this.__inputWidget.appendTo(this.__element);break;case"right":case"bottom":default:this.__inputWidget.appendTo(this.__element),this.__buttonWidget.appendTo(this.__element)}b(this.__element).addClass(c.classPrefix+"layout-"+this.__options.layout),this.__buttonWidget.on("click",function(){a.trigger("buttonclick")})}})}},_p[44]={value:function(a){var b=_p.r(4),c=_p.r(25),d=_p.r(43),e=_p.r(50),f=_p.r(49);return _p.r(13).createClass("InputMenu",{base:_p.r(60),constructor:function(a){var c={input:null,menu:null,mask:null,selected:-1};a=b.extend({},c,a),this.callBase(a)},select:function(a){this.__menuWidget.select(a)},selectByValue:function(a){return this.__selectBy("values",a)},selectByLabel:function(a){return this.__selectBy("labels",a)},clearSelect:function(){return this.__lastSelect=-1,this.__menuWidget.clearSelect(),this.__inputWidget.reset(),this},setValue:function(a){return this},getValue:function(){return this.__menuWidget.getSelectedItem().getValue()},open:function(){this.__maskWidget.show(),this.__menuWidget.show()},close:function(){this.__maskWidget.hide(),this.__menuWidget.hide()},__render:function(){this.__inputWidget=new d(this.__options.input),this.__menuWidget=new e(this.__options.menu),this.__maskWidget=new f(this.__options.mask),this.callBase(),this.__inputWidget.appendTo(this.__element),this.__menuWidget.positionTo(this.__inputWidget),this.__initInputValue()},__selectBy:function(a,c){var d=this.__getItemValues()[a],e=-1;return b.each(d,function(a,b){return c===b?(e=a,!1):void 0}),-1!==e?(this.select(e),this.__menuWidget.getSelectedItem()):null},__initInputValue:function(){var a=this.__menuWidget.getItem(this.__options.selected);a&&this.__inputWidget.setValue(a.getLabel())},__initEvent:function(){var a=this;this.callBase(),this.on("buttonclick",function(){this.__menuState||(this.__appendMenu(),this.__menuState=!0),this.__inputWidget.unfocus(),this.open()}),this.on("keypress",function(a){this.__lastTime=new Date}),this.on("keyup",function(a){8!==a.keyCode&&13!==a.keyCode&&new Date-this.__lastTime<500&&this.__update()}),this.on("inputcomplete",function(){this.__inputWidget.selectRange(99999999),this.__inputComplete()}),this.__menuWidget.on("select",function(b,c){b.stopPropagation(),a.__inputWidget.setValue(c.label),a.trigger("select",c),a.close()}),this.__menuWidget.on("menuitemclick",function(b,c){a.trigger("itemclick",c)}),this.__menuWidget.on("change",function(b,c){b.stopPropagation(),a.trigger("change",c)}),this.__inputWidget.on("select change",function(a){a.stopPropagation()}),this.__maskWidget.on("maskclick",function(){a.close()}),this.on("select",function(a,b){this.__lastSelect=b})},__update:function(){var a=this.__inputWidget.getValue(),c=a.toLowerCase(),d=this.__getItemValues().labels,e=null;a&&(b.each(d,function(a,b){return 0===b.toLowerCase().indexOf(c)?(e=b,!1):void 0}),e&&(this.__inputWidget.setValue(e),this.__inputWidget.selectRange(a.length)))},__getItemValues:function(){var a=[],c=[];return b.each(this.__menuWidget.getWidgets(),function(b,d){c.push(d.getLabel()),a.push(d.getValue())}),{labels:c,values:a}},__inputComplete:function(){var a=this.__getItemValues(),c=a.labels,d=-1,e=this.__inputWidget.getValue(),f=this.__lastSelect;b.each(c,function(a,b){return b===e?(d=a,!1):void 0}),this.trigger("select",{index:d,label:e,value:a.values[d]}),f&&f.value===e||this.trigger("change",{from:f||{index:-1,label:null,value:null},to:{index:d,label:e,value:a.values[d]}})},__appendMenu:function(){this.__menuWidget.appendTo(this.__inputWidget.getElement().ownerDocument.body)},__initOptions:function(){this.callBase(),this.widgetName="InputMenu",this.__tpl=c,this.__lastTime=0,this.__lastSelect=null,this.__inputWidget=null,this.__menuWidget=null,this.__maskWidget=null,this.__menuState=!1,-1!==this.__options.selected&&(this.__options.menu.selected=this.__options.selected)}})}},_p[45]={value:function(a){var b=_p.r(12),c=_p.r(4),d=_p.r(26);return _p.r(13).createClass("Input",{base:_p.r(60),constructor:function(a){var b={placeholder:null};a=c.extend({},b,a),this.callBase(a)},getValue:function(){return this.__element.value},setValue:function(a){return this.__element.value=a,this},disable:function(){this.callBase(),this.__element.disabled=!0},enable:function(){this.__element.disabled=!1,this.callBase()},reset:function(){return this.__element.value=this.__options.value||"",this},selectAll:function(){this.__element.select()},selectRange:function(a,b){a||(a=0),b||(b=1e9),this.__element.setSelectionRange(a,b)},focus:function(){return this.__element.focus(),this},unfocus:function(){return this.__element.blur(),this},__initOptions:function(){this.callBase(),this.widgetName="Input",this.__tpl=d,this.__allow_focus=!0},__render:function(){this.callBase(),this.__element.removeAttribute("unselectable"),this.__options.placeholder&&this.__element.setAttribute("placeholder",this.__options.placeholder),this.addClass(b.classPrefix+"selectable")},__initEvent:function(){this.callBase(),this.on("keydown",function(a){13===a.keyCode&&this.trigger("inputcomplete",{value:this.getValue()})})}})}},_p[46]={value:function(a){var b=_p.r(13),c=_p.r(27),d=_p.r(42),e=_p.r(48),f=_p.r(12),g=_p.r(4);return b.createClass("Item",{base:_p.r(60),constructor:function(a){var b={label:"",icon:null,selected:!1,textAlign:"left"};a=g.extend({},b,a),this.callBase(a)},getValue:function(){return this.__options.value||this.__labelWidget.getValue()||this.__iconWidget.getValue()||null},select:function(){return this.__update(!0),this},unselect:function(){return this.__update(!1),this},isSelected:function(){return this.__selectState},setLabel:function(a){return this.__labelWidget.setText(a),this},getLabel:function(){return this.__labelWidget.getText()},setIcon:function(a){return this.__iconWidget.setImage(a),this},getIcon:function(){return this.__iconWidget.getImage()},__render:function(){this.callBase(),this.__iconWidget=new d(this.__options.icon),this.__labelWidget=new e(this.__options.label),this.__iconWidget.appendTo(this.__element),this.__labelWidget.appendTo(this.__element)},__update:function(a){var b=a?"addClass":"removeClass";return a=!!a,g(this.__element)[b](f.classPrefix+"item-selected"),this.__selectState=a,this.trigger(a?"itemselect":"itemunselect"),this},__initEvent:function(){this.callBase(),this.on("click",function(){this.trigger("itemclick")})},__initOptions:function(){this.callBase(),this.widgetName="Item",this.__tpl=c,this.__iconWidget=null,this.__labelWidget=null,this.__selectState=this.__options.selected,"object"!=typeof this.__options.label&&(this.__options.label={text:this.__options.label}),this.__options.label.textAlign||(this.__options.label.textAlign=this.__options.textAlign),"object"!=typeof this.__options.icon&&(this.__options.icon={img:this.__options.icon})}})}},_p[47]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(48),e=_p.r(4);return b.createClass("LabelPanel",{base:_p.r(51),constructor:function(a){var b={layout:"bottom"};a=e.extend({},b,a),this.callBase(a)},disable:function(){this.callBase(),this.__labelWidget.disable()},enable:function(){this.callBase(),this.__labelWidget.enable()},__render:function(){var a=null,b=this.__options,f=this.__element,g=c.classPrefix,h="fui-label-panel-content",i=null;return this.__labelWidget=new d(b.label),this.callBase(),i=this.__contentElement,e(f).addClass(g+"label-panel"),e(f).addClass(g+"layout-"+b.layout),a=e('<div class="'+h+'"></div>'),i.appendChild(this.__labelWidget.getElement()),i.appendChild(a[0]),this.__contentElement=a[0],this},__initOptions:function(){var a=this.__options.label;this.callBase(),this.widgetName="LabelPanel",this.__labelWidget=null,"object"!=typeof a&&(this.__options.label={text:a}),this.__options.label.className||(this.__options.label.className=""),this.__options.label.className+=" fui-label-panel-label"}})}},_p[48]={value:function(a){var b=_p.r(13),c=_p.r(28),d=_p.r(4);return b.createClass("Label",{base:_p.r(60),constructor:function(a){var b={text:"",textAlign:"center"};a=d.extend({},b,a),this.callBase(a)},getValue:function(){return this.__options.text},setText:function(a){var b=this.__options.text;return this.__options.text=a,d(this.__element).text(a),this.trigger("labelchange",{currentText:a,prevText:b}),this},getText:function(){return this.__options.text},__allowShowTitle:function(){return!1},__initOptions:function(){this.callBase(),this.widgetName="Label",this.__tpl=c,this.__options.text=this.__options.text.toString()}})}},_p[49]={value:function(a){function b(){f(window).on("resize",function(){f.each(h,function(a,b){b&&!b.isHide()&&b.__resize()})})}var c=_p.r(13),d=_p.r(29),e=_p.r(60),f=_p.r(4),g=!1,h=[];return c.createClass("Mask",{base:_p.r(60),constructor:function(a){var b={bgcolor:"#000",opacity:0,inner:!0,target:null,scroll:!1,hide:!0};a=f.extend({},b,a),this.callBase(a)},maskTo:function(a){return a&&(this.__target=a),this},show:function(){var a=null;this.__target||(this.__target=this.__element.ownerDocument.body),a=this.__target.ownerDocument.documentElement,f.contains(a,this.__element)||this.appendTo(this.__target.ownerDocument.body),this.callBase(),this.__position(),this.__resize(),this.__hideState=!1},hide:function(){this.callBase(),this.__hideState=!0},isHide:function(){return this.__hideState},__initOptions:function(){this.callBase(),this.widgetName="Mask",this.__tpl=d,this.__cacheId=h.length,this.__hideState=!0,h.push(this),this.__target=this.__options.target,this.__target instanceof e&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),this.__initMaskEvent(),g||(g=!0,b())},__initMaskEvent:function(){this.on("mousewheel",function(a){var b=a.originalEvent;a.preventDefault(),a.stopPropagation(),this.trigger("scroll",{delta:b.wheelDelta||b.deltaY||b.detail})}),this.on("click",function(a){a.stopPropagation(),a.target===this.__element&&this.trigger("maskclick")})},__resize:function(){var a=null;this.__targetIsBody()?(a=f(c.getView(this.__target)),a={width:a.width(),height:a.height()}):a=c.getRect(this.__target),this.__element.style.width=a.width+"px",this.__element.style.height=a.height+"px"},__position:function(){var a=null,b=null;this.__targetIsBody()?a={top:0,left:0}:(b=c.getRect(this.__target),a={top:b.top,left:b.left}),f(this.__element).css("top",a.top+"px").css("left",a.left+"px")},__targetIsBody:function(){return"body"===this.__target.tagName.toLowerCase()}})}},_p[50]={value:function(a){var b=_p.r(13),c=_p.r(46),d=_p.r(12),e=_p.r(4);return b.createClass("Menu",{base:_p.r(54),constructor:function(a){var b={column:!0,selected:-1,textAlign:"left",items:[]};a=e.extend({},b,a),this.callBase(a)},select:function(a){var b=this.__widgets[a];return b?(this.__selectItem(b),this):this},clearSelect:function(){var a=this.getSelectedItem();a&&a.unselect(),this.__currentSelect=-1,this.__prevSelect=-1},getItems:function(){return this.getWidgets.apply(this,arguments)},getItem:function(){return this.getWidget.apply(this,arguments)},appendItem:function(a){return this.appendWidget.apply(this,arguments)},insertItem:function(a){return this.insertWidget.apply(this,arguments)},removeItem:function(a){return this.removeWidget.apply(this,arguments)},clearItems:function(){for(;this.getItems().length;)this.removeItem(0);return this},getSelected:function(){return this.__currentSelect},getSelectedItem:function(){return this.getItem(this.__currentSelect)},insertWidget:function(a,b){var c=this.callBase(a,b);return null===c?c:(a<=this.__currentSelect&&this.__currentSelect++,a<=this.__prevSelect&&this.__prevSelect++,c)},removeWidget:function(a){var b=a;return"number"!=typeof b&&(b=this.indexOf(a)),a=this.callBase(a),b===this.__currentSelect?this.__currentSelect=-1:b<this.__currentSelect&&this.__currentSelect--,b===this.__prevSelect?this.__prevSelect=-1:b<this.__prevSelect&&this.__prevSelect--,a},__initOptions:function(){this.callBase(),this.__prevSelect=-1,this.__currentSelect=this.__options.selected,this.widgetName="Menu"},__render:function(){var a=this,b=this.__options.textAlign,f=this.__options.selected;this.callBase(),e(this.__element).addClass(d.classPrefix+"menu"),e.each(this.__options.items,function(d,e){"object"!=typeof e&&(e={label:e}),e.selected=d===f,e.textAlign=b,a.appendItem(new c(e))})},__initEvent:function(){this.callBase(),this.on("itemclick",function(a){this.__selectItem(a.widget,!0)})},__selectItem:function(a,b){var c=null;if(this.__currentSelect>-1&&this.__widgets[this.__currentSelect].unselect(),this.__prevSelect=this.__currentSelect,this.__currentSelect=this.indexOf(a),a.select(),c={index:this.__currentSelect,label:a.getLabel(),value:a.getValue()},b&&this.trigger("menuitemclick",c),this.trigger("select",c),this.__prevSelect!==this.__currentSelect){var d=this.__widgets[this.__prevSelect]||null;this.trigger("change",{from:{index:this.__prevSelect,label:d&&d.getLabel(),value:d&&d.getValue()},to:{index:this.__currentSelect,label:a.getLabel(),value:a.getValue()}})}},__valid:function(a){return a instanceof c}})}},_p[51]={value:function(a){var b=_p.r(13),c=_p.r(30),d=_p.r(4);return b.createClass("Panel",{base:_p.r(39),constructor:function(a){var b={};a=d.extend({},b,a),this.callBase(a)},__render:function(){var a=null;this.callBase(),a=d('<div class="fui-panel-content"></div>'),this.__contentElement.appendChild(a[0]),this.__contentElement=a[0]},__initOptions:function(){this.callBase(),this.widgetName="Panel",this.__tpl=c}})}},_p[52]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(4),e=_p.r(50);return b.createClass("PopupMenu",{base:_p.r(53),constructor:function(a){this.callBase(d.extend({menu:{}},a))},getMenuWidget:function(){return this.__menuWidget},__initOptions:function(){this.callBase(),this.widgetName="PopupMenu"},__render:function(){this.callBase(),this.__menuWidget=new e,this.appendWidget(this.__menuWidget),d(this.__element).addClass(c.classPrefix+"popup-menu")}})}},_p[53]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(60),e=_p.r(49),f=_p.r(4);return b.createClass("Popup",{base:_p.r(54),constructor:function(a){var b={mask:{}};a=f.extend({},b,a),this.callBase(a)},open:function(){return this.__fire("open",function(){this.show()}),this},close:function(){return this.__fire("close",function(){this.hide()}),this},show:function(){return this.__target||(this.__target=this.__element.ownerDocument.body),this.__inDoc||(this.__inDoc=!0,this.appendTo(this.__element.ownerDocument.body)),this.__maskWidget.show(),this.callBase(),this.__openState=!0,this},hide:function(){return this.callBase(),this.__maskWidget.hide(),this.__openState=!1,this},toggle:function(){return this.isOpen()?this.close():this.open(),this},isOpen:function(){return this.__openState},__initOptions:function(){this.callBase(),this.widgetName="Popup",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__inDoc=!1,this.__openState=!1,this.__maskWidget=null,this.__target instanceof d&&(this.__target=this.__target.getElement())},__render:function(){this.callBase(),f(this.__element).addClass(c.classPrefix+"popup"),this.__maskWidget=new e(this.__options.mask),this.__options.draggable&&this.__initDraggable(),this.__initMaskEvent()},__initMaskEvent:function(){var a=this;this.__maskWidget.on("click",function(){a.close()})}})}},_p[54]={value:function(a){var b=_p.r(13),c=_p.r(12),d=_p.r(60),e=c.layout,f=_p.r(4);return b.createClass("PPanel",{base:_p.r(51),constructor:function(a){var b={layout:e.BOTTOM,target:null,bound:null,diff:10,hide:!0,resize:"all",iframe:!1};a=f.extend({},b,a),this.callBase(a)},positionTo:function(a,b){return a instanceof d&&(a=a.getElement()),this.__target=a,b&&(this.__layout=b),this},show:function(){var a=null;return this.__target?(this.__options.bound||(this.__options.bound=this.__target.ownerDocument.body),a=this.__target.ownerDocument.documentElement,f.contains(a,this.__element)||this.__target.ownerDocument.body.appendChild(this.__element),f.contains(a,this.__target)&&(this.callBase(b.getMarker()),this.__position(),this.__resize()),this):this.callBase()},__initOptions:function(){this.callBase(),this.widgetName="PPanel",this.__target=this.__options.target,this.__layout=this.__options.layout,this.__height_resized=!1},__render:function(){this.callBase(),this.__options.iframe&&f('<iframe class="fui-ppanel-cover" frameborder="0"></iframe>').appendTo(this.__element),f(this.__element).addClass(c.classPrefix+"ppanel")},__position:function(){var a=null,b=c.classPrefix+"ppanel-position";f(this.__element).addClass(b),a=this.__getLocation(),f(this.__element).css("top",a.top+"px").css("left",a.left+"px")},__resize:function(){var a=b.getBound(this.__target);switch(this.__options.resize){case"all":this.__resizeWidth(a),this.__resizeHeight();break;case"width":this.__resizeWidth(a);break;case"height":this.__resizeHeight()}},__resizeWidth:function(a){if(this.__target){var b=f(this.__element),c=b.outerWidth(),d=b.outerHeight(),e=a.width-c-d;this.__element.style.minWidth=e+"px"}},__resizeHeight:function(){var a=null,c=null,d=0;c=b.getRect(this.__element),c.height=this.__element.scrollHeight,c.bottom=c.top+c.height,a=this.__getBoundRect(),d=c.bottom-a.bottom,d>0?(this.__height_resized=!0,d=c.height-d-this.__options.diff,f(this.__element).css("height",d+"px")):this.__height_resized&&(this.__element.style.height=null)},__getLocation:function(){var a=b.getBound(this.__target);switch(this.__layout){case e.CENTER:case e.MIDDLE:return this.__getCenterLayout(a);case e.LEFT:case e.RIGHT:case e.BOTTOM:case e.TOP:return this.__getOuterLayout(a);default:return this.__getInnerLayout(a)}return location},__getCenterLayout:function(a){var c={top:0,left:0},d=b.getRect(this.__element),e=0;return e=a.height-d.height,e>0&&(c.top=a.top+e/2),e=a.width-d.width,e>0&&(c.left=a.left+e/2),c},__getOuterLayout:function(a){var c={top:0,left:0},d=b.getRect(this.__element);switch(this.__layout){case e.TOP:c.left=a.left,c.top=a.top-d.height;break;case e.LEFT:c.top=a.top,c.left=a.left-d.width;break;case e.RIGHT:c.top=a.top,c.left=a.right;break;case e.BOTTOM:default:c.left=a.left,c.top=a.bottom}return c},__getInnerLayout:function(a){var c={top:0,left:0},d=a,f=b.getRect(this.__element);switch(this.__layout){case e.LEFT_TOP:c.top=d.top,c.left=d.left;break;case e.RIGHT_TOP:c.top=d.top,c.left=d.left+d.width-f.width;break;case e.LEFT_BOTTOM:c.top=d.top+d.height-f.height,c.left=d.left;break;case e.RIGHT_BOTTOM:c.top=d.top+d.height-f.height,c.left=d.left+d.width-f.width}return this.__correctionLocation(c)},__getBoundRect:function(){var a=-1,c=-1,d=null;return"body"===this.__options.bound.tagName.toLowerCase()?(d=b.getView(this.__options.bound),a=f(d).width(),c=f(d).height(),{top:0,left:0,right:a,bottom:c,width:a,height:c}):b.getRect(this.__options.bound)},__correctionLocation:function(a){var c=b.getRect(this.__element),d=b.getRect(this.__target),f=this.__getBoundRect();switch(this.__layout){case e.LEFT_TOP:case e.LEFT_BOTTOM:a.left+c.width>f.right&&(a.left+=d.width-c.width);break;case e.RIGHT_TOP:case e.RIGHT_BOTTOM:a.left<f.left&&(a.left=d.left)}return a}})}},_p[55]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(51),e=_p.r(54),f=_p.r(37),g=_p.r(0),h=_p.r(49);return _p.r(13).createClass("SelectMenu",{base:d,constructor:function(a){var c={bed:{className:"fui-select-menu-bed"},button:{className:"fui-select-menu-btn"},events:["btnclick"],selected:-1};a=b.extend({},c,a),this.callBase(a)},show:function(){this.__widgetMenu.show(),this.__mask.show()},hide:function(){this.__widgetMenu.hide(),this.__mask.hide()},getValue:function(){var a=this.__widgets[this.__selected];return a?a.getValue():null},getSelected:function(){return this.__widgets[this.__selected]},select:function(a){var b=this.__widgets[a],c="fui-select-menu-selected",d=this.__selected,e=this.__widgets[this.__selected],f=this.__bed.getElement();return b?(e&&e.removeClass(c),f.innerHTML="",f.appendChild(b.cloneElement()),b.addClass(c),this.__selected=a,this.trigger("select",{index:a,widget:b}),this.__selected!==d&&this.trigger("change",{from:{index:d,widget:e},to:{index:a,widget:b}}),this):this},selectByWidget:function(a){return this.select(this.indexOf(a))},selectByValue:function(a){var c=-1;return b.each(this.__widgets,function(b,d){return d.getValue()===a?(c=b,!1):void 0}),this.select(c)},__render:function(){this.__bed=new d(this.__options.bed),this.__dropBtn=new f(this.__options.button),this.__widgetMenu=new e({className:"fui-select-menu-container",layout:c.layout.LEFT_TOP,column:this.__column}),this.__mask=new h;var a=this.__initWidgets();this.callBase(),b(this.__element).addClass(c.classPrefix+"select-menu"),this.appendWidgets([this.__bed,this.__dropBtn,this.__mask,this.__widgetMenu]),this.__widgets=[],this.__oldContentElement=this.__contentElement,this.__contentElement=this.__widgetMenu,this.appendWidgets(a),this.__widgetMenu.positionTo(this.getElement()),b.isNumeric(this.__options.selected)?-1!=this.__options.selected&&this.select(this.__options.selected):this.__bed.appendWidget(g.parse(this.__options.selected))},__initWidgets:function(){var a=[];if(this.__options.widgets)return b.each(this.__options.widgets,function(b,c){a.push(g.parse(c))}),a},__initEvent:function(){this.callBase();var a=this;this.__dropBtn.on("btnclick",function(){a.show()}),this.__mask.on("click",function(){a.hide()}),this.__widgetMenu.on(this.__options.events.join(" "),function(b){var c=b.target;if(c!==a.__oldContentElement&&c!==a.getElement)return b.stopPropagation(),a.selectByWidget(b.widget),a.hide(),!1})},__initOptions:function(){this.callBase(),this.widgetName="SelectMenu",this.__bed=null,this.__dropBtn=null,this.__widgetMenu=null,this.__mask=null,this.__widgets=[],this.__selected=-1,this.__oldContentElement=null,this.__column=this.__options.column,delete this.__options.column}})}},_p[56]={value:function(a){var b=_p.r(13),c=_p.r(31),d=_p.r(4);return b.createClass("Separator",{base:_p.r(60),constructor:function(a){var b={width:1,height:"100%",bgcolor:"#e1e1e1"};a=d.extend({},b,a),this.callBase(a)},__initOptions:function(){this.callBase(),this.widgetName="Separator",this.__tpl=c}})}},_p[57]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(32),e=_p.r(37),f=_p.r(45),g=_p.r(51);return _p.r(13).createClass("SpinButton",{base:_p.r(60),constructor:function(a){var c={suffix:null,selected:-1,items:[]};a=b.extend({},c,a),this.callBase(a)},getValue:function(){return this.__options.items[this.__currentSelected]||null},setValue:function(a){},select:function(a){this.__update(a)},selectByValue:function(a){a+="",this.__update(b.inArray(a,this.__options.items))},__render:function(){this.callBase(),this.__buttons=[new e({className:c.classPrefix+"spin-up-btn"}),new e({className:c.classPrefix+"spin-down-btn"})],this.__inputWidget=new f,this.__panelWidget=new g({column:!0}),this.__inputWidget.appendTo(this.__element),this.__panelWidget.appendWidget(this.__buttons[0]),this.__panelWidget.appendWidget(this.__buttons[1]),this.__panelWidget.appendTo(this.__element),this.__initSelected(this.__options.selected)},__initEvent:function(){var a=this;this.callBase(),this.__buttons[0].on("btnclick",function(){a.__update(a.__currentSelected-1)}),this.__buttons[1].on("btnclick",function(){a.__update(a.__currentSelected+1)})},__initSelected:function(a){this.__update(a,!1)},__update:function(a,b){var c=-1,d=null,e=null;0>a||a>=this.__options.items.length||(c=this.__currentSelected,this.__currentSelected=a,e=this.__options.items[this.__currentSelected],d=e+" "+(this.__options.suffix||""),this.__inputWidget.setValue(d),b!==!1&&this.trigger("change",{from:this.__options.items[c]||null,to:e}))},__initOptions:function(){var a=this.__options.items;this.callBase(),this.widgetName="SpinButton",this.__tpl=d,this.__buttons=[],this.__panelWidget=null,this.__inputWidget=null,this.__currentSelected=-1,b.each(a,function(b,c){a[b]=c+""})}})}},_p[58]={value:function(a){var b=_p.r(4),c=_p.r(12),d=_p.r(33),e=_p.r(37),f=_p.r(51);return _p.r(13).createClass("Tabs",{base:_p.r(60),constructor:function(a){var c={selected:0,buttons:[],panels:[]};a=b.extend({},c,a),this.callBase(a)},getButtons:function(){return this.__btns},getButton:function(a){return this.getButtons()[a]||null},getButtonByValue:function(a){var c=null;return b.each(this.__btns,function(b,d){return d.getValue()===a?(c=d,!1):void 0}),c},getPanels:function(){return this.__panels},getPanel:function(a){return this.getPanels()[a]||null},getPanelByValue:function(a){var c=null;return b.each(this.__panels,function(b,d){return d.getValue()===a?(c=d,!1):void 0}),c},getSelectedIndex:function(){return this.__selected},getSelected:function(){var a=this.getSelectedIndex();return{button:this.getButton(a),panel:this.getPanel(a)}},appendTab:function(a){return a.panels=a.panels||[],this.__renderByOptions(a)},removeTab:function(a){if(0>a)return null;var b=this.__btns.splice(a,1),c=this.__panels.splice(a,1);return b.length?(b=b[0],c=c[0],b.remove(),c.remove(),{button:b,panel:c}):null},select:function(a){var b=null;return this.__selectItem(a)?(b=this.__getInfo(a),this.trigger("tabsselect",b),this.__prevSelected!==this.__selected&&this.trigger("tabschange",{from:this.__getInfo(this.__prevSelected),to:b}),this):this},getIndexByButton:function(a){return b.inArray(a,this.__btns)},appendButtonTo:function(a){b.each(this.__btns,function(b,c){c.appendTo(a)})},appendPanelTo:function(a){b.each(this.__panels,function(b,c){c.appendTo(a)})},__render:function(){this.callBase(),this.__btnWrap=b(".fui-tabs-button-wrap",this.__element)[0],this.__panelWrap=b(".fui-tabs-panel-wrap",this.__element)[0],this.__renderByOptions(this.__options),this.__selectItem(this.__options.selected)},__renderByOptions:function(a){var c=this,d=[],g=this.__btns,h=this.__panels,i=this.__btnWrap,j=this.__panelWrap;return b.each(a.buttons,function(b,k){var l=null,m=null;"object"!=typeof k&&(k={label:k}),l=new e(k),l.on("click",function(){c.select(c.getIndexByButton(this))}),k=a.panels[b]||{},k.hide=!0,m=new f(k),g.push(l),h.push(m),d.push({button:l,panel:m}),l.appendTo(i),m.appendTo(j)}),d},__initOptions:function(){this.callBase(),this.widgetName="Tabs",this.__tpl=d,this.__btns=[],this.__panels=[],this.__prevSelected=-1,this.__selected=-1,this.__btnWrap=null,this.__panelWrap=null,null===this.__options.panels&&(this.__options.panels=[],this.__options.panels.length=this.__options.buttons.length)},__selectItem:function(a){var b=this.getButton(a),d=this.getButton(this.__selected),e=c.classPrefix+"selected";return b?(d&&(d.removeClass(e),this.getPanel(this.__selected).hide()),b.addClass(e),this.getPanel(a).show(),this.__prevSelected=this.__selected,this.__selected=a,!0):!1},__getInfo:function(a){return{index:a,button:this.getButton(a),panel:this.getPanel(a)}}})}},_p[59]={value:function(a){var b=_p.r(4),c=_p.r(12);return _p.r(13).createClass("ToggleButton",{base:_p.r(37),constructor:function(a){var c={pressed:!1};a=b.extend({},c,a),this.callBase(a)},isPressed:function(){return this.__state},press:function(){var a=c.classPrefix+"button-pressed";b(this.__element).addClass(a),
- this.__updateState(!0)},bounce:function(){var a=c.classPrefix+"button-pressed";b(this.__element).removeClass(a),this.__updateState(!1)},toggle:function(){this.__state?this.bounce():this.press()},__initOptions:function(){this.callBase(),this.widgetName="ToggleButton",this.__state=!1},__render:function(){return this.callBase(),b(this.__element).addClass(c.classPrefix+"toggle-button"),this.__initButtonState(),this},__initButtonState:function(){this.__options.pressed&&(b(this.__element).addClass(c.classPrefix+"button-pressed"),this.__state=!0)},__initEvent:function(){this.callBase(),this.on("click",function(){this.toggle()})},__updateState:function(a){a=!!a,this.__state=a,this.trigger("change",a,!a)}})}},_p[60]={value:function(a){function b(){return c+ ++d}var c="_fui_",d=0,e=_p.r(12),f=_p.r(11),g=_p.r(4),h=_p.r(13),i=h.createClass("Widget",{constructor:function(a){var b={id:null,className:"",disabled:!1,preventDefault:!1,text:"",value:null,hide:!1,width:null,height:null};this.__widgetType="widget",this.__tpl="",this.__compiledTpl="",this.__options={},this.__element=null,this.__allow_focus=!!e.allowFocus,this.widgetName="Widget",this.__extendOptions(b,a),this.__initOptions(),this.__render(),this.__initEvent(),this.__initWidgets&&this.__initWidgets()},getId:function(){return this.id},getValue:function(){return this.__options.value},getOptions:function(){return this.__options},setValue:function(a){return this.__options.value=a,this},show:function(){return this.__show(),this},hide:function(){return this.__hide(),this},addClass:function(a){return g(this.__element).addClass(a),this},removeClass:function(a){return g(this.__element).removeClass(a),this},setStyle:function(){return g.fn.css.apply(g(this.__element),arguments),this},getStyle:function(){return g.fn.css.apply(g(this.__element),arguments)},isDisabled:function(){return this.__options.disabled},enable:function(){return this.__options.disabled=!1,g(this.__element).removeClass(e.classPrefix+"disabled"),this},disable:function(){return this.__options.disabled=!0,g(this.__element).addClass(e.classPrefix+"disabled"),this},cloneElement:function(){return this.__element.cloneNode(!0)},getElement:function(){return this.__element},appendTo:function(a){if(h.isElement(a))a.appendChild(this.__element);else{if(!(a instanceof i))throw new Error("TypeError: Widget.appendTo()");a.__appendChild(this)}return this},remove:function(){var a=this.__element.parentNode;return a&&a.removeChild(this.__element),this},off:function(a,b){return g(this.__element).off(b&&b.__fui_listener),this},on:function(a,b){return this.__options.preventDefault||this.__on(a,b),this},__initOptions:function(){},__render:function(){var a=null,b=this.__tpl,c=this.__options,d=null;return this.id=this.__id(),f.__registerInstance(this),this.__compiledTpl=h.Tpl.compile(b,c),this.__element=g(this.__compiledTpl)[0],this.__element.setAttribute("id",this.id),a=g(this.__element),c.disabled&&a.addClass(e.classPrefix+"disabled"),a.addClass(e.classPrefix+"widget"),d=c.className,d.length>0&&a.addClass(g.isArray(d)?d.join(" "):d),this.__initBasicEnv(),c.hide&&this.__hide(),c.style&&this.setStyle(c.style),this},__appendChild:function(a){return this.__element.appendChild(a.getElement())},__initEvent:function(){this.on("mousedown",function(a){var b=a.target.tagName.toLowerCase();e.control[b]||this.__allowFocus()?a.stopPropagation():a.preventDefault()})},__on:function(a,b){var c=this;return b.__fui_listener=function(a,d){for(var e=[],f=0,g=arguments.length;g>f;f++)1!==f&&e.push(arguments[f]);return a.widget=d,c.isDisabled()?void 0:b.apply(c,e)},g(this.__element).on(a,b.__fui_listener),this},trigger:function(a,b){return this.__options.preventDefault||this.__trigger.apply(this,arguments),this},__allowShowTitle:function(){return!0},__allowFocus:function(){return!!this.__allow_focus},__trigger:function(a,b){var c=[].slice.call(arguments,1);return g(this.__element).trigger(a,[this].concat(c)),this},__triggerHandler:function(a,b){var c=[this].concat([].slice.call(arguments,1));return g(this.__element).triggerHandler(a,c)},__fire:function(a,b){var c={cancel:!1};return/^(before|after)/.test(a)?this:(this.__trigger("before"+a,c),c.cancel===!0?this:(c=b.call(this,a),this.__trigger(a),this.__trigger("after"+a,c),this))},__extendOptions:function(){var a=[{},this.__options],b=[!0];a=a.concat([].slice.call(arguments,0));for(var c=0,d=a.length;d>c;c++)"string"!=typeof a[c]&&b.push(a[c]);this.__options=g.extend.apply(g,b)},__hide:function(){g(this.__element).addClass(e.classPrefix+"hide")},__show:function(){g(this.__element).removeClass(e.classPrefix+"hide")},__initBasicEnv:function(){this.__options.text&&this.__allowShowTitle()&&this.__element.setAttribute("title",this.__options.text),this.__options.width&&(this.__element.style.width=this.__options.width+"px"),this.__options.height&&(this.__element.style.height=this.__options.height+"px"),this.widgetName&&this.__element.setAttribute("rule",this.widgetName)},__id:function(){return this.__options.id||b()}});return i}},_p[61]={value:function(a){_p.r(1),_p.r(2)}};var moduleMapping={"fui.export":61};use("fui.export")}(),function(a){function b(a,b){a.prototype=Object.create(b.prototype),a.prototype.constructor=a}function c(){Error.apply(this,arguments)}function d(a){if(Error.call(this,a),"object"==typeof a)for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);else this.detail=a}function e(a,b){this.id=a,this.username=b}function f(a){this.content=a,a instanceof Blob?this.type=j.file.TYPE_BLOB:"string"==typeof a?this.type=j.file.TYPE_TEXT:"object"==typeof a?this.type=j.file.TYPE_JSON:this.type=j.file.TYPE_UNKNOWN}function g(a){this.setPath(a),this.isDir=!1,this.data=null,this.size=0,this.createTime=new Date,this.modifyTime=new Date}function h(a,b,c){this.user=a,this.file=b,this.access=c||0}function i(a,b,c){this.path=a,this.method=b,this.user=c,this.dupPolicy=j.file.DUP_FAIL,this.newPath=null,this.acl=null,this.extra=null,this.dataType=j.file.TYPE_TEXT}var j={version:"1.0"};j.provider={},j.file={},j.user={};var k={},l=null,m=function(){return new a.resolve(null)},n={check:m,login:m,logout:m,init:m,current:m};b(c,Error),b(d,Error),j.AuthError=c,j.FileRequestError=d,g.prototype.setPath=function(a){j.file.anlysisPath(a,this)},j.file.anlysisPath=function(a,b){b=b||{};for(var c=a.split("/");"/"==c[0]||""===c[0];)c.shift();for(;"/"==c[c.length-1]||""===c[c.length-1];)c.pop();if(b.filename=c.pop()||null,c.length?b.parentPath="/"+c.join("/")+"/":b.parentPath=b.filename?"/":null,b.filename){var d=b.filename.split(".");d.length>1?b.extension="."+d.pop():b.extension=null,b.name=d.join("."),b.path=b.parentPath+b.filename}else b.path="/";return b},j.user.User=e,j.file.Data=f,j.file.File=g,j.file.Acl=h,j.file.FileRequest=i,j.file.TYPE_TEXT="text",j.file.TYPE_JSON="json",j.file.TYPE_BLOB="blob",j.file.TYPE_UNKNOWN="unknown",j.file.METHOD_READ="read",j.file.METHOD_WRITE="write",j.file.METHOD_LIST="list",j.file.METHOD_MOVE="move",j.file.METHOD_DELETE="delete",j.file.METHOD_MKDIR="mkdir",j.file.METHOD_ACL_READ="readAcl",j.file.METHOD_ACL_WRITE="writeAcl",j.file.DUP_OVERWRITE="overwrite",j.file.DUP_FAIL="fail",j.file.DUP_RENAME="rename",j.file.ACCESS_PUBLIC=1,j.file.ACCESS_READ=2,j.file.ACCESS_WRITE=4,j.file.ACCESS_CREATE=8,j.file.ACCESS_DELETE=16,j.file.ACCESS_ACL_READ=32,j.file.ACCESS_ACL_WRITE=64,j.file.ACCESS_ALL=65534,j.provider.register=function(a,b){if(k[a]=b,l||(l=b),"function"!=typeof b.handle)throw new Error("Not implement: provider.handle()")},j.provider.use=function(a){l=k[a]},j.provider.init=function(a,b){var c=k[a];return c&&"function"==typeof c.init?c.init.call(c,b):null},j.user.impl=function(a){n=a},["check","login","logout","init","current"].forEach(function(a){j.user[a]=function(){return n[a].apply(n,arguments)}}),["read","write","list","move","delete","mkdir","readAcl","writeAcl"].forEach(function(b){j.file[b]=function(c){return j.user.check().then(function(d){var e=c.provider?k[c.provider]:l,f=new i(c.path,b,d);"read"==b&&(f.dataType=c.dataType||j.file.TYPE_TEXT),"write"==b&&(f.dupPolicy=c.ondup,f.data=new j.file.Data(c.content),delete c.ondup),"move"==b&&(f.dupPolicy=c.ondup,f.newPath=c.newPath,delete c.newPath),"writeAcl"==b&&(f.acl=c.acl,delete c.acl),delete c.provider,delete c.path,f.extra=c;var g=e.handle(f);return a.resolve(g)})}}),window.fio=j}(Promise),function(a,b){function c(a){m=a.apiKey||m}function d(a){return new Promise(function(c,d){b.ajax(a).done(c).fail(d)})}function e(){for(var a,b=p.current,c=/[&\?#](\w+?)=([^&]+)/g,d={};a=c.exec(b);)d[a[1]]=a[2];return d}function f(){var a=document.cookie,b=new RegExp(m+"_ak=(.*?)(;|$)"),c=b.exec(a);return c&&decodeURIComponent(c[1])||null}function g(a,b){var c=m+"_ak="+encodeURIComponent(a);c+="; max-age="+(b||60),document.cookie=c}function h(){document.cookie=m+"_ak="}function i(){return o}function j(){function a(){return new Promise(function(a,b){function c(){return clearTimeout(g),!e&&f.length&&(g=setTimeout(c,f.shift())),d({url:p.getLoggedInUser,data:{access_token:n},dataType:"jsonp"}).then(function(b){clearTimeout(g),e||a(b),e=!0})}var e=!1,f=[1e3,2e3,3e3],g=0;c()})}if(o&&+new Date-o.validateTime<36e5)return Promise.resolve(o);if(j.pendingRequest)return j.pendingRequest;var b=e();return b.access_token?(g(b.access_token,b.state),document.location.href=p.current.substr(0,document.location.href.indexOf("#")),j.pendingRequest=new Promise(function(){})):(n=f())?j.pendingRequest=a().then(function(a){return a.error_code?(n=null,h(),null):(o=new fio.user.User(a.uid,a.uname),o.smallImage="http://tb.himg.baidu.com/sys/portraitn/item/"+a.portrait,o.largeImage="http://tb.himg.baidu.com/sys/portrait/item/"+a.portrait,o.access_token=n,o.validateTime=+new Date,j.pendingRequest=null,o)}):Promise.resolve(null)}function k(b){return a.location.href=p.authorize+"?"+["client_id="+m,"response_type=token","scope=basic netdisk","redirect_uri="+(b.redirectUrl||p.current),"display=page","force_login="+(b&&b.force?1:0),"state="+(b.remember||60)].join("&"),new Promise(function(){})}function l(){var a=o;return o=null,n=null,h(),Promise.resolve(a)}var m,n,o,p={authorize:"https://openapi.baidu.com/oauth/2.0/authorize",getLoggedInUser:"https://openapi.baidu.com/rest/2.0/passport/users/getLoggedInUser",current:a.location.href};fio.user.impl({check:j,login:k,logout:l,init:c,current:i})}(window,jQuery),function(a,b){function c(a){return a.cache=!1,new Promise(function(c,d){b.ajax(a).done(c).fail(d)})}function d(a){return new Promise(function(b){setTimeout(function(){b()},a)})}function e(a){var b=new fio.file.File(a.path);return b.createTime=new Date(1e3*a.ctime),b.modifyTime=new Date(1e3*a.mtime),b.size=a.size,b.isDir=!!a.isdir,b.provider="netdisk",b}function f(a){function b(){return c({url:h.file,data:{method:"meta",access_token:e,path:a},dataType:"json"})["catch"](function(a){if(b.retry++>2)throw a;return new Promise(function(a){setTimeout(function(){a(b())},200*b.retry)})})}var d=fio.user.current(),e=d&&d.access_token;if(!e)throw new Error("Not Authorized");return b.retry=0,b()}function g(g){function i(){function b(b){if(a.console.warn("PCS Fail("+ ++p+"): ",{request:g,error:b}),o--)return d(1e3*p).then(i);throw b.requestMethod=g.method,b.requestPath=g.path,b.requestUser=g.user&&g.user.username||null,b.requestParam=l,g.dataType&&(b.requestDataType=g.dataType),b}function h(a){function b(a){return a.list[0]}if(a.error_code)throw new fio.FileRequestError(a);if(g.method===fio.file.METHOD_READ)return f(l.path).then(b).then(e).then(function(b){return b.data=new fio.file.Data(a),b});if(g.method==fio.file.METHOD_LIST)return a.list.map(e);if(g.method==fio.file.METHOD_MOVE)return new Promise(function(c){setTimeout(function(){c(f(a.extra.list[0].to).then(b).then(e))},200)});if(g.method==fio.file.METHOD_DELETE)return new fio.file.File(g.path);var c=e(a);return g.method===fio.file.METHOD_WRITE&&(c.data=g.data),c}function j(a){var c=a.responseText,d={readyState:a.readyState,status:a.status,statusText:a.statusText,headers:a.getAllResponseHeaders(),responseText:c};if(c)try{d.detail=JSON.parse(c)}catch(e){}return b(new fio.FileRequestError(d))}return c(m).then(h,j)}var j=fio.user.current(),k=j&&j.access_token;if(!k)throw new Error("Not Authorized");var l={},m={url:h.file,type:"GET",dataType:"JSON"};switch(g.method){case fio.file.METHOD_ACL_READ:case fio.file.METHOD_ACL_WRITE:throw new Error("Not Supported File Request:"+g.method);case fio.file.METHOD_READ:m.dataType=g.dataType,l.method="download";break;case fio.file.METHOD_WRITE:m.type="POST",l.method="upload",l.ondup=g.dupPolicy==fio.file.DUP_OVERWRITE?"overwrite":"newcopy";var n=new FormData;g.data.type==fio.file.TYPE_BLOB?n.append("file",g.data.content):n.append("file",new Blob([g.data.content],{type:"text/plain"})),m.data=n,m.processData=!1,m.contentType=!1;break;case fio.file.METHOD_LIST:l.method="list";break;case fio.file.METHOD_MKDIR:m.type="POST",l.method="mkdir";break;case fio.file.METHOD_MOVE:m.type="POST",l.method="move",l.to=g.newPath,g.dupPolicy==fio.file.DUP_RENAME&&(l.ondup="newcopy");break;case fio.file.METHOD_DELETE:m.type="POST",l.method="delete"}g.method==fio.file.METHOD_MOVE?l.from=g.path:l.path=g.path,m.url+="?"+b.param(l)+"&access_token="+k;var o=void 0===g.extra.retry?3:parseInt(g.extra.retry,10),p=0;return i()}var h={file:"https://pcs.baidu.com/rest/2.0/pcs/file"};fio.provider.register("netdisk",{handle:g})}(window,jQuery),function(){function a(a){this.tokens=[],this.tokens.links={},this.options=a||j.defaults,this.rules=k.normal,this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}function b(a,b){if(this.options=b||j.defaults,this.links=a,this.rules=l.normal,this.renderer=this.options.renderer||new c,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=l.breaks:this.rules=l.gfm:this.options.pedantic&&(this.rules=l.pedantic)}function c(a){this.options=a||{}}function d(a){this.tokens=[],this.token=null,this.options=a||j.defaults,this.options.renderer=this.options.renderer||new c,this.renderer=this.options.renderer,this.renderer.options=this.options}function e(a,b){return a.replace(b?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(a){return a.replace(/&([#\w]+);/g,function(a,b){return b=b.toLowerCase(),"colon"===b?":":"#"===b.charAt(0)?String.fromCharCode("x"===b.charAt(1)?parseInt(b.substring(2),16):+b.substring(1)):""})}function g(a,b){return a=a.source,b=b||"",function c(d,e){return d?(e=e.source||e,e=e.replace(/(^|[^\[])\^/g,"$1"),a=a.replace(d,e),c):new RegExp(a,b)}}function h(){}function i(a){for(var b,c,d=1;d<arguments.length;d++){b=arguments[d];for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])}return a}function j(b,c,f){if(f||"function"==typeof c){f||(f=c,c=null),c=i({},j.defaults,c||{});var g,h,k=c.highlight,l=0;try{g=a.lex(b,c)}catch(m){return f(m)}h=g.length;var n=function(a){if(a)return c.highlight=k,f(a);var b;try{b=d.parse(g,c)}catch(e){a=e}return c.highlight=k,a?f(a):f(null,b)};if(!k||k.length<3)return n();if(delete c.highlight,!h)return n();for(;l<g.length;l++)!function(a){return"code"!==a.type?--h||n():k(a.text,a.lang,function(b,c){return b?n(b):null==c||c===a.text?--h||n():(a.text=c,a.escaped=!0,void(--h||n()))})}(g[l])}else try{return c&&(c=i({},j.defaults,c)),d.parse(a.lex(b,c),c)}catch(m){if(m.message+="\nPlease report this to https://github.com/chjj/marked.",(c||j.defaults).silent)return"<p>An error occured:</p><pre>"+e(m.message+"",!0)+"</pre>";throw m}}var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:h,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:h,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:h,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};k.bullet=/(?:[*+-]|\d+\.)/,k.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,k.item=g(k.item,"gm")(/bull/g,k.bullet)(),k.list=g(k.list)(/bull/g,k.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+k.def.source+")")(),k.blockquote=g(k.blockquote)("def",k.def)(),k._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",k.html=g(k.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,k._tag)(),k.paragraph=g(k.paragraph)("hr",k.hr)("heading",k.heading)("lheading",k.lheading)("blockquote",k.blockquote)("tag","<"+k._tag)("def",k.def)(),k.normal=i({},k),k.gfm=i({},k.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),k.gfm.paragraph=g(k.paragraph)("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|")(),k.tables=i({},k.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),a.rules=k,a.lex=function(b,c){var d=new a(c);return d.lex(b)},a.prototype.lex=function(a){return a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(a,!0)},a.prototype.token=function(a,b,c){for(var d,e,f,g,h,i,j,l,m,a=a.replace(/^ +$/gm,"");a;)if((f=this.rules.newline.exec(a))&&(a=a.substring(f[0].length),f[0].length>1&&this.tokens.push({type:"space"})),f=this.rules.code.exec(a))a=a.substring(f[0].length),f=f[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?f:f.replace(/\n+$/,"")});else if(f=this.rules.fences.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"code",lang:f[2],text:f[3]});else if(f=this.rules.heading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:f[1].length,text:f[2]});else if(b&&(f=this.rules.nptable.exec(a))){for(a=a.substring(f[0].length),i={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/\n$/,"").split("\n")},l=0;l<i.align.length;l++)/^ *-+: *$/.test(i.align[l])?i.align[l]="right":/^ *:-+: *$/.test(i.align[l])?i.align[l]="center":/^ *:-+ *$/.test(i.align[l])?i.align[l]="left":i.align[l]=null;for(l=0;l<i.cells.length;l++)i.cells[l]=i.cells[l].split(/ *\| */);this.tokens.push(i)}else if(f=this.rules.lheading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:"="===f[2]?1:2,text:f[1]});else if(f=this.rules.hr.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"hr"});else if(f=this.rules.blockquote.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"blockquote_start"}),f=f[0].replace(/^ *> ?/gm,""),this.token(f,b,!0),this.tokens.push({type:"blockquote_end"});else if(f=this.rules.list.exec(a)){for(a=a.substring(f[0].length),g=f[2],this.tokens.push({type:"list_start",ordered:g.length>1}),f=f[0].match(this.rules.item),d=!1,m=f.length,l=0;m>l;l++)i=f[l],j=i.length,i=i.replace(/^ *([*+-]|\d+\.) +/,""),~i.indexOf("\n ")&&(j-=i.length,i=this.options.pedantic?i.replace(/^ {1,4}/gm,""):i.replace(new RegExp("^ {1,"+j+"}","gm"),"")),this.options.smartLists&&l!==m-1&&(h=k.bullet.exec(f[l+1])[0],g===h||g.length>1&&h.length>1||(a=f.slice(l+1).join("\n")+a,l=m-1)),e=d||/\n\n(?!\s*$)/.test(i),l!==m-1&&(d="\n"===i.charAt(i.length-1),e||(e=d)),this.tokens.push({type:e?"loose_item_start":"list_item_start"}),this.token(i,!1,c),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(f=this.rules.html.exec(a))a=a.substring(f[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===f[1]||"script"===f[1]||"style"===f[1],text:f[0]});else if(!c&&b&&(f=this.rules.def.exec(a)))a=a.substring(f[0].length),this.tokens.links[f[1].toLowerCase()]={href:f[2],title:f[3]};else if(b&&(f=this.rules.table.exec(a))){for(a=a.substring(f[0].length),i={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/(?: *\| *)?\n$/,"").split("\n")},l=0;l<i.align.length;l++)/^ *-+: *$/.test(i.align[l])?i.align[l]="right":/^ *:-+: *$/.test(i.align[l])?i.align[l]="center":/^ *:-+ *$/.test(i.align[l])?i.align[l]="left":i.align[l]=null;for(l=0;l<i.cells.length;l++)i.cells[l]=i.cells[l].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(i)}else if(b&&(f=this.rules.paragraph.exec(a)))a=a.substring(f[0].length),this.tokens.push({type:"paragraph",text:"\n"===f[1].charAt(f[1].length-1)?f[1].slice(0,-1):f[1]});else if(f=this.rules.text.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"text",text:f[0]});else if(a)throw new Error("Infinite loop on byte: "+a.charCodeAt(0));return this.tokens};var l={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:h,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:h,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};l._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,l._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,l.link=g(l.link)("inside",l._inside)("href",l._href)(),l.reflink=g(l.reflink)("inside",l._inside)(),l.normal=i({},l),l.pedantic=i({},l.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),l.gfm=i({},l.normal,{escape:g(l.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:g(l.text)("]|","~]|")("|","|https?://|")()}),l.breaks=i({},l.gfm,{br:g(l.br)("{2,}","*")(),text:g(l.gfm.text)("{2,}","*")()}),b.rules=l,b.output=function(a,c,d){var e=new b(c,d);return e.output(a)},b.prototype.output=function(a){for(var b,c,d,f,g="";a;)if(f=this.rules.escape.exec(a))a=a.substring(f[0].length),g+=f[1];else if(f=this.rules.autolink.exec(a))a=a.substring(f[0].length),"@"===f[2]?(c=this.mangle(":"===f[1].charAt(6)?f[1].substring(7):f[1]),d=this.mangle("mailto:")+c):(c=e(f[1]),d=c),g+=this.renderer.link(d,null,c);else if(this.inLink||!(f=this.rules.url.exec(a))){if(f=this.rules.tag.exec(a))!this.inLink&&/^<a /i.test(f[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(f[0])&&(this.inLink=!1),a=a.substring(f[0].length),g+=this.options.sanitize?e(f[0]):f[0];else if(f=this.rules.link.exec(a))a=a.substring(f[0].length),this.inLink=!0,g+=this.outputLink(f,{href:f[2],title:f[3]}),this.inLink=!1;else if((f=this.rules.reflink.exec(a))||(f=this.rules.nolink.exec(a))){if(a=a.substring(f[0].length),b=(f[2]||f[1]).replace(/\s+/g," "),b=this.links[b.toLowerCase()],!b||!b.href){g+=f[0].charAt(0),a=f[0].substring(1)+a;continue}this.inLink=!0,g+=this.outputLink(f,b),this.inLink=!1}else if(f=this.rules.strong.exec(a))a=a.substring(f[0].length),g+=this.renderer.strong(this.output(f[2]||f[1]));else if(f=this.rules.em.exec(a))a=a.substring(f[0].length),g+=this.renderer.em(this.output(f[2]||f[1]));else if(f=this.rules.code.exec(a))a=a.substring(f[0].length),g+=this.renderer.codespan(e(f[2],!0));else if(f=this.rules.br.exec(a))a=a.substring(f[0].length),g+=this.renderer.br();else if(f=this.rules.del.exec(a))a=a.substring(f[0].length),g+=this.renderer.del(this.output(f[1]));else if(f=this.rules.text.exec(a))a=a.substring(f[0].length),g+=e(this.smartypants(f[0]));else if(a)throw new Error("Infinite loop on byte: "+a.charCodeAt(0))}else a=a.substring(f[0].length),c=e(f[1]),d=c,g+=this.renderer.link(d,null,c);return g},b.prototype.outputLink=function(a,b){var c=e(b.href),d=b.title?e(b.title):null;return"!"!==a[0].charAt(0)?this.renderer.link(c,d,this.output(a[1])):this.renderer.image(c,d,e(a[1]))},b.prototype.smartypants=function(a){return this.options.smartypants?a.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):a},b.prototype.mangle=function(a){for(var b,c="",d=a.length,e=0;d>e;e++)b=a.charCodeAt(e),Math.random()>.5&&(b="x"+b.toString(16)),c+="&#"+b+";";return c},c.prototype.code=function(a,b,c){if(this.options.highlight){var d=this.options.highlight(a,b);null!=d&&d!==a&&(c=!0,a=d)}return b?'<pre><code class="'+this.options.langPrefix+e(b,!0)+'">'+(c?a:e(a,!0))+"\n</code></pre>\n":"<pre><code>"+(c?a:e(a,!0))+"\n</code></pre>"},c.prototype.blockquote=function(a){return"<blockquote>\n"+a+"</blockquote>\n"},c.prototype.html=function(a){return a},c.prototype.heading=function(a,b,c){return"<h"+b+' id="'+this.options.headerPrefix+c.toLowerCase().replace(/[^\w]+/g,"-")+'">'+a+"</h"+b+">\n"},c.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},c.prototype.list=function(a,b){var c=b?"ol":"ul";return"<"+c+">\n"+a+"</"+c+">\n"},c.prototype.listitem=function(a){return"<li>"+a+"</li>\n"},c.prototype.paragraph=function(a){return"<p>"+a+"</p>\n"},c.prototype.table=function(a,b){return"<table>\n<thead>\n"+a+"</thead>\n<tbody>\n"+b+"</tbody>\n</table>\n"},c.prototype.tablerow=function(a){return"<tr>\n"+a+"</tr>\n"},c.prototype.tablecell=function(a,b){var c=b.header?"th":"td",d=b.align?"<"+c+' style="text-align:'+b.align+'">':"<"+c+">";return d+a+"</"+c+">\n"},c.prototype.strong=function(a){return"<strong>"+a+"</strong>"},c.prototype.em=function(a){return"<em>"+a+"</em>"},c.prototype.codespan=function(a){return"<code>"+a+"</code>"},c.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},c.prototype.del=function(a){return"<del>"+a+"</del>"},c.prototype.link=function(a,b,c){if(this.options.sanitize){try{var d=decodeURIComponent(f(a)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===d.indexOf("javascript:"))return""}var g='<a href="'+a+'"';return b&&(g+=' title="'+b+'"'),g+=">"+c+"</a>"},c.prototype.image=function(a,b,c){var d='<img src="'+a+'" alt="'+c+'"';return b&&(d+=' title="'+b+'"'),d+=this.options.xhtml?"/>":">"},d.parse=function(a,b,c){var e=new d(b,c);return e.parse(a)},d.prototype.parse=function(a){this.inline=new b(a.links,this.options,this.renderer),this.tokens=a.reverse();for(var c="";this.next();)c+=this.tok();return c},d.prototype.next=function(){return this.token=this.tokens.pop()},d.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},d.prototype.parseText=function(){for(var a=this.token.text;"text"===this.peek().type;)a+="\n"+this.next().text;return this.inline.output(a)},d.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var a,b,c,d,e,f="",g="";for(c="",a=0;a<this.token.header.length;a++)d={header:!0,align:this.token.align[a]},c+=this.renderer.tablecell(this.inline.output(this.token.header[a]),{header:!0,align:this.token.align[a]});for(f+=this.renderer.tablerow(c),a=0;a<this.token.cells.length;a++){for(b=this.token.cells[a],c="",e=0;e<b.length;e++)c+=this.renderer.tablecell(this.inline.output(b[e]),{header:!1,align:this.token.align[e]});g+=this.renderer.tablerow(c)}return this.renderer.table(f,g);case"blockquote_start":for(var g="";"blockquote_end"!==this.next().type;)g+=this.tok();return this.renderer.blockquote(g);case"list_start":for(var g="",h=this.token.ordered;"list_end"!==this.next().type;)g+=this.tok();return this.renderer.list(g,h);case"list_item_start":for(var g="";"list_item_end"!==this.next().type;)g+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(g);case"loose_item_start":for(var g="";"list_item_end"!==this.next().type;)g+=this.tok();return this.renderer.listitem(g);case"html":var i=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(i);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},h.exec=h,j.options=j.setOptions=function(a){return i(j.defaults,a),j},j.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new c,xhtml:!1},j.Parser=d,j.parser=d.parse,j.Renderer=c,j.Lexer=a,j.lexer=a.lex,j.InlineLexer=b,j.inlineLexer=b.output,j.parse=j,"undefined"!=typeof module&&"object"==typeof exports?module.exports=j:"function"==typeof define&&define.amd?define(function(){return j}):this.marked=j}.call(function(){return this||("undefined"!=typeof window?window:global)}()),function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?oe(d):{},oe(Gf,d,!1),o(d);var e=d.value;"string"==typeof e&&(e=new cg(e,d.mode)),this.doc=e;var f=this.display=new b(c,e);f.wrapper.CodeMirror=this,k(this),i(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),d.autofocus&&!jf&&zb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new he},Ze&&11>$e&&setTimeout(pe(yb,this,!0),20),Cb(this),De(),_a(this),this.curOp.forceUpdate=!0,Cd(this,e),d.autofocus&&!jf||xe()==f.input?setTimeout(pe(Zb,this),20):$b(this);for(var g in Hf)Hf.hasOwnProperty(g)&&Hf[g](this,d[g],If);u(this);for(var h=0;h<Mf.length;++h)Mf[h](this);bb(this)}function b(a,b){var c=this,d=c.input=te("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");_e?d.style.width="1000px":d.setAttribute("wrap","off"),hf&&(d.style.border="1px solid black"),d.setAttribute("autocorrect","off"),d.setAttribute("autocapitalize","off"),d.setAttribute("spellcheck","false"),c.inputDiv=te("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),c.scrollbarH=te("div",[te("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),c.scrollbarV=te("div",[te("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),c.scrollbarFiller=te("div",null,"CodeMirror-scrollbar-filler"),c.gutterFiller=te("div",null,"CodeMirror-gutter-filler"),c.lineDiv=te("div",null,"CodeMirror-code"),c.selectionDiv=te("div",null,null,"position: relative; z-index: 1"),c.cursorDiv=te("div",null,"CodeMirror-cursors"),c.measure=te("div",null,"CodeMirror-measure"),c.lineMeasure=te("div",null,"CodeMirror-measure"),c.lineSpace=te("div",[c.measure,c.lineMeasure,c.selectionDiv,c.cursorDiv,c.lineDiv],null,"position: relative; outline: none"),c.mover=te("div",[te("div",[c.lineSpace],"CodeMirror-lines")],null,"position: relative"),c.sizer=te("div",[c.mover],"CodeMirror-sizer"),c.heightForcer=te("div",null,null,"position: absolute; height: "+mg+"px; width: 1px;"),c.gutters=te("div",null,"CodeMirror-gutters"),c.lineGutter=null,c.scroller=te("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll"),c.scroller.setAttribute("tabIndex","-1"),c.wrapper=te("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror"),Ze&&8>$e&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0),hf&&(d.style.width="0px"),_e||(c.scroller.draggable=!0),ef&&(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"),Ze&&8>$e&&(c.scrollbarH.style.minHeight=c.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(c.wrapper):a(c.wrapper),c.viewFrom=c.viewTo=b.first,
- c.view=[],c.externalMeasured=null,c.viewOffset=0,c.lastSizeC=0,c.updateLineNumbers=null,c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null,c.prevInput="",c.alignWidgets=!1,c.pollingFast=!1,c.poll=new he,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=null,c.inaccurateSelection=!1,c.maxLine=null,c.maxLineLength=0,c.maxLineChanged=!1,c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null,c.shift=!1,c.selForContextMenu=null}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),d(b)}function d(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,wa(a,100),a.state.modeGen++,a.curOp&&ob(a)}function e(a){a.options.lineWrapping?(Ae(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth=""):(ze(a.display.wrapper,"CodeMirror-wrap"),n(a)),g(a),ob(a),Oa(a),setTimeout(function(){r(a)},100)}function f(a){var b=Za(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/$a(a.display)-3);return function(e){if(bd(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 g(a){var b=a.doc,c=f(a);b.iter(function(a){var b=c(a);b!=a.height&&Gd(a,b)})}function h(a){var b=Rf[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}function i(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Oa(a)}function j(a){k(a),ob(a),setTimeout(function(){t(a)},20)}function k(a){var b=a.display.gutters,c=a.options.gutters;ue(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(te("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none",l(a)}function l(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px",a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0}function m(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=Wc(d);){var e=b.find(0,!0);d=e.from.line,c+=e.from.ch-e.to.ch}for(d=a;b=Xc(d);){var e=b.find(0,!0);c-=d.text.length-e.from.ch,d=e.to.line,c+=d.text.length-e.to.ch}return c}function n(a){var b=a.display,c=a.doc;b.maxLine=Dd(c,c.first),b.maxLineLength=m(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=m(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function o(a){var b=le(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 p(a){return a.display.scroller.clientHeight-a.display.wrapper.clientHeight<mg-3}function q(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,hScrollbarTakesSpace:p(a),barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+Ba(a.display))}}function r(a,b){b||(b=q(a));var c=a.display,d=Fe(c.measure),e=b.docHeight+mg,f=b.scrollWidth>b.clientWidth;f&&b.scrollWidth<=b.clientWidth+1&&d>0&&!b.hScrollbarTakesSpace&&(f=!1);var g=e>b.clientHeight;if(g?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=f?d+"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,e-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0"),f?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=g?d+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0"),f&&g?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=d+"px"):c.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="",!a.state.checkedOverlayScrollbar&&b.clientHeight>0){if(0===d){var h=kf&&!ff?"12px":"18px";c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=h;var i=function(b){_d(b)!=c.scrollbarV&&_d(b)!=c.scrollbarH&&jb(a,Gb)(b)};ig(c.scrollbarV,"mousedown",i),ig(c.scrollbarH,"mousedown",i)}a.state.checkedOverlayScrollbar=!0}}function s(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Aa(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=Id(b,d),g=Id(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(f>h)return{from:h,to:Id(b,Jd(Dd(b,h))+a.wrapper.clientHeight)};if(Math.min(i,b.lastLine())>=g)return{from:Id(b,Jd(Dd(b,i))-a.wrapper.clientHeight),to:i}}return{from:f,to:Math.max(g,f+1)}}function t(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=w(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);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 u(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=v(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(te("div",[te("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",l(a),!0}return!1}function v(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function w(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function x(a,b,c){var d=a.display;this.viewport=b,this.visible=s(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.oldViewFrom=d.viewFrom,this.oldViewTo=d.viewTo,this.oldScrollerWidth=d.scroller.clientWidth,this.force=c,this.dims=F(a)}function y(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return qb(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&0==ub(a))return!1;u(a)&&(qb(a),b.dims=F(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&f-c.viewFrom<20&&(f=Math.max(d.first,c.viewFrom)),c.viewTo>g&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),qf&&(f=_c(a.doc,f),g=ad(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastSizeC!=b.wrapperHeight;tb(a,f,g),c.viewOffset=Jd(Dd(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=ub(a);if(!h&&0==i&&!b.force&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=xe();return i>4&&(c.lineDiv.style.display="none"),G(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),j&&xe()!=j&&j.offsetHeight&&j.focus(),ue(c.cursorDiv),ue(c.selectionDiv),h&&(c.lastSizeC=b.wrapperHeight,wa(a,400)),c.updateLineNumbers=null,!0}function z(a,b){for(var c=b.force,d=b.viewport,e=!0;;e=!1){if(e&&a.options.lineWrapping&&b.oldScrollerWidth!=a.display.scroller.clientWidth)c=!0;else if(c=!1,d&&null!=d.top&&(d={top:Math.min(a.doc.height+Ba(a.display)-mg-a.display.scroller.clientHeight,d.top)}),b.visible=s(a.display,a.doc,d),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!y(a,b))break;D(a);var f=q(a);sa(a),B(a,f),r(a,f)}be(a,"update",a),(a.display.viewFrom!=b.oldViewFrom||a.display.viewTo!=b.oldViewTo)&&be(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo)}function A(a,b){var c=new x(a,b);if(y(a,c)){D(a),z(a,c);var d=q(a);sa(a),B(a,d),r(a,d)}}function B(a,b){a.display.sizer.style.minHeight=a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=Math.max(b.docHeight,b.clientHeight-mg)+"px"}function C(a,b){a.display.sizer.offsetWidth+a.display.gutters.offsetWidth<a.display.scroller.clientWidth-1&&(a.display.sizer.style.minHeight=a.display.heightForcer.style.top="0px",a.display.gutters.style.height=b.docHeight+"px")}function D(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d<b.view.length;d++){var e,f=b.view[d];if(!f.hidden){if(Ze&&8>$e){var g=f.node.offsetTop+f.node.offsetHeight;e=g-c,c=g}else{var h=f.node.getBoundingClientRect();e=h.bottom-h.top}var i=f.line.height-e;if(2>e&&(e=Za(b)),(i>.001||-.001>i)&&(Gd(f.line,e),E(f.line),f.rest))for(var j=0;j<f.rest.length;j++)E(f.rest[j])}}}function E(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function F(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:w(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function G(a,b,c){function d(b){var c=b.nextSibling;return _e&&kf&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,i=e.view,j=e.viewFrom,k=0;k<i.length;k++){var l=i[k];if(l.hidden);else if(l.node){for(;h!=l.node;)h=d(h);var m=f&&null!=b&&j>=b&&l.lineNumber;l.changes&&(le(l.changes,"gutter")>-1&&(m=!1),H(a,l,j,c)),m&&(ue(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(v(a.options,j)))),h=l.node.nextSibling}else{var n=P(a,l,j,c);g.insertBefore(n,h)}j+=l.size}for(;h;)h=d(h)}function H(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?L(a,b):"gutter"==f?N(a,b,c,d):"class"==f?M(b):"widget"==f&&O(b,d)}b.changes=null}function I(a){return a.node==a.text&&(a.node=te("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),Ze&&8>$e&&(a.node.style.zIndex=2)),a.node}function J(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=I(a);a.background=c.insertBefore(te("div",null,b),c.firstChild)}}function K(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):qd(a,b)}function L(a,b){var c=b.text.className,d=K(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,M(b)):c&&(b.text.className=c)}function M(a){J(a),a.line.wrapClass?I(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function N(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=I(b),g=b.gutter=f.insertBefore(te("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);if(!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(te("div",v(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(te("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function O(a,b){a.alignable&&(a.alignable=null);for(var c,d=a.node.firstChild;d;d=c){var c=d.nextSibling;"CodeMirror-linewidget"==d.className&&a.node.removeChild(d)}Q(a,b)}function P(a,b,c,d){var e=K(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),M(b),N(a,b,c,d),Q(b,d),b.node}function Q(a,b){if(R(a.line,a,b,!0),a.rest)for(var c=0;c<a.rest.length;c++)R(a.rest[c],a,b,!1)}function R(a,b,c,d){if(a.widgets)for(var e=I(b),f=0,g=a.widgets;f<g.length;++f){var h=g[f],i=te("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||(i.ignoreEvents=!0),S(h,i,b,c),d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i),be(h,"redraw")}}function S(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 T(a){return rf(a.line,a.ch)}function U(a,b){return sf(a,b)<0?b:a}function V(a,b){return sf(a,b)<0?a:b}function W(a,b){this.ranges=a,this.primIndex=b}function X(a,b){this.anchor=a,this.head=b}function Y(a,b){var c=a[b];a.sort(function(a,b){return sf(a.from(),b.from())}),b=le(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(sf(f.to(),e.from())>=0){var g=V(f.from(),e.from()),h=U(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new X(i?h:g,i?g:h))}}return new W(a,b)}function Z(a,b){return new W([new X(a,b||a)],0)}function $(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function _(a,b){if(b.line<a.first)return rf(a.first,0);var c=a.first+a.size-1;return b.line>c?rf(c,Dd(a,c).text.length):aa(b,Dd(a,b.line).text.length)}function aa(a,b){var c=a.ch;return null==c||c>b?rf(a.line,b):0>c?rf(a.line,0):a}function ba(a,b){return b>=a.first&&b<a.first+a.size}function ca(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=_(a,b[d]);return c}function da(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=sf(c,e)<0;f!=sf(d,e)<0?(e=c,c=d):f!=sf(c,d)<0&&(c=d)}return new X(e,c)}return new X(d||c,c)}function ea(a,b,c,d){ka(a,new W([da(a,a.sel.primary(),b,c)],0),d)}function fa(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=da(a,a.sel.ranges[e],b[e],null);var f=Y(d,a.sel.primIndex);ka(a,f,c)}function ga(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,ka(a,Y(e,a.sel.primIndex),d)}function ha(a,b,c,d){ka(a,Z(b,c),d)}function ia(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new X(_(a,b[c].anchor),_(a,b[c].head))}};return kg(a,"beforeSelectionChange",a,c),a.cm&&kg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?Y(c.ranges,c.ranges.length-1):b}function ja(a,b,c){var d=a.history.done,e=ke(d);e&&e.ranges?(d[d.length-1]=b,la(a,b,c)):ka(a,b,c)}function ka(a,b,c){la(a,b,c),Rd(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function la(a,b,c){(fe(a,"beforeSelectionChange")||a.cm&&fe(a.cm,"beforeSelectionChange"))&&(b=ia(a,b));var d=c&&c.bias||(sf(b.primary().head,a.sel.primary().head)<0?-1:1);ma(a,oa(a,b,d,!0)),c&&c.scroll===!1||!a.cm||sc(a.cm)}function ma(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ee(a.cm)),be(a,"cursorActivity",a))}function na(a){ma(a,oa(a,a.sel,null,!1),og)}function oa(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=pa(a,g.anchor,c,d),i=pa(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new X(h,i))}return e?Y(e,b.primIndex):b}function pa(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Dd(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(kg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==sf(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?_(a,rf(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?rf(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,rf(a.first,0)):pa(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function qa(a){for(var b=a.display,c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++){var h=c.sel.ranges[g],i=h.empty();(i||a.options.showCursorWhenSelecting)&&ta(a,h,e),i||ua(a,h,f)}if(a.options.moveInputWithCursor){var j=Ua(a,c.sel.primary().head,"div"),k=b.wrapper.getBoundingClientRect(),l=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,j.top+l.top-k.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,j.left+l.left-k.left))}return d}function ra(a,b){ve(a.display.cursorDiv,b.cursors),ve(a.display.selectionDiv,b.selection),null!=b.teTop&&(a.display.inputDiv.style.top=b.teTop+"px",a.display.inputDiv.style.left=b.teLeft+"px")}function sa(a){ra(a,qa(a))}function ta(a,b,c){var d=Ua(a,b.head,"div",null,null,!a.options.singleCursorHeightPerLine),e=c.appendChild(te("div"," ","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(te("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function ua(a,b,c){function d(a,b,c,d){0>b&&(b=0),b=Math.round(b),d=Math.round(d),h.appendChild(te("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){function f(c,d){return Ta(a,rf(b,c),"div",l,d)}var h,i,l=Dd(g,b),m=l.text.length;return Je(Kd(l),c||0,null==e?m:e,function(a,b,g){var l,n,o,p=f(a,"left");if(a==b)l=p,n=o=p.left;else{if(l=f(b-1,"right"),"rtl"==g){var q=p;p=l,l=q}n=p.left,o=l.right}null==c&&0==a&&(n=j),l.top-p.top>3&&(d(n,p.top,null,p.bottom),n=j,p.bottom<l.top&&d(n,p.bottom,null,l.top)),null==e&&b==m&&(o=k),(!h||p.top<h.top||p.top==h.top&&p.left<h.left)&&(h=p),(!i||l.bottom>i.bottom||l.bottom==i.bottom&&l.right>i.right)&&(i=l),j+1>n&&(n=j),d(n,l.top,o-n,l.bottom)}),{start:h,end:i}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),i=Ca(a.display),j=i.left,k=f.lineSpace.offsetWidth-i.right,l=b.from(),m=b.to();if(l.line==m.line)e(l.line,l.ch,m.ch);else{var n=Dd(g,l.line),o=Dd(g,m.line),p=Zc(n)==Zc(o),q=e(l.line,l.ch,p?n.text.length+1:null).end,r=e(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(d(q.right,q.top,null,q.bottom),d(j,r.top,r.left,r.bottom)):d(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&d(j,q.bottom,null,r.top)}c.appendChild(h)}function va(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(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function wa(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,pe(xa,a))}function xa(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Of(b.mode,za(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=md(a,f,d,!0);f.styles=h.styles;var i=f.styleClasses,j=h.classes;j?f.styleClasses=j:i&&(f.styleClasses=null);for(var k=!g||g.length!=f.styles.length||i!=j&&(!i||!j||i.bgClass!=j.bgClass||i.textClass!=j.textClass),l=0;!k&&l<g.length;++l)k=g[l]!=f.styles[l];k&&e.push(b.frontier),f.stateAfter=Of(b.mode,d)}else od(a,f.text,d),f.stateAfter=b.frontier%5==0?Of(b.mode,d):null;return++b.frontier,+new Date>c?(wa(a,a.options.workDelay),!0):void 0}),e.length&&ib(a,function(){for(var b=0;b<e.length;b++)pb(a,e[b],"text")})}}function ya(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=Dd(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=rg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function za(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=ya(a,b,c),g=f>d.first&&Dd(d,f-1).stateAfter;return g=g?Of(d.mode,g):Pf(d.mode),d.iter(f,b,function(c){od(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?Of(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Aa(a){return a.lineSpace.offsetTop}function Ba(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Ca(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=ve(a.measure,te("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function Da(a,b,c){var d=a.options.lineWrapping,e=d&&a.display.scroller.clientWidth;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 Ea(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 d=0;d<a.rest.length;d++)if(Hd(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function Fa(a,b){b=Zc(b);var c=Hd(b),d=a.display.externalMeasured=new mb(a.doc,b,c);d.lineN=c;var e=d.built=qd(a,d);return d.text=e.pre,ve(a.display.lineMeasure,e.pre),d}function Ga(a,b,c,d){return Ja(a,Ia(a,b),c,d)}function Ha(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[rb(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function Ia(a,b){var c=Hd(b),d=Ha(a,c);d&&!d.text?d=null:d&&d.changes&&H(a,d,c,F(a)),d||(d=Fa(a,b));var e=Ea(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function Ja(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||(Da(a,b.view,b.rect),b.hasHeights=!0),f=Ka(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 Ka(a,b,c,d){for(var e,f,g,h,i=b.map,j=0;j<i.length;j+=3){var k=i[j],l=i[j+1];if(k>c?(f=0,g=1,h="left"):l>c?(f=c-k,g=f+1):(j==i.length-3||c==l&&i[j+3]>c)&&(g=l-k,f=g-1,c>=l&&(h="right")),null!=f){if(e=i[j+2],k==l&&d==(e.insertLeft?"left":"right")&&(h=d),"left"==d&&0==f)for(;j&&i[j-2]==i[j-3]&&i[j-1].insertLeft;)e=i[(j-=3)+2],h="left";if("right"==d&&f==l-k)for(;j<i.length-3&&i[j+3]==i[j+4]&&!i[j+5].insertLeft;)e=i[(j+=3)+2],h="right";break}}var m;if(3==e.nodeType){for(var j=0;4>j;j++){for(;f&&se(b.line.text.charAt(k+f));)--f;for(;l>k+g&&se(b.line.text.charAt(k+g));)++g;if(Ze&&9>$e&&0==f&&g==l-k)m=e.parentNode.getBoundingClientRect();else if(Ze&&a.options.lineWrapping){var n=ug(e,f,g).getClientRects();m=n.length?n["right"==d?n.length-1:0]:wf}else m=ug(e,f,g).getBoundingClientRect()||wf;if(m.left||m.right||0==f)break;g=f,f-=1,h="right"}Ze&&11>$e&&(m=La(a.display.measure,m))}else{f>0&&(h=d="right");var n;m=a.options.lineWrapping&&(n=e.getClientRects()).length>1?n["right"==d?n.length-1:0]:e.getBoundingClientRect()}if(Ze&&9>$e&&!f&&(!m||!m.left&&!m.right)){var o=e.parentNode.getClientRects()[0];m=o?{left:o.left,right:o.left+$a(a.display),top:o.top,bottom:o.bottom}:wf}for(var p=m.top-b.rect.top,q=m.bottom-b.rect.top,r=(p+q)/2,s=b.view.measure.heights,j=0;j<s.length-1&&!(r<s[j]);j++);var t=j?s[j-1]:0,u=s[j],v={left:("right"==h?m.right:m.left)-b.rect.left,right:("left"==h?m.left:m.right)-b.rect.left,top:t,bottom:u};return m.left||m.right||(v.bogus=!0),a.options.singleCursorHeightPerLine||(v.rtop=p,v.rbottom=q),v}function La(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ie(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 Ma(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 Na(a){a.display.externalMeasure=null,ue(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Ma(a.display.view[b])}function Oa(a){Na(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function Pa(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Qa(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ra(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=ed(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Jd(b);if("local"==d?g+=Aa(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:Qa());var i=h.left+("window"==d?0:Pa());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function Sa(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=Pa(),e-=Qa();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 Ta(a,b,c,d,e){return d||(d=Dd(a.doc,b.line)),Ra(a,d,Ga(a,d,b.ch,e),c)}function Ua(a,b,c,d,e,f){function g(b,g){var h=Ja(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,Ra(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==Ke(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=Le(c)-(c.level%2?0:1),d=!0):a==Le(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=Ke(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||Dd(a.doc,b.line),e||(e=Ia(a,d));var i=Kd(d),j=b.ch;if(!i)return g(j);var k=Se(i,j),l=h(j,k);return null!=Ig&&(l.other=h(j,Ig)),l}function Va(a,b){var c=0,b=_(a.doc,b);a.options.lineWrapping||(c=$a(a.display)*b.ch);var d=Dd(a.doc,b.line),e=Jd(d)+Aa(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function Wa(a,b,c,d){var e=rf(a,b);return e.xRel=d,c&&(e.outside=!0),e}function Xa(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return Wa(d.first,0,!0,-1);var e=Id(d,c),f=d.first+d.size-1;if(e>f)return Wa(d.first+d.size-1,Dd(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Dd(d,e);;){var h=Ya(a,g,e,b,c),i=Xc(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=Hd(g=j.to.line)}}function Ya(a,b,c,d,e){function f(d){var e=Ua(a,rf(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:g<e.top?e.left+i:(h=!1,e.left)}var g=e-Jd(b),h=!1,i=2*a.display.wrapper.clientWidth,j=Ia(a,b),k=Kd(b),l=b.text.length,m=Me(b),n=Ne(b),o=f(m),p=h,q=f(n),r=h;if(d>q)return Wa(c,n,r,1);for(;;){if(k?n==m||n==Ue(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);se(b.text.charAt(s));)++s;var u=Wa(c,s,s==m?p:r,-1>t?-1:t>1?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Ue(b,w,1)}var y=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function Za(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==tf){tf=te("pre");for(var b=0;49>b;++b)tf.appendChild(document.createTextNode("x")),tf.appendChild(te("br"));tf.appendChild(document.createTextNode("x"))}ve(a.measure,tf);var c=tf.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),ue(a.measure),c||1}function $a(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=te("span","xxxxxxxxxx"),c=te("pre",[b]);ve(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function _a(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,id:++yf},xf?xf.ops.push(a.curOp):a.curOp.ownsGroup=xf={ops:[a.curOp],delayedCallbacks:[]}}function ab(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();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++](e.cm)}}while(c<b.length)}function bb(a){var b=a.curOp,c=b.ownsGroup;if(c)try{ab(c)}finally{xf=null;for(var d=0;d<c.ops.length;d++)c.ops[d].cm.curOp=null;cb(c)}}function cb(a){for(var b=a.ops,c=0;c<b.length;c++)db(b[c]);for(var c=0;c<b.length;c++)eb(b[c]);for(var c=0;c<b.length;c++)fb(b[c]);for(var c=0;c<b.length;c++)gb(b[c]);for(var c=0;c<b.length;c++)hb(b[c])}function db(a){var b=a.cm,c=b.display;a.updateMaxLine&&n(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 x(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function eb(a){a.updatedDisplay=a.mustUpdate&&y(a.cm,a.update)}function fb(a){var b=a.cm,c=b.display;a.updatedDisplay&&D(b),a.barMeasure=q(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Ga(b,c.maxLine,c.maxLine.text.length).left+3,a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo+mg-c.scroller.clientWidth)),(a.updatedDisplay||a.selectionChanged)&&(a.newSelectionNodes=qa(b))}function gb(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&Pb(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1),a.newSelectionNodes&&ra(b,a.newSelectionNodes),a.updatedDisplay&&B(b,a.barMeasure),(a.updatedDisplay||a.startHeight!=b.doc.height)&&r(b,a.barMeasure),a.selectionChanged&&va(b),b.state.focused&&a.updateInput&&yb(b,a.typing)}function hb(a){var b=a.cm,c=b.display,d=b.doc;if(null!=a.adjustWidthTo&&Math.abs(a.barMeasure.scrollWidth-b.display.scroller.scrollWidth)>1&&r(b),a.updatedDisplay&&z(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null!=a.scrollTop&&(c.scroller.scrollTop!=a.scrollTop||a.forceScroll)){var e=Math.max(0,Math.min(c.scroller.scrollHeight-c.scroller.clientHeight,a.scrollTop));c.scroller.scrollTop=c.scrollbarV.scrollTop=d.scrollTop=e}if(null!=a.scrollLeft&&(c.scroller.scrollLeft!=a.scrollLeft||a.forceScroll)){var f=Math.max(0,Math.min(c.scroller.scrollWidth-c.scroller.clientWidth,a.scrollLeft));c.scroller.scrollLeft=c.scrollbarH.scrollLeft=d.scrollLeft=f,t(b)}if(a.scrollToPos){var g=oc(b,_(d,a.scrollToPos.from),_(d,a.scrollToPos.to),a.scrollToPos.margin);a.scrollToPos.isCursor&&b.state.focused&&nc(b,g)}var h=a.maybeHiddenMarkers,i=a.maybeUnhiddenMarkers;if(h)for(var j=0;j<h.length;++j)h[j].lines.length||kg(h[j],"hide");if(i)for(var j=0;j<i.length;++j)i[j].lines.length&&kg(i[j],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.updatedDisplay&&_e&&(b.options.lineWrapping&&C(b,a.barMeasure),a.barMeasure.scrollWidth>a.barMeasure.clientWidth&&a.barMeasure.scrollWidth<a.barMeasure.clientWidth+1&&!p(b)&&r(b)),a.changeObjs&&kg(b,"changes",b,a.changeObjs)}function ib(a,b){if(a.curOp)return b();_a(a);try{return b()}finally{bb(a)}}function jb(a,b){return function(){if(a.curOp)return b.apply(a,arguments);_a(a);try{return b.apply(a,arguments)}finally{bb(a)}}}function kb(a){return function(){if(this.curOp)return a.apply(this,arguments);_a(this);try{return a.apply(this,arguments)}finally{bb(this)}}}function lb(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);
- _a(b);try{return a.apply(this,arguments)}finally{bb(b)}}}function mb(a,b,c){this.line=b,this.rest=$c(b),this.size=this.rest?Hd(ke(this.rest))-c+1:1,this.node=this.text=null,this.hidden=bd(a,b)}function nb(a,b,c){for(var d,e=[],f=b;c>f;f=d){var g=new mb(a.doc,Dd(a.doc,f),f);d=f+g.size,e.push(g)}return e}function ob(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)qf&&_c(a.doc,b)<e.viewTo&&qb(a);else if(c<=e.viewFrom)qf&&ad(a.doc,c+d)>e.viewFrom?qb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)qb(a);else if(b<=e.viewFrom){var f=sb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):qb(a)}else if(c>=e.viewTo){var f=sb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):qb(a)}else{var g=sb(a,b,b,-1),h=sb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(nb(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):qb(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function pb(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[rb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==le(g,c)&&g.push(c)}}}function qb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function rb(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 sb(a,b,c,d){var e,f=rb(a,b),g=a.display.view;if(!qf||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=0,i=a.display.viewFrom;f>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;_c(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 tb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=nb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=nb(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(rb(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(nb(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,rb(a,c)))),d.viewTo=c}function ub(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 vb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){xb(a),a.state.focused&&vb(a)})}function wb(a){function b(){var d=xb(a);d||c?(a.display.pollingFast=!1,vb(a)):(c=!0,a.display.poll.set(60,b))}var c=!1;a.display.pollingFast=!0,a.display.poll.set(20,b)}function xb(a){var b=a.display.input,c=a.display.prevInput,d=a.doc;if(!a.state.focused||Eg(b)&&!c||Bb(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var e=b.value;if(e==c&&!a.somethingSelected())return!1;if(Ze&&$e>=9&&a.display.inputHasSelection===e||kf&&/[\uf700-\uf7ff]/.test(e))return yb(a),!1;var f=!a.curOp;f&&_a(a),a.display.shift=!1,8203!=e.charCodeAt(0)||d.sel!=a.display.selForContextMenu||c||(c="");for(var g=0,h=Math.min(c.length,e.length);h>g&&c.charCodeAt(g)==e.charCodeAt(g);)++g;var i=e.slice(g),j=Dg(i),k=null;a.state.pasteIncoming&&d.sel.ranges.length>1&&(zf&&zf.join("\n")==i?k=d.sel.ranges.length%zf.length==0&&me(zf,Dg):j.length==d.sel.ranges.length&&(k=me(j,function(a){return[a]})));for(var l=d.sel.ranges.length-1;l>=0;l--){var m=d.sel.ranges[l],n=m.from(),o=m.to();g<c.length?n=rf(n.line,n.ch-(c.length-g)):a.state.overwrite&&m.empty()&&!a.state.pasteIncoming&&(o=rf(o.line,Math.min(Dd(d,o.line).text.length,o.ch+ke(j).length)));var p=a.curOp.updateInput,q={from:n,to:o,text:k?k[l%k.length]:j,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(gc(a.doc,q),be(a,"inputRead",a,q),i&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&m.head.ch<100&&(!l||d.sel.ranges[l-1].head.line!=m.head.line)){var r=a.getModeAt(m.head),s=Ff(q);if(r.electricChars){for(var t=0;t<r.electricChars.length;t++)if(i.indexOf(r.electricChars.charAt(t))>-1){uc(a,s.line,"smart");break}}else r.electricInput&&r.electricInput.test(Dd(d,s.line).text.slice(0,s.ch))&&uc(a,s.line,"smart")}}return sc(a),a.curOp.updateInput=p,a.curOp.typing=!0,e.length>1e3||e.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=e,f&&bb(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function yb(a,b){var c,d,e=a.doc;if(a.somethingSelected()){a.display.prevInput="";var f=e.sel.primary();c=Fg&&(f.to().line-f.from().line>100||(d=a.getSelection()).length>1e3);var g=c?"-":d||a.getSelection();a.display.input.value=g,a.state.focused&&tg(a.display.input),Ze&&$e>=9&&(a.display.inputHasSelection=g)}else b||(a.display.prevInput=a.display.input.value="",Ze&&$e>=9&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function zb(a){"nocursor"==a.options.readOnly||jf&&xe()==a.display.input||a.display.input.focus()}function Ab(a){a.state.focused||(zb(a),Zb(a))}function Bb(a){return a.options.readOnly||a.doc.cantEdit}function Cb(a){function b(){a.state.focused&&setTimeout(pe(zb,a),0)}function c(b){de(a,b)||hg(b)}function d(b){if(a.somethingSelected())zf=a.getSelections(),e.inaccurateSelection&&(e.prevInput="",e.inaccurateSelection=!1,e.input.value=zf.join("\n"),tg(e.input));else{for(var c=[],d=[],f=0;f<a.doc.sel.ranges.length;f++){var g=a.doc.sel.ranges[f].head.line,h={anchor:rf(g,0),head:rf(g+1,0)};d.push(h),c.push(a.getRange(h.anchor,h.head))}"cut"==b.type?a.setSelections(d,null,og):(e.prevInput="",e.input.value=c.join("\n"),tg(e.input)),zf=c}"cut"==b.type&&(a.state.cutIncoming=!0)}var e=a.display;ig(e.scroller,"mousedown",jb(a,Gb)),Ze&&11>$e?ig(e.scroller,"dblclick",jb(a,function(b){if(!de(a,b)){var c=Fb(a,b);if(c&&!Lb(a,b)&&!Eb(a.display,b)){fg(b);var d=a.findWordAt(c);ea(a.doc,d.anchor,d.head)}}})):ig(e.scroller,"dblclick",function(b){de(a,b)||fg(b)}),ig(e.lineSpace,"selectstart",function(a){Eb(e,a)||fg(a)}),of||ig(e.scroller,"contextmenu",function(b){_b(a,b)}),ig(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Ob(a,e.scroller.scrollTop),Pb(a,e.scroller.scrollLeft,!0),kg(a,"scroll",a))}),ig(e.scrollbarV,"scroll",function(){e.scroller.clientHeight&&Ob(a,e.scrollbarV.scrollTop)}),ig(e.scrollbarH,"scroll",function(){e.scroller.clientHeight&&Pb(a,e.scrollbarH.scrollLeft)}),ig(e.scroller,"mousewheel",function(b){Qb(a,b)}),ig(e.scroller,"DOMMouseScroll",function(b){Qb(a,b)}),ig(e.scrollbarH,"mousedown",b),ig(e.scrollbarV,"mousedown",b),ig(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),ig(e.input,"keyup",function(b){Xb.call(a,b)}),ig(e.input,"input",function(){Ze&&$e>=9&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),wb(a)}),ig(e.input,"keydown",jb(a,Vb)),ig(e.input,"keypress",jb(a,Yb)),ig(e.input,"focus",pe(Zb,a)),ig(e.input,"blur",pe($b,a)),a.options.dragDrop&&(ig(e.scroller,"dragstart",function(b){Nb(a,b)}),ig(e.scroller,"dragenter",c),ig(e.scroller,"dragover",c),ig(e.scroller,"drop",jb(a,Mb))),ig(e.scroller,"paste",function(b){Eb(e,b)||(a.state.pasteIncoming=!0,zb(a),wb(a))}),ig(e.input,"paste",function(){if(_e&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=e.input.selectionStart,c=e.input.selectionEnd;e.input.value+="$",e.input.selectionEnd=c,e.input.selectionStart=b,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,wb(a)}),ig(e.input,"cut",d),ig(e.input,"copy",d),ef&&ig(e.sizer,"mouseup",function(){xe()==e.input&&e.input.blur(),zb(a)})}function Db(a){var b=a.display;b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,a.setSize()}function Eb(a,b){for(var c=_d(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Fb(a,b,c,d){var e=a.display;if(!c){var f=_d(b);if(f==e.scrollbarH||f==e.scrollbarV||f==e.scrollbarFiller||f==e.gutterFiller)return null}var g,h,i=e.lineSpace.getBoundingClientRect();try{g=b.clientX-i.left,h=b.clientY-i.top}catch(b){return null}var j,k=Xa(a,g,h);if(d&&1==k.xRel&&(j=Dd(a.doc,k.line).text).length==k.ch){var l=rg(j,j.length,a.options.tabSize)-j.length;k=rf(k.line,Math.max(0,Math.round((g-Ca(a.display).left)/$a(a.display))-l))}return k}function Gb(a){if(!de(this,a)){var b=this,c=b.display;if(c.shift=a.shiftKey,Eb(c,a))return void(_e||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!Lb(b,a)){var d=Fb(b,a);switch(window.focus(),ae(a)){case 1:d?Hb(b,a,d):_d(a)==c.scroller&&fg(a);break;case 2:_e&&(b.state.lastMiddleDown=+new Date),d&&ea(b.doc,d),setTimeout(pe(zb,b),20),fg(a);break;case 3:of&&_b(b,a)}}}}function Hb(a,b,c){setTimeout(pe(Ab,a),0);var d,e=+new Date;vf&&vf.time>e-400&&0==sf(vf.pos,c)?d="triple":uf&&uf.time>e-400&&0==sf(uf.pos,c)?(d="double",vf={time:e,pos:c}):(d="single",uf={time:e,pos:c});var f=a.doc.sel,g=kf?b.metaKey:b.ctrlKey;a.options.dragDrop&&Cg&&!Bb(a)&&"single"==d&&f.contains(c)>-1&&f.somethingSelected()?Ib(a,b,c,g):Jb(a,b,c,d,g)}function Ib(a,b,c,d){var e=a.display,f=jb(a,function(g){_e&&(e.scroller.draggable=!1),a.state.draggingText=!1,jg(document,"mouseup",f),jg(e.scroller,"drop",f),Math.abs(b.clientX-g.clientX)+Math.abs(b.clientY-g.clientY)<10&&(fg(g),d||ea(a.doc,c),zb(a),Ze&&9==$e&&setTimeout(function(){document.body.focus(),zb(a)},20))});_e&&(e.scroller.draggable=!0),a.state.draggingText=f,e.scroller.dragDrop&&e.scroller.dragDrop(),ig(document,"mouseup",f),ig(e.scroller,"drop",f)}function Jb(a,b,c,d,e){function f(b){if(0!=sf(p,b))if(p=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=rg(Dd(j,c.line).text,c.ch,f),h=rg(Dd(j,b.line).text,b.ch,f),i=Math.min(g,h),n=Math.max(g,h),o=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));q>=o;o++){var r=Dd(j,o).text,s=ie(r,i,f);i==n?e.push(new X(rf(o,s),rf(o,s))):r.length>s&&e.push(new X(rf(o,s),rf(o,ie(r,n,f))))}e.length||e.push(new X(c,c)),ka(j,Y(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new X(rf(b.line,0),_(j,rf(b.line+1,0)));sf(w.anchor,u)>0?(v=w.head,u=V(t.from(),w.anchor)):(v=w.anchor,u=U(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new X(_(j,u),v),ka(j,Y(e,l),pg)}}function g(b){var c=++r,e=Fb(a,b,!0,"rect"==d);if(e)if(0!=sf(e,p)){Ab(a),f(e);var h=s(i,j);(e.line>=h.to||e.line<h.from)&&setTimeout(jb(a,function(){r==c&&g(b)}),150)}else{var k=b.clientY<q.top?-20:b.clientY>q.bottom?20:0;k&&setTimeout(jb(a,function(){r==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(b){r=1/0,fg(b),zb(a),jg(document,"mousemove",t),jg(document,"mouseup",u),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;fg(b);var k,l,m=j.sel;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?j.sel.ranges[l]:new X(c,c)):k=j.sel.primary(),b.altKey)d="rect",e||(k=new X(c,c)),c=Fb(a,b,!0,!0),l=-1;else if("double"==d){var n=a.findWordAt(c);k=a.display.shift||j.extend?da(j,k,n.anchor,n.head):n}else if("triple"==d){var o=new X(rf(c.line,0),_(j,rf(c.line+1,0)));k=a.display.shift||j.extend?da(j,k,o.anchor,o.head):o}else k=da(j,k,c);e?l>-1?ga(j,l,k,pg):(l=j.sel.ranges.length,ka(j,Y(j.sel.ranges.concat([k]),l),{scroll:!1,origin:"*mouse"})):(l=0,ka(j,new W([k],0),pg),m=j.sel);var p=c,q=i.wrapper.getBoundingClientRect(),r=0,t=jb(a,function(a){ae(a)?g(a):h(a)}),u=jb(a,h);ig(document,"mousemove",t),ig(document,"mouseup",u)}function Kb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&fg(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!fe(a,c))return $d(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=Id(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),$d(b)}}}function Lb(a,b){return Kb(a,b,"gutterClick",!0,be)}function Mb(a){var b=this;if(!de(b,a)&&!Eb(b.display,a)){fg(a),Ze&&(Af=+new Date);var c=Fb(b,a,!0),d=a.dataTransfer.files;if(c&&!Bb(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=jb(b,function(){if(f[d]=h.result,++g==e){c=_(b.doc,c);var a={from:c,to:c,text:Dg(f.join("\n")),origin:"paste"};gc(b.doc,a),ja(b.doc,Z(c,Ff(a)))}}),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(pe(zb,b),20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!(kf?a.metaKey:a.ctrlKey))var j=b.listSelections();if(la(b.doc,Z(c,c)),j)for(var i=0;i<j.length;++i)mc(b.doc,"",j[i].anchor,j[i].head,"drag");b.replaceSelection(f,"around","paste"),zb(b)}}catch(a){}}}}function Nb(a,b){if(Ze&&(!a.state.draggingText||+new Date-Af<100))return void hg(b);if(!de(a,b)&&!Eb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!df)){var c=te("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",cf&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),cf&&c.parentNode.removeChild(c)}}function Ob(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,We||A(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),We&&A(a),wa(a,100))}function Pb(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,t(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function Qb(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&b.detail&&b.axis==b.HORIZONTAL_AXIS&&(c=b.detail),null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&kf&&_e)a:for(var g=b.target,h=e.view;g!=f;g=g.parentNode)for(var i=0;i<h.length;i++)if(h[i].node==g){a.display.currentWheelTarget=g;break a}if(c&&!We&&!cf&&null!=Cf)return d&&Ob(a,Math.max(0,Math.min(f.scrollTop+d*Cf,f.scrollHeight-f.clientHeight))),Pb(a,Math.max(0,Math.min(f.scrollLeft+c*Cf,f.scrollWidth-f.clientWidth))),fg(b),void(e.wheelStartX=null);if(d&&null!=Cf){var j=d*Cf,k=a.doc.scrollTop,l=k+e.wrapper.clientHeight;0>j?k=Math.max(0,k+j-50):l=Math.min(a.doc.height,l+j+50),A(a,{top:k,bottom:l})}20>Bf&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,c=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null,c&&(Cf=(Cf*Bf+c)/(Bf+1),++Bf)}},200)):(e.wheelDX+=c,e.wheelDY+=d))}}function Rb(a,b,c){if("string"==typeof b&&(b=Qf[b],!b))return!1;a.display.pollingFast&&xb(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{Bb(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=ng}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Sb(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function Tb(a,b){var c=Ac(a.options.keyMap),d=c.auto;clearTimeout(Df),d&&!Tf(b)&&(Df=setTimeout(function(){Ac(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,h(a))},50));var e=Uf(b,!0),f=!1;if(!e)return!1;var g=Sb(a);return f=b.shiftKey?Sf("Shift-"+e,g,function(b){return Rb(a,b,!0)})||Sf(e,g,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?Rb(a,b):void 0}):Sf(e,g,function(b){return Rb(a,b)}),f&&(fg(b),va(a),be(a,"keyHandled",a,e,b)),f}function Ub(a,b,c){var d=Sf("'"+c+"'",Sb(a),function(b){return Rb(a,b,!0)});return d&&(fg(b),va(a),be(a,"keyHandled",a,"'"+c+"'",b)),d}function Vb(a){var b=this;if(Ab(b),!de(b,a)){Ze&&11>$e&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=Tb(b,a);cf&&(Ef=d?c:null,!d&&88==c&&!Fg&&(kf?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||Wb(b)}}function Wb(a){function b(a){18!=a.keyCode&&a.altKey||(ze(c,"CodeMirror-crosshair"),jg(document,"keyup",b),jg(document,"mouseover",b))}var c=a.display.lineDiv;Ae(c,"CodeMirror-crosshair"),ig(document,"keyup",b),ig(document,"mouseover",b)}function Xb(a){16==a.keyCode&&(this.doc.sel.shift=!1),de(this,a)}function Yb(a){var b=this;if(!(de(b,a)||a.ctrlKey&&!a.altKey||kf&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(cf&&c==Ef)return Ef=null,void fg(a);if(!(cf&&(!a.which||a.which<10)||ef)||!Tb(b,a)){var e=String.fromCharCode(null==d?c:d);Ub(b,a,e)||(Ze&&$e>=9&&(b.display.inputHasSelection=null),wb(b))}}}function Zb(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(kg(a,"focus",a),a.state.focused=!0,Ae(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(yb(a),_e&&setTimeout(pe(yb,a,!0),0))),vb(a),va(a))}function $b(a){a.state.focused&&(kg(a,"blur",a),a.state.focused=!1,ze(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function _b(a,b){function c(){if(null!=e.input.selectionStart){var b=a.somethingSelected(),c=e.input.value=""+(b?e.input.value:"");e.prevInput=b?"":"",e.input.selectionStart=1,e.input.selectionEnd=c.length,e.selForContextMenu=a.doc.sel}}function d(){if(e.inputDiv.style.position="relative",e.input.style.cssText=i,Ze&&9>$e&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=g),vb(a),null!=e.input.selectionStart){(!Ze||Ze&&9>$e)&&c();var b=0,d=function(){e.selForContextMenu==a.doc.sel&&0==e.input.selectionStart?jb(a,Qf.selectAll)(a):b++<10?e.detectingSelectAll=setTimeout(d,500):yb(a)};e.detectingSelectAll=setTimeout(d,200)}}if(!de(a,b,"contextmenu")){var e=a.display;if(!Eb(e,b)&&!ac(a,b)){var f=Fb(a,b),g=e.scroller.scrollTop;if(f&&!cf){var h=a.options.resetSelectionOnContextMenu;h&&-1==a.doc.sel.contains(f)&&jb(a,ka)(a.doc,Z(f),og);var i=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(Ze?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",_e)var j=window.scrollY;if(zb(a),_e&&window.scrollTo(null,j),yb(a),a.somethingSelected()||(e.input.value=e.prevInput=" "),e.selForContextMenu=a.doc.sel,clearTimeout(e.detectingSelectAll),Ze&&$e>=9&&c(),of){hg(b);var k=function(){jg(window,"mouseup",k),setTimeout(d,20)};ig(window,"mouseup",k)}else setTimeout(d,50)}}}}function ac(a,b){return fe(a,"gutterContextMenu")?Kb(a,b,"gutterContextMenu",!1,kg):!1}function bc(a,b){if(sf(a,b.from)<0)return a;if(sf(a,b.to)<=0)return Ff(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+=Ff(b).ch-b.to.ch),rf(c,d)}function cc(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new X(bc(e.anchor,b),bc(e.head,b)))}return Y(c,a.sel.primIndex)}function dc(a,b,c){return a.line==b.line?rf(c.line,a.ch-b.ch+c.ch):rf(c.line+(a.line-b.line),a.ch)}function ec(a,b,c){for(var d=[],e=rf(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=dc(h.from,e,f),j=dc(Ff(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=sf(k.head,k.anchor)<0;d[g]=new X(l?j:i,l?i:j)}else d[g]=new X(i,i)}return new W(d,a.sel.primIndex)}function fc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=_(a,b)),c&&(this.to=_(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),kg(a,"beforeChange",a,d),a.cm&&kg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function gc(a,b,c){if(a.cm){if(!a.cm.curOp)return jb(a.cm,gc)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(fe(a,"beforeChange")||a.cm&&fe(a.cm,"beforeChange"))||(b=fc(a,b,!0))){var d=pf&&!c&&Pc(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)hc(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else hc(a,b)}}function hc(a,b){if(1!=b.text.length||""!=b.text[0]||0!=sf(b.from,b.to)){var c=cc(a,b);Pd(a,b,c,a.cm?a.cm.curOp.id:NaN),kc(a,b,c,Mc(a,b));var d=[];Bd(a,function(a,c){c||-1!=le(d,a.history)||(Zd(a.history,b),d.push(a.history)),kc(a,b,null,Mc(a,b))})}}function ic(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i<g.length&&(d=g[i],c?!d.ranges||d.equals(a.sel):d.ranges);i++);if(i!=g.length){for(e.lastOrigin=e.lastSelOrigin=null;d=g.pop(),d.ranges;){if(Sd(d,h),c&&!d.equals(a.sel))return void ka(a,d,{clearRedo:!1});f=d}var j=[];Sd(f,h),h.push({changes:j,generation:e.generation}),e.generation=d.generation||++e.maxGeneration;for(var k=fe(a,"beforeChange")||a.cm&&fe(a.cm,"beforeChange"),i=d.changes.length-1;i>=0;--i){var l=d.changes[i];if(l.origin=b,k&&!fc(a,l,!1))return void(g.length=0);j.push(Md(a,l));var m=i?cc(a,l):ke(g);kc(a,l,m,Oc(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:Ff(l)});var n=[];Bd(a,function(a,b){b||-1!=le(n,a.history)||(Zd(a.history,l),n.push(a.history)),kc(a,l,null,Oc(a,l))})}}}}function jc(a,b){if(0!=b&&(a.first+=b,a.sel=new W(me(a.sel.ranges,function(a){return new X(rf(a.anchor.line+b,a.anchor.ch),rf(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){ob(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)pb(a.cm,d,"gutter")}}function kc(a,b,c,d){if(a.cm&&!a.cm.curOp)return jb(a.cm,kc)(a,b,c,d);if(b.to.line<a.first)return void jc(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);jc(a,e),b={from:rf(a.first,0),to:rf(b.to.line+e,b.to.ch),text:[ke(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:rf(f,Dd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Ed(a,b.from,b.to),c||(c=cc(a,b)),a.cm?lc(a.cm,b,d):yd(a,b,d),la(a,c,og)}}function lc(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=Hd(Zc(Dd(d,g.line))),d.iter(j,h.line+1,function(a){return a==e.maxLine?(i=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&ee(a),yd(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,function(a){var b=m(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),wa(a,400);var k=b.text.length-(h.line-g.line)-1;g.line!=h.line||1!=b.text.length||xd(a.doc,b)?ob(a,g.line,h.line+1,k):pb(a,g.line,"text");var l=fe(a,"changes"),n=fe(a,"change");if(n||l){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&be(a,"change",a,o),l&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function mc(a,b,c,d,e){if(d||(d=c),sf(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=Dg(b)),gc(a,{from:c,to:d,text:b,origin:e})}function nc(a,b){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!gf){var f=te("div","",null,"position: absolute; top: "+(b.top-c.viewOffset-Aa(a.display))+"px; height: "+(b.bottom-b.top+mg)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}function oc(a,b,c,d){null==d&&(d=0);for(var e=0;5>e;e++){var f=!1,g=Ua(a,b),h=c&&c!=b?Ua(a,c):g,i=qc(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(Ob(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(Pb(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)return g}}function pc(a,b,c,d,e){var f=qc(a,b,c,d,e);null!=f.scrollTop&&Ob(a,f.scrollTop),null!=f.scrollLeft&&Pb(a,f.scrollLeft)}function qc(a,b,c,d,e){var f=a.display,g=Za(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=f.scroller.clientHeight-mg,j={};e-c>i&&(e=c+i);var k=a.doc.height+Ba(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=f.scroller.clientWidth-mg-f.gutters.offsetWidth,q=d-b>p;return q&&(d=b+p),10>b?j.scrollLeft=0:o>b?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function rc(a,b,c){(null!=b||null!=c)&&tc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function sc(a){tc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?rf(b.line,b.ch-1):b,d=rf(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function tc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Va(a,b.from),d=Va(a,b.to),e=qc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function uc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=za(a,b):c="prev");var g=a.options.tabSize,h=Dd(f,b),i=rg(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==ng||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?rg(Dd(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 l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+=" ";if(j>m&&(l+=je(j-m)),l!=k)mc(f,l,rf(b,0),rf(b,k.length),"+input");else for(var n=0;n<f.sel.ranges.length;n++){var o=f.sel.ranges[n];if(o.head.line==b&&o.head.ch<k.length){var m=rf(b,k.length);ga(f,n,new X(m,m));break}}h.stateAfter=null}function vc(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=Dd(a,$(a,b)):e=Hd(b),null==e?null:(d(f,e)&&a.cm&&pb(a.cm,e,c),f)}function wc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&sf(f.from,ke(d).to)<=0;){var g=d.pop();if(sf(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}ib(a,function(){for(var b=d.length-1;b>=0;b--)mc(a.doc,"",d[b].from,d[b].to,"+delete");sc(a)})}function xc(a,b,c,d,e){function f(){var b=h+c;return b<a.first||b>=a.first+a.size?l=!1:(h=b,k=Dd(a,b))}function g(a){var b=(e?Ue:Ve)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(0>c?Ne:Me)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Dd(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||g(!p);p=!1){var q=k.text.charAt(i)||"\n",r=qe(q,o)?"w":n&&"\n"==q?"n":!n||/\s/.test(q)?null:"p";if(!n||p||r||(r="s"),m&&m!=r){0>c&&(c=1,g());break}if(r&&(m=r),c>0&&!g(!p))break}var s=pa(a,rf(h,i),j,!0);return l||(s.hitSide=!0),s}function yc(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);e=b.top+c*(h-(0>c?1.5:.5)*Za(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=Xa(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function zc(b,c,d,e){a.defaults[b]=c,d&&(Hf[b]=e?function(a,b,c){c!=If&&d(a,b,c)}:d)}function Ac(a){return"string"==typeof a?Rf[a]:a}function Bc(a,b,c,d,e){if(d&&d.shared)return Cc(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return jb(a.cm,Bc)(a,b,c,d,e);var f=new Wf(a,e),g=sf(b,c);if(d&&oe(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=te("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(Yc(a,b.line,b,c,f)||b.line!=c.line&&Yc(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");qf=!0}f.addToHistory&&Pd(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,function(a){j&&f.collapsed&&!j.options.lineWrapping&&Zc(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&Gd(a,0),Jc(a,new Gc(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i}),f.collapsed&&a.iter(b.line,c.line+1,function(b){bd(a,b)&&Gd(b,0)}),f.clearOnEnter&&ig(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(pf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++Xf,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)ob(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(var k=b.line;k<=c.line;k++)pb(j,k,"text");f.atomic&&na(j.doc),be(j,"markerAdded",j,f)}return f}function Cc(a,b,c,d,e){d=oe(d),d.shared=!1;var f=[Bc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Bd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Bc(a,_(a,b),_(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=ke(f)}),new Yf(f,g)}function Dc(a){return a.findMarks(rf(a.first,0),a.clipPos(rf(a.lastLine())),function(a){return a.parent})}function Ec(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(sf(f,g)){var h=Bc(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function Fc(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Bd(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==le(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function Gc(a,b,c){this.marker=a,this.from=b,this.to=c}function Hc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Ic(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Jc(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Kc(a,b,c){if(a)for(var d,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 Gc(g,f.from,i?null:f.to))}}return d}function Lc(a,b,c){if(a)for(var d,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 Gc(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return d}function Mc(a,b){var c=ba(a,b.from.line)&&Dd(a,b.from.line).markedSpans,d=ba(a,b.to.line)&&Dd(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==sf(b.from,b.to),h=Kc(c,e,g),i=Lc(d,f,g),j=1==b.text.length,k=ke(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=Hc(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=Hc(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=Nc(h)),i&&i!=h&&(i=Nc(i));var o=[h];if(!j){var p,q=b.text.length-2;if(q>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(p||(p=[])).push(new Gc(h[l].marker,null,null));for(var l=0;q>l;++l)o.push(p);o.push(i)}return o}function Nc(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 Oc(a,b){var c=Vd(a,b),d=Mc(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 Pc(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!=le(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(!(sf(j.to,h.from)<0||sf(j.from,h.to)>0)){var k=[i,1],l=sf(j.from,h.from),m=sf(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Qc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Rc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Sc(a){return a.inclusiveLeft?-1:0}function Tc(a){return a.inclusiveRight?1:0}function Uc(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=sf(d.from,e.from)||Sc(a)-Sc(b);if(f)return-f;var g=sf(d.to,e.to)||Tc(a)-Tc(b);return g?g:b.id-a.id}function Vc(a,b){var c,d=qf&&a.markedSpans;if(d)for(var e,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||Uc(c,e.marker)<0)&&(c=e.marker);return c}function Wc(a){return Vc(a,!0)}function Xc(a){return Vc(a,!1)}function Yc(a,b,c,d,e){var f=Dd(a,b),g=qf&&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=sf(j.from,c)||Sc(i.marker)-Sc(e),l=sf(j.to,d)||Tc(i.marker)-Tc(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(sf(j.to,c)>0||i.marker.inclusiveRight&&e.inclusiveLeft)||k>=0&&(sf(j.from,d)<0||i.marker.inclusiveLeft&&e.inclusiveRight)))return!0}}}function Zc(a){for(var b;b=Wc(a);)a=b.find(-1,!0).line;return a}function $c(a){for(var b,c;b=Xc(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function _c(a,b){var c=Dd(a,b),d=Zc(c);return c==d?b:Hd(d)}function ad(a,b){if(b>a.lastLine())return b;var c,d=Dd(a,b);if(!bd(a,d))return b;for(;c=Xc(d);)d=c.find(1,!0).line;return Hd(d)+1}function bd(a,b){var c=qf&&b.markedSpans;if(c)for(var d,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&&cd(a,b,d))return!0}}function cd(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return cd(a,d.line,Hc(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,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)&&cd(a,b,e))return!0}function dd(a,b,c){Jd(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&rc(a,null,c)}function ed(a){if(null!=a.height)return a.height;if(!we(document.body,a.node)){var b="position: relative;";a.coverGutter&&(b+="margin-left: -"+a.cm.getGutterElement().offsetWidth+"px;"),ve(a.cm.display.measure,te("div",[a.node],null,b))}return a.height=a.node.offsetHeight}function fd(a,b,c,d){var e=new Zf(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),vc(a.doc,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,!bd(a.doc,b)){var d=Jd(b)<a.doc.scrollTop;Gd(b,b.height+ed(e)),d&&rc(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function gd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Qc(a),Rc(a,c);var e=d?d(a):1;e!=a.height&&Gd(a,e)}function hd(a){a.parent=null,Qc(a)}function id(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 jd(b,c){if(b.blankLine)return b.blankLine(c);if(b.innerMode){var d=a.innerMode(b,c);return d.mode.blankLine?d.mode.blankLine(d.state):void 0}}function kd(a,b,c){for(var d=0;10>d;d++){var e=a.token(b,c);if(b.pos>b.start)return e}throw new Error("Mode "+a.name+" failed to advance stream.")}function ld(b,c,d,e,f,g,h){var i=d.flattenSpans;null==i&&(i=b.options.flattenSpans);var j,k=0,l=null,m=new Vf(c,b.options.tabSize);for(""==c&&id(jd(d,e),g);!m.eol();){if(m.pos>b.options.maxHighlightLength?(i=!1,h&&od(b,c,e,m.pos),m.pos=c.length,j=null):j=id(kd(d,m,e),g),b.options.addModeClass){var n=a.innerMode(d,e).mode.name;n&&(j="m-"+(j?n+" "+j:n))}i&&l==j||(k<m.start&&f(m.start,l),k=m.start,l=j),m.start=m.pos}for(;k<m.pos;){var o=Math.min(m.pos,k+5e4);f(o,l),k=o}}function md(a,b,c,d){var e=[a.state.modeGen],f={};ld(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;ld(a,b.text,h.mode,!0,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,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function nd(a,b){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=md(a,b,b.stateAfter=za(a,Hd(b)));b.styles=c.styles,c.classes?b.styleClasses=c.classes:b.styleClasses&&(b.styleClasses=null)}return b.styles}function od(a,b,c,d){var e=a.doc.mode,f=new Vf(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&jd(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)kd(e,f,c),f.start=f.pos}function pd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?ag:_f;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function qd(a,b){var c=te("span",null,null,_e?"padding-right: .1px":null),d={pre:te("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=sd,(Ze||_e)&&a.getOption("lineWrapping")&&(d.addToken=td(d.addToken)),He(a.display.measure)&&(f=Kd(g))&&(d.addToken=ud(d.addToken,f)),d.map=[],wd(g,d,nd(a,g)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Be(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Be(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Ge(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return kg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Be(d.pre.className,d.textClass||"")),d}function rd(a){var b=te("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function sd(a,b,c,d,e,f){if(b){var g=a.cm.options.specialChars,h=!1;if(g.test(b))for(var i=document.createDocumentFragment(),j=0;;){g.lastIndex=j;var k=g.exec(b),l=k?k.index-j:b.length-j;if(l){var m=document.createTextNode(b.slice(j,j+l));i.appendChild(Ze&&9>$e?te("span",[m]):m),a.map.push(a.pos,a.pos+l,m),a.col+=l,a.pos+=l}if(!k)break;if(j+=l+1," "==k[0]){var n=a.cm.options.tabSize,o=n-a.col%n,m=i.appendChild(te("span",je(o),"cm-tab"));a.col+=o}else{var m=a.cm.options.specialCharPlaceholder(k[0]);i.appendChild(Ze&&9>$e?te("span",[m]):m),a.col+=1}a.map.push(a.pos,a.pos+1,m),a.pos++}else{a.col+=b.length;var i=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,i),Ze&&9>$e&&(h=!0),a.pos+=b.length}if(c||d||e||h){var p=c||"";d&&(p+=d),e&&(p+=e);var q=te("span",[i],p);return f&&(q.title=f),a.content.appendChild(q)}a.content.appendChild(i)}}function td(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function ud(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var i=c.pos,j=i+d.length;;){for(var k=0;k<b.length;k++){var l=b[k];if(l.to>i&&l.from<=i)break}if(l.to>=j)return a(c,d,e,f,g,h);a(c,d.slice(0,l.to-i),e,f,null,h),f=null,d=d.slice(l.to-i),i=l.to}}}function vd(a,b,c,d){var e=!d&&c.widgetNode;e&&(a.map.push(a.pos,a.pos+b,e),a.content.appendChild(e)),a.pos+=b}function wd(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m=e.length,n=0,o=1,p="",q=0;;){if(q==n){h=i=j=k="",l=null,q=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=n&&(null==t.to||t.to>n)?(null!=t.to&&q>t.to&&(q=t.to,i=""),u.className&&(h+=" "+u.className),u.startStyle&&t.from==n&&(j+=" "+u.startStyle),u.endStyle&&t.to==q&&(i+=" "+u.endStyle),u.title&&!k&&(k=u.title),u.collapsed&&(!l||Uc(l.marker,u)<0)&&(l=t)):t.from>n&&q>t.from&&(q=t.from),"bookmark"==u.type&&t.from==n&&u.widgetNode&&r.push(u)}if(l&&(l.from||0)==n&&(vd(b,(null==l.to?m+1:l.to)-n,l.marker,null==l.from),null==l.to))return;if(!l&&r.length)for(var s=0;s<r.length;++s)vd(b,0,r[s])}if(n>=m)break;for(var v=Math.min(m,q);;){if(p){var w=n+p.length;if(!l){var x=w>v?p.slice(0,v-n):p;b.addToken(b,x,g?g+h:h,j,n+x.length==q?i:"",k)}if(w>=v){p=p.slice(v-n),n=v;break}n=w,j=""}p=e.slice(f,f=c[o++]),g=pd(c[o++],b.cm.options)}}else for(var o=1;o<c.length;o+=2)b.addToken(b,e.slice(f,f=c[o]),pd(c[o+1],b.cm.options))}function xd(a,b){return 0==b.from.ch&&0==b.to.ch&&""==ke(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function yd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){gd(a,c,e,d),be(a,"change",a,b)}var g=b.from,h=b.to,i=b.text,j=Dd(a,g.line),k=Dd(a,h.line),l=ke(i),m=e(i.length-1),n=h.line-g.line;if(xd(a,b)){for(var o=0,p=[];o<i.length-1;++o)p.push(new $f(i[o],e(o),d));f(k,k.text,m),n&&a.remove(g.line,n),p.length&&a.insert(g.line,p)}else if(j==k)if(1==i.length)f(j,j.text.slice(0,g.ch)+l+j.text.slice(h.ch),m);else{for(var p=[],o=1;o<i.length-1;++o)p.push(new $f(i[o],e(o),d));p.push(new $f(l+j.text.slice(h.ch),m,d)),f(j,j.text.slice(0,g.ch)+i[0],e(0)),a.insert(g.line+1,p)}else if(1==i.length)f(j,j.text.slice(0,g.ch)+i[0]+k.text.slice(h.ch),e(0)),a.remove(g.line+1,n);else{f(j,j.text.slice(0,g.ch)+i[0],e(0)),f(k,l+k.text.slice(h.ch),m);for(var o=1,p=[];o<i.length-1;++o)p.push(new $f(i[o],e(o),d));n>1&&a.remove(g.line+1,n-1),a.insert(g.line+1,p)}be(a,"change",a,b)}function zd(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function Ad(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Bd(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 Cd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,g(a),c(a),a.options.lineWrapping||n(a),a.options.mode=b.modeOption,ob(a)}function Dd(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 Ed(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 Fd(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function Gd(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function Hd(a){if(null==a.parent)return null;for(var b=a.parent,c=le(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 Id(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 d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(h>b)break;b-=h}return c+d}function Jd(a){a=Zc(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 d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function Kd(a){var b=a.order;return null==b&&(b=a.order=Jg(a.text)),b}function Ld(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 Md(a,b){var c={from:T(b.from),to:Ff(b),text:Ed(a,b.from,b.to)};return Td(a,c,b.from.line,b.to.line+1),Bd(a,function(a){Td(a,c,b.from.line,b.to.line+1)},!0),c}function Nd(a){for(;a.length;){var b=ke(a);if(!b.ranges)break;a.pop()}}function Od(a,b){return b?(Nd(a.done),ke(a.done)):a.done.length&&!ke(a.done).ranges?ke(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),ke(a.done)):void 0}function Pd(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=Od(e,e.lastOp==d))){var h=ke(f.changes);0==sf(b.from,b.to)&&0==sf(b.from,h.to)?h.to=Ff(b):f.changes.push(Md(a,b))}else{var i=ke(e.done);for(i&&i.ranges||Sd(a.sel,e.done),f={changes:[Md(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=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||kg(a,"historyAdded")}function Qd(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 Rd(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||Qd(a,f,ke(e.done),b))?e.done[e.done.length-1]=b:Sd(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&Nd(e.undone)}function Sd(a,b){var c=ke(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Td(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 Ud(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 Vd(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(Ud(c[d]));return e}function Wd(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?W.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var j,k=g[i];if(h.push({from:k.from,to:k.to,text:k.text}),b)for(var l in k)(j=l.match(/^spans_(\d+)$/))&&le(b,Number(j[1]))>-1&&(ke(h)[l]=k[l],delete k[l])}}}return e}function Xd(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Yd(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++)Xd(f.ranges[h].anchor,b,c,d),Xd(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=rf(i.from.line+d,i.from.ch),i.to=rf(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Zd(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Yd(a.done,c,d,e),Yd(a.undone,c,d,e)}function $d(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function _d(a){return a.target||a.srcElement}function ae(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),kf&&a.ctrlKey&&1==b&&(b=3),b}function be(a,b){function c(a){return function(){a.apply(null,f)}}var d=a._handlers&&a._handlers[b];if(d){var e,f=Array.prototype.slice.call(arguments,2);xf?e=xf.delayedCallbacks:lg?e=lg:(e=lg=[],setTimeout(ce,0));for(var g=0;g<d.length;++g)e.push(c(d[g]))}}function ce(){var a=lg;lg=null;for(var b=0;b<a.length;++b)a[b]()}function de(a,b,c){return kg(a,c||b.type,a,b),$d(b)||b.codemirrorIgnore}function ee(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==le(c,b[d])&&c.push(b[d])}function fe(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function ge(a){a.prototype.on=function(a,b){ig(this,a,b)},a.prototype.off=function(a,b){jg(this,a,b)}}function he(){this.id=null}function ie(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 je(a){for(;sg.length<=a;)sg.push(ke(sg)+" ");return sg[a]}function ke(a){return a[a.length-1]}function le(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function me(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function ne(a,b){var c;if(Object.create)c=Object.create(a);else{var d=function(){};d.prototype=a,c=new d}return b&&oe(b,c),c}function oe(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 pe(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function qe(a,b){return b?b.source.indexOf("\\w")>-1&&wg(a)?!0:b.test(a):wg(a)}function re(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function se(a){return a.charCodeAt(0)>=768&&xg.test(a)}function te(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 ue(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function ve(a,b){return ue(a).appendChild(b)}function we(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function xe(){return document.activeElement}function ye(a){return new RegExp("\\b"+a+"\\b\\s*")}function ze(a,b){var c=ye(b);c.test(a.className)&&(a.className=a.className.replace(c,""))}function Ae(a,b){ye(b).test(a.className)||(a.className+=" "+b)}function Be(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!ye(c[d]).test(b)&&(b+=" "+c[d]);return b}function Ce(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function De(){Bg||(Ee(),Bg=!0)}function Ee(){var a;ig(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,yg=null,Ce(Db)},100))}),ig(window,"blur",function(){Ce($b)})}function Fe(a){if(null!=yg)return yg;var b=te("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ve(a,b),b.offsetWidth&&(yg=b.offsetHeight-b.clientHeight),yg||0}function Ge(a){if(null==zg){var b=te("span","");ve(a,te("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(zg=b.offsetWidth<=1&&b.offsetHeight>2&&!(Ze&&8>$e))}return zg?te("span",""):te("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function He(a){if(null!=Ag)return Ag;var b=ve(a,document.createTextNode("AخA")),c=ug(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=ug(b,1,2).getBoundingClientRect();return Ag=d.right-c.right<3}function Ie(a){if(null!=Gg)return Gg;var b=ve(a,te("span","x")),c=b.getBoundingClientRect(),d=ug(b,0,1).getBoundingClientRect();return Gg=Math.abs(c.left-d.left)>1}function Je(a,b,c,d){if(!a)return d(b,c,"ltr");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"),e=!0)}e||d(b,c,"ltr")}function Ke(a){return a.level%2?a.to:a.from}function Le(a){return a.level%2?a.from:a.to}function Me(a){var b=Kd(a);return b?Ke(b[0]):0}function Ne(a){var b=Kd(a);return b?Le(ke(b)):a.text.length}function Oe(a,b){var c=Dd(a.doc,b),d=Zc(c);d!=c&&(b=Hd(d));var e=Kd(d),f=e?e[0].level%2?Ne(d):Me(d):0;return rf(b,f)}function Pe(a,b){for(var c,d=Dd(a.doc,b);c=Xc(d);)d=c.find(1,!0).line,b=null;var e=Kd(d),f=e?e[0].level%2?Me(d):Ne(d):d.text.length;return rf(null==b?Hd(d):b,f)}function Qe(a,b){var c=Oe(a,b.line),d=Dd(a.doc,c.line),e=Kd(d);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 rf(c.line,g?0:f)}return c}function Re(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Se(a,b){Ig=null;for(var c,d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b){if(null!=c)return Re(a,e.level,a[c].level)?(e.from!=e.to&&(Ig=c),d):(e.from!=e.to&&(Ig=d),c);c=d}}return c}function Te(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&se(a.text.charAt(b)));return b}function Ue(a,b,c,d){var e=Kd(a);if(!e)return Ve(a,b,c,d);for(var f=Se(e,b),g=e[f],h=Te(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return Se(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Te(a,g.to,-1,d):Te(a,g.from,1,d)}}function Ve(a,b,c,d){var e=b+c;if(d)for(;e>0&&se(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var We=/gecko\/\d/i.test(navigator.userAgent),Xe=/MSIE \d/.test(navigator.userAgent),Ye=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ze=Xe||Ye,$e=Ze&&(Xe?document.documentMode||6:Ye[1]),_e=/WebKit\//.test(navigator.userAgent),af=_e&&/Qt\/\d+\.\d+/.test(navigator.userAgent),bf=/Chrome\//.test(navigator.userAgent),cf=/Opera\//.test(navigator.userAgent),df=/Apple Computer/.test(navigator.vendor),ef=/KHTML\//.test(navigator.userAgent),ff=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),gf=/PhantomJS/.test(navigator.userAgent),hf=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),jf=hf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),kf=hf||/Mac/.test(navigator.platform),lf=/win/i.test(navigator.platform),mf=cf&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);mf&&(mf=Number(mf[1])),mf&&mf>=15&&(cf=!1,_e=!0);var nf=kf&&(af||cf&&(null==mf||12.11>mf)),of=We||Ze&&$e>=9,pf=!1,qf=!1,rf=a.Pos=function(a,b){return this instanceof rf?(this.line=a,void(this.ch=b)):new rf(a,b)},sf=a.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};W.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=sf(c.anchor,d.anchor)||0!=sf(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new X(T(this.ranges[b].anchor),T(this.ranges[b].head));return new W(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(sf(b,d.from())>=0&&sf(a,d.to())<=0)return c}return-1}},X.prototype={from:function(){return V(this.anchor,this.head)},to:function(){return U(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var tf,uf,vf,wf={left:0,right:0,top:0,bottom:0},xf=null,yf=0,zf=null,Af=0,Bf=0,Cf=null;Ze?Cf=-.53:We?Cf=15:bf?Cf=-.7:df&&(Cf=-1/3);var Df,Ef=null,Ff=a.changeEnd=function(a){return a.text?rf(a.from.line+a.text.length-1,ke(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),zb(this),wb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,Hf.hasOwnProperty(a)&&jb(this,Hf[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:kb(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:d,modeSpec:b,opaque:c&&c.opaque}),this.state.modeGen++,ob(this)}),removeOverlay:kb(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,void ob(this)}}),indentLine:kb(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),ba(this.doc,a)&&uc(this,a,b,c)}),indentSelection:kb(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(uc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&sc(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;c>i;++i)uc(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&ga(this.doc,d,new X(f,j[d].to()),og)}}}),getTokenAt:function(a,b){var c=this.doc;a=_(c,a);for(var d=za(this,a.line,b),e=this.doc.mode,f=Dd(c,a.line),g=new Vf(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=kd(e,g,d)}return{start:g.start,end:g.pos,string:g.current(),type:h||null,state:d}},getTokenTypeAt:function(a){a=_(this.doc,a);var b,c=nd(this,Dd(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("cm-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 c=[];if(!Nf.hasOwnProperty(b))return Nf;var d=Nf[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==le(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=$(c,null==a?c.first+c.size-1:a),za(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?_(this.doc,a):a?d.from():d.to(),Ua(this,c,b||"page")},charCoords:function(a,b){return Ta(this,_(this.doc,a),b||"page")},coordsChar:function(a,b){return a=Sa(this,a,b||"page"),Xa(this,a.left,a.top)},lineAtHeight:function(a,b){return a=Sa(this,{top:a,left:0},b||"page").top,Id(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=Dd(this.doc,a);return Ra(this,e,{top:0,left:0},b||"page").top+(c?this.doc.height-Jd(e):0)},defaultTextHeight:function(){return Za(this.display)},defaultCharWidth:function(){return $a(this.display)},setGutterMarker:kb(function(a,b,c){return vc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&re(d)&&(a.gutterMarkers=null),!0})}),clearGutter:kb(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,pb(b,d,"gutter"),re(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineWidget:kb(function(a,b,c){return fd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!ba(this.doc,a))return null;var b=a;if(a=Dd(this.doc,a),!a)return null}else{var b=Hd(a);if(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}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=Ua(this,_(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",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&&pc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:kb(Vb),triggerOnKeyPress:kb(Yb),triggerOnKeyUp:Xb,execCommand:function(a){return Qf.hasOwnProperty(a)?Qf[a](this):void 0},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=_(this.doc,a);b>f&&(g=xc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:kb(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?xc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},qg)}),deleteH:kb(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):wc(this,function(c){var e=xc(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=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=_(this.doc,a);b>g;++g){var i=Ua(this,h,"div");if(null==f?f=i.left:i.left=f,h=yc(this,i,e,c),h.hitSide)break}return h},moveV:kb(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=Ua(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=yc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&rc(c,null,Ta(c,i,"div").top-h.top),i},qg),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=Dd(b,a.line).text,d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");(a.xRel<0||e==c.length)&&d?--d:++e;for(var g=c.charAt(d),h=qe(g,f)?function(a){return qe(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!qe(a)};d>0&&h(c.charAt(d-1));)--d;for(;e<c.length&&h(c.charAt(e));)++e}return new X(rf(a.line,d),rf(a.line,e))},toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Ae(this.display.cursorDiv,"CodeMirror-overwrite"):ze(this.display.cursorDiv,"CodeMirror-overwrite"),kg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return xe()==this.display.input},scrollTo:kb(function(a,b){(null!=a||null!=b)&&tc(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=mg;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:kb(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:rf(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)tc(this),this.curOp.scrollToPos=a;else{var c=qc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:kb(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}var d=this;null!=a&&(d.display.wrapper.style.width=c(a)),null!=b&&(d.display.wrapper.style.height=c(b)),d.options.lineWrapping&&Na(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){pb(d,e,"widget");break;
- }++e}),d.curOp.forceUpdate=!0,kg(d,"refresh",this)}),operation:function(a){return ib(this,a)},refresh:kb(function(){var a=this.display.cachedTextHeight;ob(this),this.curOp.forceUpdate=!0,Oa(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),l(this),(null==a||Math.abs(a-Za(this.display))>.5)&&g(this),kg(this,"refresh",this)}),swapDoc:kb(function(a){var b=this.doc;return b.cm=null,Cd(this,a),Oa(this),yb(this),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,be(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ge(a);var Gf=a.defaults={},Hf=a.optionHandlers={},If=a.Init={toString:function(){return"CodeMirror.Init"}};zc("value","",function(a,b){a.setValue(b)},!0),zc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),zc("indentUnit",2,c,!0),zc("indentWithTabs",!1),zc("smartIndent",!0),zc("tabSize",4,function(a){d(a),Oa(a),ob(a)},!0),zc("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test(" ")?"":"| "),"g"),a.refresh()},!0),zc("specialCharPlaceholder",rd,function(a){a.refresh()},!0),zc("electricChars",!0),zc("rtlMoveVisually",!lf),zc("wholeLineUpdateBefore",!0),zc("theme","default",function(a){i(a),j(a)},!0),zc("keyMap","default",h),zc("extraKeys",null),zc("lineWrapping",!1,e,!0),zc("gutters",[],function(a){o(a.options),j(a)},!0),zc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?w(a.display)+"px":"0",a.refresh()},!0),zc("coverGutterNextToScrollbar",!1,r,!0),zc("lineNumbers",!1,function(a){o(a.options),j(a)},!0),zc("firstLineNumber",1,j,!0),zc("lineNumberFormatter",function(a){return a},j,!0),zc("showCursorWhenSelecting",!1,sa,!0),zc("resetSelectionOnContextMenu",!0),zc("readOnly",!1,function(a,b){"nocursor"==b?($b(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||yb(a))}),zc("disableInput",!1,function(a,b){b||yb(a)},!0),zc("dragDrop",!0),zc("cursorBlinkRate",530),zc("cursorScrollMargin",0),zc("cursorHeight",1,sa,!0),zc("singleCursorHeightPerLine",!0,sa,!0),zc("workTime",100),zc("workDelay",100),zc("flattenSpans",!0,d,!0),zc("addModeClass",!1,d,!0),zc("pollInterval",100),zc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),zc("historyEventDelay",1250),zc("viewportMargin",10,function(a){a.refresh()},!0),zc("maxHighlightLength",1e4,d,!0),zc("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),zc("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),zc("autofocus",null);var Jf=a.modes={},Kf=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),Jf[b]=c},a.defineMIME=function(a,b){Kf[a]=b},a.resolveMode=function(b){if("string"==typeof b&&Kf.hasOwnProperty(b))b=Kf[b];else if(b&&"string"==typeof b.name&&Kf.hasOwnProperty(b.name)){var c=Kf[b.name];"string"==typeof c&&(c={name:c}),b=ne(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=Jf[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(Lf.hasOwnProperty(c.name)){var f=Lf[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var Lf=a.modeExtensions={};a.extendMode=function(a,b){var c=Lf.hasOwnProperty(a)?Lf[a]:Lf[a]={};oe(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){cg.prototype[a]=b},a.defineOption=zc;var Mf=[];a.defineInitHook=function(a){Mf.push(a)};var Nf=a.helpers={};a.registerHelper=function(b,c,d){Nf.hasOwnProperty(b)||(Nf[b]=a[b]={_global:[]}),Nf[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),Nf[b]._global.push({pred:d,val:e})};var Of=a.copyState=function(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},Pf=a.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var Qf=a.commands={selectAll:function(a){a.setSelection(rf(a.firstLine(),0),rf(a.lastLine()),og)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),og)},killLine:function(a){wc(a,function(b){if(b.empty()){var c=Dd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:rf(b.head.line+1,0)}:{from:b.head,to:rf(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){wc(a,function(b){return{from:rf(b.from().line,0),to:_(a.doc,rf(b.to().line+1,0))}})},delLineLeft:function(a){wc(a,function(a){return{from:rf(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){wc(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){wc(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){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(rf(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(rf(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return Oe(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return Qe(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){return Pe(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},qg)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},qg)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?Qe(a,b.head):d},qg)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){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=rg(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){ib(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=Dd(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new rf(e.line,e.ch-1)),e.ch>0)e=new rf(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),rf(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Dd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+"\n"+g.charAt(g.length-1),rf(e.line-1,g.length-1),rf(e.line,1),"+transpose")}c.push(new X(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){ib(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),sc(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},Rf=a.keyMap={};Rf.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"},Rf.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"},Rf.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"]},Rf.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"},Rf["default"]=kf?Rf.macDefault:Rf.pcDefault;var Sf=a.lookupKey=function(a,b,c){function d(b){b=Ac(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0;g<f.length;++g){var h=d(f[g]);if(h)return h}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},Tf=a.isModifierKey=function(a){var b=Hg[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},Uf=a.keyName=function(a,b){if(cf&&34==a.keyCode&&a["char"])return!1;var c=Hg[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(nf?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(nf?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)};a.fromTextArea=function(b,c){function d(){b.value=j.getValue()}if(c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex),!c.placeholder&&b.placeholder&&(c.placeholder=b.placeholder),null==c.autofocus){var e=xe();c.autofocus=e==b||null!=b.getAttribute("autofocus")&&e==document.body}if(b.form&&(ig(b.form,"submit",d),!c.leaveSubmitMethodAlone)){var f=b.form,g=f.submit;try{var h=f.submit=function(){d(),f.submit=g,f.submit(),f.submit=h}}catch(i){}}b.style.display="none";var j=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return j.save=d,j.getTextArea=function(){return b},j.toTextArea=function(){j.toTextArea=isNaN,d(),b.parentNode.removeChild(j.getWrapperElement()),b.style.display="",b.form&&(jg(b.form,"submit",d),"function"==typeof b.form.submit&&(b.form.submit=g))},j};var Vf=a.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Vf.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=rg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?rg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return rg(this.string,null,this.tabSize)-(this.lineStart?rg(this.string,this.lineStart,this.tabSize):0)},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},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var Wf=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a};ge(Wf),Wf.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&_a(a),fe(this,"clear")){var c=this.find();c&&be(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=Hc(g.markedSpans,this);a&&!this.collapsed?pb(a,Hd(g),"text"):a&&(null!=h.to&&(e=Hd(g)),null!=h.from&&(d=Hd(g))),g.markedSpans=Ic(g.markedSpans,h),null==h.from&&this.collapsed&&!bd(this.doc,g)&&a&&Gd(g,Za(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Zc(this.lines[f]),j=m(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&ob(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&na(a.doc)),a&&be(a,"markerCleared",a,this),b&&bb(a),this.parent&&this.parent.clear()}},Wf.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Hc(f.markedSpans,this);if(null!=g.from&&(c=rf(b?f:Hd(f),g.from),-1==a))return c;if(null!=g.to&&(d=rf(b?f:Hd(f),g.to),1==a))return d}return c&&{from:c,to:d}},Wf.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&ib(c,function(){var d=a.line,e=Hd(a.line),f=Ha(c,e);if(f&&(Ma(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!bd(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=ed(b)-g;h&&Gd(d,d.height+h)}})},Wf.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=le(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},Wf.prototype.detachLine=function(a){if(this.lines.splice(le(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var Xf=0,Yf=a.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};ge(Yf),Yf.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();be(this,"clear")}},Yf.prototype.find=function(a,b){return this.primary.find(a,b)};var Zf=a.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};ge(Zf),Zf.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=Hd(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=ed(this);ib(a,function(){dd(a,c,-f),pb(a,d,"widget"),Gd(c,Math.max(0,c.height-f))})}},Zf.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=ed(this)-a;d&&ib(b,function(){b.curOp.forceUpdate=!0,dd(b,c,d),Gd(c,c.height+d)})};var $f=a.Line=function(a,b,c){this.text=a,Rc(this,b),this.height=c?c(this):1};ge($f),$f.prototype.lineNo=function(){return Hd(this)};var _f={},ag={};zd.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,hd(e),be(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;d<b.length;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},Ad.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof zd))){var h=[];this.collapse(h),this.children=[new zd(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new zd(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Ad(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=le(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Ad(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=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var bg=0,cg=a.Doc=function(a,b,c){if(!(this instanceof cg))return new cg(a,b,c);null==c&&(c=0),Ad.call(this,[new zd([new $f("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=rf(c,0);this.sel=Z(d),this.history=new Ld(null),this.id=++bg,this.modeOption=b,"string"==typeof a&&(a=Dg(a)),yd(this,{from:d,to:d,text:a}),ka(this,Z(d),og)};cg.prototype=ne(Ad.prototype,{constructor:cg,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=Fd(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:lb(function(a){var b=rf(this.first,0),c=this.first+this.size-1;gc(this,{from:b,to:rf(c,Dd(this,c).text.length),text:Dg(a),origin:"setValue"},!0),ka(this,Z(b))}),replaceRange:function(a,b,c,d){b=_(this,b),c=c?_(this,c):b,mc(this,a,b,c,d)},getRange:function(a,b,c){var d=Ed(this,_(this,a),_(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return ba(this,a)?Dd(this,a):void 0},getLineNumber:function(a){return Hd(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Dd(this,a)),Zc(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return _(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:lb(function(a,b,c){ha(this,_(this,"number"==typeof a?rf(a,b||0):a),null,c)}),setSelection:lb(function(a,b,c){ha(this,_(this,a),_(this,b||a),c)}),extendSelection:lb(function(a,b,c){ea(this,_(this,a),b&&_(this,b),c)}),extendSelections:lb(function(a,b){fa(this,ca(this,a,b))}),extendSelectionsBy:lb(function(a,b){fa(this,me(this.sel.ranges,a),b)}),setSelections:lb(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new X(_(this,a[d].anchor),_(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),ka(this,Y(e,b),c)}}),addSelection:lb(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new X(_(this,a),_(this,b||a))),ka(this,Y(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this.sel.ranges,d=0;d<c.length;d++){var e=Ed(this,c[d].from(),c[d].to());b=b?b.concat(e):e}return a===!1?b:b.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ed(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},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:lb(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:Dg(a[f]),origin:c}}for(var h=b&&"end"!=b&&ec(this,d,b),f=d.length-1;f>=0;f--)gc(this,d[f]);h?ja(this,h):this.cm&&sc(this.cm)}),undo:lb(function(){ic(this,"undo")}),redo:lb(function(){ic(this,"redo")}),undoSelection:lb(function(){ic(this,"undo",!0)}),redoSelection:lb(function(){ic(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 d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Ld(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:Wd(this.history.done),undone:Wd(this.history.undone)}},setHistory:function(a){var b=this.history=new Ld(this.history.maxGeneration);b.done=Wd(a.done.slice(0),null,!0),b.undone=Wd(a.undone.slice(0),null,!0)},addLineClass:lb(function(a,b,c){return vc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:lb(function(a,b,c){return vc(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),markText:function(a,b,c){return Bc(this,_(this,a),_(this,b),c,"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};return a=_(this,a),Bc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=_(this,a);var b=[],c=Dd(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=_(this,a),b=_(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];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||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;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,void++c)}),_(this,rf(c,b))},indexFromPos:function(a){a=_(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new cg(Fd(this,this.first,this.first+this.size),this.modeOption,this.first);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 cg(Fd(this,b,c),a.mode||this.modeOption,b);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}],Ec(d,Dc(this)),d},unlinkDoc:function(b){if(b instanceof a&&(b=b.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=this.linked[c];if(d.doc==b){this.linked.splice(c,1),b.unlinkDoc(this),Fc(Dc(this));break}}if(b.history==this.history){var e=[b.id];Bd(b,function(a){e.push(a.id)},!0),b.history=new Ld(null),b.history.done=Wd(this.history.done,e),b.history.undone=Wd(this.history.undone,e)}},iterLinkedDocs:function(a){Bd(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),cg.prototype.eachLine=cg.prototype.iter;var dg="iter insert remove copy getEditor".split(" ");for(var eg in cg.prototype)cg.prototype.hasOwnProperty(eg)&&le(dg,eg)<0&&(a.prototype[eg]=function(a){return function(){return a.apply(this.doc,arguments)}}(cg.prototype[eg]));ge(cg);var fg=a.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},gg=a.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},hg=a.e_stop=function(a){fg(a),gg(a)},ig=a.on=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={}),e=d[b]||(d[b]=[]);e.push(c)}},jg=a.off=function(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&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}},kg=a.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},lg=null,mg=30,ng=a.Pass={toString:function(){return"CodeMirror.Pass"}},og={scroll:!1},pg={origin:"*mouse"},qg={origin:"+move"};he.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var rg=a.countColumn=function(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}},sg=[""],tg=function(a){a.select()};hf?tg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:Ze&&(tg=function(a){try{a.select()}catch(b){}}),[].indexOf&&(le=function(a,b){return a.indexOf(b)}),[].map&&(me=function(a,b){return a.map(b)});var ug,vg=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,wg=a.isWordChar=function(a){return/\w/.test(a)||a>""&&(a.toUpperCase()!=a.toLowerCase()||vg.test(a))},xg=/[\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]/;ug=document.createRange?function(a,b,c){var d=document.createRange();return d.setEnd(a,c),d.setStart(a,b),d}:function(a,b,c){var d=document.body.createTextRange();return d.moveToElementText(a.parentNode),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d},Ze&&11>$e&&(xe=function(){try{return document.activeElement}catch(a){return document.body}});var yg,zg,Ag,Bg=!1,Cg=function(){if(Ze&&9>$e)return!1;var a=te("div");return"draggable"in a||"dragDrop"in a}(),Dg=a.splitLines=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/)},Eg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Fg=function(){var a=te("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Gg=null,Hg={3:"Enter",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",107:"=",109:"-",127:"Delete",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"};a.keyNames=Hg,function(){for(var a=0;10>a;a++)Hg[a+48]=Hg[a+96]=String(a);for(var a=65;90>=a;a++)Hg[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)Hg[a+111]=Hg[a+63235]="F"+a}();var Ig,Jg=function(){function a(a){return 247>=a?c.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1773>=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="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;k>m;++m)l.push(d=a(c.charCodeAt(m)));for(var m=0,n=j;k>m;++m){var d=l[m];"m"==d?l[m]=n:n=d}for(var m=0,o=j;k>m;++m){var d=l[m];"1"==d&&"r"==o?l[m]="n":g.test(d)&&(o=d,"r"==d&&(l[m]="R"))}for(var m=1,n=l[0];k-1>m;++m){var d=l[m];"+"==d&&"1"==n&&"1"==l[m+1]?l[m]="1":","!=d||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=d}for(var m=0;k>m;++m){var d=l[m];if(","==d)l[m]="N";else if("%"==d){for(var p=m+1;k>p&&"%"==l[p];++p);for(var q=m&&"!"==l[m-1]||k>p&&"1"==l[p]?"1":"N",r=m;p>r;++r)l[r]=q;m=p-1}}for(var m=0,o=j;k>m;++m){var d=l[m];"L"==o&&"1"==d?l[m]="L":g.test(d)&&(o=d)}for(var m=0;k>m;++m)if(f.test(l[m])){for(var p=m+1;k>p&&f.test(l[p]);++p);for(var s="L"==(m?l[m-1]:j),t="L"==(k>p?l[p]:j),q=s||t?"L":"R",r=m;p>r;++r)l[r]=q;m=p-1}for(var u,v=[],m=0;k>m;)if(h.test(l[m])){var w=m;for(++m;k>m&&h.test(l[m]);++m);v.push(new b(0,w,m))}else{var x=m,y=v.length;for(++m;k>m&&"L"!=l[m];++m);for(var r=x;m>r;)if(i.test(l[r])){r>x&&v.splice(y,0,new b(1,x,r));var z=r;for(++r;m>r&&i.test(l[r]);++r);v.splice(y,0,new b(2,z,r)),x=r}else++r;m>x&&v.splice(y,0,new b(1,x,m))}return 1==v[0].level&&(u=c.match(/^\s+/))&&(v[0].from=u[0].length,v.unshift(new b(0,0,u[0].length))),1==ke(v).level&&(u=c.match(/\s+$/))&&(ke(v).to-=u[0].length,v.push(new b(0,k-u[0].length,k))),v[0].level!=ke(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="4.7.0",a}),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";a.defineMode("xml",function(b,c){function d(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(g("atom","]]>")):null:a.match("--")?c(g("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(h(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=g("meta","?>"),"meta"):(x=a.eat("/")?"closeTag":"openTag",b.tokenize=e,"tag bracket");if("&"==d){var f;return f=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),f?"atom":"error"}return a.eatWhile(/[^&<]/),null}function e(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=d,x=">"==c?"endTag":"selfcloseTag","tag bracket";if("="==c)return x="equals",null;if("<"==c){b.tokenize=d,b.state=l,b.tagName=b.tagStart=null;var e=b.tokenize(a,b);return e?e+" tag error":"tag error"}return/[\'\"]/.test(c)?(b.tokenize=f(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=e;break}return"string"};return b.isInAttribute=!0,b}function g(a,b){return function(c,e){for(;!c.eol();){if(c.match(b)){e.tokenize=d;break}c.next()}return a}}function h(a){return function(b,c){for(var e;null!=(e=b.next());){if("<"==e)return c.tokenize=h(a+1),c.tokenize(b,c);if(">"==e){if(1==a){c.tokenize=d;break}return c.tokenize=h(a-1),c.tokenize(b,c)}}return"meta"}}function i(a,b,c){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=c,(z.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function j(a){a.context&&(a.context=a.context.prev)}function k(a,b){for(var c;;){if(!a.context)return;if(c=a.context.tagName,!z.contextGrabbers.hasOwnProperty(c)||!z.contextGrabbers[c].hasOwnProperty(b))return;j(a)}}function l(a,b,c){return"openTag"==a?(c.tagStart=b.column(),m):"closeTag"==a?n:l}function m(a,b,c){return"word"==a?(c.tagName=b.current(),y="tag",q):(y="error",m)}function n(a,b,c){if("word"==a){var d=b.current();return c.context&&c.context.tagName!=d&&z.implicitlyClosed.hasOwnProperty(c.context.tagName)&&j(c),c.context&&c.context.tagName==d?(y="tag",o):(y="tag error",p)}return y="error",p}function o(a,b,c){return"endTag"!=a?(y="error",o):(j(c),l)}function p(a,b,c){return y="error",o(a,b,c)}function q(a,b,c){if("word"==a)return y="attribute",r;if("endTag"==a||"selfcloseTag"==a){var d=c.tagName,e=c.tagStart;return c.tagName=c.tagStart=null,"selfcloseTag"==a||z.autoSelfClosers.hasOwnProperty(d)?k(c,d):(k(c,d),c.context=new i(c,d,e==c.indented)),l}return y="error",q}function r(a,b,c){return"equals"==a?s:(z.allowMissing||(y="error"),q(a,b,c))}function s(a,b,c){return"string"==a?t:"word"==a&&z.allowUnquoted?(y="string",q):(y="error",q(a,b,c))}function t(a,b,c){return"string"==a?t:q(a,b,c)}var u=b.indentUnit,v=c.multilineTagIndentFactor||1,w=c.multilineTagIndentPastTag;null==w&&(w=!0);var x,y,z=c.htmlMode?{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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},A=c.alignCDATA;return{startState:function(){return{tokenize:d,state:l,indented:0,tagName:null,tagStart:null,context:null}},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;x=null;var c=b.tokenize(a,b);return(c||x)&&"comment"!=c&&(y=null,b.state=b.state(x||c,a,b),y&&(c="error"==y?c+" error":y)),c},indent:function(b,c,f){var g=b.context;if(b.tokenize.isInAttribute)return b.tagStart==b.indented?b.stringStartCol+1:b.indented+u;if(g&&g.noIndent)return a.Pass;if(b.tokenize!=e&&b.tokenize!=d)return f?f.match(/^(\s*)/)[0].length:0;if(b.tagName)return w?b.tagStart+b.tagName.length+2:b.tagStart+u*v;if(A&&/<!\[CDATA\[/.test(c))return 0;var h=c&&/^<(\/)?([\w_:\.-]*)/.exec(c);if(h&&h[1])for(;g;){if(g.tagName==h[2]){g=g.prev;break}if(!z.implicitlyClosed.hasOwnProperty(g.tagName))break;g=g.prev}else if(h)for(;g;){var i=z.contextGrabbers[g.tagName];if(!i||!i.hasOwnProperty(h[2]))break;g=g.prev}for(;g&&!g.startOfLine;)g=g.prev;return g?g.indent+u:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml"}}),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";a.defineMode("javascript",function(b,c){function d(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function e(a,b,c){return oa=a,pa=c,b}function f(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=g(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return e("number","number");if("."==c&&a.match(".."))return e("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return e(c);if("="==c&&a.eat(">"))return e("=>","operator");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),e("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),e("number","number");if("/"==c)return a.eat("*")?(b.tokenize=h,h(a,b)):a.eat("/")?(a.skipToEnd(),e("comment","comment")):"operator"==b.lastType||"keyword c"==b.lastType||"sof"==b.lastType||/^[\[{}\(,;:]$/.test(b.lastType)?(d(a),a.eatWhile(/[gimy]/),e("regexp","string-2")):(a.eatWhile(xa),e("operator","operator",a.current()));if("`"==c)return b.tokenize=i,i(a,b);if("#"==c)return a.skipToEnd(),e("error","error");if(xa.test(c))return a.eatWhile(xa),e("operator","operator",a.current());if(va.test(c)){a.eatWhile(va);var f=a.current(),j=wa.propertyIsEnumerable(f)&&wa[f];return j&&"."!=b.lastType?e(j.type,j.style,f):e("variable","variable",f)}}function g(a){return function(b,c){var d,g=!1;if(sa&&"@"==b.peek()&&b.match(ya))return c.tokenize=f,e("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||g);)g=!g&&"\\"==d;return g||(c.tokenize=f),e("string","string")}}function h(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=f;break}d="*"==c}return e("comment","comment")}function i(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=f;break}d=!d&&"\\"==c}return e("quasi","string-2",a.current())}function j(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=za.indexOf(g);if(h>=0&&3>h){if(!d){++f;break}if(0==--d)break}else if(h>=3&&6>h)++d;else if(va.test(g))e=!0;else if(e&&!d){++f;break}}e&&!d&&(b.fatArrowAt=f)}}function k(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function l(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function m(a,b,c,d,e){var f=a.cc;for(Ba.state=a,Ba.stream=e,Ba.marked=null,Ba.cc=f,Ba.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():ta?w:v;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Ba.marked?Ba.marked:"variable"==c&&l(a,d)?"variable-2":b}}}function n(){for(var a=arguments.length-1;a>=0;a--)Ba.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=Ba.state;if(d.context){if(Ba.marked="def",b(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(b(d.globalVars))return;c.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function q(){Ba.state.context={prev:Ba.state.context,vars:Ba.state.localVars},Ba.state.localVars=Ca}function r(){Ba.state.localVars=Ba.state.context.vars,Ba.state.context=Ba.state.context.prev}function s(a,b){var c=function(){var c=Ba.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new k(d,Ba.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function t(){var a=Ba.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function u(a){function b(c){return c==a?o():";"==a?n():o(b)}return b}function v(a,b){return"var"==a?o(s("vardef",b.length),R,u(";"),t):"keyword a"==a?o(s("form"),w,v,t):"keyword b"==a?o(s("form"),v,t):"{"==a?o(s("}"),O,t):";"==a?o():"if"==a?("else"==Ba.state.lexical.info&&Ba.state.cc[Ba.state.cc.length-1]==t&&Ba.state.cc.pop()(),o(s("form"),w,v,t,W)):"function"==a?o(aa):"for"==a?o(s("form"),X,v,t):"variable"==a?o(s("stat"),H):"switch"==a?o(s("form"),w,s("}","switch"),u("{"),O,t,t):"case"==a?o(w,u(":")):"default"==a?o(u(":")):"catch"==a?o(s("form"),q,u("("),ba,u(")"),v,t,r):"module"==a?o(s("form"),q,ga,r,t):"class"==a?o(s("form"),ca,t):"export"==a?o(s("form"),ha,t):"import"==a?o(s("form"),ia,t):n(s("stat"),w,u(";"),t)}function w(a){return y(a,!1)}function x(a){return y(a,!0)}function y(a,b){if(Ba.state.fatArrowAt==Ba.stream.start){var c=b?G:F;if("("==a)return o(q,s(")"),M(S,")"),t,u("=>"),c,r);if("variable"==a)return n(q,S,u("=>"),c,r)}var d=b?C:B;return Aa.hasOwnProperty(a)?o(d):"function"==a?o(aa,d):"keyword c"==a?o(b?A:z):"("==a?o(s(")"),z,na,u(")"),t,d):"operator"==a||"spread"==a?o(b?x:w):"["==a?o(s("]"),la,t,d):"{"==a?N(J,"}",null,d):"quasi"==a?n(D,d):o()}function z(a){return a.match(/[;\}\)\],]/)?n():n(w)}function A(a){return a.match(/[;\}\)\],]/)?n():n(x)}function B(a,b){return","==a?o(w):C(a,b,!1)}function C(a,b,c){var d=0==c?B:C,e=0==c?w:x;return"=>"==a?o(q,c?G:F,r):"operator"==a?/\+\+|--/.test(b)?o(d):"?"==b?o(w,u(":"),e):o(e):"quasi"==a?n(D,d):";"!=a?"("==a?N(x,")","call",d):"."==a?o(I,d):"["==a?o(s("]"),z,u("]"),t,d):void 0:void 0}function D(a,b){return"quasi"!=a?n():"${"!=b.slice(b.length-2)?o(D):o(w,E)}function E(a){return"}"==a?(Ba.marked="string-2",Ba.state.tokenize=i,o(D)):void 0}function F(a){return j(Ba.stream,Ba.state),n("{"==a?v:w)}function G(a){return j(Ba.stream,Ba.state),n("{"==a?v:x)}function H(a){return":"==a?o(t,v):n(B,u(";"),t)}function I(a){return"variable"==a?(Ba.marked="property",o()):void 0}function J(a,b){return"variable"==a||"keyword"==Ba.style?(Ba.marked="property",o("get"==b||"set"==b?K:L)):"number"==a||"string"==a?(Ba.marked=sa?"property":Ba.style+" property",o(L)):"jsonld-keyword"==a?o(L):"["==a?o(w,u("]"),L):void 0}function K(a){return"variable"!=a?n(L):(Ba.marked="property",o(aa))}function L(a){return":"==a?o(x):"("==a?n(aa):void 0}function M(a,b){function c(d){if(","==d){var e=Ba.state.lexical;return"call"==e.info&&(e.pos=(e.pos||0)+1),o(a,c)}return d==b?o():o(u(b))}return function(d){return d==b?o():n(a,c)}}function N(a,b,c){for(var d=3;d<arguments.length;d++)Ba.cc.push(arguments[d]);return o(s(b,c),M(a,b),t)}function O(a){return"}"==a?o():n(v,O)}function P(a){return ua&&":"==a?o(Q):void 0}function Q(a){return"variable"==a?(Ba.marked="variable-3",o()):void 0}function R(){return n(S,P,U,V)}function S(a,b){return"variable"==a?(p(b),o()):"["==a?N(S,"]"):"{"==a?N(T,"}"):void 0}function T(a,b){return"variable"!=a||Ba.stream.match(/^\s*:/,!1)?("variable"==a&&(Ba.marked="property"),o(u(":"),S,U)):(p(b),o(U))}function U(a,b){return"="==b?o(x):void 0}function V(a){return","==a?o(R):void 0}function W(a,b){return"keyword b"==a&&"else"==b?o(s("form","else"),v,t):void 0}function X(a){return"("==a?o(s(")"),Y,u(")"),t):void 0}function Y(a){return"var"==a?o(R,u(";"),$):";"==a?o($):"variable"==a?o(Z):n(w,u(";"),$)}function Z(a,b){return"in"==b||"of"==b?(Ba.marked="keyword",o(w)):o(B,$)}function $(a,b){return";"==a?o(_):"in"==b||"of"==b?(Ba.marked="keyword",o(w)):n(w,u(";"),_)}function _(a){")"!=a&&o(w)}function aa(a,b){return"*"==b?(Ba.marked="keyword",o(aa)):"variable"==a?(p(b),o(aa)):"("==a?o(q,s(")"),M(ba,")"),t,v,r):void 0}function ba(a){return"spread"==a?o(ba):n(S,P)}function ca(a,b){return"variable"==a?(p(b),o(da)):void 0}function da(a,b){return"extends"==b?o(w,da):"{"==a?o(s("}"),ea,t):void 0}function ea(a,b){return"variable"==a||"keyword"==Ba.style?(Ba.marked="property","get"==b||"set"==b?o(fa,aa,ea):o(aa,ea)):"*"==b?(Ba.marked="keyword",o(ea)):";"==a?o(ea):"}"==a?o():void 0}function fa(a){return"variable"!=a?n():(Ba.marked="property",o())}function ga(a,b){return"string"==a?o(v):"variable"==a?(p(b),o(ka)):void 0}function ha(a,b){return"*"==b?(Ba.marked="keyword",o(ka,u(";"))):"default"==b?(Ba.marked="keyword",o(w,u(";"))):n(v)}function ia(a){return"string"==a?o():n(ja,ka)}function ja(a,b){return"{"==a?N(ja,"}"):("variable"==a&&p(b),o())}function ka(a,b){return"from"==b?(Ba.marked="keyword",o(w)):void 0}function la(a){return"]"==a?o():n(x,ma)}function ma(a){return"for"==a?n(na,u("]")):","==a?o(M(A,"]")):n(M(x,"]"))}function na(a){return"for"==a?o(X,na):"if"==a?o(w,na):void 0}var oa,pa,qa=b.indentUnit,ra=c.statementIndent,sa=c.jsonld,ta=c.json||sa,ua=c.typescript,va=c.wordCharacters||/[\w$\xa1-\uffff]/,wa=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"debugger":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,undefined:f,NaN:f,Infinity:f,"this":a("this"),module:a("module"),"class":a("class"),"super":a("atom"),"yield":d,"export":a("export"),"import":a("import"),"extends":d};if(ua){var h={type:"variable",style:"variable-3"},i={"interface":a("interface"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),string:h,number:h,bool:h,any:h};for(var j in i)g[j]=i[j]}return g}(),xa=/[+\-*&%=<>!?|~^]/,ya=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,za="([{}])",Aa={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Ba={state:null,column:null,marked:null,cc:null},Ca={name:"this",next:{name:"arguments"}};return t.lex=!0,{startState:function(a){var b={tokenize:f,lastType:"sof",cc:[],lexical:new k((a||0)-qa,0,"block",!1),localVars:c.localVars,context:c.localVars&&{vars:c.localVars},indented:0};return c.globalVars&&"object"==typeof c.globalVars&&(b.globalVars=c.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),j(a,b)),b.tokenize!=h&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==oa?c:(b.lastType="operator"!=oa||"++"!=pa&&"--"!=pa?oa:"incdec",m(b,c,oa,pa,a))},indent:function(b,d){if(b.tokenize==h)return a.Pass;if(b.tokenize!=f)return 0;var e=d&&d.charAt(0),g=b.lexical;if(!/^\s*else\b/.test(d))for(var i=b.cc.length-1;i>=0;--i){var j=b.cc[i];if(j==t)g=g.prev;else if(j!=W)break}"stat"==g.type&&"}"==e&&(g=g.prev),ra&&")"==g.type&&"stat"==g.prev.type&&(g=g.prev);var k=g.type,l=e==k;return"vardef"==k?g.indented+("operator"==b.lastType||","==b.lastType?g.info+1:0):"form"==k&&"{"==e?g.indented:"form"==k?g.indented+qa:"stat"==k?g.indented+("operator"==b.lastType||","==b.lastType?ra||qa:0):"switch"!=g.info||l||0==c.doubleIndentSwitch?g.align?g.column+(l?0:1):g.indented+(l?0:qa):g.indented+(/^(?:case|default)\b/.test(d)?qa:2*qa)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:ta?null:"/*",blockCommentEnd:ta?null:"*/",lineComment:ta?null:"//",fold:"brace",helperType:ta?"json":"javascript",jsonldMode:sa,jsonMode:ta}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!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]]=!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"]}function d(a,b){return a.skipTo("-->")?(a.match("-->"),b.tokenize=null):a.skipToEnd(),["comment","comment"]}a.defineMode("css",function(b,c){function d(a,b){return n=b,a}function e(a,b){var c=a.next();if(q[c]){var e=q[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&&a.match("rl(")?(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+-/)?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){return a.context=new h(c,b.indentation()+p,a.context),c}function j(a){return a.context=a.context.prev,a.context.type}function k(a,b,c){return z[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();o=w.hasOwnProperty(b)?"atom":v.hasOwnProperty(b)?"keyword":"variable"}c.propertyKeywords||(c=a.resolveMode("text/css"));var n,o,p=b.indentUnit,q=c.tokenHooks,r=c.mediaTypes||{},s=c.mediaFeatures||{},t=c.propertyKeywords||{},u=c.nonStandardPropertyKeywords||{},v=c.colorKeywords||{},w=c.valueKeywords||{},x=c.fontProperties||{},y=c.allowNested,z={};return z.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if("@media"==a)return i(c,b,"media");if("@font-face"==a)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)o="builtin";else if("word"==a)o="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(y&&"("==a)return i(c,b,"parens")}return c.context.type},z.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return t.hasOwnProperty(d)?(o="property","maybeprop"):u.hasOwnProperty(d)?(o="string-2","maybeprop"):y?(o=b.match(/^\s*:/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==a?"block":y||"hash"!=a&&"qualifier"!=a?z.top(a,b,c):(o="error","block")},z.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},z.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&y)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}|[0-9a-fA-f]{6})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else o+=" error";return"prop"},z.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(o="property","maybeprop"):c.context.type},z.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):("word"==a&&m(b),"parens")},z.pseudo=function(a,b,c){return"word"==a?(o="variable-3",c.context.type):k(a,b,c)},z.media=function(a,b,c){if("("==a)return i(c,b,"media_parens");if("}"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,y?"block":"top");if("word"==a){var d=b.current().toLowerCase();o="only"==d||"not"==d||"and"==d?"keyword":r.hasOwnProperty(d)?"attribute":s.hasOwnProperty(d)?"property":"error"}return c.context.type},z.media_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):z.media(a,b,c)},z.font_face_before=function(a,b,c){return"{"==a?i(c,b,"font_face"):k(a,b,c)},z.font_face=function(a,b,c){return"}"==a?j(c):"word"==a?(o=x.hasOwnProperty(b.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},z.keyframes=function(a,b,c){return"word"==a?(o="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},z.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?o="tag":"hash"==a&&(o="builtin"),"at")},z.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("variable"!=a&&(o="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:"top",context:new h("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&&(n=c[1],c=c[0]),o=c,b.state=z[b.state](n,a,b),o},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&&"font_face"!=c.type)&&(")"!=d||"parens"!=c.type&&"media_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"media"!=c.type)||(e=c.indent-p,c=c.prev),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var e=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],f=b(e),g=["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"],h=b(g),i=["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-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","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-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","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","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","marker-offset","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","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","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","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"],j=b(i),k=["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"],l=b(k),m=["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"],n=b(m),o=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","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","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","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","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","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","malayalam","match","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","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","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","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","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],p=b(o),q=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],r=b(q),s=e.concat(g).concat(i).concat(k).concat(m).concat(o);
- a.registerHelper("hintWords","css",s),a.defineMIME("text/css",{mediaTypes:f,mediaFeatures:h,propertyKeywords:j,nonStandardPropertyKeywords:l,colorKeywords:n,valueKeywords:p,fontProperties:r,tokenHooks:{"<":function(a,b){return a.match("!--")?(b.tokenize=d,d(a,b)):!1},"/":function(a,b){return a.eat("*")?(b.tokenize=c,c(a,b)):!1}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:f,mediaFeatures:h,propertyKeywords:j,nonStandardPropertyKeywords:l,colorKeywords:n,valueKeywords:p,fontProperties:r,allowNested:!0,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*\{/)?[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:f,mediaFeatures:h,propertyKeywords:j,nonStandardPropertyKeywords:l,colorKeywords:n,valueKeywords:p,fontProperties:r,allowNested:!0,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(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),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";a.defineMode("htmlmixed",function(b,c){function d(a,b){var c=b.htmlState.tagName;c&&(c=c.toLowerCase());var d=h.token(a,b.htmlState);if("script"==c&&/\btag\b/.test(d)&&">"==a.current()){var e=a.string.slice(Math.max(0,a.pos-100),a.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);e=e?e[1]:"",e&&/[\"\']/.test(e.charAt(0))&&(e=e.slice(1,e.length-1));for(var k=0;k<j.length;++k){var l=j[k];if("string"==typeof l.matches?e==l.matches:l.matches.test(e)){l.mode&&(b.token=f,b.localMode=l.mode,b.localState=l.mode.startState&&l.mode.startState(h.indent(b.htmlState,"")));break}}}else"style"==c&&/\btag\b/.test(d)&&">"==a.current()&&(b.token=g,b.localMode=i,b.localState=i.startState(h.indent(b.htmlState,"")));return d}function e(a,b,c){var d,e=a.current(),f=e.search(b);return f>-1?a.backUp(e.length-f):(d=e.match(/<\/?$/))&&(a.backUp(e.length),a.match(b,!1)||a.match(e)),c}function f(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=d,b.localState=b.localMode=null,d(a,b)):e(a,/<\/\s*script\s*>/,b.localMode.token(a,b.localState))}function g(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=d,b.localState=b.localMode=null,d(a,b)):e(a,/<\/\s*style\s*>/,i.token(a,b.localState))}var h=a.getMode(b,{name:"xml",htmlMode:!0,multilineTagIndentFactor:c.multilineTagIndentFactor,multilineTagIndentPastTag:c.multilineTagIndentPastTag}),i=a.getMode(b,"css"),j=[],k=c&&c.scriptTypes;if(j.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:a.getMode(b,"javascript")}),k)for(var l=0;l<k.length;++l){var m=k[l];j.push({matches:m.matches,mode:m.mode&&a.getMode(b,m.mode)})}return j.push({matches:/./,mode:a.getMode(b,"text/plain")}),{startState:function(){var a=h.startState();return{token:d,localMode:null,localState:null,htmlState:a}},copyState:function(b){if(b.localState)var c=a.copyState(b.localMode,b.localState);return{token:b.token,localMode:b.localMode,localState:c,htmlState:a.copyState(h,b.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(b,c){return!b.localMode||/^\s*<\//.test(c)?h.indent(b.htmlState,c):b.localMode.indent?b.localMode.indent(b.localState,c):a.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||h}}}},"xml","javascript","css"),a.defineMIME("text/html","htmlmixed")}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror",require("../xml/xml"))):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("markdown",function(b,c){function d(a,b,c){return b.f=b.inline=c,c(a,b)}function e(a,b,c){return b.f=b.block=c,c(a,b)}function f(a){return a.linkTitle=!1,a.em=!1,a.strong=!1,a.quote=0,t||a.f!=h||(a.f=l,a.block=g),a.trailingSpace=0,a.trailingSpaceNewLine=!1,a.thisLineHasContent=!1,null}function g(a,b){var f=a.sol(),g=b.list!==!1;b.list!==!1&&b.indentationDiff>=0?(b.indentationDiff<4&&(b.indentation-=b.indentationDiff),b.list=null):b.list!==!1&&b.indentation>0?(b.list=null,b.listDepth=Math.floor(b.indentation/4)):b.list!==!1&&(b.list=!1,b.listDepth=0);var h=null;if(b.indentationDiff>=4)return b.indentation-=4,a.skipToEnd(),z;if(a.eatSpace())return null;if(h=a.match(R))return b.header=h[0].length<=6?h[0].length:6,c.highlightFormatting&&(b.formatting="header"),b.f=b.inline,j(b);if(b.prevLineHasContent&&(h=a.match(S)))return b.header="="==h[0].charAt(0)?1:2,c.highlightFormatting&&(b.formatting="header"),b.f=b.inline,j(b);if(a.eat(">"))return b.indentation++,b.quote=f?1:b.quote+1,c.highlightFormatting&&(b.formatting="quote"),a.eatSpace(),j(b);if("["===a.peek())return d(a,b,p);if(a.match(N,!0))return E;if((!b.prevLineHasContent||g)&&(a.match(O,!1)||a.match(P,!1))){var k=null;return a.match(O,!0)?k="ul":(a.match(P,!0),k="ol"),b.indentation+=4,b.list=!0,b.listDepth++,c.taskLists&&a.match(Q,!1)&&(b.taskList=!0),b.f=b.inline,c.highlightFormatting&&(b.formatting=["list","list-"+k]),j(b)}return c.fencedCodeBlocks&&a.match(/^```([\w+#]*)/,!0)?(b.localMode=w(RegExp.$1),b.localMode&&(b.localState=b.localMode.startState()),e(a,b,i),c.highlightFormatting&&(b.formatting="code-block"),b.code=!0,j(b)):d(a,b,b.inline)}function h(a,b){var c=u.token(a,b.htmlState);return(t&&null===b.htmlState.tagStart&&!b.htmlState.context||b.md_inside&&a.current().indexOf(">")>-1)&&(b.f=l,b.block=g,b.htmlState=null),c}function i(a,b){if(a.sol()&&a.match(/^```/,!0)){b.localMode=b.localState=null,b.f=l,b.block=g,c.highlightFormatting&&(b.formatting="code-block"),b.code=!0;var d=j(b);return b.code=!1,d}return b.localMode?b.localMode.token(a,b.localState):(a.skipToEnd(),z)}function j(a){var b=[];if(a.formatting){b.push(G),"string"==typeof a.formatting&&(a.formatting=[a.formatting]);for(var d=0;d<a.formatting.length;d++)b.push(G+"-"+a.formatting[d]),"header"===a.formatting[d]&&b.push(G+"-"+a.formatting[d]+"-"+a.header),"quote"===a.formatting[d]&&b.push(!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?G+"-"+a.formatting[d]+"-"+a.quote:"error")}if(a.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(a.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(a.linkHref)return b.push(K),b.length?b.join(" "):null;if(a.strong&&b.push(M),a.em&&b.push(L),a.linkText&&b.push(J),a.code&&b.push(z),a.header&&(b.push(y),b.push(y+"-"+a.header)),a.quote&&(b.push(A),b.push(!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?A+"-"+a.quote:A+"-"+c.maxBlockquoteDepth)),a.list!==!1){var e=(a.listDepth-1)%3;b.push(e?1===e?C:D:B)}return a.trailingSpaceNewLine?b.push("trailing-space-new-line"):a.trailingSpace&&b.push("trailing-space-"+(a.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function k(a,b){return a.match(T,!0)?j(b):void 0}function l(b,d){var f=d.text(b,d);if("undefined"!=typeof f)return f;if(d.list)return d.list=null,j(d);if(d.taskList){var g="x"!==b.match(Q,!0)[1];return g?d.taskOpen=!0:d.taskClosed=!0,c.highlightFormatting&&(d.formatting="task"),d.taskList=!1,j(d)}if(d.taskOpen=!1,d.taskClosed=!1,d.header&&b.match(/^#+$/,!0))return c.highlightFormatting&&(d.formatting="header"),j(d);var i=b.sol(),k=b.next();if("\\"===k&&(b.next(),c.highlightFormatting)){var l=j(d);return l?l+" formatting-escape":"formatting-escape"}if(d.linkTitle){d.linkTitle=!1;var o=k;"("===k&&(o=")"),o=(o+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var p="^\\s*(?:[^"+o+"\\\\]+|\\\\\\\\|\\\\.)"+o;if(b.match(new RegExp(p),!0))return K}if("`"===k){var q=d.formatting;c.highlightFormatting&&(d.formatting="code");var r=j(d),s=b.pos;b.eatWhile("`");var t=1+b.pos-s;return d.code?t===x?(d.code=!1,r):(d.formatting=q,j(d)):(x=t,d.code=!0,j(d))}if(d.code)return j(d);if("!"===k&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return b.match(/\[[^\]]*\]/),d.inline=d.f=n,F;if("["===k&&b.match(/.*\](\(| ?\[)/,!1))return d.linkText=!0,c.highlightFormatting&&(d.formatting="link"),j(d);if("]"===k&&d.linkText){c.highlightFormatting&&(d.formatting="link");var l=j(d);return d.linkText=!1,d.inline=d.f=n,l}if("<"===k&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=m,c.highlightFormatting&&(d.formatting="link");var l=j(d);return l?l+=" ":l="",l+H}if("<"===k&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=m,c.highlightFormatting&&(d.formatting="link");var l=j(d);return l?l+=" ":l="",l+I}if("<"===k&&b.match(/^\w/,!1)){if(-1!=b.string.indexOf(">")){var v=b.string.substring(1,b.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(v)&&(d.md_inside=!0)}return b.backUp(1),d.htmlState=a.startState(u),e(b,d,h)}if("<"===k&&b.match(/^\/\w*?>/))return d.md_inside=!1,"tag";var w=!1;if(!c.underscoresBreakWords&&"_"===k&&"_"!==b.peek()&&b.match(/(\w)/,!1)){var y=b.pos-2;if(y>=0){var z=b.string.charAt(y);"_"!==z&&z.match(/(\w)/,!1)&&(w=!0)}}if("*"===k||"_"===k&&!w)if(i&&" "===b.peek());else{if(d.strong===k&&b.eat(k)){c.highlightFormatting&&(d.formatting="strong");var r=j(d);return d.strong=!1,r}if(!d.strong&&b.eat(k))return d.strong=k,c.highlightFormatting&&(d.formatting="strong"),j(d);if(d.em===k){c.highlightFormatting&&(d.formatting="em");var r=j(d);return d.em=!1,r}if(!d.em)return d.em=k,c.highlightFormatting&&(d.formatting="em"),j(d)}else if(" "===k&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return j(d);b.backUp(1)}return" "===k&&(b.match(/ +$/,!1)?d.trailingSpace++:d.trailingSpace&&(d.trailingSpaceNewLine=!0)),j(d)}function m(a,b){var d=a.next();if(">"===d){b.f=b.inline=l,c.highlightFormatting&&(b.formatting="link");var e=j(b);return e?e+=" ":e="",e+H}return a.match(/^[^>]+/,!0),H}function n(a,b){if(a.eatSpace())return null;var d=a.next();return"("===d||"["===d?(b.f=b.inline=o("("===d?")":"]"),c.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,j(b)):"error"}function o(a){return function(b,d){var e=b.next();if(e===a){d.f=d.inline=l,c.highlightFormatting&&(d.formatting="link-string");var f=j(d);return d.linkHref=!1,f}return b.match(s(a),!0)&&b.backUp(1),d.linkHref=!0,j(d)}}function p(a,b){return a.match(/^[^\]]*\]:/,!1)?(b.f=q,a.next(),c.highlightFormatting&&(b.formatting="link"),b.linkText=!0,j(b)):d(a,b,l)}function q(a,b){if(a.match(/^\]:/,!0)){b.f=b.inline=r,c.highlightFormatting&&(b.formatting="link");var d=j(b);return b.linkText=!1,d}return a.match(/^[^\]]+/,!0),J}function r(a,b){return a.eatSpace()?null:(a.match(/^[^\s]+/,!0),void 0===a.peek()?b.linkTitle=!0:a.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=l,K)}function s(a){return U[a]||(a=(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),U[a]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+a+")")),U[a]}var t=a.modes.hasOwnProperty("xml"),u=a.getMode(b,t?{name:"xml",htmlMode:!0}:"text/plain"),v={html:"htmlmixed",js:"javascript",json:"application/json",c:"text/x-csrc","c++":"text/x-c++src",java:"text/x-java",csharp:"text/x-csharp","c#":"text/x-csharp",scala:"text/x-scala"},w=function(){var c,d,e={},f={},g=[];for(var h in a.modes)a.modes.propertyIsEnumerable(h)&&g.push(h);for(c=0;c<g.length;c++)e[g[c]]=g[c];var i=[];for(var h in a.mimeModes)a.mimeModes.propertyIsEnumerable(h)&&i.push({mime:h,mode:a.mimeModes[h]});for(c=0;c<i.length;c++)d=i[c].mime,f[d]=i[c].mime;for(var j in v)(v[j]in e||v[j]in f)&&(e[j]=v[j]);return function(c){return e[c]?a.getMode(b,e[c]):null}}();void 0===c.highlightFormatting&&(c.highlightFormatting=!1),void 0===c.maxBlockquoteDepth&&(c.maxBlockquoteDepth=0),void 0===c.underscoresBreakWords&&(c.underscoresBreakWords=!0),void 0===c.fencedCodeBlocks&&(c.fencedCodeBlocks=!1),void 0===c.taskLists&&(c.taskLists=!1);var x=0,y="header",z="comment",A="quote",B="variable-2",C="variable-3",D="keyword",E="hr",F="tag",G="formatting",H="link",I="link",J="link",K="string",L="em",M="strong",N=/^([*\-=_])(?:\s*\1){2,}\s*$/,O=/^[*\-+]\s+/,P=/^[0-9]+\.\s+/,Q=/^\[(x| )\](?=\s)/,R=/^#+/,S=/^(?:\={1,}|-{1,})$/,T=/^[^#!\[\]*_\\<>` "'(]+/,U=[],V={startState:function(){return{f:g,prevLineHasContent:!1,thisLineHasContent:!1,block:g,htmlState:null,indentation:0,inline:l,text:k,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1}},copyState:function(b){return{f:b.f,prevLineHasContent:b.prevLineHasContent,thisLineHasContent:b.thisLineHasContent,block:b.block,htmlState:b.htmlState&&a.copyState(u,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?a.copyState(b.localMode,b.localState):null,inline:b.inline,text:b.text,formatting:!1,linkTitle:b.linkTitle,em:b.em,strong:b.strong,header:b.header,taskList:b.taskList,list:b.list,listDepth:b.listDepth,quote:b.quote,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside}},token:function(a,b){if(b.formatting=!1,a.sol()){var c=!!b.header;if(b.header=0,a.match(/^\s*$/,!0)||c)return b.prevLineHasContent=!1,f(b),c?this.token(a,b):null;b.prevLineHasContent=b.thisLineHasContent,b.thisLineHasContent=!0,b.taskList=!1,b.code=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,b.f=b.block;var d=a.match(/^\s*/,!0)[0].replace(/\t/g," ").length,e=4*Math.floor((d-b.indentation)/4);e>4&&(e=4);var g=b.indentation+e;if(b.indentationDiff=g-b.indentation,b.indentation=g,d>0)return null}var h=b.f(a,b);return a.start==a.pos?this.token(a,b):h},innerMode:function(a){return a.block==h?{state:a.htmlState,mode:u}:a.localState?{state:a.localState,mode:a.localMode}:{state:a,mode:V}},blankLine:f,getType:j,fold:"markdown"};return V},"xml"),a.defineMIME("text/x-markdown","markdown")}),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";a.overlayMode=function(b,c,d){return{startState:function(){return{base:a.startState(b),overlay:a.startState(c),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,lineSeen:null}},copyState:function(d){return{base:a.copyState(b,d.base),overlay:a.copyState(c,d.overlay),basePos:d.basePos,baseCur:null,overlayPos:d.overlayPos,overlayCur:null}},token:function(a,e){return(a.sol()||a.string!=e.lineSeen||Math.min(e.basePos,e.overlayPos)<a.start)&&(e.lineSeen=a.string,e.basePos=e.overlayPos=a.start),a.start==e.basePos&&(e.baseCur=b.token(a,e.base),e.basePos=a.pos),a.start==e.overlayPos&&(a.pos=a.start,e.overlayCur=c.token(a,e.overlay),e.overlayPos=a.pos),a.pos=Math.min(e.basePos,e.overlayPos),null==e.overlayCur?e.baseCur:null!=e.baseCur&&e.overlay.combineTokens||d&&null==e.overlay.combineTokens?e.baseCur+" "+e.overlayCur:e.overlayCur},indent:b.indent&&function(a,c){return b.indent(a.base,c)},electricChars:b.electricChars,innerMode:function(a){return{state:a.base,mode:b}},blankLine:function(a){b.blankLine&&b.blankLine(a.base),c.blankLine&&c.blankLine(a.overlay)}}}}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("gfm",function(b,c){function d(a){return a.code=!1,null}var e=0,f={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(a){return{code:a.code,codeBlock:a.codeBlock,ateSpace:a.ateSpace}},token:function(a,b){if(b.combineTokens=null,b.codeBlock)return a.match(/^```/)?(b.codeBlock=!1,null):(a.skipToEnd(),null);if(a.sol()&&(b.code=!1),a.sol()&&a.match(/^```/))return a.skipToEnd(),b.codeBlock=!0,null;if("`"===a.peek()){a.next();var c=a.pos;a.eatWhile("`");var d=1+a.pos-c;return b.code?d===e&&(b.code=!1):(e=d,b.code=!0),null}if(b.code)return a.next(),null;if(a.eatSpace())return b.ateSpace=!0,null;if(a.sol()||b.ateSpace){if(b.ateSpace=!1,a.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return b.combineTokens=!0,"link";if(a.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return b.combineTokens=!0,"link"}return a.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=a.string.slice(a.start-2,a.start)?(b.combineTokens=!0,"link"):(a.next(),null)},blankLine:d},g={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0};for(var h in c)g[h]=c[h];return g.name="markdown",a.defineMIME("gfmBase",g),a.overlayMode(a.getMode(b,"gfmBase"),f)},"markdown")}),function(){function use(a){_p.r([moduleMapping[a]])}var _p={r:function(a){if(_p[a].inited)return _p[a].value;if("function"!=typeof _p[a].value)return _p[a].inited=!0,_p[a].value;var b={exports:{}},c=_p[a].value(null,b.exports,b);if(_p[a].inited=!0,_p[a].value=c,void 0!==c)return c;for(var d in b.exports)if(b.exports.hasOwnProperty(d))return _p[a].inited=!0,_p[a].value=b.exports,b.exports}};_p[0]={value:function(a){function b(a){var b=parseFloat(a,10);return/ms/.test(a)?b:/s/.test(a)?1e3*b:/min/.test(a)?60*b*1e3:b}var c=_p.r(8),d=_p.r(1),e=_p.r(11).createClass("Animator",{constructor:function(a,b,c){if(1==arguments.length){var d=arguments[0];this.beginValue=d.beginValue,this.finishValue=d.finishValue,this.setter=d.setter}else this.beginValue=a,this.finishValue=b,this.setter=c},start:function(a,c,d,e,f){2===arguments.length&&"object"==typeof c&&(d=c.easing,e=c.delay,f=c.callback,c=c.duration),4===arguments.length&&"function"==typeof e&&(f=e,e=0);var g=this.create(a,c,d,f);return e=b(e),e>0?setTimeout(function(){g.play()},e):g.play(),g},create:function(a,f,g,h){var i;return f=f&&b(f)||e.DEFAULT_DURATION,g=g||e.DEFAULT_EASING,"string"==typeof g&&(g=d[g]),i=new c(this,a,f,g),"function"==typeof h&&i.on("finish",h),i},reverse:function(){return new e(this.finishValue,this.beginValue,this.setter)}});e.DEFAULT_DURATION=300,e.DEFAULT_EASING="linear";var f=_p.r(60);return _p.r(11).extendClass(f,{animate:function(a,b,c,d,e){function f(){g.shift(),g.length&&setTimeout(g[0].t.play.bind(g[0].t),g[0].d)}var g=this._KityAnimateQueue=this._KityAnimateQueue||[],h=a.create(this,b,c,e);return h.on("finish",f),g.push({t:h,d:d}),1==g.length&&setTimeout(h.play.bind(h),d),this},timeline:function(){return this._KityAnimateQueue[0].t},stop:function(){var a=this._KityAnimateQueue;if(a)for(;a.length;)a.shift().t.stop();return this}}),e}},_p[1]={value:function(a,b,c){var d={linear:function(a,b,c,d){return c*(a/d)+b},swing:function(a,b,c,e){return d.easeOutQuad(a,b,c,e)},ease:function(a,b,c,e){return d.easeInOutCubic(a,b,c,e)},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeInQuart:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOutQuart:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOutQuart:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOutQuint:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOutQuint:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOutSine:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOutSine:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},easeInExpo:function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b},easeOutExpo:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOutExpo:function(a,b,c,d){return 0===a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOutCirc:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOutCirc:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),g<Math.abs(c)?(g=c,e=f/4):e=f/(2*Math.PI)*Math.asin(c/g),-(g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f))+b)},easeOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),g<Math.abs(c)?(g=c,e=f/4):e=f/(2*Math.PI)*Math.asin(c/g),g*Math.pow(2,-10*a)*Math.sin(2*(a*d-e)*Math.PI/f)+c+b)},easeInOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0===a)return b;if(2==(a/=d/2))return b+c;if(f||(f=.3*d*1.5),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return 1>a?-.5*g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b},easeInBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},easeInBounce:function(a,b,c,e){return c-d.easeOutBounce(e-a,0,c,e)+b},easeOutBounce:function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOutBounce:function(a,b,c,e){return e/2>a?.5*d.easeInBounce(2*a,0,c,e)+b:.5*d.easeOutBounce(2*a-e,0,c,e)+.5*c+b}};return d}},_p[2]={value:function(a,b){function c(a){1===l.push(a)&&(i=j(d))}function d(){var a=l;for(l=[];a.length;)h(a.pop());i=0}function e(a){var b=g(a);return c(b),b}function f(a){var b=l.indexOf(a);~b&&l.splice(b,1),0===l.length&&k(i)}function g(a){var b={index:0,time:+new Date,elapsed:0,action:a,next:function(){c(b)}};return b}function h(a){var b=+new Date,c=b-a.time;c>200&&(c=1e3/60),a.dur=c,a.elapsed+=c,a.time=b,a.action.call(null,a),a.index++}var i,j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return setTimeout(a,1e3/60)},k=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout,l=[];b.requestFrame=e,b.releaseFrame=f}},_p[3]={value:function(a){var b=_p.r(0),c=_p.r(34),d=_p.r(46),e=_p.r(60),f=_p.r(11).createClass("MotionAnimator",{base:b,constructor:function(a,b){var e=this;this.callBase({beginValue:0,finishValue:1,setter:function(a,b){var f=e.motionPath instanceof d?e.motionPath.getPathData():e.motionPath,g=c.pointAtPath(f,b);a.setTranslate(g.x,g.y),this.doRotate&&a.setRotate(g.tan.getAngle())}}),this.doRotate=b,this.motionPath=a}});return _p.r(11).extendClass(e,{motion:function(a,b,c,d,e){return this.animate(new f(a),b,c,d,e)}}),f}},_p[4]={value:function(a){var b=_p.r(0),c=_p.r(11).createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return a.getOpacity()},finishValue:a,setter:function(a,b){a.setOpacity(b)}})}}),d=_p.r(60);return _p.r(11).extendClass(d,{fxOpacity:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),c}},_p[5]={value:function(a){var b=_p.r(0),c=_p.r(34),d=_p.r(11).createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return this.beginPath=a.getPathData(),0},finishValue:1,setter:function(b,d){b.setPathData(c.pathTween(this.beginPath,a,d))}})}}),e=_p.r(46);return _p.r(11).extendClass(e,{fxPath:function(a,b,c,e,f){return this.animate(new d(a),b,c,e,f)}}),d}},_p[6]={value:function(a){var b=_p.r(0),c=_p.r(11).createClass("RotateAnimator",{base:b,constructor:function(a){this.callBase({beginValue:0,finishValue:a,setter:function(a,b,c){var d=c.getDelta();a.rotate(d,ax,ay)}})}}),d=_p.r(60);return _p.r(11).extendClass(d,{fxRotate:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)}}),c}},_p[7]={value:function(a){var b=_p.r(0),c=_p.r(11).createClass("ScaleAnimator",{base:b,constructor:function(a,b){this.callBase({beginValue:0,finishValue:1,setter:function(c,d,e){var f=e.getDelta(),g=Math.pow(a,f),h=Math.pow(b,f);c.scale(h,g)}})}}),d=_p.r(60);return _p.r(11).extendClass(d,{fxScale:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}},_p[8]={value:function(a){function b(a,b,c){return f.paralle(a,b,function(a,b){return a+(b-a)*c})}function c(a,b){return f.paralle(a,b,function(a,b){return b-a})}function d(a,b,c){this.timeline=a,this.target=a.target,this.type=b;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])}var e=_p.r(33),f=_p.r(12),g=_p.r(2),h=_p.r(11).createClass("Timeline",{mixins:[e],constructor:function(a,b,c,d){this.callMixin(),this.target=b,this.time=0,this.duration=c,this.easing=d,this.animator=a,this.beginValue=a.beginValue,this.finishValue=a.finishValue,this.setter=a.setter,this.status="ready"},nextFrame:function(a){"playing"==this.status&&(this.time+=a.dur,this.setValue(this.getValue()),this.time>=this.duration&&this.timeUp(),a.next())},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var a=this.beginValue,c=this.finishValue,d=this.getValueProportion();return b(a,c,d)},setValue:function(a){this.lastValue=this.currentValue,this.currentValue=a,this.setter.call(this.target,this.target,a,this)},getDelta:function(){return this.lastValue=void 0===this.lastValue?this.beginValue:this.lastValue,c(this.lastValue,this.currentValue)},play:function(){var a=this.status;switch(this.status="playing",a){case"ready":f.isFunction(this.beginValue)&&(this.beginValue=this.beginValue.call(this.target,this.target)),f.isFunction(this.finishValue)&&(this.finishValue=this.finishValue.call(this.target,this.target)),this.time=0,this.setValue(this.beginValue),this.frame=g.requestFrame(this.nextFrame.bind(this));break;case"finished":case"stoped":this.time=0,this.frame=g.requestFrame(this.nextFrame.bind(this));break;case"paused":this.frame.next()}return this.fire("play",new d(this,"play",{lastStatus:a})),this},pause:function(){return this.status="paused",this.fire("pause",new d(this,"pause")),g.releaseFrame(this.frame),this},stop:function(){return this.status="stoped",this.setValue(this.finishValue),this.rollbacking=!1,this.fire("stop",new d(this,"stop")),g.releaseFrame(this.frame),this},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new d(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new d(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishValue),this.status="finished",this.fire("finish",new d(this,"finish")),g.releaseFrame(this.frame)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(a,b){return this.repeatOption=a,this.rollback=b,this}});return h.requestFrame=g.requestFrame,h.releaseFrame=g.releaseFrame,h}},_p[9]={value:function(a){var b=_p.r(0),c=_p.r(11).createClass("TranslateAnimator",{base:b,constructor:function(a,b){this.callBase({x:0,y:0},{x:a,y:b},function(a,b,c){var d=c.getDelta();a.translate(d.x,d.y)})}}),d=_p.r(60);return _p.r(11).extendClass(d,{fxTranslate:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}},_p[10]={value:function(){var a=function(){var a,b=navigator.userAgent.toLowerCase(),c=window.opera;a={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(b),opera:!!c&&c.version,webkit:b.indexOf(" applewebkit/")>-1,mac:b.indexOf("macintosh")>-1},a.gecko="Gecko"==navigator.product&&!a.webkit&&!a.opera&&!a.ie;var d=0;if(a.ie&&(d=1*(b.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]||0),a.ie11Compat=11==document.documentMode,a.ie9Compat=9==document.documentMode),a.gecko){var e=b.match(/rv:([\d\.]+)/);e&&(e=e[1].split("."),d=1e4*e[0]+100*(e[1]||0)+1*(e[2]||0))}return/chrome\/(\d+\.\d)/i.test(b)&&(a.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(b)&&!/chrome/i.test(b)&&(a.safari=+(RegExp.$1||RegExp.$2)),a.opera&&(d=parseFloat(c.version())),a.webkit&&(d=parseFloat(b.match(/ applewebkit\/(\d+)/)[1])),a.version=d,a.isCompatible=!a.mobile&&(a.ie&&d>=6||a.gecko&&d>=10801||a.opera&&d>=9.5||a.air&&d>=1||a.webkit&&d>=522||!1),a}();return a}},_p[11]={value:function(require,exports){function Class(){}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}exports.Class=Class,Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName},Class.prototype.getClass=function(){return this.constructor};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],
- a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,d=extend(d,b)},exports.extendClass=extend}},_p[12]={value:function(){var a={each:function(a,b,c){if(null!==a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},extend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(a[g]=f[g])}return a},deepExtend:function(a,b){for(var c=arguments,d=this.isBoolean(c[c.length-1])?c[c.length-1]:!1,e=this.isBoolean(c[c.length-1])?c.length-1:c.length,f=1;e>f;f++){var g=c[f];for(var h in g)d&&a.hasOwnProperty(h)||(this.isObject(a[h])&&this.isObject(g[h])?this.deepExtend(a[h],g[h],d):a[h]=g[h])}return a},clone:function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},copy:function(a){return"object"!=typeof a?a:"function"==typeof a?null:JSON.parse(JSON.stringify(a))},queryPath:function(a,b){for(var c=a.split("."),d=0,e=b,f=c.length;f>d;){if(!(c[d]in e))return void 0;if(e=e[c[d]],d++,d>=f||void 0===e)return e}},getValue:function(a,b){return void 0!==a?a:b},flatten:function(b){var c,d=[],e=b.length;for(c=0;e>c;c++)b[c]instanceof Array?d=d.concat(a.flatten(b[c])):d.push(b[c]);return d},paralle:function(b,c,d){var e,f,g,h;if(b instanceof Array){for(h=[],f=0;f<b.length;f++)h.push(a.paralle(b[f],c[f],d));return h}if(b instanceof Object){if(e=b.getClass&&b.getClass(),e&&e.parse)b=b.valueOf(),c=c.valueOf(),h=a.paralle(b,c,d),h=e.parse(h);else{h={};for(g in b)b.hasOwnProperty(g)&&c.hasOwnProperty(g)&&(h[g]=a.paralle(b[g],c[g],d))}return h}return!1===isNaN(parseFloat(b))?d(b,c):h},parallelize:function(b){return function(c,d){return a.paralle(c,d,b)}}};return a.each(["String","Function","Array","Number","RegExp","Object","Boolean"],function(b){a["is"+b]=function(a){return Object.prototype.toString.apply(a)=="[object "+b+"]"}}),a}},_p[13]={value:function(a,b,c){var d=_p.r(16),e=_p.r(12),f=_p.r(11).createClass("ColorMatrixEffect",{base:d,constructor:function(a,b){this.callBase(d.NAME_COLOR_MATRIX),this.set("type",e.getValue(a,f.TYPE_MATRIX)),this.set("in",e.getValue(b,d.INPUT_SOURCE_GRAPHIC))}});return e.extend(f,{TYPE_MATRIX:"matrix",TYPE_SATURATE:"saturate",TYPE_HUE_ROTATE:"hueRotate",TYPE_LUMINANCE_TO_ALPHA:"luminanceToAlpha",MATRIX_ORIGINAL:"10000010000010000010".split("").join(" "),MATRIX_EMPTY:"00000000000000000000".split("").join(" ")}),f}},_p[14]={value:function(a,b,c){var d=_p.r(16),e=_p.r(12),f=_p.r(11).createClass("CompositeEffect",{base:d,constructor:function(a,b,c){this.callBase(d.NAME_COMPOSITE),this.set("operator",e.getValue(a,f.OPERATOR_OVER)),b&&this.set("in",b),c&&this.set("in2",c)}});return e.extend(f,{OPERATOR_OVER:"over",OPERATOR_IN:"in",OPERATOR_OUT:"out",OPERATOR_ATOP:"atop",OPERATOR_XOR:"xor",OPERATOR_ARITHMETIC:"arithmetic"}),f}},_p[15]={value:function(a,b,c){var d=_p.r(16),e=_p.r(12),f=_p.r(11).createClass("ConvolveMatrixEffect",{base:d,constructor:function(a,b){this.callBase(d.NAME_CONVOLVE_MATRIX),this.set("edgeMode",e.getValue(a,f.MODE_DUPLICATE)),this.set("in",e.getValue(b,d.INPUT_SOURCE_GRAPHIC))}});return e.extend(f,{MODE_DUPLICATE:"duplicate",MODE_WRAP:"wrap",MODE_NONE:"none"}),f}},_p[16]={value:function(a,b,c){var d=_p.r(67),e=_p.r(11).createClass("Effect",{constructor:function(a){this.node=d.createNode(a)},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node},toString:function(){return this.node.getAttribute("result")||""}});return _p.r(12).extend(e,{NAME_GAUSSIAN_BLUR:"feGaussianBlur",NAME_OFFSET:"feOffset",NAME_COMPOSITE:"feComposite",NAME_COLOR_MATRIX:"feColorMatrix",NAME_CONVOLVE_MATRIX:"feConvolveMatrix",INPUT_SOURCE_GRAPHIC:"SourceGraphic",INPUT_SOURCE_ALPHA:"SourceAlpha",INPUT_BACKGROUND_IMAGE:"BackgroundImage",INPUT_BACKGROUND_ALPHA:"BackgroundAlpha",INPUT_FILL_PAINT:"FillPaint",INPUT_STROKE_PAINT:"StrokePaint"}),e}},_p[17]={value:function(a,b,c){var d=_p.r(16),e=_p.r(12);return _p.r(11).createClass("GaussianblurEffect",{base:d,constructor:function(a,b){this.callBase(d.NAME_GAUSSIAN_BLUR),this.set("stdDeviation",e.getValue(a,1)),this.set("in",e.getValue(b,d.INPUT_SOURCE_GRAPHIC))}})}},_p[18]={value:function(a,b,c){var d=_p.r(16),e=_p.r(12);return _p.r(11).createClass("OffsetEffect",{base:d,constructor:function(a,b,c){this.callBase(d.NAME_OFFSET),this.set("dx",e.getValue(a,0)),this.set("dy",e.getValue(b,0)),this.set("in",e.getValue(c,d.INPUT_SOURCE_GRAPHIC))}})}},_p[19]={value:function(a){return _p.r(11).createClass("EffectContainer",{base:_p.r(29),addEffect:function(a,b){return this.addItem.apply(this,arguments)},prependEffect:function(){return this.prependItem.apply(this,arguments)},appendEffect:function(){return this.appendItem.apply(this,arguments)},removeEffect:function(a){return this.removeItem.apply(this,arguments)},addEffects:function(){return this.addItems.apply(this,arguments)},setEffects:function(){return this.setItems.apply(this,arguments)},getEffect:function(){return this.getItem.apply(this,arguments)},getEffects:function(){return this.getItems.apply(this,arguments)},getFirstEffect:function(){return this.getFirstItem.apply(this,arguments)},getLastEffect:function(){return this.getLastItem.apply(this,arguments)},handleAdd:function(a,b){var c=this.getEffects().length,d=this.getItem(b+1);return c===b+1?void this.node.appendChild(a.getNode()):void this.node.insertBefore(a.getNode(),d.getNode())}})}},_p[20]={value:function(a,b,c){var d=_p.r(67),e=_p.r(11),f=e.createClass("Filter",{mixins:[_p.r(19)],constructor:function(a,b,c,e){this.node=d.createNode("filter"),void 0!==a&&this.set("x",a),void 0!==b&&this.set("y",b),void 0!==c&&this.set("width",c),void 0!==e&&this.set("height",e)},getId:function(){return this.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node}}),g=_p.r(60);return e.extendClass(g,{applyFilter:function(a){var b=a.get("id");return b&&this.node.setAttribute("filter","url(#"+b+")"),this}}),f}},_p[21]={value:function(a,b,c){var d=_p.r(17);return _p.r(11).createClass("GaussianblurFilter",{base:_p.r(20),constructor:function(a){this.callBase(),this.addEffect(new d(a))}})}},_p[22]={value:function(a,b,c){var d=_p.r(17),e=_p.r(16),f=_p.r(13),g=_p.r(28),h=_p.r(12),i=_p.r(14),j=_p.r(18);return _p.r(11).createClass("ProjectionFilter",{base:_p.r(20),constructor:function(a,b,c){this.callBase(),this.gaussianblurEffect=new d(a,e.INPUT_SOURCE_ALPHA),this.gaussianblurEffect.set("result","gaussianblur"),this.addEffect(this.gaussianblurEffect),this.offsetEffect=new j(b,c,this.gaussianblurEffect),this.offsetEffect.set("result","offsetBlur"),this.addEffect(this.offsetEffect),this.colorMatrixEffect=new f(f.TYPE_MATRIX,this.offsetEffect),this.colorMatrixEffect.set("values",f.MATRIX_ORIGINAL),this.colorMatrixEffect.set("result","colorOffsetBlur"),this.addEffect(this.colorMatrixEffect),this.compositeEffect=new i(i.OPERATOR_OVER,e.INPUT_SOURCE_GRAPHIC,this.colorMatrixEffect),this.addEffect(this.compositeEffect)},setColor:function(a){var b=null,c=[];if(h.isString(a)&&(a=g.parse(a)),!a)return this;b=f.MATRIX_EMPTY.split(" "),c.push(a.get("r")),c.push(a.get("g")),c.push(a.get("b"));for(var d=0,e=c.length;e>d;d++)b[5*d+3]=c[d]/255;return b[18]=a.get("a"),this.colorMatrixEffect.set("values",b.join(" ")),this},setOpacity:function(a){var b=this.colorMatrixEffect.get("values").split(" ");return b[18]=a,this.colorMatrixEffect.set("values",b.join(" ")),this},setOffset:function(a,b){this.setOffsetX(a),this.setOffsetY(b)},setOffsetX:function(a){this.offsetEffect.set("dx",a)},setOffsetY:function(a){this.offsetEffect.set("dy",a)},setDeviation:function(a){this.gaussianblurEffect.set("stdDeviation",a)}})}},_p[23]={value:function(a,b,c){return _p.r(11).createClass("Bezier",{mixins:[_p.r(51)],base:_p.r(46),constructor:function(a){this.callBase(),a=a||[],this.changeable=!0,this.setBezierPoints(a)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(a){return this.setPoints(a)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=null,b=this.getBezierPoints();if(!(b.length<2)){a=this.getDrawer(),a.clear();var c=b[0].getVertex(),d=null,e=null;a.moveTo(c.x,c.y);for(var f=1,g=b.length;g>f;f++)c=b[f].getVertex(),e=b[f].getBackward(),d=b[f-1].getForward(),a.bezierTo(d.x,d.y,e.x,e.y,c.x,c.y);return this}}})}},_p[24]={value:function(a,b,c){var d=_p.r(63),e=_p.r(73),f=_p.r(11).createClass("BezierPoint",{constructor:function(a,b,c){this.vertex=new d(a,b),this.forward=new d(a,b),this.backward=new d(a,b),this.setSmooth(void 0===c||c),this.setSymReflaction(!0)},clone:function(){var a=new f,b=null;return b=this.getVertex(),a.setVertex(b.x,b.y),b=this.getForward(),a.setForward(b.x,b.y),b=this.getBackward(),a.setBackward(b.x,b.y),a.setSymReflaction(this.isSymReflaction),a.setSmooth(this.isSmooth()),a},setVertex:function(a,b){return this.vertex.setPoint(a,b),this.update(),this},moveTo:function(a,b){var c=this.forward.getPoint(),d=this.backward.getPoint(),e=this.vertex.getPoint(),f={left:a-e.x,top:b-e.y};this.forward.setPoint(c.x+f.left,c.y+f.top),this.backward.setPoint(d.x+f.left,d.y+f.top),this.vertex.setPoint(a,b),this.update()},setForward:function(a,b){return this.forward.setPoint(a,b),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this.lastControlPointSet=this.forward,this},setBackward:function(a,b){return this.backward.setPoint(a,b),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this.lastControlPointSet=this.backward,this},setSymReflaction:function(a){return this.symReflaction=a,this.smooth&&this.setSmooth(!0),this},isSymReflaction:function(){return this.symReflaction},updateAnother:function(a,b){var c=this.getVertex(),d=e.fromPoints(a.getPoint(),c),f=e.fromPoints(c,b.getPoint());return f=d.normalize(this.isSymReflaction()?d.length():f.length()),b.setPoint(c.x+f.x,c.y+f.y),this},setSmooth:function(a){var b;return this.smooth=!!a,this.smooth&&(b=this.lastControlPointSet)&&this.updateAnother(b,b==this.forward?this.backward:this.forward),this},isSmooth:function(){return this.smooth},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},update:function(){return this.container?void(this.container.update&&this.container.update(this)):this}});return f}},_p[25]={value:function(a,b,c){var d=_p.r(11).createClass("Box",{constructor:function(a,b,c,d){var e=arguments[0];e&&"object"==typeof e&&(a=e.x,b=e.y,c=e.width,d=e.height),0>c&&(a-=c=-c),0>d&&(b-=d=-d),this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this.left=this.x,this.right=this.x+this.width,this.top=this.y,this.bottom=this.y+this.height,this.cx=this.x+this.width/2,this.cy=this.y+this.height/2},getRangeX:function(){return[this.left,this.right]},getRangeY:function(){return[this.top,this.bottom]},merge:function(a){if(this.isEmpty())return new d(a.x,a.y,a.width,a.height);var b=Math.min(this.left,a.left),c=Math.max(this.right,a.right),e=Math.min(this.top,a.top),f=Math.max(this.bottom,a.bottom);return new d(b,e,c-b,f-e)},intersect:function(a){!a instanceof d&&(a=new d(a));var b=Math.max(this.left,a.left),c=Math.min(this.right,a.right),e=Math.max(this.top,a.top),f=Math.min(this.bottom,a.bottom);return b>c||e>f?new d:new d(b,e,c-b,f-e)},expand:function(a,b,c,e){if(arguments.length<1)return new d(this);arguments.length<2&&(b=a),arguments.length<3&&(c=a),arguments.length<4&&(e=b);var f=this.left-e,g=this.top-a,h=this.width+b,i=this.height+a;return new d(f,g,h,i)},valueOf:function(){return[this.x,this.y,this.width,this.height]},toString:function(){return this.valueOf().join(" ")},isEmpty:function(){return!this.width||!this.height}});return d.parse=function(a){return"string"==typeof a?d.parse(a.split(/[\s,]+/).map(parseFloat)):a instanceof Array?new d(a[0],a[1],a[2],a[3]):"x"in a?new d(a):null},d}},_p[26]={value:function(a,b,c){return _p.r(11).createClass("Circle",{base:_p.r(32),constructor:function(a,b,c){this.callBase(a,a,b,c)},getRadius:function(){return this.getRadiusX()},setRadius:function(a){return this.callBase(a,a)}})}},_p[27]={value:function(a,b,c){var d=_p.r(11),e=_p.r(60),f=d.createClass("Clip",{base:e,mixins:[_p.r(61)],constructor:function(a){this.callBase("clipPath",a)},clip:function(a){return a.getNode().setAttribute("clip-path",this),this}});return d.extendClass(e,{clipWith:function(a){return a instanceof e&&(a=new f(a.getPaper()).addShape(a)),a.clip(this),this}}),f}},_p[28]={value:function(a,b,c){var d=_p.r(12),e=_p.r(64),f={},g=_p.r(11).createClass("Color",{constructor:function(){var a=null;"string"==typeof arguments[0]?(a=f.parseToValue(arguments[0]),null===a&&(a={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(a={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:void 0===arguments[3]?1:parseFloat(arguments[3])},a=f.overflowFormat(a),a=d.extend(a,f.rgbValueToHslValue(a))),this._color=a},set:function(a,b){if(!g._MAX_VALUE[a])throw new Error("Color set(): Illegal parameter");return"a"!==a&&(b=Math.floor(b)),"h"==a&&(b=(b+360)%360),this._color[a]=Math.max(g._MIN_VALUE[a],Math.min(g._MAX_VALUE[a],b)),-1!=="rgb".indexOf(a)?this._color=d.extend(this._color,f.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(a)&&(this._color=d.extend(this._color,f.hslValueToRGBValue(this._color))),this},inc:function(a,b){return b=this.get(a)+b,"h"==a?b=(b+360)%360:(b=Math.min(g._MAX_VALUE[a],b),b=Math.max(g._MIN_VALUE[a],b)),this.clone().set(a,b)},dec:function(a,b){return this.inc(a,-b)},clone:function(){return new g(this.toRGBA())},get:function(a){return g._MAX_VALUE[a]?this._color[a]:null},getValues:function(){return d.clone(this._color)},valueOf:function(){return this.getValues()},toRGB:function(){return f.toString(this._color,"rgb")},toRGBA:function(){return f.toString(this._color,"rgba")},toHEX:function(){return f.toString(this._color,"hex")},toHSL:function(){return f.toString(this._color,"hsl")},toHSLA:function(){return f.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return d.extend(g,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(a){var b;return d.isString(a)&&(b=f.parseToValue(a)),d.isObject(a)&&"r"in a&&(b=a),null===b?new g:new g(b.r,b.g,b.b,b.a)},createHSL:function(a,b,c){return g.createHSLA(a,b,c,1)},createHSLA:function(a,b,c,d){var e=null;return b+="%",c+="%",e=["hsla("+a,b,c,d+")"],g.parse(e.join(", "))},createRGB:function(a,b,c){return g.createRGBA(a,b,c,1)},createRGBA:function(a,b,c,d){return new g(a,b,c,d)}}),d.extend(f,{parseToValue:function(a){var b={};if(a=e.EXTEND_STANDARD[a]||e.COLOR_STANDARD[a]||a,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a))b=f.hexToValue(a);else if(/^(rgba?)/i.test(a))b=f.rgbaToValue(a);else{if(!/^(hsla?)/i.test(a))return null;b=f.hslaToValue(a)}return f.overflowFormat(b)},hexToValue:function(a){var b={},c=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?(a=RegExp.$1.split(""),d.each(c,function(c,d){3===a.length?b[c]=f.toNumber(a[d]+a[d]):b[c]=f.toNumber(a[2*d]+a[2*d+1])}),b=d.extend(b,f.rgbValueToHslValue(b)),b.a=1,b):null},rgbaToValue:function(a){var b={},c=!1,e=["r","g","b"];return/^(rgba?)/i.test(a)?(c=4===RegExp.$1.length,a=a.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),d.each(e,function(c,d){b[c]=0|a[d]}),b=d.extend(b,f.rgbValueToHslValue(b)),b.a=c?parseFloat(a[3]):1,b):null},hslaToValue:function(a){var b={},c=!1;return/^(hsla?)/i.test(a)?(c=4===RegExp.$1.length,a=a.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),b.h=0|a[0],b.s=0|a[1],b.l=0|a[2],b=d.extend(b,f.hslValueToRGBValue(b)),b=f.hslValueToRGBValue(b),b.a=c?parseFloat(a[3]):1,b):null},hslValueToRGBValue:function(a){function b(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+6*(b-a)*(2/3-c):a}var c=null,e=null,f={};return a=d.extend({},a),a.h=a.h/360,a.s=a.s/100,a.l=a.l/100,0===a.s?f.r=f.g=f.b=a.l:(c=a.l<.5?a.l*(1+a.s):a.l+a.s-a.l*a.s,e=2*a.l-c,f.r=b(e,c,a.h+1/3),f.g=b(e,c,a.h),f.b=b(e,c,a.h-1/3)),f.r=Math.min(Math.round(255*f.r),255),f.g=Math.min(Math.round(255*f.g),255),f.b=Math.min(Math.round(255*f.b),255),f},rgbValueToHslValue:function(a){var b=null,c=null,e={};return a=d.extend({},a),a.r=a.r/255,a.g=a.g/255,a.b=a.b/255,b=Math.max(a.r,a.g,a.b),c=Math.min(a.r,a.g,a.b),b===c?e.h=0:b===a.r?a.g>=a.b?e.h=60*(a.g-a.b)/(b-c):e.h=60*(a.g-a.b)/(b-c)+360:b===a.g?e.h=60*(a.b-a.r)/(b-c)+120:b===a.b&&(e.h=60*(a.r-a.g)/(b-c)+240),e.l=(b+c)/2,0===e.l||b===c?e.s=0:e.l>0&&e.l<=.5?e.s=(b-c)/(b+c):e.s=(b-c)/(2-b-c),e.h=Math.round(e.h),e.s=Math.round(100*e.s),e.l=Math.round(100*e.l),e},toString:function(a,b){var c=[];return a=d.extend({},a),-1!==b.indexOf("hsl")&&(a.s+="%",a.l+="%"),"hex"!==b?(d.each(b.split(""),function(b){c.push(a[b])}),(b+"("+c.join(", ")+")").toLowerCase()):(c.push(f.toHexValue(+a.r)),c.push(f.toHexValue(+a.g)),c.push(f.toHexValue(+a.b)),("#"+c.join("")).toLowerCase())},toNumber:function(a){return 0|Number("0x"+a)},toHexValue:function(a){var b=a.toString(16);return 1===b.length?"0"+b:b},overflowFormat:function(a){var b=d.extend({},a),c="rgba";return d.each(c.split(""),function(a){b.hasOwnProperty(a)&&(b[a]=Math.min(g._MAX_VALUE[a],b[a]),b[a]=Math.max(g._MIN_VALUE[a],b[a]))}),b}}),g}},_p[29]={value:function(a,b,c){function d(){return this.container.removeItem(this),this}return _p.r(11).createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(a){return this.getItems()[a]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(a){return this.getItems().indexOf(a)},eachItem:function(a){var b,c=this.getItems(),d=c.length;for(b=0;d>b;b++)a.call(this,b,c[b]);return this},addItem:function(a,b,c){var e=this.getItems(),f=e.length;return~e.indexOf(a)?this:(b>=0&&f>b||(b=f),e.splice(b,0,a),"object"==typeof a&&(a.container=this,a.remove=d),this.handleAdd(a,b),c||this.onContainerChanged("add",[a]),this)},addItems:function(a){for(var b=0,c=a.length;c>b;b++)this.addItem(a[b],-1,!0);return this.onContainerChanged("add",a),this},setItems:function(a){return this.clear().addItems(a)},appendItem:function(a){return this.addItem(a)},prependItem:function(a){return this.addItem(a,0)},removeItem:function(a,b){if("number"!=typeof a)return this.removeItem(this.indexOf(a));var c=this.getItems(),d=(c.length,c[a]);return void 0===d?this:(c.splice(a,1),d.container&&delete d.container,d.remove&&delete d.remove,this.handleRemove(d,a),b||this.onContainerChanged("remove",[d]),this)},clear:function(){for(var a,b=[];a=this.getFirstItem();)b.push(a),this.removeItem(0,!0);return this.onContainerChanged("remove",b),this},onContainerChanged:function(a,b){},handleAdd:function(a,b){},handleRemove:function(a,b){}})}},_p[30]={value:function(a,b,c){var d=_p.r(12),e={getCurvePanLines:function(a,b){var c=e.getCenterPoints(a),d=e.getPanLine(a.length,c);return e.getMovedPanLines(a,d,b)},getCenterPoints:function(a){for(var b={},c=null,d=0,e=0,f=a.length;f>d;d++)e=d===f-1?0:d+1,c=d+","+e,b[c]={x:(a[d].x+a[e].y)/2,y:(a[d].x+a[e].y)/2};return b},getPanLine:function(a,b){for(var c,d={},e=null,f=0;a>f;f++){var g=null,h=null;c=(f+1)%a,e=c,g=b[f+","+c],f=c,c=(f+1)%a,h=b[f+","+c],d[e]={points:[{x:g.x,y:g.y},{x:h.x,y:h.y}],center:{x:(g.x+h.x)/2,y:(g.y+h.y)/2}},f=(e+a-1)%a}return d},getMovedPanLines:function(a,b,c){var e={};return d.each(a,function(a,f){var g=b[f],h=g.center,i={x:h.x-a.x,y:h.y-a.y},j=e[f]={points:[],center:{x:a.x,y:a.y}};d.each(g.points,function(a,b){var d={x:a.x-i.x,y:a.y-i.y},e=j.center,f=d.x-e.x,g=d.y-e.y;d.x=e.x+c*f,d.y=e.y+c*g,j.points.push(d)})}),e}};return _p.r(11).createClass("Curve",{base:_p.r(46),mixins:[_p.r(51)],constructor:function(a,b){this.callBase(),this.setPoints(a||[]),this.closeState=!!b,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(a){return this.smoothFactor=0>a?0:a,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var a=this.getPoints(),b=null,c=this.getDrawer(),d=null,f=null,g=null;if(c.clear(),0===a.length)return this;if(c.moveTo(a[0]),1===a.length)return this;if(2===a.length)return c.lineTo(a[1]),this;b=e.getCurvePanLines(a,this.getSmoothFactor());for(var h=1,i=a.length;i>h;h++)d=b[h].center,f=this.closeState||h!=i-1?b[h].points[0]:b[h].center,g=this.closeState||1!=h?b[h-1].points[1]:b[h-1].center,c.bezierTo(g.x,g.y,f.x,f.y,d.x,d.y);return this.closeState&&(d=b[0].center,f=b[0].points[0],g=b[a.length-1].points[1],c.bezierTo(g.x,g.y,f.x,f.y,d.x,d.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}},_p[31]={value:function(a,b,c){return _p.r(11).createClass("Data",{constructor:function(){this._data={}},setData:function(a,b){return this._data[a]=b,this},getData:function(a){return this._data[a]},removeData:function(a){return delete this._data[a],this}})}},_p[32]={value:function(a,b,c){var d=(_p.r(12),_p.r(50));return _p.r(11).createClass("Ellipse",{base:_p.r(46),constructor:function(a,b,c,d){this.callBase(),this.rx=a||0,this.ry=b||0,this.cx=c||0,this.cy=d||0,this.update()},update:function(){var a=this.rx,b=this.ry,c=this.cx+a,d=this.cx-a,e=this.cy,f=this.getDrawer();return f.clear(),f.moveTo(c,e),f.arcTo(a,b,0,1,1,d,e),f.arcTo(a,b,0,1,1,c,e),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return new d(this.cx,this.cy)},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(a,b){return this.rx=a,this.ry=b,this.update()},setRadiusX:function(a){return this.rx=a,this.update()},setRadiusY:function(a){return this.ry=a,this.update()},setCenter:function(a,b){if(1==arguments.length){var c=d.parse(arguments[0]);a=c.x,b=c.y}return this.cx=a,this.cy=b,this.update()},setCenterX:function(a){return this.cx=a,this.update()},setCenterY:function(a){return this.cy=a,this.update()}})}},_p[33]={value:function(a,b,c){function d(a,b,c){return c=!!c,j.isString(a)&&(a=a.match(/\S+/g)),j.each(a,function(a){f.call(this,this.node,a,b,c)},this),this}function e(a,b){var c=null,d=this._EVNET_UID,e=void 0===b;return c=m[d][a],e||(e=!0,j.each(c,function(a,d){a===b?delete c[d]:e=!1})),e&&(h(this.node,a,l[d][a]),delete m[d][a],delete l[d][a]),this}function f(a,b,c,d){var e=this._EVNET_UID,f=this;l[e]||(l[e]={}),l[e][b]||(l[e][b]=function(a){a=new k(a||window.event),j.each(m[e][b],function(c){var e;return c&&(e=c.call(f,a),d&&f.off(b,c)),e},f)}),m[e]||(m[e]={}),m[e][b]?m[e][b].push(c):(m[e][b]=[c],a&&"on"+b in a&&g(a,b,l[e][b]))}function g(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function h(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent(b,c)}function i(a,b,c){var d=null,e=null,f=l[a._EVNET_UID];f&&(e=f[b],e&&(d=j.extend({type:b,target:a},c||{}),e.call(a,d)))}!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}();var j=_p.r(12),k=_p.r(62),l={},m={},n=0;return _p.r(11).createClass("EventHandler",{constructor:function(){this._EVNET_UID=++n},addEventListener:function(a,b){return d.call(this,a,b,!1)},addOnceEventListener:function(a,b){return d.call(this,a,b,!0)},removeEventListener:function(a,b){return e.call(this,a,b)},on:function(a,b){return this.addEventListener.apply(this,arguments)},once:function(a,b){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(a,b){return this.trigger.apply(this,arguments)},trigger:function(a,b){return i(this,a,b),this}})}},_p[34]={value:function(a){function b(a){var b,c,d,e,f;for(b=[],c=0;c<a.length;c++)for(e=a[c],b.push(f=[]),d=0;d<e.length;d++)f.push(e[d]);return a.isUniform&&(b.isUniform=!0),a.isAbsolute&&(b.isAbsolute=!0),a.isCurve&&(b.isCurve=!0),b}function c(a,b,c){function d(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function e(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=e.cache=e.cache||{},i=e.count=e.count||[];return h.hasOwnProperty(g)?(d(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a.apply(b,f),c?c(h[g]):h[g])}return e}function d(a,b,c,e,f,g,h,i,j,k){var l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=Math,R=Q.PI,S=Math.abs,T=120*R/180,U=R/180*(+f||0),V=[],W=function(a,b,c){var d=a*Q.cos(c)-b*Q.sin(c),e=a*Q.sin(c)+b*Q.cos(c);return{x:d,y:e}};if(k?(w=k[0],x=k[1],u=k[2],v=k[3]):(l=W(a,b,-U),a=l.x,b=l.y,l=W(i,j,-U),i=l.x,j=l.y,m=Q.cos(R/180*f),n=Q.sin(R/180*f),p=(a-i)/2,q=(b-j)/2,o=p*p/(c*c)+q*q/(e*e),o>1&&(o=Q.sqrt(o),c=o*c,e=o*e),r=c*c,s=e*e,t=(g==h?-1:1)*Q.sqrt(S((r*s-r*q*q-s*p*p)/(r*q*q+s*p*p))),u=t*c*q/e+(a+i)/2,v=t*-e*p/c+(b+j)/2,w=Q.asin(((b-v)/e).toFixed(9)),x=Q.asin(((j-v)/e).toFixed(9)),w=u>a?R-w:w,x=u>i?R-x:x,0>w&&(w=2*R+w),0>x&&(x=2*R+x),h&&w>x&&(w-=2*R),!h&&x>w&&(x-=2*R)),y=x-w,S(y)>T&&(z=x,A=i,B=j,x=w+T*(h&&x>w?1:-1),i=u+c*Q.cos(x),j=v+e*Q.sin(x),V=d(i,j,c,e,f,0,h,A,B,[x,z,u,v])),y=x-w,C=Q.cos(w),D=Q.sin(w),E=Q.cos(x),F=Q.sin(x),G=Q.tan(y/4),H=4/3*c*G,I=4/3*e*G,J=[a,b],K=[a+H*D,b-I*C],L=[i+H*F,j-I*E],M=[i,j],K[0]=2*J[0]-K[0],K[1]=2*J[1]-K[1],k)return[K,L,M].concat(V);for(V=[K,L,M].concat(V).join().split(","),N=[],O=0,P=V.length;P>O;O++)N[O]=O%2?W(V[O-1],V[O],U).y:W(V[O],V[O+1],U).x;return N}function e(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function f(a,b){function c(a){return function(b,c){return b+a*(c-b)}}var d=c(b||.5),e=a,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=d(f,h),o=d(g,i),p=d(h,j),q=d(i,k),r=d(j,l),s=d(k,m),t=d(n,p),u=d(o,q),v=d(p,r),w=d(q,s),x=d(t,v),y=d(u,w);return[[f,g,n,o,t,u,x,y],[x,y,v,w,r,s,l,m]]}var g=_p.r(12),h=_p.r(50),i=_p.r(73),j=_p.r(43),k={},l=/([achlmrqstvz])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?\s*)+)/gi,m=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)\s*,?\s*/gi,n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0};k.pathToString=function(a){return a=a||this,"string"==typeof a?a:a instanceof Array?(a=g.flatten(a),a.join(",").replace(/,?([achlmqrstvxz]),?/gi,"$1")):void 0},k.parsePathString=c(function(a){var b=[];return a.replace(l,function(a,c,d){var e=[],f=c.toLowerCase();if(d.replace(m,function(a,b){b&&e.push(+b)}),"m"==f&&e.length>2&&(b.push([c].concat(e.splice(0,2))),f="l",c="m"==c?"l":"L"),"r"==f)b.push([c].concat(e));else for(;e.length>=n[f]&&(b.push([c].concat(e.splice(0,n[f]))),n[f]););}),b.isUniform=!0,b.toString=k.pathToString,b}),k.pathToAbsolute=c(function(a){var b,c,d,e,f,g,h,i,j=a.isUniform?a:k.parsePathString(k.pathToString(a)),l=[],m=0,n=0,o=0,p=0,q=0;for("M"==j[0][0]&&(m=+j[0][1],n=+j[0][2],o=m,p=n,q++,l[0]=["M",m,n]),d=q,g=j.length;g>d;d++){if(l.push(b=[]),c=j[d],c[0]!=c[0].toUpperCase())switch(b[0]=c[0].toUpperCase(),b[0]){case"A":b[1]=c[1],b[2]=c[2],b[3]=c[3],b[4]=c[4],b[5]=c[5],b[6]=+(c[6]+m),b[7]=+(c[7]+n);break;case"V":b[1]=+c[1]+n;break;case"H":b[1]=+c[1]+m;break;case"M":o=+c[1]+m,p=+c[2]+n;break;default:for(e=1,h=c.length;h>e;e++)b[e]=+c[e]+(e%2?m:n)}else for(f=0,i=c.length;i>f;f++)b[f]=c[f];switch(b[0]){case"Z":m=o,n=p;break;case"H":m=b[1];break;case"V":n=b[1];break;case"M":o=b[b.length-2],p=b[b.length-1];break;default:m=b[b.length-2],n=b[b.length-1]}}return l.isUniform=!0,l.isAbsolute=!0,l.toString=k.pathToString,l}),k.pathToCurve=c(function(a){var b,c,f,g,h,i,j,l,m,n,o,p,q=[];for(a.isAbsolute||(a=k.pathToAbsolute(a)),b=0;b<a.length;b++)if(f=a[b][0],g=a[b].slice(1),"M"!=f){switch("Z"==f&&(l=!0,f="L",g=h),j=g.slice(g.length-2),"H"==f&&(j=[g[0],i[1]],f="L"),"V"==f&&(j=[i[0],g[0]],f="L"),("S"==f||"T"==f)&&(n=[i[0]+(i[0]-m[0]),i[1]+(i[1]-m[1])]),f){case"L":o=i,p=j;break;case"C":o=g.slice(0,2),p=g.slice(2,4);break;case"S":o=n.slice(),p=g.slice(0,2);break;case"Q":m=g.slice(0,2),g=e.apply(null,i.concat(g)),o=g.slice(0,2),p=g.slice(2,4);break;case"T":g=e.apply(null,i.concat(n).concat(g)),o=g.slice(0,2),p=g.slice(2,4);break;case"A":for(g=d.apply(null,i.concat(g)),c=0;c in g;)o=g.slice(c,c+2),p=g.slice(c+2,c+4),j=g.slice(c+4,c+6),q.push(["C"].concat(o).concat(p).concat(j)),c+=6}"A"!=f&&q.push(["C"].concat(o).concat(p).concat(j)),i=j,"Q"!=f&&(m=p),l&&(q.push(["Z"]),l=!1)}else h=m=i=g,q.push(a[b]);return q.isUniform=!0,q.isAbsolute=!0,q.isCurve=!0,q.toString=k.pathToString,q}),k.cutBezier=c(f),k.subBezier=function(a,b,c){var d=f(a,b)[0];return c?f(d,c/b)[1]:d},k.pointAtBezier=function(a,b){var c=f(a,b)[0],d=h.parse(c.slice(6)),e=h.parse(c.slice(4,2)),g=i.fromPoints(e,d);return 0===b?d.tan=k.pointAtBezier(a,.01).tan:d.tan=g.normalize(),d},k.bezierLength=c(function(a){function b(a){var b=i*Math.pow(a,4)+j*Math.pow(a,3)+k*Math.pow(a,2)+l*a+m;return 0>b&&(b=0),Math.pow(b,.5)}var c,d,e,f,g,h,i,j,k,l,m,n=a;return c=-3*n[0]+9*n[2]-9*n[4]+3*n[6],d=6*n[0]-12*n[2]+6*n[4],e=-3*n[0]+3*n[2],f=-3*n[1]+9*n[3]-9*n[5]+3*n[7],g=6*n[1]-12*n[3]+6*n[5],h=-3*n[1]+3*n[3],i=Math.pow(c,2)+Math.pow(f,2),j=2*(c*d+f*g),k=2*(c*e+f*h)+Math.pow(d,2)+Math.pow(g,2),l=2*(d*e+g*h),m=Math.pow(e,2)+Math.pow(h,2),(b(0)+b(1)+4*(b(.125)+b(.375)+b(.625)+b(.875))+2*(b(.25)+b(.5)+b(.75)))/24});var o=c(function(a){var b,c,d,e,f,g,h;for(g=[],h=0,b=0,c=a.length;c>b;b++)d=a[b],"M"!=d[0]?"Z"!=d[0]?(f=k.bezierLength(e.concat(d.slice(1))),g.push([h,h+f]),h+=f,e=d.slice(4)):g.push(null):(e=d.slice(1),g.push(null));return g.totalLength=h,g});k.subPath=function(a,b,c){var d;if(c=c||0,d=b-c,d-=0|d,c-=0|c,b=c+d,b>1)return k.subPath(a,1,c).concat(k.subPath(a,b-1));a.isCurve||(a=k.pathToCurve(a));var e,f,g,h,i,j,l,m,n,p=o(a),q=p.totalLength,r=q*b,s=q*(c||0),t=[];for(e=0,f=a.length;f>e;e++)if("M"!=a[e][0]){if("Z"!=a[e][0])if(g=p[e][0],h=p[e][1],i=h-g,l=j.concat(a[e].slice(1)),s>h)j=l.slice(l.length-2);else{if(s>=g)m=k.subBezier(l,Math.min((r-g)/i,1),(s-g)/i),n=!0,j=m.slice(0,2),t.push(["M"].concat(m.slice(0,2))),t.push(["C"].concat(m.slice(2)));else if(r>=h)t.push(a[e].slice());else{if(!(r>=g))break;m=k.subBezier(l,(r-g)/i),t.push(["C"].concat(m.slice(2))),n=!1}j=l.slice(l.length-2)}}else j=a[e].slice(1),n&&t.push(a[e].slice());return t.isAbsolute=!0,t.isCurve=!0,t.isUniform=!0,t.toString=k.pathToString,t},k.pointAtPath=function(a,b){a.isCurve||(a=k.pathToCurve(a));var c=k.subPath(a,b),d="Z"==c[c.length-1][0]?c[c.length-2]:c[c.length-1];d=d.slice(1);var e=h.parse(d.slice(4)),f=h.parse(d.slice(2,4));return e.tan=i.fromPoints(f,e).normalize(),e},k.pathLength=c(function(a){a.isCurve||(a=k.pathToCurve(a));var b=o(a);return b.totalLength}),k.pathKeyPoints=c(function(a){var b,c,d;for(a.isCurve||(a=k.pathToCurve(a)),d=[],b=0,c=a.length;c>b;b++)"z"!=a[b][0]&&d.push(a[b].slice(a[b].length-2));return d});var p=c(function(a,c){function d(a,b){return a[b||a.i]&&a[b||a.i][0]}function e(a,b){return a[b||a.i]&&a[b||a.i].slice(1)}function f(a,b){var c=e(a,b);return c&&c.slice(-2)}function g(a){return"Z"==d(a)?(a.splice(a.i,1),!0):!1}function h(a){return"M"==d(a)?(a.o.splice(a.o.i,0,["M"].concat(f(a.o,a.o.i-1))),
- a.i++,a.o.i++,!0):!1}function i(a){for(var b,c=1;!b;)b=f(a,a.length-c++);for(a.o.i=a.i;a.length<a.o.length;)g(a.o)||h(a.o)||(a.push(["C"].concat(b).concat(b).concat(b)),a.i++,a.o.i++)}a.isCurve||(a=k.pathToCurve(a)),c.isCurve||(c=k.pathToCurve(c));var j=b(a),l=b(c);for(j.i=0,l.i=0,j.o=l,l.o=j;j.i<j.length&&l.i<l.length;)g(j)||g(l)||(d(j)!=d(l)?h(j)||h(l)||(j.i++,l.i++):(j.i++,l.i++));return j.i==j.length&&i(j),l.i==l.length&&i(l),delete j.i,delete j.o,delete l.i,delete l.o,[j,l]});return k.alignCurve=p,k.pathTween=function(a,b,c){if(0===c)return a;if(1===c)return b;var d,e,f,g=p(a,b),h=[];for(a=g[0],b=g[1],e=0;e<a.length;e++)for(h.push(d=[]),d.push(a[e][0]),f=1;f<a[e].length;f++)d.push(a[e][f]+c*(b[e][f]-a[e][f]));return h.isUniform=h.isCurve=h.isAbsolute=!0,h},k.transformPath=c(function(a,b){var c,d,e,f,g,i;for(a.isCurve||(a=k.pathToCurve(a)),f=[],c=0,d=a.length;d>c;c++)for(f.push(g=[a[c][0]]),e=1;e<a[c].length;e+=2)i=a[c].slice(e,e+2),i=b.transformPoint(h.parse(i)),f.push(i);return f}),_p.r(11).extendClass(j,{transformPath:function(a){return k.transformPath(a,this)}}),k}},_p[35]={value:function(a,b,c){var d=_p.r(67),e=_p.r(58),f=_p.r(28);return _p.r(11).createClass("GradientBrush",{base:e,constructor:function(a,b){this.callBase(a,b),this.stops=[]},addStop:function(a,b,c){var e=d.createNode("stop");return b instanceof f||(b=f.parse(b)),void 0===c&&(c=b.get("a")),e.setAttribute("offset",a),e.setAttribute("stop-color",b.toRGB()),1>c&&e.setAttribute("stop-opacity",c),this.node.appendChild(e),this}})}},_p[36]={value:function(a,b,c){var d=_p.r(61);return _p.r(11).createClass("Group",{mixins:[d],base:_p.r(60),constructor:function(){this.callBase("g")}})}},_p[37]={value:function(a,b,c){var d=_p.r(61);return _p.r(11).createClass("HyperLink",{mixins:[d],base:_p.r(60),constructor:function(a){this.callBase("a"),this.setHref(a)},setHref:function(a){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),this},getHref:function(){return this.node.getAttributeNS("xlink:href")},setTarget:function(a){return this.node.setAttribute("target",a),this},getTarget:function(){return this.node.getAttribute("target")}})}},_p[38]={value:function(a,b,c){return _p.r(11).createClass("Image",{base:_p.r(60),constructor:function(a,b,c,d,e){this.callBase("image"),this.url=a,this.width=b||0,this.height=c||0,this.x=d||0,this.y=e||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(a){return this.url=""===a?null:a,this.update()},getUrl:function(){return this.url},setWidth:function(a){return this.width=a,this.update()},getWidth:function(){return this.width},setHeight:function(a){return this.height=a,this.update()},getHeight:function(){return this.height},setX:function(a){return this.x=a,this.update()},getX:function(){return this.x},setY:function(a){return this.y=a,this.update()},getY:function(){return this.y}})}},_p[39]={value:function(a,b,c){return _p.r(11).createClass("Line",{base:_p.r(46),constructor:function(a,b,c,d){this.callBase(),this.point1={x:a||0,y:b||0},this.point2={x:c||0,y:d||0},this.update()},setPoint1:function(a,b){return this.point1.x=a,this.point1.y=b,this.update()},setPoint2:function(a,b){return this.point2.x=a,this.point2.y=b,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var a=this.getDrawer();return a.clear(),a.moveTo(this.point1.x,this.point1.y),a.lineTo(this.point2.x,this.point2.y),this}})}},_p[40]={value:function(a,b,c){var d=(_p.r(67),_p.r(35));return _p.r(11).createClass("LinearGradientBrush",{base:d,constructor:function(a){this.callBase("linearGradient",a),this.setStartPosition(0,0),this.setEndPosition(1,0)},setStartPosition:function(a,b){return this.node.setAttribute("x1",a),this.node.setAttribute("y1",b),this},setEndPosition:function(a,b){return this.node.setAttribute("x2",a),this.node.setAttribute("y2",b),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}},_p[41]={value:function(a,b,c){var d=_p.r(50),e=_p.r(11).createClass("Marker",{base:_p.r(58),mixins:[_p.r(61),_p.r(75)],constructor:function(){this.callBase("marker"),this.setOrient("auto")},setRef:function(a,b){return 1===arguments.length&&(b=a.y,a=a.x),this.node.setAttribute("refX",a),this.node.setAttribute("refY",b),this},getRef:function(){return new d(+this.node.getAttribute("refX"),+this.node.getAttribute("refY"))},setWidth:function(a){return this.node.setAttribute("markerWidth",this.width=a),this},setOrient:function(a){return this.node.setAttribute("orient",this.orient=a),this},getOrient:function(){return this.orient},getWidth:function(){return+this.width},setHeight:function(a){return this.node.setAttribute("markerHeight",this.height=a),this},getHeight:function(){return+this.height}}),f=_p.r(46);return _p.r(11).extendClass(f,{setMarker:function(a,b){return b=b||"end",a?this.node.setAttribute("marker-"+b,a.toString()):this.node.removeAttribute("marker-"+b),this}}),e}},_p[42]={value:function(a,b,c){var d=_p.r(11),e=_p.r(60),f=d.createClass("Mask",{base:e,mixins:[_p.r(61)],constructor:function(){this.callBase("mask")},mask:function(a){return a.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return d.extendClass(e,{maskWith:function(a){return a.mask(this),this}}),f}},_p[43]={value:function(a,b,c){function d(a,b){return{a:b.a*a.a+b.c*a.b,b:b.b*a.a+b.d*a.b,c:b.a*a.c+b.c*a.d,d:b.b*a.c+b.d*a.d,e:b.a*a.e+b.c*a.f+b.e,f:b.b*a.e+b.d*a.f+b.f}}function e(a){return a*Math.PI/180}var f=_p.r(12),g=_p.r(25),h=/matrix\s*\((.+)\)/i,i=_p.r(50),j=_p.r(11).createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(a,b){return this.m=d(this.m,{a:1,c:0,e:a,b:0,d:1,f:b}),this},rotate:function(a){var b=e(a),c=Math.sin(b),f=Math.cos(b);return this.m=d(this.m,{a:f,c:-c,e:0,b:c,d:f,f:0}),this},scale:function(a,b){return void 0===b&&(b=a),this.m=d(this.m,{a:a,c:0,e:0,b:0,d:b,f:0}),this},skew:function(a,b){void 0===b&&(b=a);var c=Math.tan(e(a)),f=Math.tan(e(b));return this.m=d(this.m,{a:1,c:c,e:0,b:f,d:1,f:0}),this},inverse:function(){var a,b,c,d,e,f,g,h=this.m,i=h.a,k=h.b,l=h.c,m=h.d,n=h.e,o=h.f;return a=i*m-k*l,b=m/a,c=-k/a,d=-l/a,e=i/a,f=(l*o-n*m)/a,g=(k*n-i*o)/a,new j(b,c,d,e,f,g)},setMatrix:function(a,b,c,d,e,g){return 1===arguments.length?this.m=f.clone(arguments[0]):this.m={a:a,b:b,c:c,d:d,e:e,f:g},this},getMatrix:function(){return f.clone(this.m)},getTranslate:function(){var a=this.m;return{x:a.e/a.a,y:a.f/a.d}},mergeMatrix:function(a){return new j(d(this.m,a.m))},merge:function(a){return this.mergeMatrix(a)},toString:function(){return this.valueOf().join(" ")},valueOf:function(){var a=this.m;return[a.a,a.b,a.c,a.d,a.e,a.f]},equals:function(a){var b=this.m,c=a.m;return b.a==c.a&&b.b==c.b&&b.c==c.c&&b.d==c.d&&b.e==c.e&&b.f==c.f},transformPoint:function(){return j.transformPoint.apply(null,[].slice.call(arguments).concat([this.m]))},transformBox:function(a){return j.transformBox(a,this.m)},clone:function(){return new j(this.m)}});return j.parse=function(a){var b,c=parseFloat;if(a instanceof Array)return new j({a:a[0],b:a[1],c:a[2],d:a[3],e:a[4],f:a[5]});if(b=h.exec(a)){var d=b[1].split(",");return 6!=d.length&&(d=b[1].split(" ")),new j({a:c(d[0]),b:c(d[1]),c:c(d[2]),d:c(d[3]),e:c(d[4]),f:c(d[5])})}return new j},j.transformPoint=function(a,b,c){return 2===arguments.length&&(c=b,b=a.y,a=a.x),new i(c.a*a+c.c*b+c.e,c.b*a+c.d*b+c.f)},j.transformBox=function(a,b){for(var c,d,e=Number.MAX_VALUE,h=-Number.MAX_VALUE,i=Number.MAX_VALUE,k=-Number.MAX_VALUE,l=[[a.x,a.y],[a.x+a.width,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height]],m=[];c=l.pop();)d=j.transformPoint(c[0],c[1],b),m.push(d),e=Math.min(e,d.x),h=Math.max(h,d.x),i=Math.min(i,d.y),k=Math.max(k,d.y);return a=new g({x:e,y:i,width:h-e,height:k-i}),f.extend(a,{closurePoints:m}),a},j.getCTM=function(a,b){var c={a:1,b:0,c:0,d:1,e:0,f:0},d=a.shapeNode||a.node;switch(b=b||"parent"){case"screen":c=d.getScreenCTM();break;case"doc":case"paper":c=d.getCTM();break;case"view":case"top":a.getPaper()&&(c=d.getTransformToElement(a.getPaper().shapeNode));break;case"parent":a.node.parentNode&&(c=d.getTransformToElement(a.node.parentNode));break;default:b.node&&(c=d.getTransformToElement(b.shapeNode||b.node))}return c?new j(c.a,c.b,c.c,c.d,c.e,c.f):new j},j}},_p[44]={value:function(a,b,c){var d=_p.r(64),e=_p.r(28),f=_p.r(12),g=_p.r(11).createClass("Palette",{constructor:function(){this.color={}},get:function(a){var b=this.color[a]||d.EXTEND_STANDARD[a]||d.COLOR_STANDARD[a]||"";return b?new e(b):null},getColorValue:function(a){return this.color[a]||d.EXTEND_STANDARD[a]||d.COLOR_STANDARD[a]||""},add:function(a,b){return"string"==typeof b?this.color[a]=new e(b).toRGBA():this.color[a]=b.toRGBA(),b},remove:function(a){return this.color.hasOwnProperty(a)?(delete this.color[a],!0):!1}});return f.extend(g,{getColor:function(a){var b=d.EXTEND_STANDARD[a]||d.COLOR_STANDARD[a];return b?new e(b):null},getColorValue:function(a){return d.EXTEND_STANDARD[a]||d.COLOR_STANDARD[a]||""},addColor:function(a,b){return"string"==typeof b?d.EXTEND_STANDARD[a]=new e(b).toRGBA():d.EXTEND_STANDARD[a]=b.toRGBA(),b},removeColor:function(a){return d.EXTEND_STANDARD.hasOwnProperty(a)?(delete d.EXTEND_STANDARD[a],!0):!1}}),g}},_p[45]={value:function(a,b,c){var d=_p.r(11),e=_p.r(12),f=_p.r(67),g=_p.r(29),h=_p.r(61),i=_p.r(75),j=_p.r(33),k=_p.r(66),l=_p.r(43),m=d.createClass("Paper",{mixins:[h,j,k,i],constructor:function(a){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=f.createNode("defs")),this.node.appendChild(this.shapeNode=f.createNode("g")),this.resources=new g,this.setWidth("100%").setHeight("100%"),a&&this.renderTo(a),this.callMixin()},renderTo:function(a){e.isString(a)&&(a=document.getElementById(a)),this.container=a,a.appendChild(this.node)},createSVGNode:function(){var a=f.createNode("svg");return a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a.setAttribute("version","1.1"),a},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return this.node.clientWidth},setWidth:function(a){return this.node.setAttribute("width",a),this},getHeight:function(){return this.node.clientHeight},setHeight:function(a){return this.node.setAttribute("height",a),this},setViewPort:function(a,b,c){var d,e;1==arguments.length&&(d=arguments[0],a=d.center.x,b=d.center.y,c=d.zoom),c=c||1,e=this.getViewBox();var f=new l,g=e.x+e.width/2-a,h=e.y+e.height/2-b;return f.translate(-a,-b),f.scale(c),f.translate(a,b),f.translate(g,h),this.shapeNode.setAttribute("transform","matrix("+f+")"),this.viewport={center:{x:a,y:b},offset:{x:g,y:h},zoom:c},this},getViewPort:function(){if(!this.viewport){var a=this.getViewBox();return{zoom:1,center:{x:a.x+a.width/2,y:a.y+a.height/2},offset:{x:0,y:0}}}return this.viewport},getViewPortMatrix:function(){return l.parse(this.shapeNode.getAttribute("transform"))},getViewPortTransform:function(){var a=this.shapeNode.getCTM();return new l(a.a,a.b,a.c,a.d,a.e,a.f)},getTransform:function(){return this.getViewPortTransform().reverse()},addResource:function(a){return this.resources.appendItem(a),a.node&&this.resourceNode.appendChild(a.node),this},removeResource:function(a){return a.remove&&a.remove(),a.node&&this.resourceNode.removeChild(a.node),this},getPaper:function(){return this}}),n=_p.r(60);return d.extendClass(n,{getPaper:function(){for(var a=this.container;a&&a instanceof m==!1;)a=a.container;return a},isAttached:function(){return!!this.getPaper()},whenPaperReady:function(a){function b(){var b=c.getPaper();return b&&a&&a.call(c,b),b}var c=this;return b()||this.on("add treeadd",function d(){b()&&(c.off("add",d),c.off("treeadd",d))}),this}}),m}},_p[46]={value:function(a,b,c){var d=_p.r(12),e=_p.r(11).createClass,f=_p.r(60),g=_p.r(67),h=_p.r(34),i=Array.prototype.slice,j=(d.flatten,e("PathDrawer",{constructor:function(a){this.segment=[],this.path=a,this.__clear=!1},getPath:function(){return this.path},redraw:function(){return this._transation=this._transation||[],this.clear()},done:function(){var a=this._transation;return this._transation=null,this.push(a),this},clear:function(){return this._transation?this._transation=[]:this.path.setPathData("M 0 0"),this._clear=!0,this},push:function(){var a,b=i.call(arguments);return this._transation?(this._transation.push(b),this):(this._clear?(a="",this._clear=!1):a=this.path.getPathData(),a=a||"",this.path.setPathData(a+h.pathToString(b)),this)},moveTo:function(a,b){return this.push("M",i.call(arguments))},moveBy:function(a,b){return this.push("m",i.call(arguments))},lineTo:function(a,b){return this.push("L",i.call(arguments))},lineBy:function(a,b){return this.push("l",i.call(arguments))},arcTo:function(a,b,c,d,e,f,g){return this.push("A",i.call(arguments))},arcBy:function(a,b,c,d,e,f,g){return this.push("a",arguments)},carcTo:function(a,b,c,d,e){return this.push("A",[a,a,0].concat(i.call(arguments,1)))},carcBy:function(a,b,c,d,e){return this.push("a",[a,a,0].concat(i.call(arguments,1)))},bezierTo:function(a,b,c,d,e,f){return this.push("C",i.call(arguments))},bezierBy:function(a,b,c,d,e,f){return this.push("c",i.call(arguments))},close:function(){return this.push("z")}}));return e("Path",{base:f,constructor:function(a){this.callBase("path"),a&&this.setPathData(a),this.node.setAttribute("fill",g.defaults.fill),this.node.setAttribute("stroke",g.defaults.stroke)},setPathData:function(a){return a=a||"M0,0",this.pathdata=h.pathToString(a),this.node.setAttribute("d",this.pathdata),this.trigger("shapeupdate",{type:"pathdata"}),this},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new j(this)},isClosed:function(){var a=this.getPathData();return!!~a.indexOf("z")||!!~a.indexOf("Z")}})}},_p[47]={value:function(a,b,c){var d=_p.r(58),e=_p.r(61);_p.r(67);return _p.r(11).createClass("PatternBrush",{base:d,mixins:[e],constructor:function(a){this.callBase("pattern",a),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(a){return this.x=a,this.node.setAttribute("x",a),this},setY:function(a){return this.y=a,this.node.setAttribute("y",a),this},setWidth:function(a){return this.width=a,this.node.setAttribute("width",a),this},setHeight:function(a){return this.height=a,this.node.setAttribute("height",a),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}},_p[48]={value:function(a,b,c){var d=_p.r(28);return _p.r(11).createClass("Pen",{constructor:function(a,b){this.brush=a,this.width=b||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=1},getBrush:function(){return this.brush},setBrush:function(a){return this.brush=a,this},setColor:function(a){return this.setBrush(a)},getColor:function(){return this.brush instanceof d?this.brush:null},getWidth:function(){return this.width},setWidth:function(a){return this.width=a,this},getOpacity:function(){return this.opacity},setOpacity:function(a){this.opacity=a},getLineCap:function(){return this.linecap},setLineCap:function(a){return this.linecap=a,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(a){return this.linejoin=a,this},getDashArray:function(){return this.dashArray},setDashArray:function(a){return this.dashArray=a,this},stroke:function(a){var b=a.node;b.setAttribute("stroke",this.brush.toString()),b.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&b.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&b.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&b.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&b.setAttribute("stroke-dasharray",this.getDashArray())}})}},_p[49]={value:function(a,b,c){return _p.r(11).createClass({base:_p.r(68),constructor:function(a,b,c){this.callBase([0,a],b,c)},getRadius:function(){return this.getSectionArray()[1]},setRadius:function(a){this.setSectionArray([0,a])}})}},_p[50]={value:function(a,b,c){var d=_p.r(11).createClass("Point",{constructor:function(a,b){this.x=a||0,this.y=b||0},offset:function(a,b){return 1==arguments.length&&(b=a.y,a=a.x),new d(this.x+a,this.y+b)},valueOf:function(){return[this.x,this.y]},toString:function(){return this.valueOf().join(" ")},spof:function(){return new d((0|this.x)+.5,(0|this.y)+.5)},round:function(){return new d(0|this.x,0|this.y)},isOrigin:function(){return 0===this.x&&0===this.y}});return d.fromPolar=function(a,b,c){return"rad"!=c&&(b=b/180*Math.PI),new d(a*Math.cos(b),a*Math.sin(b))},d.parse=function(a){return a?a instanceof d?a:"string"==typeof a?d.parse(a.split(/\s*[\s,]\s*/)):"0"in a&&"1"in a?new d(a[0],a[1]):void 0:new d},d}},_p[51]={value:function(a,b,c){return _p.r(11).createClass("PointContainer",{base:_p.r(29),constructor:function(){this.callBase()},addPoint:function(a,b){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(a){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}},_p[52]={value:function(a,b,c){_p.r(12);return _p.r(11).createClass("Poly",{base:_p.r(46),mixins:[_p.r(51)],constructor:function(a,b){this.callBase(),this.closeable=!!b,this.setPoints(a||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=this.getDrawer(),b=this.getPoints();if(a.clear(),!b.length)return this;a.moveTo(b[0]);for(var c,d=1,e=b.length;e>d;d++)c=b[d],a.lineTo(c);return this.closeable&&b.length>2&&a.close(),this}})}},_p[53]={value:function(a,b,c){return _p.r(11).createClass("Polygon",{base:_p.r(52),constructor:function(a){this.callBase(a,!0)}})}},_p[54]={value:function(a,b,c){return _p.r(11).createClass("Polyline",{base:_p.r(52),constructor:function(a){this.callBase(a)}})}},_p[55]={value:function(a,b,c){var d=_p.r(35);return _p.r(11).createClass("RadialGradientBrush",{base:d,constructor:function(a){this.callBase("radialGradient",a),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5)},setCenter:function(a,b){return this.node.setAttribute("cx",a),this.node.setAttribute("cy",b),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(a,b){return this.node.setAttribute("fx",a),this.node.setAttribute("fy",b),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(a){return this.node.setAttribute("r",a),this},getRadius:function(){return+this.node.getAttribute("r")}})}},_p[56]={value:function(a,b,c){var d={},e=_p.r(12),f=_p.r(50),g=_p.r(25);e.extend(d,{formatRadius:function(a,b,c){var d=Math.floor(Math.min(a/2,b/2));return Math.min(d,c)}});var h=_p.r(11).createClass("Rect",{base:_p.r(46),constructor:function(a,b,c,e,f){this.callBase(),this.x=c||0,this.y=e||0,this.width=a||0,this.height=b||0,this.radius=d.formatRadius(this.width,this.height,f||0),this.update()},update:function(){var a=this.x,b=this.y,c=this.width,d=this.height,e=this.radius,f=this.getDrawer().redraw();return e?(c-=2*e,d-=2*e,f.push("M",a+e,b),f.push("h",c),f.push("a",e,e,0,0,1,e,e),f.push("v",d),f.push("a",e,e,0,0,1,-e,e),f.push("h",-c),f.push("a",e,e,0,0,1,-e,-e),f.push("v",-d),f.push("a",e,e,0,0,1,e,-e),f.push("z")):(f.push("M",a,b),f.push("h",c),f.push("v",d),f.push("h",-c),f.push("z")),f.done(),this},setWidth:function(a){return this.width=a,this.update()},setHeight:function(a){return this.height=a,this.update()},setSize:function(a,b){return this.width=a,this.height=b,this.update()},setBox:function(a){return this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.update()},getBox:function(){return new g(this.x,this.y,this.width,this.height)},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=d.formatRadius(this.width,this.height,a||0),this.update()},getPosition:function(){return new f(this.x,this.y)},setPosition:function(a,b){if(1==arguments.length){var c=f.parse(arguments[0]);b=c.y,a=c.x}return this.x=a,this.y=b,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(a){return this.x=a,this.update()},setPositionY:function(a){return this.y=a,this.update()}});return h}},_p[57]={value:function(a,b,c){var d=_p.r(50);return _p.r(11).createClass("RegularPolygon",{base:_p.r(46),constructor:function(a,b,c,e){this.callBase(),this.radius=b||0,this.side=Math.max(a||3,3),arguments.length>2&&3==arguments.length&&(e=c.y,c=c.x),this.center=new d(c,e),this.draw()},getSide:function(){return this.side},setSide:function(a){return this.side=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},draw:function(){var a,b=this.radius,c=this.side,e=2*Math.PI/c,f=this.getDrawer();for(f.clear(),f.moveTo(d.fromPolar(b,Math.PI/2,"rad").offset(this.center)),a=0;c>=a;a++)f.lineTo(d.fromPolar(b,e*a+Math.PI/2,"rad").offset(this.center));return f.close(),this}})}},_p[58]={value:function(a,b,c){var d=_p.r(67);return _p.r(11).createClass("Resource",{constructor:function(a,b){this.callBase(),this.node=d.createNode(a),b&&b.addResource(this)},toString:function(){return"url(#"+this.node.id+")"}})}},_p[59]={value:function(a,b,c){return _p.r(11).createClass({base:_p.r(68),constructor:function(a,b){this.callBase([a,b],360,0)},getInnerRadius:function(){return this.getSectionArray()[0]},getOuterRadius:function(){return this.getSectionArray()[1]},setInnerRadius:function(a){this.setSectionArray([a,this.getOuterRadius()])},setOuterRadius:function(a){this.setSectionArray([this.getInnerRadius(),a])}})}},_p[60]={value:function(a,b,c){var d=_p.r(67),e=_p.r(12),f=_p.r(33),g=_p.r(66),h=_p.r(31),i=_p.r(43),j=(_p.r(48),Array.prototype.slice),k=_p.r(25),l=_p.r(11).createClass("Shape",{mixins:[f,g,h],constructor:function(a){this.node=d.createNode(a),this.node.shape=this,this.transform={translate:null,rotate:null,scale:null,matrix:null},this.callMixin()},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},getNode:function(){return this.node},getBoundaryBox:function(){var a;try{a=this.node.getBBox()}catch(b){a={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return new k(a)},getRenderBox:function(a){var b=this.getBoundaryBox(),c=this.getTransform(a);return c.transformBox(b)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var a=this.getRenderBox();return delete a.x,delete a.y,a},setOpacity:function(a){return this.node.setAttribute("opacity",a),this},getOpacity:function(){var a=this.node.getAttribute("opacity");return a?+a:1},setVisible:function(a){return a?this.node.removeAttribute("display"):this.node.setAttribute("display","none"),this},getVisible:function(){this.node.getAttribute("display")},hasAncestor:function(a){for(var b=this.container;b;){if(b===a)return!0;b=b.container}return!1},getTransform:function(a){return i.getCTM(this,a)},clearTransform:function(){return this.node.removeAttribute("transform"),this.transform={translate:null,rotate:null,scale:null,matrix:null},this.trigger("shapeupdate",{type:"transform"}),this},_applyTransform:function(){var a=this.transform,b=[];return a.translate&&b.push(["translate(",a.translate,")"]),a.rotate&&b.push(["rotate(",a.rotate,")"]),a.scale&&b.push(["scale(",a.scale,")"]),a.matrix&&b.push(["matrix(",a.matrix,")"]),this.node.setAttribute("transform",e.flatten(b).join(" ")),this},setMatrix:function(a){return this.transform.matrix=a,this._applyTransform()},setTranslate:function(a){return this.transform.translate=null!==a&&j.call(arguments)||null,this._applyTransform()},setRotate:function(a){return this.transform.rotate=null!==a&&j.call(arguments)||null,this._applyTransform()},setScale:function(a){return this.transform.scale=null!==a&&j.call(arguments)||null,this._applyTransform()},translate:function(a,b){var c=this.transform.matrix||new i;return void 0===b&&(b=0),this.transform.matrix=c.translate(a,b),this._applyTransform()},rotate:function(a){var b=this.transform.matrix||new i;return this.transform.matrix=b.rotate(a),this._applyTransform()},scale:function(a,b){var c=this.transform.matrix||new i;return void 0===b&&(b=a),this.transform.matrix=c.scale(a,b),this._applyTransform()},skew:function(a,b){var c=this.transform.matrix||new i;return void 0===b&&(b=a),this.transform.matrix=c.skew(a,b),this._applyTransform()},stroke:function(a,b){return a&&a.stroke?a.stroke(this):a?(this.node.setAttribute("stroke",a.toString()),b&&this.node.setAttribute("stroke-width",b)):null===a&&this.node.removeAttribute("stroe"),this},fill:function(a){return a&&this.node.setAttribute("fill",a.toString()),null===a&&this.node.removeAttribute("fill"),this},setAttr:function(a,b){var c=this;return e.isObject(a)&&e.each(a,function(a,b){c.setAttr(b,a)}),void 0===b||null===b||""===b?this.node.removeAttribute(a):this.node.setAttribute(a,b),this},getAttr:function(a){return this.node.getAttribute(a)}});return l}},_p[61]={value:function(a,b,c){var d=_p.r(29),e=_p.r(12),f=_p.r(11).createClass("ShapeContainer",{base:d,isShapeContainer:!0,handleAdd:function(a,b){var c=this.getShapeNode();c.insertBefore(a.node,c.childNodes[b]||null),a.trigger("add",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeadd",this)},handleRemove:function(a,b){var c=this.getShapeNode();c.removeChild(a.node),a.trigger("remove",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeremove",this)},notifyTreeModification:function(a,b){this.eachItem(function(c,d){d.notifyTreeModification&&d.notifyTreeModification(a,b),d.trigger(a,{container:b})})},getShape:function(a){return this.getItem(a)},addShape:function(a,b){return this.addItem(a,b)},put:function(a){return this.addShape(a),a},appendShape:function(a){return this.addShape(a)},prependShape:function(a){return this.addShape(a,0)},replaceShape:function(a,b){var c=this.indexOf(b);if(-1!==c)return this.removeShape(c),this.addShape(a,c),this},addShapeBefore:function(a,b){var c=this.indexOf(b);return this.addShape(a,c)},addShapeAfter:function(a,b){var c=this.indexOf(b);return this.addShape(a,-1===c?void 0:c+1)},addShapes:function(a){return this.addItems(a)},removeShape:function(a){return this.removeItem(a)},getShapes:function(){return this.getItems()},getShapesByType:function(a){function b(d){a.toLowerCase()==d.getType().toLowerCase()&&c.push(d),d.isShapeContainer&&e.each(d.getShapes(),function(a){b(a)})}var c=[];return b(this),c},getShapeById:function(a){return this.getShapeNode().getElementById(a).shape},arrangeShape:function(a,b){return this.removeShape(a).addShape(a,b)},getShapeNode:function(){return this.shapeNode||this.node}}),g=_p.r(60);return _p.r(11).extendClass(g,{bringTo:function(a){return this.container.arrangeShape(this,a),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(a,b){return a.container&&(this.remove&&this.remove(),a.container.addShape(this,a.container.indexOf(a)+(b||0))),this},bringAbove:function(a){return this.bringRefer(a)},bringBelow:function(a){return this.bringRefer(a,1)},replaceBy:function(a){return this.container&&(a.bringAbove(this),this.remove()),this}}),f}},_p[62]={value:function(a,b,c){var d=_p.r(43),e=_p.r(12),f=_p.r(50);return _p.r(11).createClass("ShapeEvent",{constructor:function(a){var b=null;e.isObject(a.target)?e.extend(this,a):(this.type=a.type,b=a.target,b.correspondingUseElement&&(b=b.correspondingUseElement),this.originEvent=a,this.targetShape=b.shape||b.paper||a.currentTarget&&(a.currentTarget.shape||a.currentTarget.paper),a._kityParam&&e.extend(this,a._kityParam))},preventDefault:function(){var a=this.originEvent;return a?a.preventDefault?(a.preventDefault(),a.cancelable):(a.returnValue=!1,!0):!0},getPosition:function(a,b){if(!this.originEvent)return null;var c=this.originEvent.touches?this.originEvent.touches[b||0]:this.originEvent,e=this.targetShape,g=e.shapeNode||e.node,h=new f(c&&c.clientX||0,c&&c.clientY||0),i=d.transformPoint(h,g.getScreenCTM().inverse()),j=d.getCTM(e,a||"view").transformPoint(i);return j},stopPropagation:function(){var a=this.originEvent;return a?void(a.stopPropagation?a.stopPropagation():a.cancelBubble=!1):!0}})}},_p[63]={value:function(a,b,c){return _p.r(11).createClass("ShapePoint",{base:_p.r(50),constructor:function(a,b){this.callBase(a,b)},setX:function(a){return this.setPoint(a,this.y)},setY:function(a){return this.setPoint(this.x,a)},setPoint:function(a,b){return this.x=a,this.y=b,this.update(),this},getPoint:function(){return this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}},_p[64]={value:{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",
- oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}},_p[65]={value:function(a,b,c){var d={3:.2,5:.38196601125,6:.57735026919,8:.541196100146,10:.726542528005,12:.707106781187},e=_p.r(50);return _p.r(11).createClass("Star",{base:_p.r(46),constructor:function(a,b,c,d,f){this.callBase(),this.vertex=a||3,this.radius=b||0,this.shrink=c,this.offset=d||new e(0,0),this.angleOffset=f||0,this.draw()},getVertex:function(){return this.vertex},setVertex:function(a){return this.vertex=a,this.draw()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.draw()},getShrink:function(){return this.shrink},setShrink:function(a){return this.shrink=a,this.draw()},getOffset:function(){return this.offset},setOffset:function(a){return this.offset=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,b,c=this.radius,f=this.radius*(this.shrink||d[this.vertex]||.5),g=this.vertex,h=this.offset,i=90,j=180/g,k=this.angleOffset,l=this.getDrawer();for(l.clear(),l.moveTo(e.fromPolar(f,i)),a=1;2*g>=a;a++)b=i+j*a,l.lineTo(a%2?e.fromPolar(c,b+k).offset(h):e.fromPolar(f,b));l.close()}})}},_p[66]={value:function(a,b,c){function d(a){return a.classList||(a.classList=new e(a)),a.classList}var e=_p.r(11).createClass("ClassList",{constructor:function(a){this._node=a,this._list=a.className.toString().split(" ")},_update:function(){this._node.className=this._list.join(" ")},add:function(a){this._list.push(a),this._update()},remove:function(a){var b=this._list.indexOf(a);~b&&this._list.splice(b,1),this._update()},contains:function(a){return!!~this._list.indexOf(a)}});return _p.r(11).createClass("Styled",{addClass:function(a){return d(this.node).add(a),this},removeClass:function(a){return d(this.node).remove(a),this},hasClass:function(a){return d(this.node).contains(a)},setStyle:function(a){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var b in a)a.hasOwnProperty(b)&&(this.node.style[b]=a[b]);return this}})}},_p[67]={value:function(a,b,c){var d=document,e=0,f={createNode:function(a){var b=d.createElementNS(f.ns,a);return b.id="kity_"+a+"_"+e++,b},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return f}},_p[68]={value:function(a,b,c){var d=_p.r(50);return _p.r(11).createClass("Sweep",{base:_p.r(46),constructor:function(a,b,c){this.callBase(),this.sectionArray=a||[],this.angle=b||0,this.angleOffset=c||0,this.draw()},getSectionArray:function(){return this.sectionArray},setSectionArray:function(a){return this.sectionArray=a,this.draw()},getAngle:function(){return this.angle},setAngle:function(a){return this.angle=a,this.draw()},getAngleOffset:function(){return this.angleOffset},setAngleOffset:function(a){return this.angleOffset=a,this.draw()},draw:function(){var a,b=this.sectionArray;for(a=0;a<b.length;a+=2)this.drawSection(b[a],b[a+1]);return this},drawSection:function(a,b){var c=this.angle&&(this.angle%360?this.angle%360:360),e=this.angleOffset,f=e+c/2,g=e+c,h=0>c?0:1,i=this.getDrawer();return i.redraw(),0===c?void i.done():(i.moveTo(d.fromPolar(a,e)),i.lineTo(d.fromPolar(b,e)),b&&(i.carcTo(b,0,h,d.fromPolar(b,f)),i.carcTo(b,0,h,d.fromPolar(b,g))),i.lineTo(d.fromPolar(a,g)),a&&(i.carcTo(a,0,h,d.fromPolar(a,f)),i.carcTo(a,0,h,d.fromPolar(a,e))),i.close(),void i.done())}})}},_p[69]={value:function(a,b,c){function d(a){var b=a._cachedFontHash;if(i[b])return i[b];var c=a.getContent();a.setContent("百度Fex");var d=a.getBoundaryBox(),e=a.getY(),f=e-d.y+ +a.node.getAttribute("dy"),g=f-d.height;return a.setContent(c),i[b]={top:f,bottom:g,middle:(f+g)/2}}var e=_p.r(70),f=_p.r(61),g=_p.r(67),h=_p.r(12),i={};return _p.r(11).createClass("Text",{base:e,mixins:[f],constructor:function(a){this.callBase("text"),void 0!==a&&this.setContent(a),this._buildFontHash()},_buildFontHash:function(){var a=window.getComputedStyle(this.node);this._cachedFontHash=[a.fontFamily,a.fontSize,a.fontStretch,a.fontStyle,a.fontVariant,a.fontWeight].join("-")},_fontChanged:function(a){var b=this._lastFont,c=h.extend({},b,a);if(!b)return this._lastFont=a,!0;var d=b.family!=c.family||b.size!=c.size||b.style!=c.style||b.weight!=c.weight;return this._lastFont=c,d},setX:function(a){return this.node.setAttribute("x",a),this},setPosition:function(a,b){return this.setX(a).setY(b)},setY:function(a){return this.node.setAttribute("y",a),this},getX:function(){return+this.node.getAttribute("x")||0},getY:function(){return+this.node.getAttribute("y")||0},setFont:function(a){return this.callBase(a),this._fontChanged(a)&&(this._buildFontHash(),this.setVerticalAlign(this.getVerticalAlign())),this},setTextAnchor:function(a){return this.node.setAttribute("text-anchor",a),this},getTextAnchor:function(){return this.node.getAttribute("text-anchor")||"start"},setVerticalAlign:function(a){return this.whenPaperReady(function(){var b;switch(a){case"top":b=d(this).top;break;case"bottom":b=d(this).bottom;break;case"middle":b=d(this).middle;break;default:b=0}this.node.setAttribute("dy",b)}),this.verticalAlign=a,this},getVerticalAlign:function(){return this.verticalAlign||"baseline"},setStartOffset:function(a){this.shapeNode!=this.node&&this.shapeNode.setAttribute("startOffset",100*a+"%")},addSpan:function(a){return this.addShape(a),this},setPath:function(a){var b=this.shapeNode;if(this.shapeNode==this.node){for(b=this.shapeNode=g.createNode("textPath");this.node.firstChild;)this.shapeNode.appendChild(this.node.firstChild);this.node.appendChild(b)}return b.setAttributeNS(g.xlink,"xlink:href","#"+a.node.id),this.setTextAnchor(this.getTextAnchor()),this}})}},_p[70]={value:function(a,b,c){var d=_p.r(60);return _p.r(11).createClass("TextContent",{base:d,constructor:function(a){this.callBase(a),this.shapeNode=this.shapeNode||this.node,this.shapeNode.setAttribute("text-rendering","geometricPrecision")},clearContent:function(){for(;this.shapeNode.firstChild;)this.shapeNode.removeChild(this.shapeNode.firstChild);return this},setContent:function(a){return this.shapeNode.textContent=a,this},getContent:function(){return this.shapeNode.textContent},appendContent:function(a){return this.shapeNode.textContent+=a,this},setSize:function(a){return this.setFontSize(a)},setFontSize:function(a){return this.setFont({size:a})},setFontFamily:function(a){return this.setFont({family:a})},setFontBold:function(a){return this.setFont({weight:a?"bold":"normal"})},setFontItalic:function(a){return this.setFont({style:a?"italic":"normal"})},setFont:function(a){var b=this.node;return["family","size","weight","style"].forEach(function(c){null===a[c]?b.removeAttribute("font-"+c):a[c]&&b.setAttribute("font-"+c,a[c])}),this},getExtentOfChar:function(a){return this.node.getExtentOfChar(a)},getRotationOfChar:function(a){return this.node.getRotationOfChar(a)},getCharNumAtPosition:function(a,b){return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(a,b))}})}},_p[71]={value:function(a,b,c){var d=_p.r(70),e=_p.r(66);return _p.r(11).createClass("TextSpan",{base:d,mixins:[e],constructor:function(a){this.callBase("tspan"),this.setContent(a)}})}},_p[72]={value:function(a,b,c){var d=_p.r(67),e=_p.r(11),f=e.createClass("Use",{base:_p.r(60),constructor:function(a){this.callBase("use"),this.ref(a)},ref:function(a){if(!a)return this.node.removeAttributeNS(d.xlink,"xlink:href"),this;var b=a.getId();return b&&this.node.setAttributeNS(d.xlink,"xlink:href","#"+b),"none"===a.node.getAttribute("fill")&&a.node.removeAttribute("fill"),"none"===a.node.getAttribute("stroke")&&a.node.removeAttribute("stroke"),this}}),g=_p.r(60);return e.extendClass(g,{use:function(){return new f(this)}}),f}},_p[73]={value:function(a,b,c){var d=_p.r(50),e=_p.r(43),f=_p.r(11).createClass("Vector",{base:d,constructor:function(a,b){this.callBase(a,b)},square:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.square())},add:function(a){return new f(this.x+a.x,this.y+a.y)},minus:function(a){return new f(this.x-a.x,this.y-a.y)},dot:function(a){return this.x*a.x+this.y*a.y},project:function(a){return a.multipy(this.dot(a)/a.square())},normalize:function(a){return void 0===a&&(a=1),this.multipy(a/this.length())},multipy:function(a){return new f(this.x*a,this.y*a)},rotate:function(a,b){"rad"==b&&(a=a/Math.PI*180);var c=(new e).rotate(a).transformPoint(this);return new f(c.x,c.y)},vertical:function(){return new f(this.y,-this.x)},reverse:function(){return this.multipy(-1)},getAngle:function(){var a=this.length();if(0===a)return 0;var b=Math.acos(this.x/a),c=this.y>0?1:-1;return 180*c*b/Math.PI}});return f.fromPoints=function(a,b){return new f(b.x-a.x,b.y-a.y)},f.fromPolar=function(){var a=d.fromPolar.apply(d,arguments);return new f(a.x,a.y)},_p.r(11).extendClass(d,{asVector:function(){return new f(this.x,this.y)}}),f}},_p[74]={value:function(a,b,c){var d=_p.r(61),e=_p.r(75);return _p.r(11).createClass("View",{mixins:[d,e],base:_p.r(74),constructor:function(){this.callBase("view")}})}},_p[75]={value:function(a,b,c){return _p.r(11).createClass("ViewBox",{getViewBox:function(){var a=this.node.getAttribute("viewBox");return null===a?{x:0,y:0,width:this.node.clientWidth||this.node.parentNode.clientWidth,height:this.node.clientHeight||this.node.parentNode.clientHeight}:(a=a.split(" "),{x:+a[0],y:+a[1],width:+a[2],height:+a[3]})},setViewBox:function(a,b,c,d){return this.node.setAttribute("viewBox",[a,b,c,d].join(" ")),this}})}},_p[76]={value:function(a,b,c){var d={},e=_p.r(12);return d.version="2.0.0",e.extend(d,{createClass:_p.r(11).createClass,extendClass:_p.r(11).extendClass,Utils:e,Browser:_p.r(10),Box:_p.r(25),Bezier:_p.r(23),BezierPoint:_p.r(24),Circle:_p.r(26),Clip:_p.r(27),Color:_p.r(28),Container:_p.r(29),Curve:_p.r(30),Ellipse:_p.r(32),Group:_p.r(36),Gradient:_p.r(35),HyperLink:_p.r(37),Image:_p.r(38),Line:_p.r(39),LinearGradient:_p.r(40),Mask:_p.r(42),Matrix:_p.r(43),Marker:_p.r(41),Palette:_p.r(44),Paper:_p.r(45),Path:_p.r(46),Pattern:_p.r(47),Pen:_p.r(48),Point:_p.r(50),PointContainer:_p.r(51),Polygon:_p.r(53),Polyline:_p.r(54),Pie:_p.r(49),RadialGradient:_p.r(55),Resource:_p.r(58),Rect:_p.r(56),RegularPolygon:_p.r(57),Ring:_p.r(59),Shape:_p.r(60),ShapePoint:_p.r(63),ShapeContainer:_p.r(61),Sweep:_p.r(68),Star:_p.r(65),Text:_p.r(69),TextSpan:_p.r(71),Use:_p.r(72),Vector:_p.r(73),g:_p.r(34),Animator:_p.r(0),Easing:_p.r(1),OpacityAnimator:_p.r(4),RotateAnimator:_p.r(6),ScaleAnimator:_p.r(7),Timeline:_p.r(8),TranslateAnimator:_p.r(9),PathAnimator:_p.r(5),MotionAnimator:_p.r(3),requestFrame:_p.r(2).requestFrame,releaseFrame:_p.r(2).releaseFrame,Filter:_p.r(20),GaussianblurFilter:_p.r(21),ProjectionFilter:_p.r(22),ColorMatrixEffect:_p.r(13),CompositeEffect:_p.r(14),ConvolveMatrixEffect:_p.r(15),Effect:_p.r(16),GaussianblurEffect:_p.r(17),OffsetEffect:_p.r(18)}),window.kity=d}};var moduleMapping={kity:76};use("kity")}();var KityMinder=window.KM=window.KityMinder=function(){var a={},b=0,c={};return{version:"1.3.5",uuid:function(a){return a=a||"unknown",c[a]=c[a]||0,++c[a],a+"_"+c[a]},createMinder:function(a,b){b=b||{},b.renderTo=Utils.isString(a)?document.getElementById(a):a;var c=new Minder(b);return this.addMinder(b.renderTo,c),c},addMinder:function(c,d){var e;e="string"==typeof c?c:c.id||"KM_INSTANCE_"+b++,a[e]=d},getMinder:function(c,d){var e;return e="string"==typeof c?c:c.id||"KM_INSTANCE_"+b++,a[e]||this.createMinder(c,d)},LANG:{}}}(),utils=Utils=KityMinder.Utils={extend:kity.Utils.extend.bind(kity.Utils),listen:function(a,b,c){var d=utils.isArray(b)?b:utils.trim(b).split(/\s+/),e=d.length;if(e)for(;e--;)if(b=d[e],a.addEventListener)a.addEventListener(b,c,!1);else{c._d||(c._d={els:[]});var f=b+c.toString(),g=utils.indexOf(c._d.els,a);c._d[f]&&-1!=g||(-1==g&&c._d.els.push(a),c._d[f]||(c._d[f]=function(a){return c.call(a.srcElement,a||window.event)}),a.attachEvent("on"+b,c._d[f]))}a=null},trim:function(a){return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},each:function(a,b,c){if(null!=a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,d,a[d],a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,f,a[f],a)===!1)return!1},addCssRule:function(a,b,c){var d;return void 0===b||b&&b.nodeType&&9==b.nodeType?(c=b&&b.nodeType&&9==b.nodeType?b:c||document,d=c.getElementById(a),d?d.innerHTML:void 0):(c=c||document,d=c.getElementById(a),""===b?d?(d.parentNode.removeChild(d),!0):!1:void(d?d.innerHTML=b:(d=c.createElement("style"),d.id=a,d.innerHTML=b,c.getElementsByTagName("head")[0].appendChild(d))))},keys:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},proxy:function(a,b){return function(){return a.apply(b,arguments)}},indexOf:function(a,b,c){var d=-1;return c=this.isNumber(c)?c:0,this.each(a,function(a,e){return e>=c&&a===b?(d=e,!1):void 0}),d},argsToArray:function(a,b){return Array.prototype.slice.call(a,b||0)},clonePlainObject:function(a,b){var c;b=b||{};for(var d in a)a.hasOwnProperty(d)&&(c=a[d],utils.isObject(c)||utils.isArray(c)?(b[d]=utils.isArray(c)?[]:{},utils.clonePlainObject(a[d],b[d])):b[d]=c);return b},compareObject:function(a,b){var c;if(this.isEmptyObject(a)!==this.isEmptyObject(b))return!1;if(this.getObjectLength(a)!=this.getObjectLength(b))return!1;for(var d in a)if(a.hasOwnProperty(d)){if(c=a[d],void 0===b[d])return!1;if(this.isObject(c)||this.isArray(c)){if(this.isObject(b[d])!==this.isObject(c))return!1;if(this.isArray(c)!==this.isArray(b[d]))return!1;if(this.compareObject(c,b[d])===!1)return!1}else if(c!=b[d])return!1}return!0},getObjectLength:function(a){if(this.isArray(a)||this.isString(a))return a.length;var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;return b},isEmptyObject:function(a){if(null==a)return!0;if(this.isArray(a)||this.isString(a))return 0===a.length;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},loadFile:function(){function a(a,c){try{for(var d,e=0;d=b[e++];)if(d.doc===a&&d.url==(c.src||c.href))return d}catch(f){return null}}var b=[];return function(c,d,e){var f=a(c,d);if(f)return void(f.ready?e&&e():f.funs.push(e));if(b.push({doc:c,url:d.src||d.href,funs:[e]}),!c.body){var g=[];for(var h in d)"tag"!=h&&g.push(h+'="'+d[h]+'"');return void c.write("<"+d.tag+" "+g.join(" ")+" ></"+d.tag+">")}if(!d.id||!c.getElementById(d.id)){var i=c.createElement(d.tag);delete d.tag;for(var h in d)i.setAttribute(h,d[h]);i.onload=i.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(f=a(c,d),f.funs.length>0){f.ready=1;for(var b;b=f.funs.pop();)b()}i.onload=i.onreadystatechange=null}},c.getElementsByTagName("head")[0].appendChild(i)}}}(),clone:function(a,b){var c;b=b||{};for(var d in a)a.hasOwnProperty(d)&&(c=a[d],"object"==typeof c?(b[d]=utils.isArray(c)?[]:{},utils.clone(a[d],b[d])):b[d]=c);return b},unhtml:function(a,b){return a?a.replace(b||/[&<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g,function(a,b){return b?a:{"<":"<","&":"&",'"':""",">":">","'":"'"}[a]}):""},cloneArr:function(a){return[].concat(a)},clearWhitespace:function(a){return a.replace(/[\u200b\t\r\n]/g,"")},getValueByIndex:function(a,b){var c=0,d=0;return utils.each(a,function(a,e){if(c+e.length>=b){if(b-c==e.length){if(1==e.length&&0===e[0].width)return void c++;d={x:e[e.length-1].x+e[e.length-1].width,y:e[e.length-1].y}}else d=e[b-c];return!1}c+=e.length+(1==e.length&&0===e[0].width?0:1)}),d},getNodeIndex:function(a,b){for(var c=a,d=0;c=c.previousSibling;)b&&3==c.nodeType?c.nodeType!=c.nextSibling.nodeType&&d++:d++;return d}};Utils.each(["String","Function","Array","Number","RegExp","Object"],function(a,b){KityMinder.Utils["is"+b]=function(a){return Object.prototype.toString.apply(a)=="[object "+b+"]"}});var browser=KityMinder.browser=function(){var a=navigator.userAgent.toLowerCase(),b=window.opera,c={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(a),opera:!!b&&b.version,webkit:a.indexOf(" applewebkit/")>-1,mac:a.indexOf("macintosh")>-1,quirks:"BackCompat"==document.compatMode,ipad:a.indexOf("ipad")>-1};c.gecko="Gecko"==navigator.product&&!c.webkit&&!c.opera&&!c.ie;var d=0;if(c.ie){var e=a.match(/(?:msie\s([\w.]+))/),f=a.match(/(?:trident.*rv:([\w.]+))/);d=e&&f&&e[1]&&f[1]?Math.max(1*e[1],1*f[1]):e&&e[1]?1*e[1]:f&&f[1]?1*f[1]:0,c.ie11Compat=11==document.documentMode,c.ie9Compat=9==document.documentMode,c.ie8=!!document.documentMode,c.ie8Compat=8==document.documentMode,c.ie7Compat=7==d&&!document.documentMode||7==document.documentMode,c.ie6Compat=7>d||c.quirks,c.ie9above=d>8,c.ie9below=9>d}if(c.gecko){var g=a.match(/rv:([\d\.]+)/);g&&(g=g[1].split("."),d=1e4*g[0]+100*(g[1]||0)+1*(g[2]||0))}return/chrome\/(\d+\.\d)/i.test(a)&&(c.chrome=+RegExp.$1),/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a)&&!/chrome/i.test(a)&&(c.safari=+(RegExp.$1||RegExp.$2)),c.opera&&(d=parseFloat(b.version())),c.webkit&&(d=parseFloat(a.match(/ applewebkit\/(\d+)/)[1])),c.version=d,c.isCompatible=!c.mobile&&(c.ie&&d>=6||c.gecko&&d>=10801||c.opera&&d>=9.5||c.air&&d>=1||c.webkit&&d>=522||!1),c}(),ie=browser.ie,webkit=browser.webkit,gecko=browser.gecko,opera=browser.opera,Minder=KityMinder.Minder=kity.createClass("KityMinder",{constructor:function(a){this._options=Utils.extend(window.KITYMINDER_CONFIG||{},a);for(var b=Minder._initFnQueue.slice();b.length;)b.shift().call(this,a);this.fire("ready")}});Minder._initFnQueue=[],Minder.registerInit=function(a){Minder._initFnQueue.push(a)};var Command=kity.createClass("Command",{constructor:function(){this._isContentChange=!0,this._isSelectionChange=!1},execute:function(a,b){},setContentChanged:function(a){this._isContentChange=!!a},isContentChanged:function(){return this._isContentChange},setSelectionChanged:function(a){this._isSelectionChange=!!a},isSelectionChanged:function(){return this._isContentChange},queryState:function(a){return 0},queryValue:function(a){return 0},isNeedUndo:function(){return!0}});kity.extendClass(Minder,{_getCommand:function(a){return this._commands[a.toLowerCase()]},_queryCommand:function(a,b,c){var d=this._getCommand(a);if(d){var e=d["query"+b];if(e)return e.apply(d,[this].concat(c))}return 0},queryCommandState:function(a){return this._queryCommand(a,"State",Utils.argsToArray(1))},queryCommandValue:function(a){return this._queryCommand(a,"Value",Utils.argsToArray(1))},execCommand:function(a){a=a.toLowerCase();var b,c,d,e,f=Utils.argsToArray(arguments,1),g=this;return b=this._getCommand(a),e={command:b,commandName:a.toLowerCase(),commandArgs:f},b&&~this.queryCommandState(a)?(!this._hasEnterExecCommand&&b.isNeedUndo()?(this._hasEnterExecCommand=!0,c=this._fire(new MinderEvent("beforeExecCommand",e,!0)),c||(this._fire(new MinderEvent("saveScene")),this._fire(new MinderEvent("preExecCommand",e,!1)),d=b.execute.apply(b,[g].concat(f)),this._fire(new MinderEvent("execCommand",e,!1)),this._fire(new MinderEvent("saveScene")),b.isContentChanged()&&this._firePharse(new MinderEvent("contentchange")),this._interactChange()),this._hasEnterExecCommand=!1):(d=b.execute.apply(b,[g].concat(f)),this._hasEnterExecCommand||this._interactChange()),void 0===d?null:d):!1}});var MinderNode=KityMinder.MinderNode=kity.createClass("MinderNode",{constructor:function(a){this.parent=null,this.root=this,this.children=[],this.data={},this.tmpData={},this.initContainers(),Utils.isString(a)?this.setText(a):this.setData(a)},initContainers:function(){this.rc=(new kity.Group).setId(KityMinder.uuid("minder_node")),this.rc.minderNode=this},isRoot:function(){return this.root===this},isLeaf:function(){return 0===this.children.length},getRoot:function(){return this.root||this},getParent:function(){return this.parent},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getComplex:function(){var a=0;return this.traverse(function(){a++}),a},getType:function(a){return this.type=["root","main","sub"][Math.min(this.getLevel(),2)],this.type},isAncestorOf:function(a){for(var b=a.parent;b;){if(b==this)return!0;b=b.parent}return!1},setText:function(a){return utils.isArray(a)&&(a=a.join("\n")),this.setData("text",a)},getText:function(a){var b=this.getData("text")||"";return a&&(b=b.split("\n")),b},preTraverse:function(a,b){var c=this.getChildren();b||a(this);for(var d=0;d<c.length;d++)c[d].preTraverse(a)},postTraverse:function(a,b){for(var c=this.getChildren(),d=0;d<c.length;d++)c[d].postTraverse(a);b||a(this)},traverse:function(a,b){return this.postTraverse(a,b)},getChildren:function(){return this.children},getIndex:function(){return this.parent?this.parent.children.indexOf(this):-1},insertChild:function(a,b){void 0===b&&(b=this.children.length),a.parent&&a.parent.removeChild(a),a.parent=this,a.root=this.root,this.children.splice(b,0,a)},appendChild:function(a){return this.insertChild(a)},prependChild:function(a){return this.insertChild(a,0)},removeChild:function(a){var b,c=a;a instanceof MinderNode&&(c=this.children.indexOf(a)),c>=0&&(b=this.children.splice(c,1)[0],b.parent=null,b.root=b)},getChild:function(a){return this.children[a]},getFirstChild:function(){return this.children[0]},getLastChild:function(){return this.children[this.children.length-1]},getData:function(a){return void 0===a?this.data:this.data[a]},setData:function(a,b){return void 0===a?this.data={}:utils.isObject(a)?Utils.extend(this.data,a):void 0===b?(this.data[a]=null,delete this.data[a]):this.data[a]=b,this},getRenderContainer:function(){return this.rc},getCommonAncestor:function(a){return Utils.getNodeCommonAncestor(this,a)},contains:function(a){return this==a||this.isAncestorOf(a)},clone:function(){function a(b,c){var d=new KM.MinderNode;d.data=Utils.clonePlainObject(c.getData()),d.tmpData=Utils.clonePlainObject(c.getTmpData()),b&&b.appendChild(d);for(var e,f=0;e=c.children[f++];)a(d,e);return d}return a(null,this)},equals:function(a,b){function c(){e&&d.setSelectedFlag(),f&&a.setSelectedFlag()}var d=this;if(b){var e=!1,f=!1;d.isSelected()&&(e=!0,d.clearSelectedFlag()),a.isSelected()&&(f=!0,a.clearSelectedFlag())}if(a.children.length!=this.children.length)return c(),!1;if(utils.compareObject(a.getData(),d.getData())===!1)return c(),!1;if(utils.compareObject(a.getTmpData(),d.getTmpData())===!1)return c(),!1;for(var g,h=0;g=d.children[h];h++)if(g.equals(a.children[h],b)===!1)return c(),!1;return c(),!0},clearChildren:function(){this.children=[]},setTmpData:function(a,b){var c=this;utils.isObject(a)&&utils.each(a,function(a,b){c.setTmpData(a,b)}),void 0===b||null===b||""===b?delete this.tmpData[a]:this.tmpData[a]=b},getTmpData:function(a){return void 0===a?this.tmpData:this.tmpData[a]},setValue:function(a){return this.data={},this.setData(utils.clonePlainObject(a.getData())),this.tmpData={},this.setTmpData(utils.clonePlainObject(a.getTmpData())),this}});MinderNode.getCommonAncestor=function(a,b){if(a instanceof Array)return MinderNode.getCommonAncestor.apply(this,a);switch(arguments.length){case 1:return a.parent||a;case 2:if(a.isAncestorOf(b))return a;if(b.isAncestorOf(a))return b;for(var c=a.parent;c&&!c.isAncestorOf(b);)c=c.parent;return c;default:return Array.prototype.reduce.call(arguments,function(a,b){return MinderNode.getCommonAncestor(a,b)},a)}},kity.extendClass(Minder,{getRoot:function(){return this._root},setRoot:function(a){this._root=a,a.minder=this},createNode:function(a,b,c){var d=new MinderNode(a);return this.fire("nodecreate",{node:d,parent:b,index:c}),this.appendNode(d,b,c),d},appendNode:function(a,b,c){return b&&b.insertChild(a,c),this.attachNode(a),this},removeNode:function(a){a.parent&&(a.parent.removeChild(a),this.detachNode(a),this.fire("noderemove",{node:a}))},attachNode:function(a){var b=this._rc;a.traverse(function(a){a.attached=!0,b.addShape(a.getRenderContainer())}),b.addShape(a.getRenderContainer()),this.fire("nodeattach",{node:a})},detachNode:function(a){var b=this._rc;a.traverse(function(a){a.attached=!1,b.removeShape(a.getRenderContainer())}),this.fire("nodedetach",{node:a})},getMinderTitle:function(){return this.getRoot().getText()}}),kity.extendClass(MinderNode,{getMinder:function(){return this.getRoot().minder}}),kity.extendClass(Minder,{getOptions:function(a){var b;return a?(b=this.getPreferences(a),b&&b[a]||this._options[a]):(b=this.getPreferences(),utils.extend(b,this._options,!0))},setDefaultOptions:function(a,b,c){var d={};Utils.isString(a)?d[a]=b:d=a,utils.extend(this._options,d,!c)},setOptions:function(a,b){this.setPreferences(a,b)}}),Minder.registerInit(function(a){this.setDefaultOptions(KM.defaultOptions)});var MinderEvent=kity.createClass("MindEvent",{constructor:function(a,b,c){b=b||{},b.getType&&"ShapeEvent"==b.getType()?(this.kityEvent=b,this.originEvent=b.originEvent,this.getPosition=b.getPosition.bind(b)):b.target&&b.preventDefault?this.originEvent=b:kity.Utils.extend(this,b),this.type=a,this._canstop=c||!1},getTargetNode:function(){var a=this.kityEvent&&this.kityEvent.targetShape;if(!a)return null;for(;!a.minderNode&&a.container;)a=a.container;var b=a.minderNode;return b&&a.getOpacity()<1?null:b||null},stopPropagation:function(){this._stoped=!0},stopPropagationImmediately:function(){this._immediatelyStoped=!0,this._stoped=!0},shouldStopPropagation:function(){return this._canstop&&this._stoped},shouldStopPropagationImmediately:function(){return this._canstop&&this._immediatelyStoped},preventDefault:function(){this.originEvent.preventDefault()},isRightMB:function(){var a=!1;return this.originEvent?("which"in this.originEvent?a=3==this.originEvent.which:"button"in this.originEvent&&(a=2==this.originEvent.button),a):!1},getKeyCode:function(){var a=this.originEvent;return a.keyCode||a.which}});Minder.registerInit(function(){this._initEvents()}),kity.extendClass(Minder,{_initEvents:function(){this._eventCallbacks={}},_bindEvents:function(){this._bindPaperEvents(),this._bindKeyboardEvents()},_resetEvents:function(){this._initEvents(),this._bindEvents()},_bindPaperEvents:function(){this._paper.on("click dblclick mousedown contextmenu mouseup mousemove mouseover mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop",this._firePharse.bind(this)),window&&(window.addEventListener("resize",this._firePharse.bind(this)),window.addEventListener("blur",this._firePharse.bind(this)))},_bindKeyboardEvents:function(){-1==navigator.userAgent.indexOf("iPhone")&&-1==navigator.userAgent.indexOf("iPod")&&-1==navigator.userAgent.indexOf("iPad")&&Utils.listen(document.body,"keydown keyup keypress paste",this._firePharse.bind(this))},_firePharse:function(a){var b,c,d;"DOMMouseScroll"==a.type&&(a.type="mousewheel",a.wheelDelta=a.originEvent.wheelDelta=-10*a.originEvent.detail,a.wheelDeltaX=a.originEvent.mozMovementX,a.wheelDeltaY=a.originEvent.mozMovementY),b=new MinderEvent("before"+a.type,a,!0),this._fire(b)||(c=new MinderEvent("pre"+a.type,a,!0),d=new MinderEvent(a.type,a,!0),(this._fire(c)||this._fire(d))&&this._fire(new MinderEvent("after"+a.type,a,!1)))},_interactChange:function(a){var b=this;b._interactScheduled||(setTimeout(function(){b._fire(new MinderEvent("interactchange")),b._interactScheduled=!1},100),b._interactScheduled=!0)},_listen:function(a,b){var c=this._eventCallbacks[a]||(this._eventCallbacks[a]=[]);c.push(b)},_fire:function(a){var b=this.getStatus(),c=this._eventCallbacks[a.type.toLowerCase()]||[];if(b&&(c=c.concat(this._eventCallbacks[b+"."+a.type.toLowerCase()]||[])),0!==c.length){for(var d=(this.getStatus(),0);d<c.length&&(c[d].call(this,a),!a.shouldStopPropagationImmediately());d++);return a.shouldStopPropagation()}},on:function(a,b){var c=this;return utils.each(a.split(/\s+/),function(a,d){c._listen(d.toLowerCase(),b)}),this},off:function(a,b){var c,d,e,f,g=a.split(/\s+/);for(c=0;c<g.length;c++)if(e=this._eventCallbacks[g[c].toLowerCase()]){for(f=null,d=0;d<e.length;d++)e[d]==b&&(f=d);null!==f&&e.splice(f,1)}},fire:function(a,b){var c=new MinderEvent(a,b);return this._fire(c),this}}),Minder.registerInit(function(){this._initStatus()}),kity.extendClass(Minder,{_initStatus:function(){this._status="normal",this._rollbackStatus="normal"},setStatus:function(){var a=~window.location.href.indexOf("status"),b=~window.location.href.indexOf("trace");return function(c,d){return"readonly"!=this._status||d?(c!=this._status&&(this._rollbackStatus=this._status,this._status=c,this.fire("statuschange",{lastStatus:this._rollbackStatus,currentStatus:this._status}),a&&(console.log(window.event.type,this._rollbackStatus,"->",this._status),b&&console.trace())),this):this}}(),rollbackStatus:function(){this.setStatus(this._rollbackStatus)},getRollbackStatus:function(){return this._rollbackStatus},getStatus:function(){return this._status}}),Minder.registerInit(function(){this._initPaper()}),kity.extendClass(Minder,{_initPaper:function(){this._paper=new kity.Paper,this._paper.getNode().setAttribute("contenteditable",!0),this._paper.getNode().ondragstart=function(a){a.preventDefault()},this._paper.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),this._addRenderContainer(),this.setRoot(this.createNode(this.getLang().maintopic)),this._options.renderTo&&this.renderTo(this._options.renderTo)},_addRenderContainer:function(){this._rc=(new kity.Group).setId(KityMinder.uuid("minder")),this._paper.addShape(this._rc)},renderTo:function(a){this._paper.renderTo(this._renderTarget=a),this._bindEvents()},getRenderContainer:function(){return this._rc},getPaper:function(){return this._paper},getRenderTarget:function(){return this._renderTarget}}),Minder.registerInit(function(){this._initSelection()}),kity.extendClass(Minder,{_initSelection:function(){this._selectedNodes=[]},renderChangedSelection:function(a){var b=this.getSelectedNodes(),c=[],d=0;for(b.forEach(function(b){-1==a.indexOf(b)&&(c.push(b),b.setTmpData("selected",!0))}),a.forEach(function(a){-1==b.indexOf(a)&&(c.push(a),a.setTmpData("selected",!1))}),c.length&&(this._interactChange(),this.fire("selectionchange"));d<c.length;)c[d++].render()},getSelectedNodes:function(){return this._selectedNodes},getSelectedNode:function(){return this.getSelectedNodes()[0]||null},removeAllSelectedNodes:function(){var a=this._selectedNodes.splice(0);return this._selectedNodes=[],this.renderChangedSelection(a),this.fire("selectionclear")},removeSelectedNodes:function(a){var b=this,c=this._selectedNodes.slice(0);return a=Utils.isArray(a)?a:[a],Utils.each(a,function(a,c){var d;-1!==(d=b._selectedNodes.indexOf(c))&&b._selectedNodes.splice(d,1)}),this.renderChangedSelection(c),this},select:function(a,b){var c=this.getSelectedNodes().slice(0);b&&(this._selectedNodes=[]);var d=this;return a=Utils.isArray(a)?a:[a],Utils.each(a,function(a,b){-1===d._selectedNodes.indexOf(b)&&d._selectedNodes.push(b)}),this.renderChangedSelection(c),this},toggleSelect:function(a){return Utils.isArray(a)?a.forEach(this.toggleSelect.bind(this)):a.isSelected()?this.removeSelectedNodes(a):this.select(a),this},isSingleSelect:function(){return 1==this._selectedNodes.length},getSelectedAncestors:function(a){function b(a,b){for(var c=a.length-1;c>=0;--c)if(a[c].isAncestorOf(b))return!0;return!1}var c,d=this.getSelectedNodes().slice(0),e=[],f=d.indexOf(this.getRoot());for(~f&&!a&&d.splice(f,1),d.sort(function(a,b){return a.getLevel()-b.getLevel()});c=d.pop();)b(d,c)||e.push(c);return e}}),kity.extendClass(MinderNode,{isSelected:function(){return this.getTmpData("selected")},clearSelectedFlag:function(){
- this.setTmpData("selected")},setSelectedFlag:function(){this.setTmpData("selected",!0)}}),kity.extendClass(MinderEvent,{isShortcutKey:function(a){var b=this.originEvent;return b?getMetaKeyCode(a)==getMetaKeyCode(b):!1}}),Minder.registerInit(function(){this._initShortcutKey()}),kity.extendClass(Minder,{_initShortcutKey:function(){this._bindShortcutKeys()},_bindShortcutKeys:function(){var a=this._shortcutKeys={},b="hasOwnProperty";this.on("keydown",function(c){for(var d in a)if(a[b](d)&&c.isShortcutKey(d)){var e=a[d];if(e.__statusCondition&&e.__statusCondition!=this.getStatus())return;e(),c.preventDefault()}})},addShortcut:function(a,b){var c=this._shortcutKeys;a.split(/\|\s*/).forEach(function(a){var d,e=a.split("::");e.length>1&&(a=e[1],d=e[0],b.__statusCondition=d),c[a]=b})},addCommandShortcutKeys:function(a,b){var c=this._commandShortcutKeys||(this._commandShortcutKeys={}),d={};b?d[a]=b:d=a;var e=this;utils.each(d,function(a,b){c[a]=b,e.addShortcut(b,function(){0===e.queryCommandState(a)&&e.execCommand(a)})})},getCommandShortcutKey:function(a){var b=this._commandShortcutKeys;return b&&b[a]||null}}),Minder.registerInit(function(){this._initContextMenu()}),kity.extendClass(Minder,{_initContextMenu:function(){this.contextmenus=[]},addContextMenu:function(a){return utils.isArray(a)?this.contextmenus=this.contextmenus.concat(a):this.contextmenus.push(a),this},getContextMenu:function(){return this.contextmenus}}),function(){var a;KityMinder.registerModule=function(b,c){a||(a={}),a[b]=c},KityMinder.getModules=function(){return a}}(),Minder.registerInit(function(){this._initModules()}),kity.extendClass(Minder,{_initModules:function(){var a=KityMinder.getModules(),b=this._options.modules||Utils.keys(a);this._commands={},this._query={},this._modules={},this._rendererClasses={};var c,d,e,f,g,h,i,j=this;for(c=0;c<b.length;c++)if(d=b[c],a[d]&&(f="function"==typeof a[d]?a[d].call(j):a[d],this._modules[d]=f,f)){f.init&&f.init.call(j,this._options),g=f.commands;for(d in g)this._commands[d.toLowerCase()]=new g[d];if(h=f.events)for(e in h)j.on(e,h[e]);if(i=f.renderers)for(e in i)this._rendererClasses[e]=this._rendererClasses[e]||[],Utils.isArray(i[e])?this._rendererClasses[e]=this._rendererClasses[e].concat(i[e]):this._rendererClasses[e].push(i[e]);f.defaultOptions&&this.setDefaultOptions(f.defaultOptions),f.commandShortcutKeys&&this.addCommandShortcutKeys(f.commandShortcutKeys),f.contextmenu&&this.addContextMenu(f.contextmenu)}},_garbage:function(){for(this.clearSelect();this._root.getChildren().length;)this._root.removeChild(0)},destroy:function(){var a=this._modules;this._resetEvents(),this._garbage();for(var b in a)a[b].destroy&&a[b].destroy.call(this)},reset:function(){var a=this._modules;this._garbage();for(var b in a)a[b].reset&&a[b].reset.call(this)}}),Utils.extend(KityMinder,{_protocols:{},registerProtocol:function(a,b){KityMinder._protocols[a]=b}});var DEFAULT_TEXT={root:"maintopic",main:"topic",sub:"topic"};Minder.registerInit(function(){this._initProtocols()}),kity.extendClass(Minder,{_initProtocols:function(a){var b=this._protocols={},c=KityMinder._protocols;for(var d in c)c.hasOwnProperty(d)&&(b[d]=c[d](this)),b[d].name=d},getProtocol:function(a){return this._protocols[a]||null},getSupportedProtocols:function(){var a=this._protocols;return Utils.keys(a).map(function(b){return a[b]})},exportJson:function(){function a(b){var c={};c.data=b.getData();var d=b.getChildren();if(d.length){c.children=[];for(var e=0;e<d.length;e++)c.children.push(a(d[e]))}return c}var b=a(this.getRoot());return b.template=this.getTemplate(),b.theme=this.getTheme(),b.version=KityMinder.version,b},importJson:function(a,b){function c(a,b,d){var e=b.data;a.data={};for(var f in e)a.setData(f,e[f]);a.setData("text",e.text||d.getLang(DEFAULT_TEXT[a.getType()]));for(var g=b.children||[],h=0;h<g.length;h++){var i=d.createNode(null,a);c(i,g[h],d)}return a}if(a){for(this._fire(new MinderEvent("preimport",b,!1));this._root.getChildren().length;)this.removeNode(this._root.getChildren()[0]);a=KityMinder.compatibility(a),c(this._root,a,this),this.setTemplate(a.template||"default"),this.setTheme(a.theme||null),this.refresh(),this.fire("import",b),this._firePharse({type:"contentchange"}),this._interactChange()}},exportData:function(a,b){var c,d;return c=this.exportJson(),!a||(d=this.getProtocol(a),d&&d.encode)?(this._fire(new MinderEvent("beforeexport",{json:c,protocolName:a,protocol:d})),Promise.resolve(d?d.encode(c,this,b):c)):Promise.reject(new Error("Not supported protocol:"+a))},importData:function(a,b){var c,d=this;if(b&&(c=this.getProtocol(b),!c||!c.decode))return Promise.reject(new Error("Not supported protocol:"+b));var e={local:a,protocolName:b,protocol:c};return this._fire(new MinderEvent("beforeimport",e)),new Promise(function(b,d){b(c?c.decode(a):a)}).then(function(a){return d.importJson(a,e),a})}}),Minder.registerInit(function(a){a.readOnly&&this.setDisabled()}),kity.extendClass(Minder,{disable:function(){var a=this;a.bkqueryCommandState=a.queryCommandState,a.bkqueryCommandValue=a.queryCommandValue,a.queryCommandState=function(b){var c=this._getCommand(b);return c&&c.enableReadOnly?a.bkqueryCommandState.apply(a,arguments):-1},a.queryCommandValue=function(b){var c=this._getCommand(b);return c&&c.enableReadOnly?a.bkqueryCommandValue.apply(a,arguments):null},this.setStatus("readonly"),a._interactChange()},enable:function(){var a=this;a.bkqueryCommandState&&(a.queryCommandState=a.bkqueryCommandState,delete a.bkqueryCommandState),a.bkqueryCommandValue&&(a.queryCommandValue=a.bkqueryCommandValue,delete a.bkqueryCommandValue),this.setStatus("normal"),a._interactChange()}}),Utils.extend(KityMinder,{_layout:{},registerLayout:function(a,b){KityMinder._layout[a]=b,KityMinder._defaultLayout||(KityMinder._defaultLayout=a)},getLayoutList:function(){return this._layout},getLayoutInstance:function(a){var b=KityMinder._layout[a];if(!b)throw new Error("Missing Layout: "+a);var c=new b;return c}}),kity.extendClass(MinderNode,{getLayout:function(){var a=this.getData("layout");return a=a||(this.isRoot()?KityMinder._defaultLayout:this.parent.getLayout())},setLayout:function(a){return a&&("inherit"==a?this.setData("layout"):this.setData("layout",a)),this},layout:function(a,b){return this.setLayout(a).getMinder().layout(b),this},getLayoutInstance:function(){return KityMinder.getLayoutInstance(this.getLayout())},getOrderHint:function(a){return this.parent.getLayoutInstance().getOrderHint(this)},getExpandPosition:function(){return this.getLayoutInstance().getExpandPosition()},getLayoutTransform:function(){return this._layoutTransform||new kity.Matrix},getGlobalLayoutTransformPreview:function(){var a=this.parent?this.parent.getLayoutTransform():new kity.Matrix,b=this.getLayoutTransform(),c=this.getLayoutOffset();return c&&b.translate(c.x,c.y),a.merge(b)},getLayoutPointPreview:function(){return this.getGlobalLayoutTransformPreview().transformPoint(new kity.Point)},getGlobalLayoutTransform:function(){return this._globalLayoutTransform?this._globalLayoutTransform:this.parent?this.parent.getGlobalLayoutTransform():new kity.Matrix},setLayoutTransform:function(a){return this._layoutTransform=a,this},setGlobalLayoutTransform:function(a){return this.getRenderContainer().setMatrix(this._globalLayoutTransform=a),this},setVertexIn:function(a){this._vertexIn=a},setVertexOut:function(a){this._vertexOut=a},getVertexIn:function(){return this._vertexIn||new kity.Point},getVertexOut:function(){return this._vertexOut||new kity.Point},getLayoutVertexIn:function(){return this.getGlobalLayoutTransform().transformPoint(this.getVertexIn())},getLayoutVertexOut:function(){return this.getGlobalLayoutTransform().transformPoint(this.getVertexOut())},setLayoutVectorIn:function(a){return this._layoutVectorIn=a,this},setLayoutVectorOut:function(a){return this._layoutVectorOut=a,this},getLayoutVectorIn:function(){return this._layoutVectorIn||new kity.Vector},getLayoutVectorOut:function(){return this._layoutVectorOut||new kity.Vector},getLayoutBox:function(){var a=this.getGlobalLayoutTransform();return a.transformBox(this.getContentBox())},getLayoutPoint:function(){var a=this.getGlobalLayoutTransform();return a.transformPoint(new kity.Point)},getLayoutOffset:function(){if(!this.parent)return new kity.Point;var a=this.getData("layout_"+this.parent.getLayout()+"_offset");return a?new kity.Point(a.x,a.y):new kity.Point},setLayoutOffset:function(a){if(!this.parent)return this;if(a&&!this.hasLayoutOffset()){var b=this.getLayoutTransform().m;a=a.offset(b.e,b.f),this.setLayoutTransform(null)}return this.setData("layout_"+this.parent.getLayout()+"_offset",a?{x:a.x,y:a.y}:null),this},hasLayoutOffset:function(){return!!this.getData("layout_"+this.parent.getLayout()+"_offset")},resetLayoutOffset:function(){return this.setLayoutOffset(null)},getLayoutRoot:function(){return this.isLayoutRoot()?this:this.parent.getLayoutRoot()},isLayoutRoot:function(){return this.getData("layout")||this.isRoot()}}),Minder.registerInit(function(a){this.refresh()}),kity.extendClass(Minder,{layout:function(a){function b(a,c){a.isExpanded(),0||a.children.forEach(function(a){b(a,c)});var d=a.getLayoutInstance(),e=a.getChildren().filter(function(a){return!a.hasLayoutOffset()});d.doLayout(a,e,c)}this.getRoot().traverse(function(a){a.setLayoutTransform(null)}),b(this.getRoot(),1),b(this.getRoot(),2),a=a?300:0;var c=this;return this.applyLayoutResult(this.getRoot(),a).then(function(){c.fire("layoutallfinish")}),this.fire("layout")},refresh:function(a){return this.getRoot().renderTree(),this.layout(a).fire("contentchange")._interactChange(),this},applyLayoutResult:function(a,b){function c(){--i||g.resolve()}function d(a,b){a.setGlobalLayoutTransform(b),f.fire("layoutapply",{node:a,matrix:b})}function e(a,g){var h=a.getLayoutTransform().merge(g),i=a.getGlobalLayoutTransform()||new kity.Matrix,j=a.getLayoutOffset();h.translate(j.x,j.y),h.m.e=Math.round(h.m.e),h.m.f=Math.round(h.m.f),a._layoutTimeline&&(a._layoutTimeline.stop(),a._layoutTimeline=null),b?a._layoutTimeline=new kity.Animator(i,h,d).start(a,b,"ease").on("finish",function(){setTimeout(function(){d(a,h),f.fire("layoutfinish",{node:a,matrix:h}),c()},150)}):(d(a,h),f.fire("layoutfinish",{node:a,matrix:h}),c());for(var k=0;k<a.children.length;k++)e(a.children[k],h)}a=a||this.getRoot();var f=this,g={},h=new Promise(function(a,b){g.resolve=a,g.reject=b}),i=a.getComplex();return i>200&&(b=0),e(a,a.parent?a.parent.getGlobalLayoutTransform():new kity.Matrix),h}});var Layout=kity.createClass("Layout",{doLayout:function(a){throw new Error("Not Implement: Layout.doLayout()")},align:function(a,b,c){var d=this;c=c||0,a.forEach(function(a){var e=d.getTreeBox([a]),f=a.getLayoutTransform();switch(b){case"left":return f.translate(c-e.left,0);case"right":return f.translate(c-e.right,0);case"top":return f.translate(0,c-e.top);case"bottom":return f.translate(0,c-e.bottom)}})},stack:function(a,b,c){var d=this,e=0;return c=c||function(a,b,c){return a.getStyle({x:"margin-right",y:"margin-bottom"}[c])+b.getStyle({x:"margin-left",y:"margin-top"}[c])},a.forEach(function(a,f,g){var h=d.getTreeBox([a]),i={x:h.width,y:h.height}[b],j={x:h.left,y:h.top}[b],k=a.getLayoutTransform();"x"==b?k.translate(e-j,0):k.translate(0,e-j),e+=i,g[f+1]&&(e+=c(a,g[f+1],b))}),e},move:function(a,b,c){a.forEach(function(a){a.getLayoutTransform().translate(b,c)})},getBranchBox:function(a){var b,c,d,e,f=new kity.Box;for(b=0;b<a.length;b++)c=a[b],d=c.getLayoutTransform(),e=c.getContentBox(),f=f.merge(d.transformBox(e));return f},getTreeBox:function(a){var b,c,d,e,f=KityMinder.Geometry,g={x:0,y:0,height:0,width:0};for(a instanceof Array||(a=[a]),b=0;b<a.length;b++)c=a[b],d=c.getLayoutTransform(),e=c.getContentBox(),c.isExpanded()&&c.children.length&&(e=f.mergeBox(e,this.getTreeBox(c.children))),g=f.mergeBox(g,d.transformBox(e));return g},getOrderHint:function(a){return[]}}),LayoutCommand=kity.createClass("LayoutCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();c.forEach(function(a){a.layout(b)})},queryValue:function(a){var b=a.getSelectedNode();return b?b.getData("layout"):void 0},queryState:function(a){return a.getSelectedNode()?0:-1}}),ResetLayoutCommand=kity.createClass("ResetLayoutCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();c.length||(c=[a.getRoot()]),c.forEach(function(a){a.traverse(function(a){a.resetLayoutOffset(),a.isRoot()||a.setData("layout",null)})}),a.layout(300)},enableReadOnly:!0});KityMinder.registerModule("LayoutModule",{commands:{layout:LayoutCommand,resetlayout:ResetLayoutCommand},contextmenu:[{command:"resetlayout"},{divider:!0}],commandShortcutKeys:{resetlayout:"Ctrl+Shift+L"}});var cssLikeValueMatcher={left:function(a){return 3 in a&&a[3]||1 in a&&a[1]||a[0]},right:function(a){return 1 in a&&a[1]||a[0]},top:function(a){return a[0]},bottom:function(a){return 2 in a&&a[2]||a[0]}};Utils.extend(KityMinder,{_themes:{},registerTheme:function(a,b){KityMinder._themes[a]=b},getThemeList:function(){return KityMinder._themes}}),kity.extendClass(Minder,{useTheme:function(a){return this.setTheme(a),this.refresh(800),!0},setTheme:function(a){this._theme=a||null,this.getRenderTarget().style.background=this.getStyle("background"),this.fire("themechange",{theme:a})},getTheme:function(a){return this._theme||this.getOptions("defaultTheme")},getThemeItems:function(a){this.getTheme(a);return KityMinder._themes[this.getTheme(a)]},getStyle:function(a,b){var c,d,e,f,g=this.getThemeItems(b);if(a in g)return g[a];if(c=a.split("-"),c.length<2)return null;if(d=c.pop(),a=c.join("-"),a in g){if(e=g[a],Utils.isArray(e)&&(f=cssLikeValueMatcher[d]))return f(e);if(!isNaN(e))return e}return null},getNodeStyle:function(a,b){var c=this.getStyle(a.getType()+"-"+b,a);return null!==c?c:this.getStyle(b,a)}}),kity.extendClass(MinderNode,{getStyle:function(a){return this.getMinder().getNodeStyle(this,a)}}),KityMinder.registerModule("Theme",{defaultOptions:{defaultTheme:"fresh-blue"},commands:{theme:kity.createClass("ThemeCommand",{base:Command,execute:function(a,b){return a.useTheme(b)},queryValue:function(a){return a.getTheme()||"default"}})}}),Minder.registerInit(function(){this.setTheme()}),Utils.extend(KityMinder,{compatibility:function(a){function b(a,c){c(a),a.children&&a.children.forEach(function(a){b(a,c)})}function c(a){b(a,function(a){var b=a.data;delete b.layout_bottom_offset,delete b.layout_default_offset,delete b.layout_filetree_offset})}function d(a){var c=a.data.currentstyle;delete a.data.currentstyle,"bottom"==c?(a.template="structure",a.theme="snow"):"default"==c&&(a.template="default",a.theme="classic"),b(a,function(a){var b=a.data;"PriorityIcon"in b&&(b.priority=b.PriorityIcon,delete b.PriorityIcon),"ProgressIcon"in b&&(b.progress=1+(b.ProgressIcon-1<<1),delete b.ProgressIcon),delete b.point,delete b.layout})}var e=a.version||"1.1.3";switch(e){case"1.1.3":d(a);case"1.2.0":case"1.2.1":c(a)}return a}});var Renderer=KityMinder.Renderer=kity.createClass("Renderer",{constructor:function(a){this.node=a},create:function(a){throw new Error("Not implement: Renderer.create()")},shouldRender:function(a){return!0},watchChange:function(a){var b;b=void 0===this.watchingData?!0:this.watchingData!=a?!0:!1,this.watchingData=a},shouldDraw:function(a){return!0},update:function(a,b,c){return this.shouldDraw()&&this.draw(a,b),this.place(a,b,c)},draw:function(a,b){throw new Error("Not implement: Renderer.draw()")},place:function(a,b,c){throw new Error("Not implement: Renderer.place()")},getRenderShape:function(){return this._renderShape||null},setRenderShape:function(a){this._renderShape=a}});kity.extendClass(Minder,function(){function a(a,b){var c=[];["center","left","right","top","bottom","outline","outside"].forEach(function(a){var d="before"+a,e="after"+a;b[d]&&(c=c.concat(b[d])),b[a]&&(c=c.concat(b[a])),b[e]&&(c=c.concat(b[e]))}),a._renderers=c.map(function(b){return new b(a)})}return{renderNodeBatch:function(b){var c,d,e,f,g=this._rendererClasses,h=[],i=0;if(b.length){for(d=0;d<b.length;d++)f=b[d],f._renderers||a(f,g),f._contentBox=new kity.Box,this.fire("beforerender",{node:f});for(i=b[0]._renderers.length,c=0;i>c;c++){for(d=0;d<b.length;d++)"function"==typeof h[d]&&(h[d]=h[d]()),h[d]instanceof kity.Box||(h[d]=new kity.Box(h[d]));for(d=0;d<b.length;d++)f=b[d],e=f._renderers[c],h[d]&&(f._contentBox=f._contentBox.merge(h[d])),e.shouldRender(f)?(e.getRenderShape()||(e.setRenderShape(e.create(f)),e.bringToBack?f.getRenderContainer().prependShape(e.getRenderShape()):f.getRenderContainer().appendShape(e.getRenderShape())),e.getRenderShape().setVisible(!0),h[d]=e.update(e.getRenderShape(),f,f._contentBox)):e.getRenderShape()&&(e.getRenderShape().setVisible(!1),h[d]=null)}for(d=0;d<b.length;d++)this.fire("noderender",{node:b[d]})}},renderNode:function(b){var c,d=this._rendererClasses;KityMinder.Geometry;b._renderers||a(b,d),this.fire("beforerender",{node:b}),b._contentBox=new kity.Box,b._renderers.forEach(function(a){a.shouldRender(b)?(a.getRenderShape()||(a.setRenderShape(a.create(b)),a.bringToBack?b.getRenderContainer().prependShape(a.getRenderShape()):b.getRenderContainer().appendShape(a.getRenderShape())),a.getRenderShape().setVisible(!0),c=a.update(a.getRenderShape(),b,b._contentBox),"function"==typeof c&&(c=c()),c&&(b._contentBox=b._contentBox.merge(c))):a.getRenderShape()&&a.getRenderShape().setVisible(!1)}),this.fire("noderender",{node:b})}}}()),kity.extendClass(MinderNode,{render:function(){return this.attached?(this.getMinder().renderNode(this),this):void 0},renderTree:function(){if(this.attached){var a=[];return this.traverse(function(b){a.push(b)}),this.getMinder().renderNodeBatch(a),this}},getRenderer:function(a){for(var b=this._renderers,c=0;c<b.length;c++)if(b[c].getType()==a)return b[c];return null},getContentBox:function(){return this.parent&&this.parent.isCollapsed()?new kity.Box:this._contentBox||new kity.Box}}),utils.extend(KityMinder,{_connectProviders:{},_defaultConnectProvider:function(a,b,c){c.setPathData(["M",b.getLayoutVertexOut(),"L",a.getLayoutVertexIn()])},registerConnectProvider:function(a,b){KityMinder._connectProviders[a]=b},getConnectProvider:function(a){return KityMinder._connectProviders[a]||KityMinder._defaultConnectProvider}}),kity.extendClass(MinderNode,{getConnectProvider:function(){return KityMinder.getConnectProvider(this.getConnect())},getConnect:function(){return null},getConnection:function(){return this._connection||null}}),kity.extendClass(Minder,{getConnectContainer:function(){return this._connectContainer},createConnect:function(a){if(!a.isRoot()){var b=new kity.Path;a._connection=b,this._connectContainer.addShape(b),this.updateConnect(a)}},removeConnect:function(a){var b=this;a.traverse(function(a){b._connectContainer.removeShape(a._connection),a._connection=null})},updateConnect:function(a){var b=a._connection,c=a.parent;if(c&&b){if(c.isCollapsed())return void b.setVisible(!1);b.setVisible(!0);var d=a.getConnectProvider(),e=a.getStyle("connect-color")||"white",f=a.getStyle("connect-width")||2;b.stroke(e,f),d(a,c,b,f,e),f%2===0?b.setTranslate(.5,.5):b.setTranslate(0,0)}}}),KityMinder.registerModule("Connect",{init:function(){this._connectContainer=(new kity.Group).setId(KityMinder.uuid("minder_connect_group")),this.getRenderContainer().prependShape(this._connectContainer)},events:{nodeattach:function(a){this.createConnect(a.node)},nodedetach:function(a){this.removeConnect(a.node)},"layoutapply layoutfinish noderender":function(a){this.updateConnect(a.node)}}}),utils.extend(KityMinder,{_templates:{},registerTemplate:function(a,b){KityMinder._templates[a]=b},getTemplateList:function(){return KityMinder._templates}}),kity.extendClass(Minder,function(){var a=Minder.prototype.getTheme;return{useTemplate:function(a,b){this.setTemplate(a),this.refresh(b||800)},getTemplate:function(){return this._template||"default"},setTemplate:function(a){this._template=a||null},getTemplateSupport:function(a){var b=KityMinder._templates[this.getTemplate()];return b&&b[a]},getTheme:function(b){var c=this.getTemplateSupport("getTheme")||a;return c.call(this,b)}}}()),kity.extendClass(MinderNode,function(){var a=MinderNode.prototype.getLayout,b=MinderNode.prototype.getConnect;return{getLayout:function(){var b=this.getMinder().getTemplateSupport("getLayout")||a;return b.call(this,this)},getConnect:function(){var a=this.getMinder().getTemplateSupport("getConnect")||b;return a.call(this,this)}}}()),KityMinder.registerModule("TemplateModule",{commands:{template:kity.createClass("TemplateCommand",{base:Command,execute:function(a,b){a.useTemplate(b),a.execCommand("camera")},queryValue:function(a){return a.getTemplate()||"default"}})}}),kity.extendClass(Minder,{getLang:function(a){var b=KM.LANG[this.getOptions("lang")];if(!b)throw Error("not import language file");a=(a||"").split(".");for(var c,d=0;(c=a[d++])&&(b=b[c],b););if("string"==typeof b){var e=arguments;return b.replace(/\{(\d+)\}/gi,function(a,b){return void 0!=e[+b+1]&&e[+b+1].toString()||a})}return b}}),KM.defaultOptions={zIndex:1e3,lang:"zh-cn",readyOnly:!1},kity.extendClass(Minder,function(){var a="kityminder_preference",b=function(){var a=window.localStorage;return{saveLocalData:function(b,c){return a&&c?(a.setItem(b,c),!0):!1},getLocalData:function(b){return a?a.getItem(b):null},removeItem:function(b){a&&a.removeItem(b)}}}();return{setPreferences:function(c,d){var e={};Utils.isString(c)?e[c]=d:e=c;var f=b.getLocalData(a);f?(f=JSON.parse(f),utils.extend(f,e)):f=e,b.saveLocalData(a,JSON.stringify(f))},getPreferences:function(c){var d=b.getLocalData(a);return d?(d=JSON.parse(d),c?d[c]:d):{}},resetPreferences:function(a){var c=a?JSON.stringify(a):"";b.saveLocalData(c)}}}());var keymap=KityMinder.keymap=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c],b[c.toLowerCase()]=a[c]);var d=65,e="a".charCodeAt(0);"abcdefghijklmnopqrstuvwxyz".split("").forEach(function(a){b[a]=d+(a.charCodeAt(0)-e)});var f=9;do b[f.toString()]=f+48;while(--f);return b}({Backspace:8,Tab:9,Enter:13,Shift:16,Control:17,Alt:18,CapsLock:20,Esc:27,Spacebar:32,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Left:37,Up:38,Right:39,Down:40,direction:{37:1,38:1,39:1,40:1},Del:46,NumLock:144,Cmd:91,CmdFF:224,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"`":192,"=":187,"-":189,"/":191,".":190,controlKeys:{16:1,17:1,18:1,20:1,91:1,224:1},notContentChange:{13:1,9:1,33:1,34:1,35:1,36:1,16:1,17:1,18:1,20:1,91:1,37:1,38:1,39:1,40:1,113:1,114:1,115:1,144:1,27:1},isSelectedNodeKey:{37:1,38:1,39:1,40:1,13:1,9:1}});KityMinder.registerLayout("mind",kity.createClass({base:Layout,doLayout:function(a,b){var c=Math.ceil(a.children.length/2),d=[],e=[];b.forEach(function(a){a.getIndex()<c?d.push(a):e.push(a)});var f=KityMinder.getLayoutInstance("left"),g=KityMinder.getLayoutInstance("right");f.doLayout(a,e),g.doLayout(a,d);var h=a.getContentBox();a.setVertexOut(new kity.Point(h.cx,h.cy)),a.setLayoutVectorOut(new kity.Vector(0,0))},getOrderHint:function(a){var b=[],c=a.getLayoutBox(),d=5;return b.push({type:"up",node:a,area:{x:c.x,y:c.top-a.getStyle("margin-top")-d,width:c.width,height:a.getStyle("margin-top")},path:["M",c.x,c.top-d,"L",c.right,c.top-d]}),b.push({type:"down",node:a,area:{x:c.x,y:c.bottom+d,width:c.width,height:a.getStyle("margin-bottom")},path:["M",c.x,c.bottom+d,"L",c.right,c.bottom+d]}),b}})),[-1,1].forEach(function(a){var b="filetree-"+(a>0?"down":"up");KityMinder.registerLayout(b,kity.createClass({base:Layout,doLayout:function(b,c,d){var e=b.getContentBox(),f=20;if(b.setVertexOut(new kity.Point(e.left+f,a>0?e.bottom:e.top)),b.setLayoutVectorOut(new kity.Vector(0,a)),c.length){c.forEach(function(a){var b=a.getContentBox();a.setLayoutTransform(new kity.Matrix),a.setVertexIn(new kity.Point(b.left,b.cy)),a.setLayoutVectorIn(new kity.Vector(1,0))}),this.align(c,"left"),this.stack(c,"y");var g=0;g+=e.left,g+=f,g+=c[0].getStyle("margin-left");var h=0;a>0?(h+=e.bottom,h+=b.getStyle("margin-bottom"),h+=c[0].getStyle("margin-top")):(h-=this.getTreeBox(c).bottom,h+=e.top,h-=b.getStyle("margin-top"),h-=c[0].getStyle("margin-bottom")),this.move(c,g,h)}},getOrderHint:function(a){var b=[],c=a.getLayoutBox(),d=a.getLevel()>1?3:5;return b.push({type:"up",node:a,area:{x:c.x,y:c.top-a.getStyle("margin-top")-d,width:c.width,height:a.getStyle("margin-top")},path:["M",c.x,c.top-d,"L",c.right,c.top-d]}),b.push({type:"down",node:a,area:{x:c.x,y:c.bottom+d,width:c.width,height:a.getStyle("margin-bottom")},path:["M",c.x,c.bottom+d,"L",c.right,c.bottom+d]}),b}}))});var layouts=["left","right","top","bottom"];layouts.forEach(function(a){function b(a){var b=[],d=a.getLayoutBox(),e=5;return"x"==c?(b.push({type:"up",node:a,area:{x:d.x,y:d.top-a.getStyle("margin-top")-e,width:d.width,height:a.getStyle("margin-top")},path:["M",d.x,d.top-e,"L",d.right,d.top-e]}),b.push({type:"down",node:a,area:{x:d.x,y:d.bottom+e,width:d.width,height:a.getStyle("margin-bottom")},path:["M",d.x,d.bottom+e,"L",d.right,d.bottom+e]})):(b.push({type:"up",node:a,area:{x:d.left-a.getStyle("margin-left")-e,y:d.top,width:a.getStyle("margin-left"),height:d.height},path:["M",d.left-e,d.top,"L",d.left-e,d.bottom]}),b.push({type:"down",node:a,area:{x:d.right+e,y:d.top,width:a.getStyle("margin-right"),height:d.height},path:["M",d.right+e,d.top,"L",d.right+e,d.bottom]})),b}var c="left"==a||"right"==a?"x":"y",d="left"==a||"top"==a?-1:1,e={left:"right",right:"left",top:"bottom",bottom:"top",x:"y",y:"x"};KityMinder.registerLayout(a,kity.createClass({base:Layout,doLayout:function(b,f){var g=b.getContentBox();if("x"==c?(b.setVertexOut(new kity.Point(g[a],g.cy)),b.setLayoutVectorOut(new kity.Vector(d,0))):(b.setVertexOut(new kity.Point(g.cx,g[a])),b.setLayoutVectorOut(new kity.Vector(0,d))),!f.length)return!1;f.forEach(function(b){var f=b.getContentBox();b.setLayoutTransform(new kity.Matrix),"x"==c?(b.setVertexIn(new kity.Point(f[e[a]],f.cy)),b.setLayoutVectorIn(new kity.Vector(d,0))):(b.setVertexIn(new kity.Point(f.cx,f[e[a]])),b.setLayoutVectorIn(new kity.Vector(0,d)))}),this.align(f,e[a]),this.stack(f,e[c]);var h,i,j=this.getBranchBox(f);"x"==c?(h=g[a],h+=d*b.getStyle("margin-"+a),h+=d*f[0].getStyle("margin-"+e[a]),i=g.bottom,i-=g.height/2,i-=j.height/2,i-=j.y):(h=g.right,h-=g.width/2,h-=j.width/2,h-=j.x,i=g[a],i+=d*b.getStyle("margin-"+a),i+=d*f[0].getStyle("margin-"+e[a])),this.move(f,h,i)},getOrderHint:b}))}),KityMinder.registerLayout("fish-bone-master",kity.createClass("FishBoneMasterLayout",{base:Layout,doLayout:function(a,b,c){var d=[],e=[],f=b[0],g=a.getContentBox();if(a.setVertexOut(new kity.Point(g.right,g.cy)),a.setLayoutVectorOut(new kity.Vector(1,0)),f){var h=(f.getContentBox(),a.getStyle("margin-right")),i=f.getStyle("margin-left"),j=f.getStyle("margin-top"),k=f.getStyle("margin-bottom");b.forEach(function(a,b){a.setLayoutTransform(new kity.Matrix);var c=a.getContentBox();b%2?(e.push(a),a.setVertexIn(new kity.Point(c.left,c.top)),a.setLayoutVectorIn(new kity.Vector(1,1))):(d.push(a),a.setVertexIn(new kity.Point(c.left,c.bottom)),a.setLayoutVectorIn(new kity.Vector(1,-1)))}),this.stack(d,"x"),this.stack(e,"x"),this.align(d,"bottom"),this.align(e,"top");var l=g.right+h+i,m=g.cy-k-a.getStyle("margin-top"),n=g.cy+j+a.getStyle("margin-bottom");this.move(d,l,m),this.move(e,l+i,n)}}})),KityMinder.registerLayout("fish-bone-slave",kity.createClass("FishBoneSlaveLayout",{base:Layout,doLayout:function(a,b,c){var d=this,e=Math.abs,f=.382,g=a.getContentBox(),h=a.getLayoutVectorIn();a.setLayoutVectorOut(h);var i=g.left+g.width*f,j=new kity.Point(i,h.y>0?g.bottom:g.top);a.setVertexOut(j);var k=b[0];if(k){var l=k.getContentBox();b.forEach(function(a,b){a.setLayoutTransform(new kity.Matrix),a.setLayoutVectorIn(new kity.Vector(1,0)),a.setVertexIn(new kity.Point(l.left,l.cy))}),this.stack(b,"y"),this.align(b,"left");var m=0,n=0;m+=j.x,a.getLayoutVectorOut().y<0?(n-=this.getTreeBox(b).bottom,n+=a.getContentBox().top,n-=a.getStyle("margin-top"),n-=k.getStyle("margin-bottom")):(n+=a.getContentBox().bottom,n+=a.getStyle("margin-bottom"),n+=k.getStyle("margin-top")),this.move(b,m,n),2==c&&b.forEach(function(a){var b=a.getLayoutTransform(),c=a.getContentBox(),f=b.transformPoint(new kity.Point(c.left,0));d.move([a],e(f.y-j.y),0)})}}})),KityMinder.registerLayout("tianpan",kity.createClass({base:Layout,doLayout:function(a,b){if(0!=b.length){var c,d,e,f=this,g=a.getContentBox(),h=5,i=Math.max(g.width,50);b.forEach(function(a,b){a.setLayoutTransform(new kity.Matrix),e=f.getTreeBox(a),i=Math.max(Math.max(e.width,e.height),i)}),i=i/1.5/Math.PI,b.forEach(function(a,b){c=i*(Math.cos(h)+Math.sin(h)*h),d=i*(Math.sin(h)-Math.cos(h)*h),h+=.9-.02*b,a.setLayoutVectorIn(new kity.Vector(1,0)),a.setVertexIn(new kity.Point(g.cx,g.cy)),a.setLayoutTransform(new kity.Matrix),f.move([a],c,d)})}},getOrderHint:function(a){var b=[],c=a.getLayoutBox(),d=5;return b.push({type:"up",node:a,area:{x:c.x,y:c.top-a.getStyle("margin-top")-d,width:c.width,height:a.getStyle("margin-top")},path:["M",c.x,c.top-d,"L",c.right,c.top-d]}),b.push({type:"down",node:a,area:{x:c.x,y:c.bottom+d,width:c.width,height:a.getStyle("margin-bottom")},path:["M",c.x,c.bottom+d,"L",c.right,c.bottom+d]}),b}})),KityMinder.registerConnectProvider("bezier",function(a,b,c){var d=b.getLayoutVertexOut(),e=a.getLayoutVertexIn(),f=b.getLayoutVectorOut().normalize(),g=Math.round,h=Math.abs,i=[];if(i.push("M",g(d.x),g(d.y)),h(f.x)>h(f.y)){var j=(e.x+d.x)/2;i.push("C",j,d.y,j,e.y,e.x,e.y)}else{var k=(e.y+d.y)/2;i.push("C",d.x,k,e.x,k,e.x,e.y)}c.setMarker(null),c.setPathData(i)}),KityMinder.registerConnectProvider("poly",function(a,b,c,d){var e=b.getLayoutVertexOut(),f=a.getLayoutVertexIn(),g=b.getLayoutVectorOut().normalize(),h=Math.round,i=Math.abs,j=[];switch(j.push("M",h(e.x),h(e.y)),!0){case i(g.x)>i(g.y)&&g.x<0:j.push("h",-b.getStyle("margin-left")),j.push("v",f.y-e.y),j.push("H",f.x);break;case i(g.x)>i(g.y)&&g.x>=0:j.push("h",b.getStyle("margin-right")),j.push("v",f.y-e.y),j.push("H",f.x);break;case i(g.x)<=i(g.y)&&g.y<0:j.push("v",-b.getStyle("margin-top")),j.push("h",f.x-e.x),j.push("V",f.y);break;case i(g.x)<=i(g.y)&&g.y>=0:j.push("v",b.getStyle("margin-bottom")),j.push("h",f.x-e.x),j.push("V",f.y)}c.setMarker(null),c.setPathData(j)});var connectMarker=(new kity.Marker).pipe(function(){var a=7,b=new kity.Circle(a-1);this.addShape(b),this.setRef(a-1,0).setViewBox(-a,-a,a+a,a+a).setWidth(a).setHeight(a),this.dot=b,this.node.setAttribute("markerUnits","userSpaceOnUse")});KityMinder.registerConnectProvider("arc",function(a,b,c,d,e){var f,g,h,i=a.getLayoutBox(),j=b.getLayoutBox(),k=Math.abs,l=[],m=i.x>j.x?"right":"left";a.getMinder().getPaper().addResource(connectMarker),f=new kity.Point(j.cx,j.cy),g="left"==m?new kity.Point(i.right+2,i.cy):new kity.Point(i.left-2,i.cy),h=kity.Vector.fromPoints(f,g),l.push("M",f),l.push("A",k(h.x),k(h.y),0,0,h.x*h.y>0?0:1,g),c.setMarker(connectMarker),connectMarker.dot.fill(e),c.setPathData(l)}),KityMinder.registerConnectProvider("under",function(a,b,c,d,e){var f,g,h,i,j=a.getLayoutBox(),k=b.getLayoutBox(),l=(Math.abs,[]),m=j.x>k.x?"right":"left",n=(a.getStyle("connect-radius"),j.bottom+3),o="sub"==b.getType()?k.bottom+3:k.cy;"right"==m?(f=new kity.Point(k.right,o),g=new kity.Point(j.left-10,n),h=new kity.Point(j.right,n)):(f=new kity.Point(k.left,o),g=new kity.Point(j.right+10,n),h=new kity.Point(j.left,n)),i=(f.x+g.x)/2,l.push("M",f),l.push("C",i,f.y,i,g.y,g),l.push("L",h),c.setMarker(null),c.setPathData(l)}),KityMinder.registerConnectProvider("l",function(a,b,c){var d=b.getLayoutVertexOut(),e=a.getLayoutVertexIn(),f=b.getLayoutVectorOut(),g=[],h=Math.round,i=Math.abs;g.push("M",d.round()),i(f.x)>i(f.y)?g.push("H",h(e.x)):g.push("V",e.y),g.push("L",e),c.setPathData(g)}),KityMinder.registerConnectProvider("fish-bone-master",function(a,b,c){var d=b.getLayoutVertexOut(),e=a.getLayoutVertexIn(),f=Math.abs,g=f(d.y-e.y),h=f(d.x-e.x),i=[];i.push("M",d.x,d.y),i.push("h",h-g),i.push("L",e.x,e.y),c.setMarker(null),c.setPathData(i)});var connectMarker=(new kity.Marker).pipe(function(){var a=7,b=new kity.Circle(a-1);
- this.addShape(b),this.setRef(a-1,0).setViewBox(-a,-a,a+a,a+a).setWidth(a).setHeight(a),this.dot=b,this.node.setAttribute("markerUnits","userSpaceOnUse")});KityMinder.registerConnectProvider("arc_tp",function(a,b,c,d,e){var f=a.getLayoutBox(),g=b.getLayoutBox();if(a.getIndex()>0){var h=a.getIndex();g=b.getChildren()[h-1].getLayoutBox()}var i,j,k,l=(Math.abs,[]);f.x>g.x?"right":"left";a.getMinder().getPaper().addResource(connectMarker),i=new kity.Point(g.cx,g.cy),j=new kity.Point(f.cx,f.cy);var m=Math.sqrt(Math.abs(i.x-j.x)*Math.abs(i.x-j.x)+Math.abs(i.y-j.y)*Math.abs(i.y-j.y));m=0==a.getIndex()?.4*m:m,k=kity.Vector.fromPoints(i,j),l.push("M",i),l.push("A",m,m,0,0,1,j),c.setMarker(connectMarker),connectMarker.dot.fill(e),c.setPathData(l)}),["classic","classic-compact"].forEach(function(a){var b="classic-compact"==a;KityMinder.registerTheme(a,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":b?[10,25]:[15,25],"root-margin":b?[15,25]:[30,100],"root-radius":30,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":b?[5,15]:[6,20],"main-margin":b?[5,10]:20,"main-radius":10,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"white","sub-background":"transparent","sub-stroke":"none","sub-font-size":12,"sub-padding":[5,10],"sub-margin":b?[5,10]:[15,20],"sub-tree-margin":30,"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5})}),["snow","snow-compact"].forEach(function(a){var b="snow-compact"==a;KityMinder.registerTheme(a,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":b?[5,10]:[15,25],"root-margin":b?15:30,"root-radius":5,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":b?[4,10]:[6,20],"main-margin":b?[5,10]:[20,40],"main-radius":5,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"black","sub-background":"white","sub-stroke":"white","sub-font-size":12,"sub-padding":[5,10],"sub-margin":b?[5,10]:[10,20],"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5})}),function(){function a(a,b,c){return kity.Color.createHSL(a,b,c)}function b(b,c){return{background:"#fbfbfb","root-color":"white","root-background":a(b,37,60),"root-stroke":a(b,37,60),"root-font-size":16,"root-padding":c?[6,12]:[12,24],"root-margin":c?10:[30,100],"root-radius":5,"root-space":10,"main-color":"black","main-background":a(b,33,95),"main-stroke":a(b,37,60),"main-stroke-width":1,"main-font-size":14,"main-padding":[6,20],"main-margin":c?8:20,"main-radius":3,"main-space":5,"sub-color":"black","sub-background":"transparent","sub-stroke":"none","sub-font-size":12,"sub-padding":c?[3,5]:[5,10],"sub-margin":c?[4,8]:[15,20],"sub-radius":5,"sub-space":5,"connect-color":a(b,37,60),"connect-width":1,"connect-radius":5,"selected-stroke":a(b,26,30),"selected-stroke-width":"3","marquee-background":a(b,100,80).set("a",.1),"marquee-stroke":a(b,37,60),"drop-hint-color":a(b,26,35),"drop-hint-width":5,"order-hint-area-color":a(b,100,30).set("a",.5),"order-hint-path-color":a(b,100,25),"order-hint-path-width":1,"text-selection-color":a(b,100,20),"line-height":1.5}}var c,d={red:0,soil:25,green:122,blue:204,purple:246,pink:334};for(c in d)KityMinder.registerTheme("fresh-"+c,b(d[c])),KityMinder.registerTheme("fresh-"+c+"-compat",b(d[c],!0))}(),KityMinder.registerTheme("fish",{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":24,"root-padding":[35,35],"root-margin":30,"root-radius":100,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":16,"main-padding":[6,20],"main-margin":[20,20],"main-radius":5,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","sub-color":"black","sub-background":"white","sub-stroke":"white","sub-font-size":12,"sub-padding":[5,10],"sub-margin":[10],"sub-radius":5,"sub-space":5,"connect-color":"white","connect-width":3,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5}),KityMinder.registerTheme("wire",{background:"black",color:"#999",stroke:"none",padding:10,margin:20,"font-size":14,"connect-color":"#999","connect-width":1,"selected-background":"#999","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.5}),["tianpan","tianpan-compact"].forEach(function(a){var b="tianpan-compact"==a;KityMinder.registerTheme(a,{background:"#3A4144 url(ui/theme/default/images/grid.png) repeat","root-color":"#430","root-background":"#e9df98","root-stroke":"#e9df98","root-font-size":25,"root-padding":b?15:20,"root-margin":b?[15,25]:100,"root-radius":30,"root-space":10,"root-shadow":"rgba(0, 0, 0, .25)","root-shape":"circle","main-color":"#333","main-background":"#a4c5c0","main-stroke":"#a4c5c0","main-font-size":15,"main-padding":b?10:12,"main-margin":b?10:12,"main-radius":10,"main-space":5,"main-shadow":"rgba(0, 0, 0, .25)","main-shape":"circle","sub-color":"#333","sub-background":"#99ca6a","sub-stroke":"#a4c5c0","sub-font-size":13,"sub-padding":5,"sub-margin":b?6:10,"sub-tree-margin":30,"sub-radius":5,"sub-space":5,"sub-shadow":"rgba(0, 0, 0, .25)","sub-shape":"circle","connect-color":"white","connect-width":2,"main-connect-width":3,"connect-radius":5,"selected-background":"rgb(254, 219, 0)","selected-stroke":"rgb(254, 219, 0)","selected-color":"black","marquee-background":"rgba(255,255,255,.3)","marquee-stroke":"white","drop-hint-color":"yellow","sub-drop-hint-width":2,"main-drop-hint-width":4,"root-drop-hint-width":4,"order-hint-area-color":"rgba(0, 255, 0, .5)","order-hint-path-color":"#0f0","order-hint-path-width":1,"text-selection-color":"rgb(27,171,255)","line-height":1.4})}),KityMinder.registerTemplate("default",{getLayout:function(a){if(a.getData("layout"))return a.getData("layout");var b=a.getLevel();return 0===b?"mind":1===b?a.getLayoutPointPreview().x>0?"right":"left":a.parent.getLayout()},getConnect:function(a){return 1==a.getLevel()?"arc":"under"}}),KityMinder.registerTemplate("structure",{getLayout:function(a){return a.getData("layout")||"bottom"},getConnect:function(a){return"poly"}}),KityMinder.registerTemplate("filetree",{getLayout:function(a){return a.getData("layout")?a.getData("layout"):a.isRoot()?"bottom":"filetree-down"},getConnect:function(a){return 1==a.getLevel()?"poly":"l"}}),KityMinder.registerTemplate("right",{getLayout:function(a){return a.getData("layout")||"right"},getConnect:function(a){return 1==a.getLevel()?"arc":"bezier"}}),KityMinder.registerTemplate("fish-bone",{getLayout:function(a){if(a.getData("layout"))return a.getData("layout");var b=a.getLevel();return 0===b?"fish-bone-master":1===b?"fish-bone-slave":a.getLayoutPointPreview().y>0?"filetree-up":"filetree-down"},getConnect:function(a){switch(a.getLevel()){case 1:return"fish-bone-master";case 2:return"line";default:return"l"}}}),KityMinder.registerTemplate("tianpan",{getLayout:function(a){if(a.getData("layout"))return a.getData("layout");var b=a.getLevel();return 0===b?"tianpan":a.parent.getLayout()},getConnect:function(a){return"arc_tp"}});var AppendChildCommand=kity.createClass("AppendChildCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNode();if(!c)return null;b=b||a.getLang("topic"),c.expand();var d=a.createNode(b,c);a.select(d,!0),d.render(),a.layout(600)},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),AppendSiblingCommand=kity.createClass("AppendSiblingCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNode(),d=c.parent;if(!d)return a.execCommand("AppendChildNode",b);b=b||a.getLang("topic");var e=a.createNode(b,d,c.getIndex()+1);a.select(e,!0),e.render(),a.layout(600)},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),RemoveNodeCommand=kity.createClass("RemoverNodeCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes(),d=MinderNode.getCommonAncestor.apply(null,c);c.forEach(function(b){b.isRoot()||a.removeNode(b)}),a.select(d||a.getRoot(),!0),a.layout(600)},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),EditNodeCommand=kity.createClass("EditNodeCommand",{base:Command,execute:function(a){var b=a.getSelectedNode();return b?(a.select(b,!0),void a.textEditNode(b)):null},queryState:function(a){var b=a.getSelectedNode();return b?0:-1},isNeedUndo:function(){return!1}}),$importDialog,$exportDialog,ImportTextNode=kity.createClass("ImportTextNode",{base:Command,execute:function(a,b){function c(a){var b;if(a)try{g=d.decode(a,!0)}catch(c){b="文本格式解析错误. "+c.message}else b="内容不能为空";b?(h.addClass("validate-error"),j.text(b),i.disable()):(h.removeClass("validate-error"),j.text(""),i.enable())}if(!$importDialog){var d=a.getProtocol("plain"),e=400;$importDialog=new FUI.Dialog({width:600,height:e,prompt:!0,caption:a.getLang("ui.importtextnode")}).appendTo(document.getElementById("content-wrapper"));var f=$($importDialog.getBodyElement());f.html(['<textarea style="width: 100%; height: '+(e-130)+'px"></textarea>'].join(""));var g,h=f.find("textarea"),i=$importDialog.getButton(0),j=$('<span class="validate-error"></span>');h.after(j),h.on("input",function(){c(h.val())}),h.on("keydown keyup",function(a){if(9===a.keyCode&&"keydown"===a.type){a.preventDefault();var b=this.selectionStart;this.value=this.value.substring(0,this.selectionStart)+" "+this.value.substring(this.selectionEnd),this.selectionEnd=b+1}(13!==a.keyCode||a.shiftKey)&&a.stopPropagation()}),$importDialog.on("open",function(){c(h.val()),setTimeout(function(){h[0].focus()},10)}),$importDialog.on("ok",function(){function b(c,d,e){if(c&&d){var f=a.createNode(d.data.text,c);return d.children&&d.children.forEach(function(a){b(f,a)}),f.render(),f}}var c=[],d=a.getSelectedNode();g&&g.children&&d&&(d.expand(),g.children.forEach(function(a){c.push(b(d,a))})),a.select(c,!0),a.layout(300),h.val(""),c=null,g=null})}$importDialog.open()},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),ExportTextNode=kity.createClass("ExportTextNode",{base:Command,execute:function(a,b){if(!$exportDialog){var c=a.getProtocol("plain"),d=400;$exportDialog=new FUI.Dialog({width:600,height:d,prompt:!0,caption:a.getLang("ui.exporttextnode")}).appendTo(document.getElementById("content-wrapper"));var e=$($exportDialog.getBodyElement());e.html(['<textarea style="width: 100%; height: '+(d-130)+'px"></textarea>'].join(""));var f=e.find("textarea");f.on("keydown keyup",function(a){if(9===a.keyCode&&"keydown"===a.type){a.preventDefault();var b=this.selectionStart;this.value=this.value.substring(0,this.selectionStart)+" "+this.value.substring(this.selectionEnd),this.selectionEnd=b+1}(13!==a.keyCode||a.shiftKey)&&a.stopPropagation()}),$exportDialog.on("open",function(){f.val(c.encode(a.getSelectedNode())),setTimeout(function(){f[0].focus()},10)})}$exportDialog.open()},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}});KityMinder.registerModule("NodeModule",function(){return{commands:{AppendChildNode:AppendChildCommand,AppendSiblingNode:AppendSiblingCommand,ImportTextNode:ImportTextNode,ExportTextNode:ExportTextNode,RemoveNode:RemoveNodeCommand,EditNode:EditNodeCommand},contextmenu:[{command:"appendsiblingnode"},{command:"appendchildnode"},{command:"editnode"},{command:"removenode"},{command:"importtextnode"},{command:"exporttextnode"},{divider:1}],commandShortcutKeys:{appendsiblingnode:"normal::Enter",appendchildnode:"normal::Insert|Tab",editnode:"normal::F2",removenode:"normal::Del|Backspace"}}});var FONT_ADJUST={"微软雅黑,Microsoft YaHei":-.15,"arial black,avant garde":-.17,"default":-.15},TextRenderer=KityMinder.TextRenderer=kity.createClass("TextRenderer",{base:Renderer,create:function(){return(new kity.Group).setId(KityMinder.uuid("node_text"))},update:function(a,b){function c(a){return b.getData(a)||b.getStyle(a)}var d=b.getText(!0),e=b.getStyle("line-height"),f=c("font-size"),g=c("font-family")||"default",h=e*f*d.length-(e-1)*f,i=-h/2,j=FONT_ADJUST[g]||0;a.setTranslate(0,j*f);var k=new kity.Box,l=Math.round;this.setTextStyle(b,a);var m=d.length,n=a.getItems().length;if(n>m)for(var o,p=m;o=a.getItem(p);)a.removeItem(p);else if(m>n)for(var q=m-n,p=0;q>p;p++){var r=(new kity.Text).setAttr("text-rendering","inherit");kity.Browser.ie?r.setVerticalAlign("top"):r.setAttr("dominant-baseline","text-before-edge"),a.addItem(r)}for(var s,r,p=0;s=d[p],r=a.getItem(p);p++)r.setContent(s);this.setTextStyle(b,a);var t=b.getText()+[c("font-size"),c("font-name"),c("font-weight"),c("font-style")].join("/");return b._currentTextHash==t&&b._currentTextGroupBox?b._currentTextGroupBox:(b._currentTextHash=t,function(){a.eachItem(function(a,b){var c=i+a*f*e;b.setY(c),k=k.merge(new kity.Box(0,c,b.getBoundaryBox().width||1,f))});var c=0,d=b.getStyle("shape");d&&"circle"==d&&(c=Math.max(k.width,k.height)/2-k.height/2);var g=new kity.Box(l(k.x),l(k.y-c),l(k.width),l(k.height));return b._currentTextGroupBox=g,g})},setTextStyle:function(a,b){var c=TextRenderer._styleHooks;c.forEach(function(c){c(a,b)})}});utils.extend(TextRenderer,{_styleHooks:[],registerStyleHook:function(a){TextRenderer._styleHooks.push(a)}}),kity.extendClass(MinderNode,{getTextGroup:function(){return this.getRenderer("TextRenderer").getRenderShape()}}),KityMinder.registerModule("text",{renderers:{center:TextRenderer}}),KityMinder.registerModule("Expand",function(){var a=this,b="expandState",c="expand",d="collapse";kity.extendClass(MinderNode,{expand:function(){return this.setData(b,c),this},collapse:function(){return this.setData(b,d),this},isExpanded:function(){var a=this.getData(b)!==d;return a&&(this.isRoot()||this.parent.isExpanded())},isCollapsed:function(){return!this.isExpanded()}});var e=kity.createClass("ExpandCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNode();if(c){for(b&&(c=c.parent);c.parent;)c.expand(),c=c.parent;c.renderTree(),a.layout(100)}},queryState:function(a){return a.getSelectedNode()?0:-1}}),f=kity.createClass("ExpandToLevelCommand",{base:Command,execute:function(a,b){a.getRoot().traverse(function(a){a.getLevel()<b&&a.expand(),a.getLevel()==b&&a.collapse()}),a.refresh(100)},enableReadOnly:!0}),g=kity.createClass("Expander",{base:kity.Group,constructor:function(a){this.callBase(),this.radius=6,this.outline=new kity.Circle(this.radius).stroke("gray").fill("white"),this.sign=(new kity.Path).stroke("gray"),this.addShapes([this.outline,this.sign]),this.initEvent(a),this.setId(KityMinder.uuid("node_expander")),this.setStyle("cursor","pointer")},initEvent:function(a){this.on("mousedown",function(b){a.isExpanded()?a.collapse():a.expand(),a.renderTree().getMinder().layout(100),a.getMinder().fire("contentchange"),b.stopPropagation(),b.preventDefault()}),this.on("dblclick click mouseup",function(a){a.stopPropagation(),a.preventDefault()})},setState:function(a){if("hide"==a)return void this.setVisible(!1);this.setVisible(!0);var b=["M",1.5-this.radius,0,"L",this.radius-1.5,0];a==d&&b.push(["M",0,1.5-this.radius,"L",0,this.radius-1.5]),this.sign.setPathData(b)}}),h=kity.createClass("ExpanderRenderer",{base:Renderer,create:function(a){return a.isRoot()?void 0:(this.expander=new g(a),a.getRenderContainer().prependShape(this.expander),a.expanderRenderer=this,this.node=a,this.expander)},shouldRender:function(a){return!a.isRoot()},update:function(a,c,d){if(c.parent){var e=c.parent.isExpanded();a.setState(e&&c.children.length?c.getData(b):"hide");var f=c.getLayoutVectorIn().normalize(a.radius+c.getStyle("stroke-width")),g=c.getVertexIn().offset(f.reverse());this.expander.setTranslate(g)}}});return{commands:{expand:e,expandtolevel:f},events:{layoutapply:function(a){var b=a.node.getRenderer("ExpanderRenderer");b.getRenderShape()&&b.update(b.getRenderShape(),a.node)},beforerender:function(a){var b=a.node,c=!b.parent||b.parent.isExpanded();b.getRenderContainer().setVisible(c),c||a.stopPropagation()},"normal.keydown":function(a){if("textedit"!=this.getStatus()){if(a.originEvent.keyCode==keymap["/"]){var b=this.getSelectedNode();if(!b||b==this.getRoot())return;var c=b.isExpanded();this.getSelectedNodes().forEach(function(a){c?a.collapse():a.expand(),a.renderTree()}),this.layout(100),this.fire("contentchange"),a.preventDefault(),a.stopPropagationImmediately()}a.isShortcutKey("Alt+`")&&this.execCommand("expandtolevel",9999);for(var d=1;6>d;d++)a.isShortcutKey("Alt+"+d)&&this.execCommand("expandtolevel",d)}}},renderers:{outside:h},contextmenu:[{command:"expandtoleaf",query:function(){return!a.getSelectedNode()},fn:function(a){a.execCommand("expandtolevel",9999)}},{command:"expandtolevel1",query:function(){return!a.getSelectedNode()},fn:function(a){a.execCommand("expandtolevel",1)}},{command:"expandtolevel2",query:function(){return!a.getSelectedNode()},fn:function(a){a.execCommand("expandtolevel",2)}},{command:"expandtolevel3",query:function(){return!a.getSelectedNode()},fn:function(a){a.execCommand("expandtolevel",3)}},{divider:!0}]}});var OutlineRenderer=kity.createClass("OutlineRenderer",{base:Renderer,create:function(a){var b=(new kity.Rect).setId(KityMinder.uuid("node_outline"));return this.bringToBack=!0,b},update:function(a,b,c){var d=b.getStyle("shape");if(d&&"circle"==d)return updateCircle(a,b,c);var e=b.getStyle("padding-left"),f=b.getStyle("padding-right"),g=b.getStyle("padding-top"),h=b.getStyle("padding-bottom"),i={x:c.x-e,y:c.y-g,width:c.width+e+f,height:c.height+g+h},j=b.isSelected()?"selected-":"";return a.setPosition(i.x,i.y).setSize(i.width,i.height).setRadius(b.getStyle("radius")).fill(b.getData("background")||b.getStyle(j+"background")||b.getStyle("background")).stroke(b.getStyle(j+"stroke"||b.getStyle("stroke")),b.getStyle(j+"stroke-width")),new kity.Box(i)}}),ShadowRenderer=kity.createClass("ShadowRenderer",{base:Renderer,create:function(a){return this.bringToBack=!0,new kity.Rect},shouldRender:function(a){return a.getStyle("shadow")},update:function(a,b,c){a.setPosition(c.x+4,c.y+5).fill(b.getStyle("shadow"));var d=b.getStyle("shape");if(d){if("circle"==d){var e=Math.max(c.width,c.height);a.setSize(e,e),a.setRadius(e/2)}}else a.setSize(c.width,c.height),a.setRadius(b.getStyle("radius"))}}),marker=new kity.Marker;marker.setWidth(10),marker.setHeight(12),marker.setRef(0,0),marker.setViewBox(-6,-4,8,10),marker.addShape((new kity.Path).setPathData("M-5-3l5,3,-5,3").stroke("#33ffff"));var wireframeOption=/wire/.test(window.location.href),WireframeRenderer=kity.createClass("WireframeRenderer",{base:Renderer,create:function(){var a=new kity.Group,b=this.oxy=(new kity.Path).stroke("#f6f").setPathData("M0,-50L0,50M-50,0L50,0"),c=this.wireframe=(new kity.Rect).stroke("lightgreen"),d=this.vectorIn=(new kity.Path).stroke("#66ffff"),e=this.vectorOut=(new kity.Path).stroke("#66ffff");return d.setMarker(marker,"end"),e.setMarker(marker,"end"),a.addShapes([b,c,d,e])},shouldRender:function(){return wireframeOption},update:function(a,b,c){this.wireframe.setPosition(c.x,c.y).setSize(c.width,c.height);var d=b.getVertexIn(),e=b.getVertexOut(),f=b.getLayoutVectorIn().normalize(30),g=b.getLayoutVectorOut().normalize(30);this.vectorIn.setPathData(["M",d.offset(f.reverse()),"L",d]),this.vectorOut.setPathData(["M",e,"l",g])}});KityMinder.registerModule("OutlineModule",function(){return{events:wireframeOption?{ready:function(){this.getPaper().addResource(marker)},layoutallfinish:function(){this.getRoot().traverse(function(a){a.getRenderer("WireframeRenderer").update(null,a,a.getContentBox())})}}:null,renderers:{outline:OutlineRenderer,outside:[ShadowRenderer,WireframeRenderer]}}}),KityMinder.Geometry=function(){function a(a){return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a.cx=a.x+a.width/2,a.cy=a.y+a.height/2,a}function b(a){"x"in a&&(a.left=a.x,a.right=a.x+a.width,a.top=a.y,a.bottom=a.y+a.height)}var c={},d=Math.min,e=Math.max,f=(Math.abs,Object.prototype.hasOwnProperty);return c.isNumberInRange=function(a,b){return a>b[0]&&a<b[1]},c.getDistance=function(a,b){return kity.Vector.fromPoints(a,b).length()},c.wrapBox=a,c.getBox=function(b,c){return a({left:d(b.x,c.x),right:e(b.x,c.x),top:d(b.y,c.y),bottom:e(b.y,c.y)})},c.mergeBox=function(c,f){return b(c),b(f),a({left:d(c.left,f.left),right:e(c.right,f.right),top:d(c.top,f.top),bottom:e(c.bottom,f.bottom)})},c.getBoxRange=function(a){return{x:[a.left,a.right],y:[a.top,a.bottom]}},c.getBoxVertex=function(a){return{leftTop:{x:a.left,y:a.top},rightTop:{x:a.right,y:a.top},leftBottom:{x:a.left,y:a.bottom},rightBottom:{x:a.right,y:a.bottom}}},c.isPointInsideBox=function(a,d){b(d);var e=c.getBoxRange(d);return c.isNumberInRange(a.x,e.x)&&c.isNumberInRange(a.y,e.y)},c.getIntersectBox=function(c,f){b(c),b(f);var g=e(c.left,f.left),h=e(c.top,f.top),i=d(c.right,f.right),j=d(c.bottom,f.bottom);return i>g&&j>h?a({left:g,right:i,top:h,bottom:j}):null},c.snapToSharp=function(a){return utils.isNumber(a)?(0|a)+.5:utils.isArray(a)?a.map(c.snapToSharp):(["x","y","left","top","right","bottom"].forEach(function(b){f.call(a,b)&&(a[b]=c.snapToSharp(a[b]))}),a)},c.expandBox=function(b,c,d){return void 0===d&&(d=c),a({left:b.left-c,top:b.top-d,right:b.right+c,bottom:b.bottom+d})},c}(),KityMinder.registerModule("HistoryModule",function(){var a=this,b=kity.createClass("Scene",{constructor:function(a,b){this.data=a.clone(),this.inputStatus=b},getData:function(){return this.data},cloneData:function(){return this.getData().clone()},equals:function(a){return this.getData().equals(a.getData())},isInputStatus:function(){return this.inputStatus},setInputStatus:function(a){this.inputStatus=a}}),c=kity.createClass("HistoryManager",{constructor:function(a){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1,this.km=a},undo:function(){if(this.hasUndo){var a=this.list[this.index];if(a&&a.isInputStatus())return this.saveScene(),this.restore(--this.index),void a.setInputStatus(!1);if(1==this.list.length)return void this.restore(0);if(!this.list[this.index-1]&&1==this.list.length)return void this.reset();for(;this.list[this.index].equals(this.list[this.index-1]);)if(this.index--,0===this.index)return this.restore(0);this.restore(--this.index)}},redo:function(){if(this.hasRedo){for(;this.list[this.index].equals(this.list[this.index+1]);)if(this.index++,this.index==this.list.length-1)return this.restore(this.index);this.restore(++this.index)}},partialRenewal:function(b){function c(a,b){return a.getText()!=b.getText()?!1:utils.compareObject(a.getData(),b.getData())===!1?!1:utils.compareObject(a.getTmpData(),b.getTmpData())===!1?!1:!0}function d(b,c){c.isSelected()&&f.push(c),a.appendNode(c,b),c.render();for(var e,g=utils.cloneArr(c.children),h=0;e=g[h++];)d(c,e)}function e(b,g){c(b,g)===!1&&b.setValue(g),b.render(),b.isSelected()&&f.push(b);for(var h,i,j=0,k=0;h=b.children[j],i=g.children[k],h||i;j++,k++)h&&!i?(j--,a.removeNode(h)):!h&&i?(k--,d(b,i)):e(h,i)}var f=[];e(a.getRoot(),b),a.layout(200),a.select(f,!0),f=[]},restore:function(a){a=void 0===a?this.index:a;var b=this.list[a];this.partialRenewal(b.cloneData()),this.update(),this.km.fire("restoreScene"),this.km.fire("contentChange")},getScene:function(a){return new b(this.km.getRoot(),a)},saveScene:function(a){var b=this.getScene(a),c=this.list[this.index];return c&&c.equals(b)?void(a&&(c.setInputStatus(!0),this.update())):(this.list=this.list.slice(0,this.index+1),this.list.push(b),this.list.length>this.km.getOptions("maxUndoCount")&&this.list.shift(),this.index=this.list.length-1,void this.update())},update:function(){this.hasRedo=!!this.list[this.index+1],this.hasUndo=!!this.list[this.index-1];var a=this.list[this.index];a&&a.isInputStatus()&&(this.hasUndo=!0)},reset:function(){this.list=[],this.index=0,this.hasUndo=!1,this.hasRedo=!1}});return this.historyManager=new c(this),{defaultOptions:{maxUndoCount:20,maxInputCount:20},commands:{undo:kity.createClass("UndoCommand",{base:Command,execute:function(a){a.historyManager.undo()},queryState:function(a){return a.historyManager.hasUndo?0:-1},isNeedUndo:function(){return!1}}),redo:kity.createClass("RedoCommand",{base:Command,execute:function(a){a.historyManager.redo()},queryState:function(a){return a.historyManager.hasRedo?0:-1},isNeedUndo:function(){return!1}})},commandShortcutKeys:{undo:"ctrl+z",redo:"ctrl+y"},events:{saveScene:function(a){this.historyManager.saveScene(a.inputStatus)},"import":function(){this.historyManager.reset()}}}}),KityMinder.registerModule("ProgressModule",function(){var a=this,b="progress",c="#FFED83",d="#43BC00",e="M10,3c4.418,0,8,3.582,8,8h1c0-5.523-3.477-10-9-10S1,5.477,1,11h1C2,6.582,5.582,3,10,3z",f="#8E8E8E",g="M10,0C4.477,0,0,4.477,0,10c0,5.523,4.477,10,10,10s10-4.477,10-10C20,4.477,15.523,0,10,0zM10,18c-4.418,0-8-3.582-8-8s3.582-8,8-8s8,3.582,8,8S14.418,18,10,18z",h=(new kity.LinearGradient).pipe(function(a){a.setStartPosition(0,0),a.setEndPosition(0,1),a.addStop(0,"#fff"),a.addStop(1,"#ccc")}),i="M15.812,7.896l-6.75,6.75l-4.5-4.5L6.25,8.459l2.812,2.803l5.062-5.053L15.812,7.896z",j="#EEE";a.getPaper().addResource(h);var k=kity.createClass("ProgressIcon",{base:kity.Group,constructor:function(a){this.callBase(),this.setSize(20),this.create(),this.setValue(a),this.setId(KityMinder.uuid("node_progress")),this.translate(.5,.5)},setSize:function(a){this.width=this.height=a},create:function(){var a,b,k,l,m;a=new kity.Circle(9).fill(c),b=new kity.Pie(9,0).fill(d),k=(new kity.Path).setPathData(e).setTranslate(-10,-10).fill(f),l=(new kity.Path).setTranslate(-10,-10).setPathData(g).fill(h),m=(new kity.Path).setTranslate(-10,-10).setPathData(i).fill(j),this.addShapes([a,b,k,m,l]),this.pie=b,this.check=m},setValue:function(a){this.pie.setAngle(-360*(a-1)/8),this.check.setVisible(9==a)}}),l=kity.createClass("ProgressCommand",{base:Command,execute:function(a,c){for(var d=a.getSelectedNodes(),e=0;e<d.length;e++)d[e].setData(b,c||null).render();a.layout()},queryValue:function(a){for(var c,d=a.getSelectedNodes(),e=0;e<d.length&&!(c=d[e].getData(b));e++);return c||null},queryState:function(a){return a.getSelectedNodes().length?0:-1}});return{commands:{progress:l},renderers:{left:kity.createClass("ProgressRenderer",{base:KityMinder.Renderer,create:function(a){return new k},shouldRender:function(a){return a.getData(b)},update:function(a,c,d){var e,f,g=c.getData(b),h=c.getStyle("space-left");return a.setValue(g),e=d.left-a.width-h,f=-a.height/2,a.setTranslate(e+a.width/2,f+a.height/2),new kity.Box(e,f,a.width,a.height)}})}}}),KityMinder.registerModule("PriorityModule",function(){var a=[null,["#FF1200","#840023"],["#0074FF","#01467F"],["#00AF00","#006300"],["#FF962E","#B25000"],["#A464FF","#4720C4"],["#A3A3A3","#515151"],["#A3A3A3","#515151"],["#A3A3A3","#515151"],["#A3A3A3","#515151"]],b="M0,13c0,3.866,3.134,7,7,7h6c3.866,0,7-3.134,7-7V7H0V13z",c="M20,10c0,3.866-3.134,7-7,7H7c-3.866,0-7-3.134-7-7V7c0-3.866,3.134-7,7-7h6c3.866,0,7,3.134,7,7V10z",d="priority",e=kity.createClass("PriorityIcon",{base:kity.Group,constructor:function(){this.callBase(),this.setSize(20),this.create(),this.setId(KityMinder.uuid("node_priority"))},setSize:function(a){this.width=this.height=a},create:function(){var a,d,e,f;a=(new kity.Path).setPathData(c).fill("white"),d=(new kity.Path).setPathData(b).setTranslate(.5,.5),e=(new kity.Path).setPathData(c).setOpacity(.8).setTranslate(.5,.5),f=(new kity.Text).setX(this.width/2-.5).setY(this.height/2-1.5).setTextAnchor("middle").setVerticalAlign("middle").setFontItalic(!0).setFontSize(14).fill("white"),this.addShapes([d,e,f]),this.mask=e,this.back=d,this.number=f},setValue:function(b){var c=this.back,d=this.mask,e=this.number,f=a[b];f&&(c.fill(f[1]),d.fill(f[0])),e.setContent(b)}}),f=kity.createClass("SetPriorityCommand",{base:Command,execute:function(a,b){for(var c=a.getSelectedNodes(),e=0;e<c.length;e++)c[e].setData(d,b||null).render();a.layout()},queryValue:function(a){for(var b,c=a.getSelectedNodes(),e=0;e<c.length&&!(b=c[e].getData(d));e++);return b||null},queryState:function(a){return a.getSelectedNodes().length?0:-1}});return{commands:{priority:f},renderers:{left:kity.createClass("PriorityRenderer",{base:KityMinder.Renderer,create:function(a){return new e},shouldRender:function(a){return a.getData(d)},update:function(a,b,c){var e,f,g=b.getData(d),h=b.getStyle("space-left");return a.setValue(g),e=c.left-a.width-h,f=-a.height/2,a.setTranslate(e,f),new kity.Box({x:e,y:f,width:a.width,height:a.height})}})}}}),KityMinder.registerModule("image",function(){function a(a,b){var c=document.createElement("img");c.onload=function(){b(c.width,c.height)},c.onerror=function(){b(null)},c.src=a}function b(a,b,c,d){var e=a/b,f=c/d;return a>c&&e>f?(a=c,b=a/e):b>d&&(b=d,a=b*e),{width:0|a,height:0|b}}var c=kity.createClass("ImageCommand",{base:Command,execute:function(c,d,e){var f=c.getSelectedNodes();a(d,function(a,g){a&&(utils.each(f,function(f,h){var i=b(a,g,c.getOptions("maxImageWidth"),c.getOptions("maxImageHeight"));h.setData("image",d),h.setData("imageTitle",e),h.setData("imageSize",i),h.render()}),c.fire("saveScene"),c.layout(300))})},queryState:function(a){var b=a.getSelectedNodes(),c=0;return 0===b.length?-1:(utils.each(b,function(a,b){return b&&b.getData("image")?(c=0,!1):void 0}),c)},queryValue:function(a){var b=a.getSelectedNode();return{url:b.getData("image"),title:b.getData("imageTitle")}}}),d=kity.createClass("RemoveImageCommand",{base:Command,execute:function(a){var b=a.getSelectedNodes();utils.each(b,function(a,b){b.setData("image").render()}),a.layout(300)},queryState:function(a){var b=a.getSelectedNodes();if(0===b.length)return-1;var c=!1;return utils.each(b,function(a,b){return b.getData("image")?(c=!0,!1):void 0}),c?0:-1}}),e=kity.createClass("ImageRenderer",{base:KityMinder.Renderer,create:function(a){return new kity.Image(a.getData("image"))},shouldRender:function(a){return a.getData("image")},update:function(a,b,c){var d=b.getData("image"),e=b.getData("imageTitle"),f=b.getData("imageSize"),g=b.getStyle("space-top");if(f){e&&a.node.setAttributeNS("http://www.w3.org/1999/xlink","title",e);var h=c.cx-f.width/2,i=c.y-f.height-g;return a.setUrl(d).setX(0|h).setY(0|i).setWidth(0|f.width).setHeight(0|f.height),new kity.Box(0|h,0|i,0|f.width,0|f.height)}}});return{defaultOptions:{maxImageWidth:200,maxImageHeight:200},commands:{image:c,removeimage:d},renderers:{top:e}}}),KityMinder.registerModule("Resource",function(){
- var a=function(){var a,b,c,d,e,f,g,h,i,j,k;return k=4*(1<<30),a=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479],j=function(a){return 0>a&&(a+=k),("00000000"+a.toString(16)).slice(-8)},f=[[16,50,84,118,152,186,220,254],[174,132,249,109,193,32,123,53],[139,12,37,223,234,99,23,73],[151,19,205,235,98,165,4,143],[9,117,66,250,30,203,134,211],[194,166,176,56,212,87,239,145],[92,241,222,164,112,54,41,184],[189,231,28,147,5,79,104,162],[246,158,59,128,44,125,65,90],[42,72,103,81,191,233,195,13]],g=function(a,b,c){var d=h[a]^h[b];h[a]=d>>>c|d<<32-c},b=function(a,b,j,k,l){var m=d+f[c][a]%16,n=d+(f[c][a]>>4);b%=4,j=4+j%4,k=8+k%4,l=12+l%4,h[b]+=h[j]+(i[m]^e[n%16]),g(l,b,16),h[k]+=h[l],g(j,k,12),h[b]+=h[j]+(i[n]^e[m%16]),g(l,b,8),h[k]+=h[l],g(j,k,7)},function(f,g){g instanceof Array&&4===g.length||(g=[0,0,0,0]);var k,l,m,n,o,p,q,r;for(l=a.slice(0),k=e.slice(0,8),c=0;4>c;c+=1)k[c]^=g[c];if(m=16*f.length,o=m%512>446||m%512===0?0:m,m%512===432)f+="老";else{for(f+="耀";f.length%32!==27;)f+="\x00";f+=""}for(i=[],r=0;r<f.length;r+=2)i.push(65536*f.charCodeAt(r)+f.charCodeAt(r+1));for(i.push(0),i.push(m),p=i.length-16,q=0,d=0;d<i.length;d+=16){for(q+=512,n=d===p?o:Math.min(m,q),h=l.concat(k),h[12]^=n,h[13]^=n,c=0;10>c;c+=1)for(r=0;8>r;r+=1)4>r?b(r,r,r,r,r):b(r,r,r+1,r+2,r+3);for(r=0;8>r;r+=1)l[r]^=g[r%4]^h[r]^h[r+8]}return l.map(j).join("")}}(),b=[51,303,75,200,157,0,26,254].map(function(a){return kity.Color.createHSL(a,100,85)});kity.extendClass(Minder,{getHashCode:function(b){b=a(b);var c,d,e=1315423911;for(c=b.length-1;c>=0;c--)d=b.charCodeAt(c),e^=(e<<5)+d+(e>>2);return 2147483647&e},getResourceColor:function(a){var c,d=this._getResourceColorIndexMapping();return d.hasOwnProperty(a)||(c=this._getNextResourceColorIndex(),d[a]=c),b[d[a]]||kity.Color.createHSL(Math.floor(this.getHashCode(a)/2147483647*359),100,85)},getUsedResource:function(){var a,b=this._getResourceColorIndexMapping(),c=[];for(a in b)b.hasOwnProperty(a)&&c.push(a);return c},_getNextResourceColorIndex:function(){var a,c,d,e=this._getResourceColorIndexMapping();c=[];for(a in e)e.hasOwnProperty(a)&&c.push(e[a]);for(d=0;d<b.length;d++)if(!~c.indexOf(d))return d;return-1},_getResourceColorIndexMapping:function(){return this._resourceColorMapping||(this._resourceColorMapping={})}});var c=kity.createClass("ResourceCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();"string"==typeof b&&(b=[b]),c.forEach(function(a){a.setData("resource",b).render()}),a.layout(200)},queryValue:function(a){var b=a.getSelectedNodes(),c=[];return b.forEach(function(a){var b=a.getData("resource");b&&b.forEach(function(a){~c.indexOf(a)||c.push(a)})}),c},queryState:function(a){return a.getSelectedNode()?0:-1}}),d=kity.createClass("ResourceOverlay",{base:kity.Group,constructor:function(){this.callBase();var a,b;b=this.rect=(new kity.Rect).setRadius(4),a=this.text=(new kity.Text).setFontSize(12).setVerticalAlign("middle"),this.addShapes([b,a])},setValue:function(a,b){var c,d,e,f=8,g=4;c=this.text,a==this.lastResourceName?d=this.lastBox:(c.setContent(a),d=c.getBoundaryBox(),this.lastResourceName=a,this.lastBox=d),c.setX(f).fill(b.dec("l",70)),e=this.rect,e.setPosition(0,d.y-g),this.width=Math.round(d.width+2*f),this.height=Math.round(d.height+2*g),e.setSize(this.width,this.height),e.fill(b)}}),e=kity.createClass("ResourceRenderer",{base:KityMinder.Renderer,create:function(a){return this.overlays=[],new kity.Group},shouldRender:function(a){return a.getData("resource")&&a.getData("resource").length},update:function(a,b,c){var e,f,g,h=b.getStyle("space-right"),i=this.overlays,j=b.getData("resource"),k=b.getMinder();for(g=0,e=0;e<j.length;e++)g+=h,f=i[e],f||(f=new d,i.push(f),a.addShape(f)),f.setVisible(!0),f.setValue(j[e],k.getResourceColor(j[e])),f.setTranslate(g,-1),g+=f.width;for(;f=i[e++];)f.setVisible(!1);return a.setTranslate(c.right,0),new kity.Box({x:c.right,y:Math.round(-i[0].height/2),width:g,height:i[0].height})}});return{commands:{resource:c},renderers:{right:e}}}),KityMinder.registerModule("NoteModule",function(){var a="M9,9H3V8h6L9,9L9,9z M9,7H3V6h6V7z M9,5H3V4h6V5z M8.5,11H2V2h8v7.5 M9,12l2-2V1H1v11",b=kity.createClass("NoteCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNode();c.setData("note",b),c.render(),c.getMinder().layout(300)},queryState:function(a){return 1===a.getSelectedNodes().length?0:-1},queryValue:function(a){var b=a.getSelectedNode();return b&&b.getData("note")}}),c=kity.createClass("NoteIcon",{base:kity.Group,constructor:function(){this.callBase(),this.width=16,this.height=17,this.rect=new kity.Rect(16,17,.5,-8.5,2).fill("transparent"),this.path=(new kity.Path).setPathData(a).setTranslate(2.5,-6.5),this.addShapes([this.rect,this.path]),this.on("mouseover",function(){this.rect.fill("rgba(255, 255, 200, .8)")}).on("mouseout",function(){this.rect.fill("transparent")}),this.setStyle("cursor","pointer")}}),d=kity.createClass("NoteIconRenderer",{base:KityMinder.Renderer,create:function(a){var b=new c;return b.on("mousedown",function(b){b.preventDefault(),a.getMinder().fire("editnoterequest")}),b.on("mouseover",function(){a.getMinder().fire("shownoterequest",{node:a,icon:b})}),b.on("mouseout",function(){a.getMinder().fire("hidenoterequest",{node:a,icon:b})}),b},shouldRender:function(a){return a.getData("note")},update:function(a,b,c){var d=c.right+b.getStyle("space-left"),e=c.cy;return a.path.fill(b.getStyle("color")),a.setTranslate(d,e),new kity.Box(d,Math.round(e-a.height/2),a.width,a.height)}});return{renderers:{right:d},commands:{note:b}}});var ViewDragger=kity.createClass("ViewDragger",{constructor:function(a){this._minder=a,this._enabled=!1,this._bind();var b=this;this._minder.getViewDragger=function(){return b}},isEnabled:function(){return this._enabled},setEnabled:function(a){var b=this._minder.getPaper();b.setStyle("cursor",a?"pointer":"default"),b.setStyle("cursor",a?"-webkit-grab":"default"),this._enabled=a},move:function(a,b){var c=(this._minder,this.getMovement().offset(a));this.moveTo(c,b)},moveTo:function(a,b){if(b){var c=this;return this._moveTimeline&&this._moveTimeline.stop(),this._moveTimeline=this._minder.getRenderContainer().animate(new kity.Animator(this.getMovement(),a,function(a,b){c.moveTo(b)}),b,"easeOutCubic"),this._moveTimeline.on("finish",function(){c._moveTimeline=null}),this}this._minder.getRenderContainer().setTranslate(a.round()),this._minder.fire("viewchange")},getMovement:function(){var a=this._minder.getRenderContainer().transform.translate;return a?a[0]:new kity.Point},getView:function(){var a=this._minder,b={width:a.getRenderTarget().clientWidth,height:a.getRenderTarget().clientHeight},c=this.getMovement(),d=new kity.Box(0,0,b.width,b.height),e=a.getPaper().getViewPortMatrix();return e.inverse().translate(-c.x,-c.y).transformBox(d)},_bind:function(){function a(a){if(d){d=null,a.stopPropagation(),c&&(b.setEnabled(!1),c=!1,"hand"==b._minder.getStatus()&&b._minder.rollbackStatus());var e=b._minder.getPaper();e.setStyle("cursor","hand"==b._minder.getStatus()?"-webkit-grab":"default")}}var b=this,c=!1,d=null,e=null;this._minder.on("normal.mousedown normal.touchstart inputready.mousedown inputready.touchstart readonly.mousedown readonly.touchstart",function(a){2==a.originEvent.button&&a.originEvent.preventDefault(),(a.getTargetNode()==this.getRoot()||2==a.originEvent.button||a.originEvent.altKey)&&(d=a.getPosition(),c=!0)}).on("normal.mousemove normal.touchmove readonly.mousemove readonly.touchmove inputready.mousemove inputready.touchmove",function(a){if("touchmove"==a.type&&a.preventDefault(),c){var e=kity.Vector.fromPoints(d,a.getPosition());if(e.length()>10){this.setStatus("hand",!0);var f=b._minder.getPaper();f.setStyle("cursor","-webkit-grabbing")}}}).on("hand.beforemousedown hand.beforetouchstart",function(a){if(b.isEnabled()){d=a.getPosition(),a.stopPropagation();var c=b._minder.getPaper();c.setStyle("cursor","-webkit-grabbing")}}).on("hand.beforemousemove hand.beforetouchmove",function(a){if(d){e=a.getPosition();var c=kity.Vector.fromPoints(d,e);b.move(c),a.stopPropagation(),a.preventDefault(),a.originEvent.preventDefault(),d=e}}).on("mouseup touchend",a),window.addEventListener("mouseup",a),this._minder.on("contextmenu",function(a){a.preventDefault()})}});KityMinder.registerModule("View",function(){var a=kity.createClass("ToggleHandCommand",{base:Command,execute:function(a){"hand"!=a.getStatus()?a.setStatus("hand",!0):a.rollbackStatus(),this.setContentChanged(!1)},queryState:function(a){return"hand"==a.getStatus()?1:0},enableReadOnly:!0}),b=kity.createClass("CameraCommand",{base:Command,execute:function(a,b,c){b=b||a.getRoot();var d=a.getPaper().getViewPort(),e=b.getRenderContainer().getRenderBox("view"),f=d.center.x-e.x-e.width/2,g=d.center.y-e.y,h=a._viewDragger;h.move(new kity.Point(f,g),c),this.setContentChanged(!1)},enableReadOnly:!0}),c=kity.createClass("MoveCommand",{base:Command,execute:function(a,b,c){var d=a._viewDragger,e=a._lastClientSize;switch(b){case"up":d.move(new kity.Point(0,e.height/2),c);break;case"down":d.move(new kity.Point(0,-e.height/2),c);break;case"left":d.move(new kity.Point(e.width/2,0),c);break;case"right":d.move(new kity.Point(-e.width/2,0),c)}},enableReadOnly:!0});return{init:function(){this._viewDragger=new ViewDragger(this)},commands:{hand:a,camera:b,move:c},events:{keydown:function(a){var b=this;["up","down","left","right"].forEach(function(c){a.isShortcutKey("ctrl+"+c)&&"textedit"!=b.getStatus()&&(b.removeAllSelectedNodes(),b.execCommand("move",c,100),a.preventDefault())}),a.isShortcutKey("ctrl+enter")&&b.execCommand("camera",b.getRoot(),100)},statuschange:function(a){this._viewDragger.setEnabled("hand"==a.currentStatus)},mousewheel:function(a){var b,c;a=a.originEvent,a.ctrlKey||a.shiftKey||("wheelDeltaX"in a?(b=a.wheelDeltaX||0,c=a.wheelDeltaY||0):(b=0,c=a.wheelDelta),this._viewDragger.move({x:b/2.5,y:c/2.5}),a.preventDefault())},"normal.dblclick readonly.dblclick":function(a){a.kityEvent.targetShape instanceof kity.Paper&&this.execCommand("camera",this.getRoot(),800)},ready:function(){this.execCommand("camera",null,0),this._lastClientSize={width:this.getRenderTarget().clientWidth,height:this.getRenderTarget().clientHeight}},resize:function(a){var b={width:this.getRenderTarget().clientWidth,height:this.getRenderTarget().clientHeight},c=this._lastClientSize;this._viewDragger.move(new kity.Point((b.width-c.width)/2|0,(b.height-c.height)/2|0)),this._lastClientSize=b},"selectionchange layoutallfinish":function(a){var b=this.getSelectedNode();if(b){var c=this._viewDragger,d=c.getView(),e=b.getLayoutBox(),f=50,g=0,h=0;e.right>d.right?g+=d.right-e.right-f:e.left<d.left&&(g+=d.left-e.left+f),e.bottom>d.bottom&&(h+=d.bottom-e.bottom-f),e.top<d.top&&(h+=d.top-e.top+f),(g||h)&&c.move(new kity.Point(g,h),100)}}}}});var GM=KityMinder.Geometry,MoveToParentCommand=kity.createClass("MoveToParentCommand",{base:Command,execute:function(a,b,c){for(var d,e=b.length-1;e>=0;e--)d=b[e],d.parent&&(d.parent.removeChild(d),c.appendChild(d),d.render());c.expand(),a.select(b,!0)}}),DropHinter=kity.createClass("DropHinter",{base:kity.Group,constructor:function(){this.callBase(),this.rect=new kity.Rect,this.addShape(this.rect)},render:function(a){this.setVisible(!!a),a&&(this.rect.setBox(a.getLayoutBox()).setRadius(a.getStyle("radius")||0).stroke(a.getStyle("drop-hint-color")||"yellow",a.getStyle("drop-hint-width")||2),this.bringTop())}}),OrderHinter=kity.createClass("OrderHinter",{base:kity.Group,constructor:function(){this.callBase(),this.area=new kity.Rect,this.path=new kity.Path,this.addShapes([this.area,this.path])},render:function(a){this.setVisible(!!a),a&&(this.area.setBox(a.area),this.area.fill(a.node.getStyle("order-hint-area-color")||"rgba(0, 255, 0, .5)"),this.path.setPathData(a.path),this.path.stroke(a.node.getStyle("order-hint-path-color")||"#0f0",a.node.getStyle("order-hint-path-width")||1))}}),TreeDragger=kity.createClass("TreeDragger",{constructor:function(a){this._minder=a,this._dropHinter=new DropHinter,this._orderHinter=new OrderHinter,a.getRenderContainer().addShapes([this._dropHinter,this._orderHinter])},dragStart:function(a){this._startPosition=a},dragMove:function(a){var b=10;if(this._startPosition){var c=kity.Vector.fromPoints(this._dragPosition||this._startPosition,a),d=this._minder;if(this._dragPosition=a,!this._dragMode){if(GM.getDistance(this._dragPosition,this._startPosition)<b)return;if(!this._enterDragMode())return}for(var e=0;e<this._dragSources.length;e++)this._dragSources[e].setLayoutOffset(this._dragSources[e].getLayoutOffset().offset(c)),d.applyLayoutResult(this._dragSources[e]);this._dropTest()?this._renderOrderHint(this._orderSucceedHint=null):this._orderTest()}},dragEnd:function(){if(this._startPosition=null,this._dragPosition=null,this._dragMode){if(this._fadeDragSources(1),this._dropSucceedTarget)this._dragSources.forEach(function(a){a.setLayoutOffset(null)}),this._minder.layout(-1),this._minder.execCommand("movetoparent",this._dragSources,this._dropSucceedTarget);else if(this._orderSucceedHint){var a=this._orderSucceedHint,b=a.node.getIndex(),c=this._dragSources.map(function(a){return a.setLayoutOffset(null),a.getIndex()}),d=Math.max.apply(Math,c),e=Math.min.apply(Math,c);e>b&&"down"==a.type&&b++,b>d&&"up"==a.type&&b--,a.node.setLayoutOffset(null),this._minder.execCommand("arrange",this._dragSources,b),this._renderOrderHint(null)}else this._minder.fire("savescene");this._minder.layout(300),this._leaveDragMode(),this._minder.fire("contentchange")}},_enterDragMode:function(){return this._calcDragSources(),this._dragSources.length?(this._fadeDragSources(.5),this._calcDropTargets(),this._calcOrderHints(),this._dragMode=!0,this._minder.setStatus("dragtree"),!0):(this._startPosition=null,!1)},_calcDragSources:function(){this._dragSources=this._minder.getSelectedAncestors()},_fadeDragSources:function(a){var b=this._minder;this._dragSources.forEach(function(c){c.getRenderContainer().setOpacity(a,200),c.traverse(function(c){1>a?b.detachNode(c):b.attachNode(c)},!0)})},_calcDropTargets:function(){function a(b,c){var d,e=[];return e.push(c),c.getChildren().forEach(function(c){for(d=0;d<b.length;d++)if(b[d]==c)return;e=e.concat(a(b,c))}),e}this._dropTargets=a(this._dragSources,this._minder.getRoot()),this._dropTargetBoxes=this._dropTargets.map(function(a){return a.getLayoutBox()})},_calcOrderHints:function(){var a=this._dragSources,b=MinderNode.getCommonAncestor(a);if(b==a[0]&&(b=a[0].parent),0===a.length||b!=a[0].parent)return void(this._orderHints=[]);var c=b.children;this._orderHints=c.reduce(function(b,c){return-1==a.indexOf(c)&&(b=b.concat(c.getOrderHint())),b},[])},_leaveDragMode:function(){this._dragMode=!1,this._dropSucceedTarget=null,this._orderSucceedHint=null,this._renderDropHint(null),this._renderOrderHint(null),this._minder.rollbackStatus()},_drawForDragMode:function(){this._text.setContent(this._dragSources.length+" items"),this._text.setPosition(this._startPosition.x,this._startPosition.y+5),this._minder.getRenderContainer().addShape(this)},_boxTest:function(a,b,c){var d,e,f,g,h,i=this._dragSources.map(function(a){return a.getLayoutBox()});for(c=c||function(a,b,c){return a},d=0;d<a.length;d++)for(f=a[d],h=b.call(this,f,d),e=0;e<i.length;e++){g=i[e];var j=GM.getIntersectBox(g,h);if(c(j,g,h))return f}return null},_dropTest:function(){return this._dropSucceedTarget=this._boxTest(this._dropTargets,function(a,b){return this._dropTargetBoxes[b]},function(a,b,c){function d(a){return a.width*a.height}return a?d(a)>.5*Math.min(d(b),d(c))?!0:a.width+1>=Math.min(b.width,c.width)?!0:a.height+1>=Math.min(b.height,c.height)?!0:!1:!1}),this._renderDropHint(this._dropSucceedTarget),!!this._dropSucceedTarget},_orderTest:function(){return this._orderSucceedHint=this._boxTest(this._orderHints,function(a){return a.area}),this._renderOrderHint(this._orderSucceedHint),!!this._orderSucceedHint},_renderDropHint:function(a){this._dropHinter.render(a)},_renderOrderHint:function(a){this._orderHinter.render(a)},preventDragMove:function(){this._startPosition=null}});KityMinder.registerModule("DragTree",function(){var a;return{init:function(){a=new TreeDragger(this),window.addEventListener("mouseup",function(){a.dragEnd()})},events:{"normal.mousedown inputready.mousedown":function(b){b.originEvent.button||b.getTargetNode()&&b.getTargetNode()!=this.getRoot()&&a.dragStart(b.getPosition(this.getRenderContainer()))},"normal.mousemove dragtree.mousemove":function(b){a.dragMove(b.getPosition(this.getRenderContainer()))},"normal.mouseup dragtree.beforemouseup":function(b){a.dragEnd(),b.preventDefault()},statuschange:function(b){"textedit"==b.lastStatus&&"normal"==b.currentStatus&&a.preventDragMove()}},commands:{movetoparent:MoveToParentCommand}}}),KityMinder.registerModule("KeyboardModule",function(){function a(a){var b,d=[];a.traverse(function(a){b=a.getLayoutBox(),b.width&&b.height&&d.push({left:b.x,top:b.y,right:b.x+b.width,bottom:b.y+b.height,width:b.width,height:b.height,node:a,text:a.getText()})});for(var e=0;e<d.length;e++)c(d,e)}function b(a,b){var c,d,h,i,j,k,l;return c=e(a.left,b.left),d=f(a.right,b.right),h=e(a.top,b.top),i=f(a.bottom,b.bottom),j=d-c-a.width-b.width,k=i-h-a.height-b.height,l=0>j?k:0>k?j:g(j*j+k*k),{cx:l,cy:l}}function c(a,c){for(var d,e,f=a[c],g={},h=0;h<a.length;h++)h!=c&&(d=a[h],e=b(d,f),d.right<f.left&&(!g.left||e.cx<g.left.dist)&&(g.left={dist:e.cx,node:d.node}),d.left>f.right&&(!g.right||e.cx<g.right.dist)&&(g.right={dist:e.cx,node:d.node}),d.bottom<f.top&&(!g.top||e.cy<g.top.dist)&&(g.top={dist:e.cy,node:d.node}),d.top>f.bottom&&(!g.down||e.cy<g.down.dist)&&(g.down={dist:e.cy,node:d.node}));f.node._nearestNodes={right:g.right&&g.right.node||null,top:g.top&&g.top.node||null,left:g.left&&g.left.node||null,down:g.down&&g.down.node||null}}function d(b,c){var d=b.getSelectedNode();if(!d)return b.select(b.getRoot()),void a(b.getRoot());d._nearestNodes||a(b.getRoot());var e=d._nearestNodes[c];e&&b.select(e,!0)}var e=Math.min,f=Math.max,g=(Math.abs,Math.sqrt),h=(Math.exp,kity.createClass({base:Command,execute:function(a){var b=a.getSelectedNode();b&&b.parent&&a.select(b.parent,!0),this.setContentChanged(!1)},queryState:function(a){return a.getSelectedNode()?0:-1},enableReadOnly:!0}));return{commands:{navparent:h},commandShortcutKeys:{navparent:"shift+tab"},events:{layoutallfinish:function(){var b=this.getRoot();a(b)},"normal.keydown readonly.keydown":function(a){var b=this;["left","right","up","down"].forEach(function(c){a.isShortcutKey(c)&&d(b,"up"==c?"top":c)})},"normal.keyup":function(a){if(browser.ipad){var b=KityMinder.keymap,c=a.getTargetNode(),d=this.getLang();this.receiver&&(this.receiver.keydownNode=c);var e=a.originEvent;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;switch(e.keyCode){case b.Enter:this.execCommand("AppendSiblingNode",d.topic),a.preventDefault();break;case b.Backspace:case b.Del:a.preventDefault(),this.execCommand("RemoveNode")}}}}}}),KityMinder.registerModule("Select",function(){var a=this,b=a.getRenderContainer(),c=KityMinder.Geometry,d=function(){var d=null,e=new kity.Path,f=!1,g=10;return{selectStart:function(a){return a.originEvent.button||a.originEvent.altKey?void 0:d?this.selectEnd():void(d=c.snapToSharp(a.getPosition(b)))},selectMove:function(h){if("textedit"!=a.getStatus()&&d){var i=d,j=h.getPosition(b);if(!f){if(c.getDistance(i,j)<g)return;f=!0,b.addShape(e),e.fill(a.getStyle("marquee-background")).stroke(a.getStyle("marquee-stroke")).setOpacity(.8).getDrawer().clear()}var k=c.getBox(i,j),l=[];k.left=Math.round(k.left),k.top=Math.round(k.top),k.right=Math.round(k.right),k.bottom=Math.round(k.bottom),e.getDrawer().pipe(function(){this.clear(),this.moveTo(k.left,k.top),this.lineTo(k.right,k.top),this.lineTo(k.right,k.bottom),this.lineTo(k.left,k.bottom),this.close()}),a.getRoot().traverse(function(a){var b=a.getLayoutBox();c.getIntersectBox(b,k)&&l.push(a)}),a.select(l,!0),window.getSelection().removeAllRanges()}},selectEnd:function(a){d&&(d=null),f&&(e.fadeOut(200,"ease",0,function(){e.remove&&e.remove()}),f=!1)}}}(),e=null,f=null;return{init:function(){window.addEventListener("mouseup",function(){d.selectEnd()})},events:{mousedown:function(a){var b=a.getTargetNode();b?a.originEvent.shiftKey?this.toggleSelect(b):b.isSelected()?this.isSingleSelect()||(e=b,f=a.getPosition(this.getRenderContainer())):this.select(b,!0):(this.removeAllSelectedNodes(),d.selectStart(a),this.setStatus("normal"))},mousemove:d.selectMove,mouseup:function(a){var b=a.getTargetNode();if(b&&b==e){var c=a.getPosition(this.getRenderContainer()),g=kity.Vector.fromPoints(f,c);g.length()<1&&this.select(e,!0),e=null}d.selectEnd(a)},"normal.keydown inputready.keydown":function(a){if(a.isShortcutKey("ctrl+a")){var b=[];this.getRoot().traverse(function(a){b.push(a)}),this.select(b,!0),a.preventDefault()}}}}}),KityMinder.registerModule("TextEditModule",function(){function a(a){if(a&&b.isSingleSelect()&&a.isSelected()){a.getTextGroup().setStyle("cursor","default");var f=a.getStyle("text-selection-color");if(e.updateByMinderNode(a),c.setHide().setStartOffset(0).setEndOffset(e.getTxtOfContainer().length).setColor(f),e.updateContainerRangeBySel(),browser.ie)var g=setInterval(function(){var a=d.nativeSel.getRangeAt(0);!a||a.collapsed?d.select():clearInterval(g)});b.setStatus("inputready")}}var b=this,c=new Minder.Selection,d=new Minder.Range,e=new Minder.Receiver(this,c,d);new Minder.keyboarder(e);this.receiver=e;var f,g,h,i,j=!1,k=!1,l=!1;return b.textEditNode=function(c){a(c),b.setStatus("textedit"),e.updateSelection()},{events:{ready:function(){document.body.appendChild(e.container)},"normal.beforemousedown textedit.beforemousedown inputready.beforemousedown":function(a){if(a.isRightMB())return void(a.getTargetNode()||this.setStatus("normal"));j=!0,l=c.isShow(),c.setHide();var g=a.getTargetNode();if(!g){var m=a.kityEvent.targetShape;m&&"Selection"==m.getType()&&(g=e.getMinderNode(),a.stopPropagationImmediately())}if(g&&this.isSingleSelect()&&g.isSelected()){i=g,f=g;var n=g.getTextGroup();return c.collapse(!0),c.setColor(g.getStyle("text-selection-color")),e.updateByMinderNode(g).updateIndexByMouse(a.getPosition(g.getRenderContainer())).setRange(d).setReady(),void(l&&(c.setShowStatus(),clearTimeout(h),h=setTimeout(function(){return k?void(k=!1):(c.collapse(!0).updatePosition(e.getOffsetByIndex()).setShow(),void n.setStyle("cursor","text"))},200),b.setStatus("textedit")))}e.clearReady(),e.clear(),i&&i.getTextGroup().setStyle("cursor","default")},"inputready.keyup":function(){c.isHide()&&a(this.getSelectedNode())},"normal.keyup":function(b){var d=this.getSelectedNode(),e=b.getKeyCode();if(d&&this.isSingleSelect()&&d.isSelected()&&!c.isShow()){var f=b.originEvent;!keymap.isSelectedNodeKey[e]||f.ctrlKey||f.metaKey||f.shiftKey||f.altKey||a(d)}},"normal.mouseup textedit.mouseup inputready.mouseup":function(d){j=!1;var h=d.getTargetNode();return f=null,h&&!l&&e.isReady()?(c.collapse(!0),c.setColor(h.getStyle("text-selection-color")),browser.ipad&&e.focus(),clearTimeout(g),g=setTimeout(function(){return k?void(k=!1):(c.collapse(!0).updatePosition(e.getOffsetByIndex()).setShow(),void h.getTextGroup().setStyle("cursor","text"))},200),void b.setStatus("textedit")):void(c.isHide()?a(d.getTargetNode()):c.collapsed||e.updateContainerRangeBySel())},"textedit.beforemousemove inputready.beforemousemove":function(a){if(!browser.ipad)if(j&&e.isReady()&&l){if(a.stopPropagationImmediately(),f){var c=a.getPosition(f.getRenderContainer());e.updateSelectionByMousePosition(c).updateSelection(c),setTimeout(function(){e.updateContainerRangeBySel()})}}else j&&!l&&(b.setStatus("normal"),e.clearReady())},"normal.dblclick textedit.dblclick inputready.dblclick":function(c){var d=c.getTargetNode();k=!0,d&&(a(d),b.setStatus("textedit"),e.updateSelection())},restoreScene:function(){e.clear(),a(this.getSelectedNode())},stopTextEdit:function(){e.clear(),b.setStatus("normal")},resize:function(a){c.setHide()},execCommand:function(d){var f={appendchildnode:1,appendsiblingnode:1,editnode:1};return f[d.commandName]?(a(b.getSelectedNode()),void e.updateSelection()):void(c.isShow()&&e.updateTextOffsetData().updateSelection())},layoutfinish:function(a){a.node!==e.minderNode||"textedit"!=this.getStatus()&&"inputready"!=this.getStatus()||e.setContainerStyle()},selectionclear:function(){var c=b.getSelectedNode();c?a(c):(b.setStatus("normal"),e.clear())},blur:function(){!/\?debug#?/.test(location.href)&&e.clear()},"textedit.import":function(){b.setStatus("normal"),e.clear()},"inputready.mousewheel textedit.mousewheel":function(){e.setContainerStyle()},statuschange:function(a){"textedit"==a.lastStatus&&this.fire("contentchange")}}}}),Minder.keyboarder=kity.createClass("keyboarder",function(){return{constructor:function(a){this.re=a,this.container=a.container,this.selection=a.selection,this.range=a.range,this.km=a.km,this.lastMinderNode=null,this.isTypeText=!1,this._initEvent(),this.isShortcutCopyKey=!1},_initEvent:function(){var a=this;browser.ipad&&utils.listen(this.container,"keydown keypress keyup input",function(b){a._handleEvents.call(a,new MinderEvent("keyup"==b.type?"beforekeyup":b.type,b)),"keyup"==b.type&&"normal"==a.km.getStatus()&&a.km.fire("keyup",b)}),this.km.on("inputready.beforekeyup inputready.beforekeydown textedit.beforekeyup normal.keydown normal.keyup textedit.beforekeydown textedit.keypress textedit.paste",utils.proxy(this._handleEvents,this))},_handleEvents:function(a){switch(a.type){case"input":this._input(a);break;case"beforekeydown":this._beforeKeydown(a);break;case"beforekeyup":this._beforeKeyup(a);break;case"keyup":this._keyup(a)}},_setTextToContainer:function(a,b){var c=this;if(c.minderNode=c.re.minderNode,clearTimeout(c.timer),c.range.hasNativeRange()&&(!keymap.controlKeys[a]||b)){c.lastMinderNode===c.minderNode||keymap.notContentChange[a]||(c.km.fire("saveScene",{inputStatus:!0}),c.lastMinderNode=c.minderNode);var d=c.re.getTxtOfContainer();c.minderNode.setText(d),c.re.setContainerStyle(),c.minderNode.getRenderContainer().bringTop(),c.minderNode.render(),keymap.notContentChange[a]||(clearTimeout(c.inputTextTimer),c.inputTextTimer=setTimeout(function(){c.km.layout(300)},300)),c.re.updateTextOffsetData().updateRange().updateSelectionByRange(),c.selection.updateOffsetByTextData(c.re.textData).updatePosition(),"inputready"!=c.km.getStatus()&&c.selection.setHoldShow(),c.timer=setTimeout(function(){c.selection.isShow()&&c.selection.setShow()},200),c.km.setStatus("textedit")}},_input:function(){var a=this;browser.ipad&&setTimeout(function(){a._setTextToContainer()})},_beforeKeydown:function(a){var b=this,c=a.originEvent,d=c.keyCode;switch(this.isTypeText=229==d||0===d,d){case keymap.Enter:if(a.originEvent.shiftKey&&b.selection.isShow())return b._handlerEnterkey(),a.preventDefault(),!1;case keymap.Tab:case keymap.Insert:return void(this.selection.isShow()?(this.re.clear(),this.km.setStatus("inputready"),clearTimeout(b.inputTextTimer),a.preventDefault()):(this.km.setStatus("normal"),this.km.fire("contentchange")));case keymap.left:case keymap.right:case keymap.up:case keymap.down:case keymap.Backspace:case keymap.Del:case keymap["/"]:case keymap.F2:case keymap.Insert:if(this.selection.isHide())return void this.km.setStatus("normal");break;case keymap.Control:case keymap.Alt:case keymap.Cmd:if(this.selection.isHide()&&"textedit"!=this.km.getStatus()&&"inputready"!=this.km.getStatus())return void this.km.setStatus("normal")}if(a.originEvent.ctrlKey||a.originEvent.metaKey){if(this.selection.isHide()&&{86:1,88:1,67:1}[d])return this.isShortcutCopyKey=!0,void this.km.setStatus("normal");if(d==keymap.v)return void setTimeout(function(){b.range.updateNativeRange().insertNode($("<span>$$_kityminder_bookmark_$$</span>")[0]);var a=[];utils.each(b.container.getElementsByTagName("br"),function(b,c){a.push(c)}),utils.each(a,function(a,b){var c=document.createTextNode("\n");b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b)});var c=b.container.textContent.replace(/[\u200b\t\r]/g,""),e=c.indexOf("$$_kityminder_bookmark_$$");b.re.setContainerTxt(c.replace("$$_kityminder_bookmark_$$","")),b.range.setStartOffset(e).collapse(!0).select(),b._setTextToContainer(d)},50);if(d==keymap.x)return void setTimeout(function(){b._setTextToContainer(d)},50)}this.isShortcutCopyKey=!1,b._setTextToContainer(d)},_beforeKeyup:function(a){var b=this,c=a.originEvent,d=c.keyCode;switch(d){case keymap.Enter:case keymap.Tab:case keymap.Insert:case keymap.F2:return browser.ipad?void(this.selection.isShow()?(this.re.clear(),this.km.setStatus("inputready"),clearTimeout(b.inputTextTimer),a.preventDefault()):(this.km.setStatus("normal"),this.km.fire("contentchange"))):(keymap.Enter==d&&(this.isTypeText||browser.mac&&browser.gecko)&&b._setTextToContainer(d,!0),this.re.keydownNode===this.re.minderNode&&(this.km.rollbackStatus(),this.re.clear()),void a.preventDefault());case keymap.Del:case keymap.Backspace:case keymap.Spacebar:return browser.ipad&&this.selection.isHide()?void this.km.setStatus("normal"):void b._setTextToContainer(d,!0)}return this.isTypeText?void b._setTextToContainer(d,!0):browser.mac&&browser.gecko?void b._setTextToContainer(d,!0):(b._setTextToContainer(d,!0),!0)},_keyup:function(a){var b,c=this,d=this.km.getSelectedNode();if("normal"==this.km.getStatus()&&d&&this.selection.isHide()){if(this.isShortcutCopyKey)return;d&&this.km.isSingleSelect()&&d.isSelected()&&(this.re.updateByMinderNode(d),this.selection.setHide().setStartOffset(0).setEndOffset(this.re.getTxtOfContainer().length).setColor(d.getStyle("text-selection-color")),setTimeout(function(){c.re.updateContainerRangeBySel()}),browser.ie&&(b=setInterval(function(){var a=c.range.nativeSel.getRangeAt(0);!a||a.collapsed?c.range.select():clearInterval(b)})),this.km.setStatus("inputready"))}},_handlerEnterkey:function(){function a(a){a&&3==a.nodeType&&0===a.nodeValue.length&&a.parentNode.removeChild(a)}var b=this.range,c=document.createElement("br"),d=this;b.collapsed||b.deleteContents(),b.insertNode(c),a(c.previousSibling),a(c.nextSibling),b.setStartAfter(c),b.collapse(!0);var e=b.startContainer.childNodes[b.startOffset];e||(c=c.cloneNode(!1),b.startContainer.appendChild(c),b.setStartBefore(c),b.collapse(!0)),b.select(),d._setTextToContainer(keymap.Enter)}}}()),Minder.Range=kity.createClass("Range",function(){function a(a,b){var c=a[b+"Container"],d=a[b+"Offset"],e=0;return 1==c.nodeType&&(c=c.childNodes[d],!c&&a.startContainer&&"DIV"==a.startContainer.nodeName?(a.startContainer.innerHTML="<p></p>",d=0):3==c.nodeType&&(d=0)),utils.each(a.container.childNodes,function(a,b){return b===c?1==b.nodeType?!1:(e+=d,!1):void(e+=1==b.nodeType?1:utils.clearWhitespace(b.nodeValue).length)}),e}function b(a,b,c){var d=0,e=a.container;utils.each(e.childNodes,function(f,g){if(1==g.nodeType)return d==b?(a["set"+c](e,f),!1):void d++;var h=utils.clearWhitespace(g.nodeValue).length;return d+h>=b?(a["set"+c](g,b-d),!1):void(d+=h)})}return{constructor:function(a){this.nativeRange=document.createRange(),this.nativeSel=window.getSelection(),this.startContainer=this.endContainer=this.startOffset=this.endOffset=null,this.collapsed=!1,this.container=a||null},hasNativeRange:function(){return 0!==this.nativeSel.rangeCount},deleteContents:function(){return this.nativeRange.deleteContents(),this._updateBoundary()},select:function(){var a=this.nativeRange.startContainer;if(1==a.nodeType&&0===a.childNodes.length){var b=document.createTextNode("");a.appendChild(b),this.nativeRange.setStart(b,1),this.nativeRange.collapse(!0)}else this.collapsed&&1==a.nodeType&&(a=a.childNodes[this.startOffset],a&&3==a.nodeType&&0===a.nodeValue.length&&(this.nativeRange.setStart(a,1),this.nativeRange.collapse(!0)));try{this.nativeSel.removeAllRanges()}catch(c){}return this.nativeSel.addRange(this.nativeRange),this},_updateBoundary:function(){var a=this.nativeRange;return this.startContainer=a.startContainer,
- this.startContainer=a.startContainer,this.endContainer=a.endContainer,this.startOffset=a.startOffset,this.endOffset=a.endOffset,this.collapsed=a.collapsed,this},setStartOffset:function(a){return b(this,a,"Start"),this},setEndOffset:function(a){return b(this,a,"End"),this},setStart:function(a,b){return this.nativeRange.setStart(a,b),this._updateBoundary(),this},setStartAfter:function(a){return this.setStart(a.parentNode,utils.getNodeIndex(a)+1)},setStartBefore:function(a){return this.setStart(a.parentNode,utils.getNodeIndex(a))},setEnd:function(a,b){return this.nativeRange.setEnd(a,b),this._updateBoundary(),this},update:function(){return this.updateNativeRange()._updateBoundary(),this},getStart:function(){return this.update(),{startContainer:this.startContainer,startOffset:this.startOffset}},getStartOffset:function(){return a(this,"start")},getEndOffset:function(){return a(this,"end")},collapse:function(a){return this.nativeRange.collapse(a===!0),this._updateBoundary(),this},isCollapsed:function(){return this._updateBoundary(),this.collapsed},insertNode:function(a){return this.nativeRange.insertNode(a),this._updateBoundary()},updateNativeRange:function(){return this.nativeRange=this.nativeSel.getRangeAt(0),this},clear:function(){return this.nativeSel.removeAllRanges(),this}}}()),Minder.Receiver=kity.createClass("Receiver",{clear:function(){return this.container.innerHTML="",this.selection&&this.selection.setHide(),this.range&&this.range.clear(),this.index=0,this},constructor:function(a,b,c){this.setKityMinder(a);var d=document.createElement("div");d.setAttribute("contenteditable",!0),d.className="km_receiver",this.container=d,utils.addCssRule("km_receiver_css"," .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;"+(/\?debug#?/.test(location.href)?"":"clip:rect(1em 1em 1em 1em);")),this.index=0,this.selection=b,this.range=c,this.range.container=d},setRange:function(a,b){this.index=b||this.index,this.range=a,a.setStartOffset(this.index),a.collapse(!0);var c=this;return setTimeout(function(){c.container.focus(),a.select()}),this},setTextGroup:function(a){return this.textGroup=a,this},setKityMinder:function(a){return this.km=a,this},updateByMinderNode:function(a){return this.setMinderNode(a),this._addSelection(),this.setTextGroup(a.getTextGroup()),this.setContainerStyle(),this.updateTextOffsetData(),this.setSelectionHeight(),this.setContainerTxt(),this},setMinderNode:function(a){return this.minderNode=a,this.selection.setMinderNode(a),this},_addSelection:function(){return this.selection.container&&this.selection.remove(),this.minderNode.getRenderContainer().addShape(this.selection),this},getMinderNode:function(){return this.minderNode},updateIndex:function(){return this.index=this.range.getStartOffset(),this},setSelection:function(a){return this.selection=a,this},updateSelection:function(a){return this.selection.update(this.textData,a),this},getOffsetByIndex:function(a){return utils.getValueByIndex(this.textData,void 0!==a?a:this.index)},getBaseOffset:function(){var a=this.textGroup.getRenderBox("screen");return a},setContainerStyle:function(){var a=this.getBaseOffset();return this.container.style.cssText=";left:"+(browser.ipad?"-":"")+a.x+"px;top:"+(a.y+(/\?debug#?/.test(location.href)?this.textGroup.getItems().length*this.getlineHeight():0))+"px;width:"+a.width+"px;height:"+a.height+"px;",this},updateTextOffsetData:function(){var a,b=this,c=this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"),d=this.minderNode.getStyle("line-height")*c,e=(b.textGroup.getShapes().length*d-(d-c))/2;return this.textData=[],b.textGroup.eachItem(function(c,f){b.textData[c]=[];for(var g=c*d+1,h=f.getContent(),i=0,j=h.length;j>i;i++){try{a=f.getExtentOfChar(i)}catch(k){console.log(k)}b.textData[c].push({x:a.x,y:g-e,width:a.width,height:a.height})}0===h.length&&b.textData[c].push({x:0,y:g-e,width:0,height:d})}),this},getlineHeight:function(){return this.minderNode.getStyle("line-height")*(this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"))},updateIndexByMouse:function(a){var b=this;b.updateTextOffsetData(),this.index=0;var c=this.getlineHeight();return utils.each(this.textData,function(d,e){var f=e[0];return f.y<=a.y&&f.y+c>=a.y?(utils.each(e,function(c,d){return 0===c&&a.x<=d.x?!1:a.x>=d.x&&a.x<=d.x+d.width?(a.x-d.x>d.width/2?b.index+=c+1:b.index+=c,!1):c==e.length-1&&a.x>=d.x?(b.index+=1==e.length&&0===e[0].width?0:e.length,!1):void 0}),!1):void(b.index+=e.length+(1==e.length&&0===e[0].width?0:1))}),this.selection.setStartOffset(this.index).collapse(!0),this},setSelectionHeight:function(){return this.selection.setHeight(1*(this.minderNode.getData("font-size")||this.minderNode.getStyle("font-size"))),this},updateSelectionByMousePosition:function(a){var b=this,c=0,d=this.getlineHeight();return utils.each(this.textData,function(e,f){var g=f[0];return g.y<=a.y&&g.y+d>=a.y?(utils.each(f,function(b,d){return 0===b&&a.x<=d.x?!1:a.x>=d.x&&a.x<=d.x+d.width?(c+=b,a.x-d.x>d.width/2&&(c+=1),!1):b==f.length-1&&a.x>=d.x?(c+=1==f.length&&0===f[0].width?0:f.length,!1):void 0}),!1):g.y>a.y&&0===e?(c=0,!1):e==b.textData.length-1&&g.y+d<a.y?(c+=f.length+1,!1):void(c+=f.length+(1==f.length&&0===f[0].width?0:1))}),c<b.index?(this.selection.setStartOffset(c),this.selection.setEndOffset(b.index)):c==b.index?this.selection.setStartOffset(c).collapse(!0):(this.selection.setStartOffset(b.index),this.selection.setEndOffset(c)),this},updateRange:function(){return this.range.update(),this},updateContainerRangeBySel:function(){var a=this;return this.range.setStartOffset(this.selection.startOffset),this.range.setEndOffset(this.selection.endOffset),browser.gecko?(this.container.focus(),setTimeout(function(){a.range.select()})):this.range.select(),this},updateSelectionByRange:function(){return this.selection.setStartOffset(this.range.getStartOffset()),this.selection.setEndOffset(this.range.getEndOffset()),this},setIndex:function(a){return this.index=a,this},setContainerTxt:function(a){function b(a){return a.replace(/</g,"<").replace(/>/g,">")}return a?(a=b(a),a=a.replace(/[\n]/g,"<br/>")):(a="",this.textGroup.eachItem(function(c,d){a+=b(d.getContent())+"<br/>"})),this.container.innerHTML=a,this},setReady:function(){this._ready=!0},clearReady:function(){this._ready=!1},isReady:function(){return this._ready},focus:function(){this.container.focus()},getTxtOfContainer:function(){var a="",b=this.container;return utils.each(b.childNodes,function(c,d){3==d.nodeType?a+=d.nodeValue.replace(/[\u200b]/g,""):d!==b.lastChild&&(a+="\n")}),a}}),Minder.Selection=kity.createClass("Selection",{base:kity.Path,constructor:function(a,b,c){this.callBase(),this.height=a||20,this.setAttr("id","_kity_selection"),this.width=2,this.fill("rgb(27,171,255)"),this.setHide(),this.timer=null,this.collapsed=!0,this.startOffset=this.endOffset=0,this.setOpacity(.5),this.setStyle("cursor","text"),this._show=!1,this.offset=[],this.setTranslate(-.5,-1.5)},setMinderNode:function(a){this.minderNode=a},setColor:function(a){this.fill(a)},updateOffsetByTextData:function(a,b){if(this.collapsed)return this.offset=utils.getValueByIndex(a,this.startOffset),this;var c=[],d={},e=this.startOffset,f=this.endOffset,g=0;return utils.each(a,function(a,b){return d={width:0,x:0,y:0},utils.each(b,function(a,b){if(g>=e&&f>=g)if(0===a||g===e)d.x=b.x,d.y=b.y,d.width=b.width;else if(f>g)d.width+=b.width;else if(g===f)return!1;g++}),void 0!==d.x&&c.push(d),g===f?!1:void((1!=b.length||0!==b[0].width)&&g++)}),this.offset=c,this},updatePosition:function(a){var b=this,c=Math.round,d=function(a,b,d,e){return["M",c(a),c(b),"h",c(d),"v",c(e),"h",-c(d),"v",-c(e),"z"]};if(a=void 0!==a?a:this.offset,this.collapsed){if(isNaN(a.x)||isNaN(a.y))return console&&console.warn("editor.selection.js 不正确的偏移位置"),this;this.setPathData(d(a.x,a.y,this.width,this.height))}else this.setPathData(a.reduce(function(a,c){return a.concat(d(c.x,c.y,c.width,b.height))},[]));return this._show=!0,this},collapse:function(a){return this.setOpacity(1),this.collapsed=!0,a?this.endOffset=this.startOffset:this.startOffset=this.endOffset,this},setStartOffset:function(a){return this.startOffset=a,this.startOffset>=this.endOffset?(this.collapse(!0),this):(this.collapsed=!1,this.setOpacity(.5),this)},setEndOffset:function(a){return this.endOffset=a,this.endOffset<=this.startOffset?(this.startOffset=a,this.collapse(!0),this):(this.collapsed=!1,this.setOpacity(.5),this)},update:function(a,b){return a&&this.updateOffsetByTextData(a,b),this.updatePosition(),this.setShow(),this},setHeight:function(a){return this.height=Math.round(a)+2,this},setHide:function(){return clearInterval(this.timer),this.setStyle("display","none"),this._show=!1,this},setHoldShow:function(){return this.setStyle("display",""),clearInterval(this.timer),this},setShow:function(){this.bringTop(),clearInterval(this.timer);var a=this,b="";return a.setStyle("display",""),a._show=!0,this.collapsed&&(a.setOpacity(1),this.timer=setInterval(function(){a.setStyle("display",b),b=b?"":"none"},400)),this},setShowStatus:function(){return this._show=!0,this},isShow:function(){return this._show},isHide:function(){return!this._show}}),KityMinder.registerModule("basestylemodule",function(){function a(a,b){return a.getData(b)||a.getStyle(b)}var b=this;return KityMinder.TextRenderer.registerStyleHook(function(b,c){var d=a(b,"font-weight"),e=a(b,"font-style");[d,e].join("/");c.eachItem(function(a,b){b.setFont({weight:d,style:e})})}),{commands:{bold:kity.createClass("boldCommand",{base:Command,execute:function(a){var b=a.getSelectedNodes();1==this.queryState("bold")?utils.each(b,function(a,b){b.setData("font-weight").render()}):utils.each(b,function(a,b){b.setData("font-weight","bold").render()}),a.layout()},queryState:function(){var a=b.getSelectedNodes(),c=0;return 0===a.length?-1:(utils.each(a,function(a,b){return b&&b.getData("font-weight")?(c=1,!1):void 0}),c)}}),italic:kity.createClass("italicCommand",{base:Command,execute:function(a){var b=a.getSelectedNodes();1==this.queryState("italic")?utils.each(b,function(a,b){b.setData("font-style").render()}):utils.each(b,function(a,b){b.setData("font-style","italic").render()}),a.layout()},queryState:function(){var a=b.getSelectedNodes(),c=0;return 0===a.length?-1:(utils.each(a,function(a,b){return b&&b.getData("font-style")?(c=1,!1):void 0}),c)}})},commandShortcutKeys:{bold:"ctrl+b",italic:"ctrl+i"}}}),KityMinder.registerModule("fontmodule",function(){function a(a,b){return a.getData(b)||a.getStyle(b)}return KityMinder.TextRenderer.registerStyleHook(function(b,c){var d=b.getData("color"),e=b.getStyle("selected-color"),f=b.getStyle("color"),g=d||(b.isSelected()&&e?e:f),h=a(b,"font-family"),i=a(b,"font-size"),j=[h,i].join("/");c.fill(g),b.setTmpData("fore-color",g.toString()),c.eachItem(function(a,b){b.setFont({family:h,size:i})}),b.setTmpData("font-hash",j)}),{defaultOptions:{fontfamily:[{name:"宋体",val:"宋体,SimSun"},{name:"微软雅黑",val:"微软雅黑,Microsoft YaHei"},{name:"楷体",val:"楷体,楷体_GB2312,SimKai"},{name:"黑体",val:"黑体, SimHei"},{name:"隶书",val:"隶书, SimLi"},{name:"Andale Mono",val:"andale mono"},{name:"Arial",val:"arial,helvetica,sans-serif"},{name:"arialBlack",val:"arial black,avant garde"},{name:"Comic Sans Ms",val:"comic sans ms"},{name:"Impact",val:"impact,chicago"},{name:"Times New Roman",val:"times new roman"},{name:"Sans-Serif",val:"sans-serif"}],fontsize:[10,12,16,18,24,32,48]},commands:{forecolor:kity.createClass("fontcolorCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();utils.each(c,function(a,c){c.setData("color",b),c.render()})},queryState:function(a){return 0==a.getSelectedNodes().length?-1:0},queryValue:function(a){return 1==a.getSelectedNodes().length?a.getSelectedNodes()[0].getData("color"):"mixed"}}),background:kity.createClass("backgroudCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();utils.each(c,function(a,c){c.setData("background",b),c.render()})},queryState:function(a){return 0==a.getSelectedNodes().length?-1:0},queryValue:function(a){return 1==a.getSelectedNodes().length?a.getSelectedNodes()[0].getData("background"):"mixed"}}),fontfamily:kity.createClass("fontfamilyCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();utils.each(c,function(c,d){d.setData("font-family",b),d.render(),a.layout()})},queryState:function(a){return 0===a.getSelectedNodes().length?-1:0},queryValue:function(a){var b=a.getSelectedNode();return b?b.getData("font-family"):null}}),fontsize:kity.createClass("fontsizeCommand",{base:Command,execute:function(a,b){var c=a.getSelectedNodes();utils.each(c,function(c,d){d.setData("font-size",b),d.render(),a.layout(300)})},queryState:function(a){return 0==a.getSelectedNodes().length?-1:0},queryValue:function(a){var b=a.getSelectedNode();return b?b.getData("font-size"):null}})}}}),KityMinder.registerModule("Zoom",function(){function a(){var a=e._zoomValue>=100?"optimize-speed":"geometricPrecision";e.getRenderContainer().setAttr("text-rendering",a)}function b(a){var b=a.shapeNode,c=b.getCTM(),d=new kity.Matrix(c.a,c.b,c.c,c.d,(0|c.e)+.5,(0|c.f)+.5);b.setAttribute("transform","matrix("+d.toString()+")")}function c(b,c){var e=b.getPaper();e.getViewPort();if(c){if(a(),b.getRoot().getComplex()>200)b._zoomValue=c,b.zoom(c),b.fire("viewchange");else{var f=new kity.Animator({beginValue:b._zoomValue,finishValue:c,setter:function(a,b){a.zoom(b)}});b._zoomValue=c,d&&d.pause(),d=f.start(b,300,"easeInOutSine"),d.on("finish",function(){b.fire("viewchange")})}b.fire("zoom",{zoom:c})}}var d,e=this;e.setDefaultOptions("zoom",[10,20,30,50,80,100,120,150,200]),kity.extendClass(Minder,{zoom:function(a){var c=this.getPaper(),d=c.getViewPort();d.zoom=a/100,d.center={x:d.center.x,y:d.center.y},c.setViewPort(d),100==a&&b(c)},getZoomValue:function(){return this._zoomValue}});var f=kity.createClass("Zoom",{base:Command,execute:c,queryValue:function(a){return a._zoomValue}}),g=kity.createClass("ZoomInCommand",{base:Command,execute:function(a){c(a,this.nextValue(a))},queryState:function(a){return+!this.nextValue(a)},nextValue:function(a){var b,c=a.getOptions("zoom");for(b=0;b<c.length;b++)if(c[b]>a._zoomValue)return c[b];return 0},enableReadOnly:!0}),h=kity.createClass("ZoomOutCommand",{base:Command,execute:function(a){c(a,this.nextValue(a))},queryState:function(a){return+!this.nextValue(a)},nextValue:function(a){var b,c=a.getOptions("zoom");for(b=c.length-1;b>=0;b--)if(c[b]<a._zoomValue)return c[b];return 0},enableReadOnly:!0});return{init:function(){this._zoomValue=100,a()},commands:{"zoom-in":g,"zoom-out":h,zoom:f},events:{"normal.mousewheel readonly.mousewheel":function(a){if(a.originEvent.ctrlKey||a.originEvent.metaKey){var b=a.originEvent.wheelDelta,c=this;kity.Browser.mac||(b=-b),Math.abs(b)>100&&(clearTimeout(this._wheelZoomTimeout),this._wheelZoomTimeout=setTimeout(function(){c.getPaper()._zoom||1;0>b?c.execCommand("zoom-in"):b>0&&c.execCommand("zoom-out")},100),a.originEvent.preventDefault())}}},commandShortcutKeys:{"zoom-in":"ctrl+=","zoom-out":"ctrl+-"}}}),KityMinder.registerModule("hyperlink",function(){var a="M16.614,10.224h-1.278c-1.668,0-3.07-1.07-3.599-2.556h4.877c0.707,0,1.278-0.571,1.278-1.278V3.834 c0-0.707-0.571-1.278-1.278-1.278h-4.877C12.266,1.071,13.668,0,15.336,0h1.278c2.116,0,3.834,1.716,3.834,3.834V6.39 C20.448,8.508,18.73,10.224,16.614,10.224z M5.112,5.112c0-0.707,0.573-1.278,1.278-1.278h7.668c0.707,0,1.278,0.571,1.278,1.278 S14.765,6.39,14.058,6.39H6.39C5.685,6.39,5.112,5.819,5.112,5.112z M2.556,3.834V6.39c0,0.707,0.573,1.278,1.278,1.278h4.877 c-0.528,1.486-1.932,2.556-3.599,2.556H3.834C1.716,10.224,0,8.508,0,6.39V3.834C0,1.716,1.716,0,3.834,0h1.278 c1.667,0,3.071,1.071,3.599,2.556H3.834C3.129,2.556,2.556,3.127,2.556,3.834z";return{commands:{hyperlink:kity.createClass("hyperlink",{base:Command,execute:function(a,b,c){var d=a.getSelectedNodes();utils.each(d,function(a,d){d.setData("hyperlink",b),d.setData("hyperlinkTitle",c),d.render()}),a.layout()},queryState:function(a){var b=a.getSelectedNodes(),c=0;return 0===b.length?-1:(utils.each(b,function(a,b){return b&&b.getData("hyperlink")?(c=0,!1):void 0}),c)},queryValue:function(a){var b=a.getSelectedNode();return{url:b.getData("hyperlink"),title:b.getData("hyperlinkTitle")}}}),unhyperlink:kity.createClass("hyperlink",{base:Command,execute:function(a){var b=a.getSelectedNodes();utils.each(b,function(a,b){b.setData("hyperlink"),b.render()}),a.layout()},queryState:function(a){var b=a.getSelectedNodes();if(0===b.length)return-1;var c=!1;return utils.each(b,function(a,b){return b.getData("hyperlink")?(c=!0,!1):void 0}),c?0:-1}})},renderers:{right:kity.createClass("hyperlinkrender",{base:KityMinder.Renderer,create:function(){var b=new kity.HyperLink,c=new kity.Path,d=new kity.Rect(24,22,-2,-6,4).fill("rgba(255, 255, 255, 0)");return c.setPathData(a).fill("#666"),b.addShape(d),b.addShape(c),b.setTarget("_blank"),b.setStyle("cursor","pointer"),b.on("mouseover",function(){d.fill("rgba(255, 255, 200, .8)")}).on("mouseout",function(){d.fill("rgba(255, 255, 255, 0)")}),b},shouldRender:function(a){return a.getData("hyperlink")},update:function(a,b,c){var d=b.getData("hyperlink");a.setHref(d);var e=b.getData("hyperlinkTitle");e=e?[e,"(",d,")"].join(""):d,a.node.setAttributeNS("http://www.w3.org/1999/xlink","title",e);var f=b.getStyle("space-right");return a.setTranslate(c.right+f+2,-5),new kity.Box({x:c.right+f,y:-11,width:24,height:22})}})}}}),kity.extendClass(MinderNode,{arrange:function(a){var b=this.parent;if(b){var c=b.children;if(!(0>a||a>=c.length))return c.splice(this.getIndex(),1),c.splice(a,0,this),this}}});var ArrangeUpCommand=kity.createClass("ArrangeUpCommand",{base:Command,execute:function(a){var b=a.getSelectedNodes();b.sort(asc);var c=b.map(function(a){return a.getIndex()});b.forEach(function(a,b){a.arrange(c[b]-1)}),a.layout(300)},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),ArrangeDownCommand=kity.createClass("ArrangeUpCommand",{base:Command,execute:function(a){var b=a.getSelectedNodes();b.sort(desc);var c=b.map(function(a){return a.getIndex()});b.forEach(function(a,b){a.arrange(c[b]+1)}),a.layout(300)},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}}),ArrangeCommand=kity.createClass("ArrangeCommand",{base:Command,execute:function(a,b,c){if(b=b&&b.slice()||a.getSelectedNodes().slice(),b.length){var d=MinderNode.getCommonAncestor(b);if(d==b[0].parent){var e=b.map(function(a){return{index:a.getIndex(),node:a}}),f=Math.min.apply(Math,e.map(function(a){return a.index}))>=c;e.sort(function(a,b){return f?b.index-a.index:a.index-b.index}),e.forEach(function(a){a.node.arrange(c)}),a.layout(300)}}},queryState:function(a){var b=a.getSelectedNode();return b?0:-1}});KityMinder.registerModule("ArrangeModule",{commands:{arrangeup:ArrangeUpCommand,arrangedown:ArrangeDownCommand,arrange:ArrangeCommand},contextmenu:[{command:"arrangeup"},{command:"arrangedown"},{divider:!0}],commandShortcutKeys:{arrangeup:"normal::alt+Up",arrangedown:"normal::alt+Down"}}),KityMinder.registerModule("ClipboardModule",function(){function a(b,d){e.push(d),c.appendNode(d,b),d.render(),d.setLayoutOffset(null);for(var f,g=utils.cloneArr(d.children),h=0;f=g[h];h++)a(d,f)}function b(a){a.length&&(a.sort(function(a,b){return a.getIndex()-b.getIndex()}),d=a.map(function(a){return a.clone()}))}var c=this,d=[],e=[],f=kity.createClass("CopyCommand",{base:Command,execute:function(a){b(a.getSelectedAncestors(!0)),this.setContentChanged(!1)}}),g=kity.createClass("CutCommand",{base:Command,execute:function(a){var c=a.getSelectedAncestors();0!==c.length&&(b(c),a.select(MinderNode.getCommonAncestor(c),!0),c.slice().forEach(function(b){a.removeNode(b)}),a.layout(300))}}),h=kity.createClass("PasteCommand",{base:Command,execute:function(b){if(d.length){var c=b.getSelectedNode();if(!c)return;for(var f,g=0;f=d[g];g++)a(c,f.clone());b.select(e,!0),e=[],b.layout(300)}},queryState:function(a){return a.getSelectedNode()?0:-1}});return{commands:{copy:f,cut:g,paste:h},commandShortcutKeys:{copy:"normal::ctrl+c|",cut:"normal::ctrl+x",paste:"normal::ctrl+v"}}}),KityMinder.registerModule("StyleModule",function(){function a(a){for(var c=a.getData(),d=0;d<b.length;d++)if(b[d]in c)return!0}var b=["font-size","font-family","font-weight","font-style","background","color"],c=null;return{commands:{copystyle:kity.createClass("CopyStyleCommand",{base:Command,execute:function(a){var d=a.getSelectedNode(),e=d.getData();return c={},b.forEach(function(a){a in e?c[a]=e[a]:(c[a]=null,delete c[a])}),c},queryState:function(b){var c=b.getSelectedNodes();return 1!==c.length?-1:a(c[0])?0:-1}}),pastestyle:kity.createClass("PastStyleCommand",{base:Command,execute:function(a){return a.getSelectedNodes().forEach(function(a){for(var b in c)c.hasOwnProperty(b)&&a.setData(b,c[b])}),a.renderNodeBatch(a.getSelectedNodes()),a.layout(300),c},queryState:function(a){return c&&a.getSelectedNodes().length?0:-1}}),clearstyle:kity.createClass("ClearStyleCommand",{base:Command,execute:function(a){return a.getSelectedNodes().forEach(function(a){b.forEach(function(b){a.setData(b)})}),a.renderNodeBatch(a.getSelectedNodes()),a.layout(300),c},queryState:function(b){var c=b.getSelectedNodes();if(!c.length)return-1;for(var d=0;d<c.length;d++)if(a(c[d]))return 0;return-1}})}}}),KityMinder.registerProtocol("xmind",function(a){var b={"priority-1":["priority",1],"priority-2":["priority",2],"priority-3":["priority",3],"priority-4":["priority",4],"priority-5":["priority",5],"priority-6":["priority",6],"priority-7":["priority",7],"priority-8":["priority",8],"task-start":["progress",1],"task-oct":["progress",2],"task-quarter":["progress",3],"task-3oct":["progress",4],"task-half":["progress",5],"task-5oct":["progress",6],"task-3quar":["progress",7],"task-7oct":["progress",8],"task-done":["progress",9]};return{fileDescription:"XMind 格式",fileExtension:".xmind",dataType:"blob",mineType:"application/octet-stream",decode:function(a){function c(a,d){if(d.data={text:a.title},a.marker_refs&&a.marker_refs.marker_ref){var e,f=a.marker_refs.marker_ref;if(f.length&&f.length>0)for(var g in f)e=b[f[g].marker_id],e&&(d.data[e[0]]=e[1]);else e=b[f.marker_id],e&&(d.data[e[0]]=e[1])}a["xlink:href"]&&(d.data.hyperlink=a["xlink:href"]);var h=a.children&&a.children.topics,i=h&&(h.topic||h[0]&&h[0].topic);if(i){var j=i;if(j.length&&j.length>0){d.children=[];for(var g in j)d.children.push({}),c(j[g],d.children[g])}else d.children=[{}],c(j,d.children[0])}}function d(a){var b=$.xml2json(a),d={},e=b.sheet,f=utils.isArray(e)?e[0].topic:e.topic;return c(f,d),d}function e(a,b){return new Promise(function(b,c){zip.createReader(new zip.BlobReader(a),function(a){a.getEntries(b)},c)})}function f(a){return new Promise(function(b,c){for(var e,f;(e=a.pop())&&"content.xml"!=e.filename.split("/").pop();)e=null;e?e.getData(new zip.TextWriter,function(a){try{f=d($.parseXML(a)),b(f)}catch(e){c(e)}}):c(new Error("Content document missing"))})}return e(a).then(f)},encode:function(a,b,c){function d(){return new Promise(function(a,b){var c=new XMLHttpRequest;c.open("POST",f),c.responseType="blob",c.onload=a,c.onerror=b;var d=new FormData;d.append("type","xmind"),d.append("data",g),c.send(d)}).then(function(a){return a.target.response})}function e(){function a(a,b){var c=document.createElement("input");return c.type="hidden",c.name=a,c.value=b,c}var b=c.filename||"xmind.xmind",d=document.createElement("form");d.setAttribute("action",f),d.setAttribute("method","POST"),d.appendChild(a("filename",b)),d.appendChild(a("type","xmind")),d.appendChild(a("data",g)),d.appendChild(a("download","1")),document.body.appendChild(d),d.submit(),document.body.removeChild(d)}var f="native-support/export.php",g=JSON.stringify(a);return c&&c.download?e():d()},recognizePriority:-1}}),KityMinder.registerProtocol("freemind",function(a){function b(a,c){c.data={text:a.TEXT};var e;if(a.icon){var f,g=a.icon;if(g.length&&g.length>0)for(e in g)f=d[g[e].BUILTIN],f&&(c.data[f[0]]=f[1]);else f=d[g.BUILTIN],f&&(c.data[f[0]]=f[1])}if(a.LINK&&(c.data.hyperlink=a.LINK),a.node){var h=a.node;if(h.length&&h.length>0){c.children=[];for(e in h)c.children.push({}),b(h[e],c.children[e])}else c.children=[{}],b(h,c.children[0])}}function c(a){var c=$.xml2json(a),d={};return b(c.node,d),d}var d={"full-1":["priority",1],"full-2":["priority",2],"full-3":["priority",3],"full-4":["priority",4],"full-5":["priority",5],"full-6":["priority",6],"full-7":["priority",7],"full-8":["priority",8]};return{fileDescription:"Freemind 格式",fileExtension:".mm",dataType:"text",decode:function(a){return new Promise(function(b,d){try{b(c(a))}catch(e){d(new Error("XML 文件损坏!"))}})},encode:function(a,b,c){function d(){return new Promise(function(a,b){var c=new XMLHttpRequest;c.open("POST",f),c.responseType="blob",c.onload=a,c.onerror=b;var d=new FormData;d.append("type","freemind"),d.append("data",g),c.send(d)}).then(function(a){return a.target.response})}function e(){function a(a,b){var c=document.createElement("input");return c.type="hidden",c.name=a,c.value=b,c}var b=c.filename||"freemind.mm",d=document.createElement("form");d.setAttribute("action",f),d.setAttribute("method","POST"),d.appendChild(a("filename",b)),d.appendChild(a("type","freemind")),d.appendChild(a("data",g)),d.appendChild(a("download","1")),document.body.appendChild(d),d.submit(),document.body.removeChild(d)}var f="native-support/export.php",g=JSON.stringify(a);return c&&c.download?e():d()}}}),KityMinder.registerProtocol("mindmanager",function(a){function b(a,c){if(c.data={text:a.Text&&a.Text.PlainText||""},a.Task){var d;a.Task.TaskPriority&&(d=f[a.Task.TaskPriority],d&&(c.data[d[0]]=d[1])),a.Task.TaskPercentage&&(d=f[a.Task.TaskPercentage],d&&(c.data[d[0]]=d[1]))}if(a.Hyperlink&&(c.data.hyperlink=a.Hyperlink.Url),a.SubTopics&&a.SubTopics.Topic){var e=a.SubTopics.Topic;if(e.length&&e.length>0){c.children=[];for(var g in e)c.children.push({}),b(e[g],c.children[g])}else c.children=[{}],b(e,c.children[0])}}function c(a){var c=$.xml2json(a),d={};return b(c.OneTopic.Topic,d),d}function d(a){return new Promise(function(b,c){zip.createReader(new zip.BlobReader(a),function(a){a.getEntries(b)},c)})}function e(a){return new Promise(function(b,d){for(var e,f;(e=a.pop())&&"Document.xml"!=e.filename.split("/").pop();)e=null;e?e.getData(new zip.TextWriter,function(a){f=c($.parseXML(a)),b(f)}):d(new Error("Main document missing"))})}var f={"urn:mindjet:Prio1":["PriorityIcon",1],"urn:mindjet:Prio2":["PriorityIcon",2],"urn:mindjet:Prio3":["PriorityIcon",3],"urn:mindjet:Prio4":["PriorityIcon",4],"urn:mindjet:Prio5":["PriorityIcon",5],0:["ProgressIcon",1],25:["ProgressIcon",2],50:["ProgressIcon",3],75:["ProgressIcon",4],100:["ProgressIcon",5]};return{fileDescription:"MindManager 格式",fileExtension:".mmap",dataType:"blob",decode:function(a){return d(a).then(e)},encode:null,recognizePriority:-1}}),KityMinder.registerProtocol("plain",function(a){function b(a,b){for(var c="";b--;)c+=a;return c}function c(a,d){var e="";return d=d||0,e+=b(j,d),e+=a.data.text+h,a.children&&a.children.forEach(function(a){e+=c(a,d+1)}),e}function d(a){return!/\S/.test(a)}function e(a){for(var b=0;a.charAt(b)===j;)b++;return b}function f(a){return{data:{text:a.replace(new RegExp("^"+j+"*"),"")}}}function g(a,b){function c(a,b){var c=a.children||(a.children=[]);c.push(b)}var g,h,j,k,l,m={},n=a.split(i);b?(m[0]=g=f("root"),h=1):h=0;for(var o=0;o<n.length;o++)if(j=n[o],!d(j)){if(k=e(j)+h,l=f(j),0===k){if(g)throw new Error("Invalid local format");g=l}else{if(!m[k-1])throw new Error("Invalid local format");c(m[k-1],l)}m[k]=l}return g}var h="\r",i=/\r\n|\r|\n/,j=" ";return{fileDescription:"大纲文本",fileExtension:".txt",mineType:"text/plain",dataType:"text",encode:function(a){return c(a,0)},decode:function(a,b){return g(a,b)},recognizePriority:-1}}),KityMinder.registerProtocol("markdown",function(){function a(a){return b(a,1).join("\n")}function b(a,d){var e=[];d=d||1;var f=c(d);e.push(f+" "+a.data.text),e.push(j);var g=a.data.note;if(g){var h=/^#/.test(g);h&&(e.push(k),g=g.replace(/^#+/gm,function(a){return f+a})),e.push(g),h&&e.push(l),e.push(j)}return a.children&&a.children.forEach(function(a){e=e.concat(b(a,d+1))}),e}function c(a){for(var b="";a--;)b+="#";return b}function d(a){var b,c,d,j,k,l,m,n={};a=a.replace(/^(.+)\n={3,}/,function(a,b){return"# "+b}),b=a.split(i);for(var o=0;o<b.length;o++)c=b[o],d=g(c),d.noteClose?l=!1:d.noteStart?l=!0:(m=d.codeBlock?!m:m,l||m||!d.level||d.level>j+1?k&&f(k,c):(j=d.level,k=e(d.content,n[j-1]),n[j]=k));return h(n[1]),n[1]}function e(a,b){var c={data:{text:a,note:""}};return b&&(b.children?b.children.push(c):b.children=[c]),c}function f(a,b){a.data.note+=b+"\n"}function g(a){var b=/^(#+)?\s*(.*)$/.exec(a);return{level:b[1]&&b[1].length||null,content:b[2],noteStart:a==k,noteClose:a==l,codeBlock:/^\s*```/.test(a)}}function h(a){if(/\S/.test(a.data.note)){for(var b=a.data.note.split("\n");b.length&&!/\S/.test(b[0]);)b.shift();for(;b.length&&!/\S/.test(b[b.length-1]);)b.pop();a.data.note=b.join("\n")}else a.data.note=null,delete a.data.note;a.children&&a.children.forEach(h)}var i=/\r\n|\r|\n/,j="",k="<!--Note-->",l="<!--/Note-->";return{fileDescription:"Markdown/GFM 格式",fileExtension:".md",mineType:"text/markdown",dataType:"text",encode:function(b){return a(b)},decode:function(a){return d(a)},recognizePriority:-1}}),KityMinder.registerProtocol("json",function(a){return{fileDescription:"KityMinder 格式",fileExtension:".km",dataType:"text",mineType:"application/json",encode:function(a){return JSON.stringify(a)},decode:function(a){return JSON.parse(a)}}}),kity.Browser.ie||KityMinder.registerProtocol("png",function(a){function b(a,b){return new Promise(function(b,c){var d=document.createElement("img");d.onload=function(){b(this)},d.onerror=function(a){c(a)},d.crossOrigin="",d.src=a})}function c(){var b,c,d,f,g,h=a.getPaper(),i=(h.container,a.getRenderContainer()),j=i.getRenderBox(),k=j.width+1,l=j.height+1;return b=h.shapeNode.getAttribute("transform"),h.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),i.translate(-j.x,-j.y),c=h.container.innerHTML,i.translate(j.x,j.y),h.shapeNode.setAttribute("transform",b),d=$(c).filter("svg"),d.attr({width:j.width+1,height:j.height+1,style:'font-family: Arial, "Microsoft Yahei","Heiti SC";'}),c=$("<div></div>").append(d).html(),c=c.replace(' xmlns="http://www.w3.org/2000/svg" xmlns:NS1="" NS1:ns1:xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:NS2="" NS2:xmlns:ns1=""',""),c=c.replace(/ /g," "),f=new Blob([c],{type:"image/svg+xml"}),g=e.createObjectURL(f),{width:k,height:l,dataUrl:g,xml:c}}function d(d){function f(a,b){a.save(),a.fillStyle=b,a.fillRect(0,0,j.width,j.height),a.restore()}function g(a,b,c,d){a.drawImage(b,c,d)}function h(a){try{var b=a.toDataURL("png");return b}catch(c){throw new Error("当前浏览器版本不支持导出 PNG 功能,请尝试升级到最新版本!")}}function i(){return"undefined"!=typeof window.canvg?new Promise(function(a){window.canvg(j,o.xml,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:s,offsetY:s,renderCallback:function(){a(h(j))}})}):b(r).then(function(a){return g(k,a,s,s),e.revokeObjectURL(r),h(j)})}var j=document.createElement("canvas"),k=j.getContext("2d"),l=a.getStyle("background").toString(),m=/url\((.+)\)/.exec(l),n=kity.Color.parse(l),o=c(),p=o.width,q=o.height,r=o.dataUrl,s=20;return j.width=p+2*s,j.height=q+2*s,m?b(m[1]).then(function(a){return f(k,k.createPattern(a,"repeat")),i()}):(f(k,n.toString()),i())}var e=window.URL||window.webkitURL||window;return{fileDescription:"PNG 图片",fileExtension:".png",mineType:"image/png",dataType:"base64",encode:d,recognizePriority:-1}}),kity.Browser.ie||KityMinder.registerProtocol("svg",function(a){return{fileDescription:"SVG 矢量图",fileExtension:".svg",mineType:"image/svg+xml",dataType:"text",encode:function(b){var c,d,e=a.getPaper(),f=e.shapeNode.getAttribute("transform"),g=a.getRenderContainer(),h=g.getRenderBox(),i=(g.getTransform(),h.width),j=h.height,k=20;return e.shapeNode.setAttribute("transform","translate(0.5, 0.5)"),c=e.container.innerHTML,e.shapeNode.setAttribute("transform",f),
- d=$(c).filter("svg"),d.attr({width:i+2*k|0,height:j+2*k|0,style:'font-family: Arial, "Microsoft Yahei", "Heiti SC"; background: '+a.getStyle("background")}),d[0].setAttribute("viewBox",[h.x-k|0,h.y-k|0,i+2*k|0,j+2*k|0].join(" ")),c=$("<div></div>").append(d).html(),c=$("<div></div>").append(d).html(),c=c.replace(/ /g," ")},recognizePriority:-1}}),function(){var a=[];KityMinder.registerUI=function(b,c,d){"function"==typeof c&&(d=c,c=null),a.push({id:b,ui:d,deps:c})},kity.extendClass(Minder,{initUI:function(){var b=this._ui={},c=this;a.forEach(function(a){var d=a.deps;d&&(d=d.map(function(a){return c.getUI(a)})),b[a.id]=a.ui.apply(null,[c].concat(d||[]))}),$("#content-wrapper").delegate("#panel, #tab-container, .fui-dialog, #main-menu","keydown keyup",function(a){a.stopPropagation()}),$("#content-wrapper").delegate("input","mousedown mousemove mouseup contextmenu",function(a){a.stopPropagation()}),c.getPaper().addClass("loading-target"),this.fire("interactchange"),this.fire("uiready")},getUI:function(a){return this._ui[a]}}),$.ajaxSetup({cache:!1}),$.extend($,{pajax:function(){var a=$.ajax.apply($,arguments);return new Promise(function(b,c){a.done(b),a.fail(function(a,b,d){var e=new Error(b);e.getDetail=function(){try{return"jQuery XHR Error: \n"+JSON.stringify(d)}catch(a){return d}},c(e)})})}}),$(function(){var a=["kmcat_warn.png","kmcat_sad.png","icons.png","template_large.png","history.png","feedback.png","iconpriority.png","iconprogress.png","template.png","layout.png","next-level.png","prev-level.png"];a.forEach(function(a){(new Image).src="ui/theme/default/images/"+a})})}(),KityMinder.registerUI("eve",function(a){return{setup:function(a){var b={};return a.on=function(a,c){var d=b[a]||(b[a]=[]);return d.push(c),this},a.off=function(a,c){var d=b[a];if(d){var e=d.indexOf(c);~e?d.splice(e,1):c[a]=null}return this},a.once=function(b,c){return this.on(b,function d(){c.apply(a,arguments),a.off(b,d)})},a.fire=function(c){var d=b[c],e=[].slice.call(arguments,1);return d&&d.forEach(function(b){b.apply(a,e)}),this},a}}}),KityMinder.registerUI("memory",function(){var a=window.localStorage,b=a.uiMemory?JSON.parse(a.uiMemory):{};return{get:function(a){return b[a]||null},set:function(c,d){b[c]=d,a.uiMemory=JSON.stringify(b)}}}),kity.extendClass(FUI.Widget,{setEnable:function(a){a===!1?this.disable():this.enable()},setActive:function(a){a===!1?this.removeClass("active"):this.addClass("active")},bindExecution:function(a,b){var c=this;c.on(a,function(){c.interactFlag||b.apply(c,arguments)})},bindCommandState:function(a,b,c){var d=this;a.on("interactchange",function(){if(d.interactFlag=!0,c){var a=this.queryCommandValue(b);a!=d.lastHandleCommandValue&&(c.call(d,a),d.lastHandleCommandValue=a)}d.setEnable(-1!==this.queryCommandState(b)),d.setActive(1===this.queryCommandState(b)),d.interactFlag=!1})}}),KityMinder.registerUI("axss",function(){function a(a){var b=document.createElement("div");b.innerHTML=a,$(b).find("script, iframe, link").remove();for(var c in b)0===c.indexOf("on")&&b.removeAttribute(c);return b.innerHTML}return a}),KityMinder.registerUI("fiox",function(a){var b=a.getUI("eve");b.setup(fio.user),fio.user.init({apiKey:"wiE55BGOG8BkGnpPs6UNtPbb"})}),KityMinder.registerUI("widget/commandbutton",function(a){return{generate:function(b,c){var d=new FUI.Button({label:a.getLang("ui.command."+b)||a.getLang("ui."+b),text:a.getLang("ui.command."+b)||a.getLang("ui."+b),className:["command-widget","command-button",b]});return d.bindExecution("click",c||function(){a.execCommand(b)}),d.bindCommandState(a,b),d}}}),KityMinder.registerUI("widget/commandbuttonset",function(a){function b(b,c){return c.map(function(c){var d=a.getLang([b,c].join("."))||c;return{label:d,text:d,value:c,className:[b,c].join(" ")}})}function c(c,d){var e=new FUI.Buttonset({id:"template-set",buttons:"object"==typeof d[0]?d:b(c,d),className:["command-widget","command-buttonset",c].join(" ")});return e.bindExecution("change",function(){a.execCommand(c,e.getValue())}),e.bindCommandState(a,c,function(a){this.selectByValue(a)}),e}return{generate:c}}),KityMinder.registerUI("widget/commandinputmenu",function(a){function b(b,c){var d=new FUI.InputMenu({menu:{items:c},input:{placeholder:a.getLang("ui."+b)},className:["command-widget","command-inputmenu",b]});d.bindCommandState(a,b,function(a){d.selectByValue(a)||d.clearSelect()});var e=-1;return d.bindExecution("select",function(c,f){~f.index?a.execCommand(b,f.value):d.select(e),e=f.index}),d}return{generate:b}}),KityMinder.registerUI("widget/commandselectmenu",function(a){function b(b,c){return c.map(function(c){var d=a.getLang([b,c].join("."))||c;return{clazz:"Button",label:d,text:d,value:c,className:[b,c].join(" ")}})}function c(c,d,e){var f=new FUI.SelectMenu({widgets:"object"==typeof d[0]?d:b(c,d),className:["command-widget","command-selectmenu",c].join(" "),column:e||3});return f.bindExecution("change",function(){a.execCommand(c,f.getValue())}),f.bindCommandState(a,c,function(a){void 0!==a&&this.selectByValue(a)}),f}return{generate:c}}),KityMinder.registerUI("widget/notice",function(a){function b(a,b){function c(){var b=a.text(),c=new RegExp("at.+"+o+".+\\:(\\d+)\\:(\\d+)\\)?","g");a.text(b.replace(c,function(a,b,c){var d={line:+b,column:+c},e=m.originalPositionFor(d),f=e.name;d={line:e.line,column:e.column},e=l.originalPositionFor(d),f=f||"<Anonymous>";var g="at "+f+" ("+e.source.replace("../","")+":"+e.line+":"+e.column+")";return-1!=g.indexOf("promise")&&(g="at <async> Promise."+f),g}))}if(o){if(l)return c();b.addClass("loading"),setTimeout(function(){b.removeClass("loading")},5e3);var d=document.createElement("script");d.onload=function(){Promise.all([$.pajax({url:o.replace("min.js","js.map"),dataType:"json"}),$.pajax({url:o.replace(".js",".map"),dataType:"json"})]).then(function(a){l=new window.sourceMap.SourceMapConsumer(a[0]),m=new window.sourceMap.SourceMapConsumer(a[1]),c(),b.removeClass("loading")})},d.src="lib/source-map.min.js",document.head.appendChild(d)}}function c(b,d,e){j.hasClass("show")||j.empty(),clearTimeout(c.ttl2),d?j.addClass("warn"):j.removeClass("warn");var f=a.getUI("menu/menu");j.css({top:f&&f.isVisible()?$("#main-menu .main-menu-level1").offset().top:$("#kityminder").offset().top+20}),j.append($("<p>").text(b)),j.addClass("show"),clearTimeout(c.ttl),e=e||(d?5e3:3e3),c.ttl=setTimeout(function(){j.removeClass("show"),c.ttl2=setTimeout(function(){j.empty()},1e3)},e)}function d(a){c(a,d)}function e(a){return a=a||new Error,"string"==typeof a&&(a=new Error(a)),a.getDetail?a:("undefined"!=typeof fio&&a instanceof fio.FileRequestError?(a.status?a.description=h.pcs_code[a.detail.error_code]:a.description=h.err_network,a.getDetail=function(){return JSON.stringify(a,null,4)}):"readyState"in a||(a.getDetail=function(){return a.stack||(new Error).stack}),a)}function f(c,d){1==arguments.length&&(d=c,c="unknown"),n.empty(),d=e(d);var j=$("<div>").addClass("error-content").appendTo(n);$("<h3>").text(h[c]||h.err_unknown).appendTo(j),$("<p>").text(d.message||d.description||h.unknownreason).appendTo(j);if(d.getDetail){var l=$("<div>").addClass("error-detail").append($('<a class="expander"></a>').text(a.getLang("ui.error_detail"))).appendTo(n),m=$("<div>").addClass("error-detail-wrapper").appendTo(l),o=$("<textarea>").attr("id","error-detail-content").text(d.getDetail()+"\n\n浏览器信息:"+navigator.userAgent).appendTo(m);b(o,m);var p=$("<button>").addClass("copy-and-feedback").text(a.getLang("ui.copy_and_feedback")).appendTo(m);p.attr("data-clipboard-target","error-detail-content"),g(p),i.get("show-error-detail")&&l.addClass("expanded")}return k.show(),k.getElement().style.top="180px",new Promise(function(a){f.resolve=a})}function g(b){if(window.ZeroClipboard){ZeroClipboard.config({swfPath:"lib/ZeroClipboard.swf",hoverClass:"hover",activeClass:"active"});var c=new window.ZeroClipboard(b);c.on("ready",function(){c.on("aftercopy",function(){k.hide(),a.getUI("topbar/feedback").click()})})}else b.remove()}var h=a.getLang("error_message"),i=a.getUI("memory"),j=$("<div>").addClass("notice-widget").appendTo("#content-wrapper"),k=($("<div>").addClass("error-mask"),new FUI.Dialog({width:500,height:"auto",prompt:!0,caption:h.title,className:"error-dialog"}).appendTo(document.getElementById("content-wrapper")));k.on("ok cancel",function(a){f.resolve&&f.resolve(a)});var l,m,n=$(k.getBodyElement()),o=function(){for(var a,b,c=[].slice.apply(document.getElementsByTagName("script"));a=c.pop();)if(b=/kityminder.*\.min\.js/.exec(a.src))return b[0];return!1}();return n.delegate(".error-detail a.expander","click",function(a){var b=$(a.target).closest(".error-detail").toggleClass("expanded"),c=b.hasClass("expanded");i.set("show-error-detail",c)}),{info:c,error:f,warn:d}}),KityMinder.registerUI("widget/friendlytimespan",function(a){function b(b){var c=Math.abs(b-new Date),d=c/1e3,e=d/60,f=e/60,g=f/24;return 60>d?a.getLang("ui.justnow",0|d):60>e?a.getLang("ui.minutesago",0|e):24>f?a.getLang("ui.hoursago",0|f):2>g?a.getLang("ui.yesterday"):30>=g?a.getLang("ui.daysago",0|g):a.getLang("ui.longago")}function c(a){a.text(b(a.data("time")))}function d(){$(".friendly-time").each(function(){c($(this))})}$.extend($.fn,{displayFriendlyTime:function(a){return this.each(function(){c($(this).addClass("friendly-time").data("time",a))})}}),setInterval(d,6e4)}),KityMinder.registerUI("widget/locallist",function(){function a(a,b){function c(){m=localStorage.getItem(a),m=m?JSON.parse(m):[],this.length=m.length}function d(){for(;m.length>b;)m.pop();localStorage.setItem(a,JSON.stringify(m)),this.length=m.length}function e(a){return m[a]}function f(a){m.splice(a,1),d()}function g(){m=[],d()}function h(a){m.unshift(a),d()}function i(a){return function(b,c){return b[a]==c}}function j(a,b){"string"==typeof a&&(a=i(a));for(var c=0;c<m.length;c++)if(a(m[c],b))return c;return-1}function k(a,b){return e(j(a,b))}function l(a){m.forEach(a),d()}var m;b=b||10,c.call(this),this.get=e,this.remove=f,this.findIndex=j,this.find=k,this.forEach=l,this.unshift=h,this.clear=g}return{use:function(b){return new a(b)}}}),KityMinder.registerUI("widget/netdiskfinder",function(a){function b(b,k){function l(){function c(e){function f(a){k.remove(),e.find(".icon").after('<span class="filename">'+a+"</span>"),e.removeClass("renaming"),e.attr("draggable",!0)}function g(){f(i.filename)}function h(){var c=k.val(),e=i.parentPath+c;return i.filename==c?g():fio.file.anlysisPath(c).extension!=i.extension?(k.addClass("invalid-name"),setTimeout(function(){k.removeClass("invalid-name")},500),k.select()):(b.addClass("loading"),void s(i.path,e).then(function(){var b=i.path;i.filename=c,i.path=e,f(c),j.fire("mv",b,e,G),d.info(a.getLang("ui.rename_success",c))})["catch"](function(a){d.error("err_rename",a),g()}).then(function(){b.removeClass("loading")}))}c.onprogress=!0;var i=e.data("file"),k=$("<input>").attr("type","text").addClass("new-dir-name fui-widget fui-selectable").val(i.filename).appendTo(e);e.removeAttr("draggable"),k.on("keydown",function(a){return 13==a.keyCode?h():27==a.keyCode?(a.stopPropagation(),g()):void 0}).on("blur",g),k.on("dragstart mousedown mouseup click dblclick",function(a){a.stopPropagation()}),setTimeout(function(){k[0].select()})}M.delegate(".file-list-item a.rename-button","click",function(a){var b=$(a.target).closest("li");b.find("span.filename").remove(),c(b),b.addClass("renaming"),a.stopPropagation()})}function m(){M.delegate(".file-list-item","dblclick",function(a){if(H!=g+"/"){if(t.onprogress)return t.onprogress.select();var b=$(a.target).closest("li"),c=b.data("file");c&&v(c)}}),M.delegate(".file-list-item","mousedown",function(a){if(t.onprogress)return t.onprogress.select();var b=$(a.target).closest("li"),c=b.data("file");c&&D(c&&c.path)})}function n(){L.delegate("a","click",function(a){if(t.onprogress)return t.onprogress.select();if($(a.target).hasClass("dir-back")){var b=H.split("/");return b.pop(),b.pop(),z(b.join("/"))}z($(a.target).data("path"))})}function o(){function c(a){var b=$(a.target);if(b.hasClass("file-list-item")){try{var c=kity.Browser.ie&&10==kity.Browser.version?"text":"text/plain";a.originalEvent.dataTransfer.setData(c,"FEX"),a.originalEvent.dataTransfer.setDragImage(b.find(".icon").get(0),12,12)}catch(d){}o=b.addClass("dragging"),I.addClass("drop-mode")}}function f(a){$(a.target).removeClass("dragging"),a.originalEvent.dataTransfer.dropEffect="move",a.preventDefault(),I.removeClass("drop-mode")}function g(a){$(a.target).hasClass("filename")&&a.preventDefault()}function i(a){var b=$(a.target).closest(".dir");b.addClass("drag-enter"),a.target!=b[0]&&b.addClass("enter-child")}function k(a){if($(a.target).hasClass("dir")){if($(a.target).hasClass("enter-child"))return $(a.target).removeClass("enter-child");$(a.target).removeClass("drag-enter")}}function l(c){function f(){s(m,l).then(function(){o.remove(),j.fire("mv",m,l,G),d.info(a.getLang("ui.move_success",i.filename,k.filename))})["catch"](function(a){d.error("err_move_file",a)}).then(function(){b.removeClass("loading")})}c.preventDefault();var g=$(c.target).closest(".dir").removeClass("drag-enter");if(g.hasClass("dir")){var i=o.data("file"),k=g.data("file"),l=k.path+"/"+i.filename,m=i.path;0!==l.indexOf(m)&&(!h||window.confirm(a.getLang("ui.move_file_confirm",i.filename,k.filename)))&&(b.addClass("loading"),e.then(f),h=!1)}}var m=".file-list-item",n=".dir",o=null;M.delegate(m,"dragstart",c).delegate(m,"dragend",f).delegate(n,"dragover",g).delegate(n,"dragenter",i).delegate(n,"dragleave",k).delegate(n,"drop",l),J.delegate(n,"dragover",g).delegate(n,"dragenter",i).delegate(n,"dragleave",k).delegate(n,"drop",l),M.delegate(m+" input","dragstart",function(a){a.stopPropagation(),a.preventDefault()})}function p(){z(g)}function q(){return fio.file.mkdir({path:g})}function r(){window.confirm(a.getLang("ui.recycle_clear_confirm"))&&(b.addClass("loading"),fio.file["delete"]({path:g}).then(function(){return e=q()}).then(function(){B([]),b.removeClass("loading")}))}function s(a,b){return fio.file.move({path:a,newPath:b,ondup:0===b.indexOf(g)?fio.file.DUP_RENAME:fio.file.DUP_FAIL})}function t(){function c(){e.remove(),t.onprogress=!1}function d(){var c=f.val();c&&(b.addClass("loading"),fio.file.mkdir({path:H+c}).then(function(){return new Promise(function(a){setTimeout(function(){a(y())},200)})},function(b){b.detail&&31061==b.detail.error_code&&(b.message="已存在同名目录");var c=a.getUI("widget/notice");c.error("err_mkdir",b),e.remove()}).then(function(){b.removeClass("loading"),t.onprogress=!1}))}if(t.onprogress)return t.onprogress.select();var e=$("<li>").addClass("file-list-item dir").prependTo(M);e.append('<span class="icon"></span>');var f=$("<input>").attr("type","text").addClass("new-dir-name fui-widget fui-selectable").val(a.getLang("ui.newdir")).appendTo(e);t.onprogress=f[0],f[0].select(),f.on("keydown",function(a){13==a.keyCode&&d(),27==a.keyCode&&(c(),a.stopPropagation())}).on("blur",d)}function u(a){return a>0?1:0>a?-1:0}function v(a){return a.isDir?z(a.path):void G.fire("fileclick",a)}function w(a){return new Promise(function(b,c){M.transit({x:a,opacity:0},100,b)})}function x(){return new Promise(function(a){M.css({x:-parseInt(M.css("x"))}).stop().transit({x:0,opacity:1},100,a)})}function y(){return z(H,!0)}function z(b,c){function d(a){if(!e&&b==f){for(var c=0;c<a.length;c++){a[c].path==g&&(e=Promise.resolve(!0));break}e=e||q()}}b=b||f;var h=fio.file.list({path:b}),i=c?Promise.resolve():w(-100*u(b.length-H.length));return H="/"==b.charAt(b.length-1)?b:b+"/",C(),Promise.all([h,i]).then(function(a){var b=a[0];return d(b),B(b)},function(b){var c=a.getUI("widget/notice");c.error("err_ls",b)})}function A(b){M.empty(),b.length?b.forEach(function(b){(b.isDir||k&&k(b))&&b.path!=g&&$("<li></li>").append('<span class="icon"></span>').append('<span class="filename">'+b.filename+"</span>").append('<a class="rename-button" title="'+a.getLang("ui.rename")+'">"'+a.getLang("ui.rename")+'"</a>').addClass("file-list-item").addClass(b.isDir?"dir":"file").data("file",b).attr("draggable",!0).appendTo(M)}):M.append('<li class="empty" disabled="disabled">'+a.getLang("ui.emptydir")+"</li>")}function B(a){a.sort(function(a,b){return a.isDir>b.isDir?-1:a.isDir==b.isDir&&a.createTime>b.createTime?-1:1}),A(a),i.forEach(function(b){b!=G&&b.pwd()==H&&b._renderFileList(a)}),x(),E(),G.fire("cd",H)}function C(){function b(b){e+=b+"/";var c=$("<a></a>").addClass("dir");return b==f?c.text(a.getLang("ui.mydocument")):".recycle"==b?(c.text(a.getLang("ui.recycle")),I.addClass("recycle-bin")):c.text(b),c.data("path",e).data("file",{path:e.substr(0,e.length-1),filename:b==f?a.getLang("ui.mydocument"):b})}L.empty(),L.append(H!=f&&H!=f+"/"?'<a class="dir-back">Back</a>':'<span class="my-document"></span>');var c=H.substr(f.length),d=c.split("/"),e="";I.removeClass("recycle-bin"),L.append(b(f)),d.forEach(function(a){a&&(L.append('<span class="spliter"></span>'),L.append(b(a)))})}function D(a){return N=a,E()}function E(){var a=!1;return M.find(".file-list-item").removeClass("selected").each(function(){var b=$(this).data("file");b&&b.path==N&&($(this).addClass("selected"),a=!0,M[0].focus(),G.fire("select",b,this))}),a||(N=!1),a}function F(){return H}var G=c.setup({});i.push(G);var H=f,I=$('<div class="netdisk-finder"></div>').appendTo(b),J=$('<div class="head"></div>').appendTo(I),K=$('<div class="control"></div>').appendTo(J),L=($("<a></a>").text(a.getLang("ui.mkdir")).attr("title",a.getLang("ui.mkdir")).addClass("button mkdir").appendTo(K).click(t),$("<a></a>").text(a.getLang("ui.recycle")).attr("title",a.getLang("ui.recycle")).addClass("button recycle dir").data("file",{path:g,filename:a.getLang("ui.recycle")}).appendTo(K).click(p),$("<a></a>").text(a.getLang("ui.recycle_clear")).attr("title",a.getLang("ui.recycle_clear")).addClass("button recycle-clear").appendTo(K).click(r),$('<div class="nav"></div>').appendTo(J)),M=$('<ul class="file-list"></ul>').appendTo(I),N=null;return a.on("uiready",function(){var c=a.getUI("topbar/user");c.requireLogin(b),fio.user.on("login",function(){z()})}),m(),o(),n(),l(),G._renderFileList=A,G.list=z,G.select=D,G.pwd=F,G.refresh=y,G}var c=a.getUI("eve"),d=a.getUI("widget/notice"),e=null,f="/apps/kityminder",g=f+"/.recycle",h=!0,i=[],j=c.setup({});return j.BASE_PATH=f+"/",j.RECYCLE_PATH=g+"/",j.on("mv",function(a,b,c){i.forEach(function(a){c!=a&&a.refresh()})}),j.generate=b,j}),KM.registerUI("widget/menutab",function(a){function b(b,c,d){var e=b.getButtons().length,f=b.appendTab({buttons:[{label:a.getLang("ui.menu."+c+"tab"),className:"tab-"+c}]});return d&&b.select(e),f[0].panel.getContentElement()}return{generate:b}}),KityMinder.registerUI("doc",function(a){function b(a,b){function c(a,b){for(var c=0;c in a&&c in b&&a[c]==b[c];)c++;return c in b?0:c}if("netdisk"==h.source){var d=a.split("/"),e=b.split("/"),f=h.path.split("/"),i=c(f,d);if(i){var j=e.concat(f.slice(i));h.path=j.join("/"),h.title=j.pop(),g.fire("docchange",h)}}}function c(b){if(l)return Promise.reject(new Error("doc was locked"));var c=b;return h=b,i=!0,a.importData(b.content,b.protocol).then(function(c){return b.title=b.title||a.getMinderTitle(),a.execCommand("camera",a.getRoot(),300),b.data=c,b.json=JSON.stringify(c),g.fire("docload",b),g.fire("docchange",b),b})["catch"](function(a){h=c,j.error("err_doc_resolve",a)}).then(function(b){return i=!1,b&&j.info(a.getLang("ui.load_success",b.title)),b})}function d(b){h=b,b.data=a.exportJson(),b.json=JSON.stringify(b.data),b.saved=!0,g.fire("docsave",b),g.fire("docchange",b)}function e(){return h}function f(b){return fio.user.current()?l?!1:b?h.saved:h.saved||window.confirm(a.getLang("ui.unsavedcontent","* "+h.title)):!0}var g=a.getUI("eve").setup({}),h={saved:!0},i=!1,j=a.getUI("widget/notice"),k=a.getUI("widget/netdiskfinder");k&&k.on("mv",b);var l=!1;return g.lock=function(){l=!0},g.unlock=function(){l=!1},setTimeout(function(){a.on("contentchange",function(){i||("netdisk"!=h.source?(h.title=a.getMinderTitle(),h.saved=!1):h.saved=h.json==JSON.stringify(a.exportJson()),g.fire("docchange",h))})},1e3),g.load=c,g.save=d,g.current=e,g.checkSaved=f,g}),KityMinder.registerUI("contextmenu",function(a){function b(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}function c(a,b){var c=a[0]-b[0],d=a[1]-b[1],e=Math.sqrt(c*c+d*d);return e}var d,e=kity.Browser.mac,f=$("<ul>").addClass("km-context-menu fui-popup-menu").appendTo("#content-wrapper");f.delegate("li","mousedown",function(b,c){var d=$(b.target).closest("li").data("menu");return d.fn?d.fn.call(a,a):d.command?a.execCommand(d.command):void 0}),$("#content-wrapper").on("contextmenu",function(a){a.preventDefault()}),$("#content-wrapper").on("mousedown",function(a){f.hide(),d=2==a.button?[a.pageX,a.pageY]:null}),a.on("mouseup",function(g){if(g.isRightMB()){g=g.originEvent;var h=c(d,[g.pageX,g.pageY]);if(!(isNaN(h)||h>5)){f.empty();var i=a.getContextMenu(),j=!0;if(i.forEach(function(c){var d=c.query||function(){return c.command&&0===a.queryCommandState(c.command)};if(d()){var g=a.getLang("ui.command."+c.command),h=$("<li>").addClass("fui-item").data("menu",c).appendTo(f),i=a.getCommandShortcutKey(c.command);i&&i.split("|").forEach(function(a){var c=$("<span>").addClass("shortcut").appendTo(h);a.split("+").forEach(function(a){var d=a.split("::");a=d.length>1?d[1]:d[0],$("<span>").addClass("shortcut-key "+a.toLowerCase()).text(b(a)).appendTo(c)}),e&&c.addClass("mac")}),h.append($("<div>").text(g).addClass("menu-label")),j=!1}c.divider&&!j&&($("<li>").addClass("divider").appendTo(f),j=!0)}),i.length){f.show();var k=g.pageX,l=g.pageY,m=f.outerWidth(),n=f.outerHeight(),o=document.body.clientWidth,p=document.body.clientHeight;k+m>o&&(k-=m),l+n>p&&(l-=n),f.offset({left:k,top:l})}}}})}),KityMinder.registerUI("nav",function(a){function b(b){function c(a){return(1-(a-g)/i)*j}function d(a){l.animate({y:c(a)},200)}var e=$("<div>").addClass("zoom-pan").appendTo(b),f=a.getOptions("zoom"),g=f[0],h=f[f.length-1],i=h-g,j=e.height(),k=$("<div>").addClass("origin").appendTo(e).css("y",c(100)),l=$("<div>").addClass("indicator").appendTo(e).css("y",c(100));return a.on("zoom",function(a){d(a.zoom)}),k.click(function(){a.execCommand("zoom",100)}),e}function c(){function b(){a.on("layout layoutallfinish",e),a.on("viewchange",f)}function c(){a.off("layout layoutallfinish",e),a.off("viewchange",f)}function d(){function b(b,c){var d=m;b.x=-b.x,b.y=-b.y;var e=a.getPaper().getViewPortMatrix();d=e.transformBox(d);var f=b.offset(d.width/2,d.height/2);a.getViewDragger().moveTo(f,c)}var c=!1;h.on("mousedown",function(a){c=!0,b(a.getPosition("top"),200),g.addClass("grab")}),h.on("mousemove",function(a){c&&b(a.getPosition("top"))}),$(window).on("mouseup",function(){c=!1,g.removeClass("grab")})}function e(){var b=a.getRenderContainer().getBoundaryBox();l=b;var c=30;h.setViewBox(b.x-c-.5,b.y-c-.5,b.width+2*c+1,b.height+2*c+1);var d=[],e=[];a.getRoot().traverse(function(a){var b=a.getLayoutBox();d.push("M",b.x,b.y,"h",b.width,"v",b.height,"h",-b.width,"z"),a.getConnection()&&a.parent&&a.parent.isExpanded()&&e.push(a.getConnection().getPathData())}),h.setStyle("background",a.getStyle("background")),d.length?i.fill(a.getStyle("root-background")).setPathData(d):i.setPathData(null),e.length?j.stroke(a.getStyle("connect-color"),"0.5%").setPathData(e):j.setPathData(null),f()}function f(){m=a.getViewDragger().getView(),k.setBox(m.intersect(l))}var g=$("<div>").addClass("preview-navigator").appendTo("#content-wrapper"),h=new kity.Paper(g[0]),i=h.put(new kity.Path),j=h.put(new kity.Path),k=h.put(new kity.Rect(100,100).stroke("red","1%")),l=new kity.Box,m=new kity.Box;return d(),g.show=function(){$.fn.show.call(this),b(),e(),f()},g.hide=function(){$.fn.hide.call(this),c()},window.u=e,g}function d(b){function c(){d.toggleClass("active").hasClass("active")?(b.show(),e.set("navigator-hidden",!1)):(b.hide(),e.set("navigator-hidden",!0))}var d=$("<div>").addClass("command-button nav-trigger");return d.append('<div class="fui-icon">'),d.click(c),d.attr("title",a.getLang("ui.navigator")),e.get("navigator-hidden")&&c(),c(),d}var e=a.getUI("memory"),f=$("<div>").addClass("nav-bar").appendTo("#content-wrapper"),g=a.getUI("widget/commandbutton"),h=(g.generate("zoom-in").appendTo(f[0]),b(f),g.generate("zoom-out").appendTo(f[0]),c());g.generate("hand").appendTo(f[0]),g.generate("camera",function(){a.execCommand("camera",a.getRoot(),600)}).appendTo(f[0]),d(h).appendTo(f)}),KityMinder.registerUI("topbar/moreservice",function(a){function b(){c.prependTo("#panel").moreService({button:{"float":"left",width:"40px",height:"40px","border-right":"1px solid rgba(255, 255, 255, .5)"}})}var c,d=$("<link>").attr("href","http://baiduoffice.duapp.com/public/assets/style/moreService.css").attr("rel","stylesheet");return $("head").append(d),$.getScript("http://baiduoffice.duapp.com/public/widget/moreService.js",b),c=$('<div id="moreservice"></div>')}),KityMinder.registerUI("menu/menu",function(a){function b(){k.css("display","block"),clearTimeout(h),h=setTimeout(function(){k.addClass("show"),i.fire("show")})}function c(){i.fire("hide"),k.removeClass("show"),a.getRenderTarget().focus(),h=setTimeout(function(){k.css("display","none")})}function d(){return k.hasClass("show")}function e(){$("#content-wrapper").hasClass("fullscreen")||(d()?c:b)()}function f(b,c){var d=j.generate(m,b,c);$("<h2></h2>").text(a.getLang("ui.menu."+b+"header")).appendTo(d);return d}function g(a,b){var c=f(a,b),d=(new FUI.Tabs).appendTo(c);return{$tabs:d,createSub:function(a,b){return j.generate(d,a,b)}}}var h,i=a.getUI("eve").setup({}),j=a.getUI("widget/menutab"),k=$("<div>").attr("id","main-menu").css("display","none").appendTo("#content-wrapper"),l=new FUI.Button({id:"main-menu-btn",label:a.getLang("ui.menu.mainmenutext")}).appendTo(document.getElementById("panel")),m=new FUI.Tabs({className:"main-menu-level1"}).appendTo(k[0]);return l.on("click",e),a.addShortcut("esc",e),i.show=b,i.hide=c,i.toggle=e,i.isVisible=d,i.createSub=f,i.createSubMenu=g,i.$panel=k,i.$button=l,i.$tabs=m,i}),KityMinder.registerUI("menu/header",function(a){var b=a.getUI("menu/menu"),c=$('<div class="main-menu-header"></div>').prependTo(b.$panel),d=$('<div class="main-menu-back-panel"></div>').appendTo(c),e=$('<div class="main-menu-title">众核脑图</div>').appendTo(c);new FUI.Button({className:"main-menu-back-button",label:a.getLang("ui.back")}).appendTo(d[0]).on("click",b.hide);return b.on("show",function(){var b=a.getUI("topbar/title");e.text(b.getTitle())}),c}),KityMinder.registerUI("menu/default",function(a){a.on("uiready",function(){function b(){d.$tabs.select(1),e.$tabs.select(2),g.$tabs.select(1),fio.user.check().then(function(a){a&&g.$tabs.select(0)}),h.$menu.$tabs.select(0)}function c(){var a=/(?:shareId|share_id)=(\w+)([&#]|$)/,b=a.exec(window.location)||a.exec(document.referrer);return b?h.loadShareFile():void fio.user.check().then(function(a){function b(){e.$tabs.select(3),i.openLast()}function c(){e.$tabs.select(0),f.loadLast()}var d=i.last(),g=f.last();a?g?d?g.time>d.time?c():b():c():d?b():e.$tabs.select(1):d?b():e.$tabs.select(2)})}var d=a.getUI("menu/menu"),e=a.getUI("menu/open/open"),f=a.getUI("menu/open/recent"),g=a.getUI("menu/save/save"),h=a.getUI("menu/share/share"),i=a.getUI("menu/open/draft");b(),c()})}),KityMinder.registerUI("menu/new/new",function(a){var b,c=a.getUI("menu/menu"),d=a.getUI("doc"),e=a.getUI("eve").setup({}),f=c.createSub("new"),g=$("<ul></ul>").addClass("new-file-template-select").appendTo(f),h=KityMinder.getTemplateList();for(var i in h)b=$("<li></li>").addClass("template-item").addClass(i).data("template",i).append("<a>"+a.getLang("template")[i]+"</a>").appendTo(g);return g.delegate(".template-item","click",function(b){if(d.checkSaved()){var e=$(b.target).data("template");d.load({content:{template:e,version:KityMinder.version,data:{text:a.getLang("template")[e]}},protocol:null,saved:!0}),c.hide()}}),e}),KityMinder.registerUI("menu/open/open",function(a){return a.getUI("menu/menu").createSubMenu("open",!0)}),KityMinder.registerUI("menu/open/recent",function(a){function b(a,b){function c(a,b){for(var c=0;c in a&&c in b&&a[c]==b[c];)c++;return c in b?0:c}var e=a.split("/"),f=b.split("/");g.forEach(function(a){var b=a.path.split("/"),d=c(b,e);if(d){var g=f.concat(b.slice(d));a.path=g.join("/"),a.filename=f.pop()}}),d()}function c(b){if("netdisk"==b.source){var c=g.findIndex("path",b.path);~c&&g.remove(c),g.unshift({path:b.path,filename:fio.file.anlysisPath(b.path).filename,title:a.getMinderTitle(),time:+new Date}),d()}}function d(){k.empty(),g.forEach(function(a){var b=$("<li></li>").addClass("recent-file-item").data("path",a.path).appendTo(k);$("<h4></h4>").addClass("file-name").text(a.filename).appendTo(b),$("<p></p>").addClass("file-title").text(a.title).appendTo(b),$("<span></span>").addClass("file-time").displayFriendlyTime(a.time).appendTo(b)})}var e=(a.getUI("menu/menu"),a.getUI("menu/open/open")),f=(a.getUI("widget/fileloader"),a.getUI("widget/friendlytimespan"),a.getUI("doc")),g=a.getUI("widget/locallist").use("recent"),h=a.getUI("widget/netdiskfinder"),i=$(e.createSub("recent")).addClass("recent-file-panel");a.on("uiready",function(){a.getUI("topbar/user").requireLogin(i)});var j=($("<h2></h2>").text(a.getLang("ui.recent")).appendTo(i),$("<button></button>").addClass("clear-recent-list").text(a.getLang("ui.clearrecent")).appendTo(i)),k=$("<ul></ul>").addClass("recent-file-list").appendTo(i);return k.delegate(".recent-file-item","click",function(b){if(f.checkSaved()){var c=a.getUI("menu/open/netdisk"),d=$(b.target).closest(".recent-file-item").data("path");c.open(d)}}),j.on("click",function(){window.confirm(a.getLang("ui.clearrecentconfirm"))&&(g.clear(),d())}),f.on("docload",c),f.on("docsave",c),h.on("mv",b),d(),{hasRecent:function(){return g.length},loadLast:function(){k.find(".recent-file-item").eq(0).click()},last:function(){return g.get(0)||null}}}),KityMinder.registerUI("menu/open/netdisk",function(a){function b(b,d){function e(){return fio.file.read({path:b,dataType:l.dataType})}function f(a){var b={protocol:k[a.extension].name,content:a.data.content,title:a.filename,source:"netdisk",path:a.path,saved:!0};return g.load(b)}function h(a){return d&&d(a)||i.error("err_load",a)}c.hide(),$(a.getRenderTarget()).addClass("loading");var j=fio.file.anlysisPath(b),l=k[j.extension];return e().then(f)["catch"](h).then(function(){$(a.getRenderTarget()).removeClass("loading")})}var c=a.getUI("menu/menu"),d=a.getUI("menu/open/open"),e=a.getUI("widget/netdiskfinder"),f=a.getUI("eve"),g=a.getUI("doc"),h=f.setup({}),i=a.getUI("widget/notice"),j=$(d.createSub("netdisk")).addClass("netdisk-open-panel"),k={};a.getSupportedProtocols().forEach(function(a){a.decode&&(k[a.fileExtension]=a)});var l=e.generate(j,function(a){return k[a.extension]});return l.on("fileclick",function(a){return g.checkSaved()?b(a.path):void 0}),h.open=b,h}),KityMinder.registerUI("menu/open/local",function(a){function b(b){function c(a,c){return new Promise(function(a,d){var e;"blob"==c.dataType?a(new fio.file.Data(b)):(e=new FileReader,e.onload=function(){a(new fio.file.Data(this.result))},e.onerror=d,e.readAsText(b,"utf-8"))})}function d(){var b=a.getUI("widget/notice");b.error("err_localfile_read")}function h(a){var b={content:a.content,protocol:j.name,title:i.filename,source:"local"};return e.load(b)}if(b){var i=new fio.file.anlysisPath(b.name),j=g[i.extension];return j&&j.decode?($(a.getRenderTarget()).addClass("loading"),c(b,j).then(h,d).then(function(){$(a.getRenderTarget()).removeClass("loading")})):(f.warn(a.getLang("ui.unsupportedfile")),Promise.reject())}}var c=a.getUI("menu/menu"),d=a.getUI("menu/open/open"),e=a.getUI("doc"),f=a.getUI("widget/notice"),g={},h=[];a.getSupportedProtocols().forEach(function(a){a.decode&&(g[a.fileExtension]=a,h.push(a.fileExtension))});var i=$(d.createSub("local")).addClass("local-file-open-panel");$("<h2>本地文件</h2>").appendTo(i);var j=$('<div class="pick-file"></div>').appendTo(i),k=$("<a></a>").text(a.getLang("ui.pickfile")).appendTo(j);$("<span></span>").text(a.getLang("ui.acceptfile",h.map(function(a){
- var b=g[a];return b.fileDescription+"("+a+")"}).join(", "))).appendTo(j);$('<div class="drop-file"></div>').append($("<span></span>").html(a.getLang("ui.dropfile"))).appendTo(i);k.click(function(){e.checkSaved()&&$('<input type="file" />').attr("accept",h.join()).on("change",function(a){b(this.files[0]),c.hide()}).click()});var l=$("#content-wrapper")[0];return l.addEventListener("dragover",function(a){a.preventDefault(),a.stopPropagation()},!1),l.addEventListener("drop",function(a){if(a.dataTransfer.files.length){if(a.preventDefault(),!e.checkSaved())return;b(a.dataTransfer.files[0]),c.hide()}},!1),{read:b}}),KityMinder.registerUI("menu/open/draft",function(a){function b(b){b.saved||(b==o?n&&j.remove(0):n=null,o=b,n=n||{},n.json=JSON.stringify(a.exportJson()),n.title=b.title,n.time=+new Date,n.path=b.path,n.source=b.source,j.unshift(n),d())}function c(){n&&(j.remove(0),n=null),d()}function d(){m.empty(),j.forEach(function(a){var b=$("<li></li>").addClass("draft-list-item").data("item",a).appendTo(m);$("<h4></h4>").addClass("draft-title").text(a.title).appendTo(b),$("<span></span>").addClass("file-time").displayFriendlyTime(a.time).appendTo(b)})}var e=a.getUI("menu/menu"),f=a.getUI("menu/open/open"),g=(a.getUI("widget/fileloader"),a.getUI("widget/friendlytimespan"),a.getUI("doc"));if(localStorage.drafts){var h=JSON.parse(localStorage.drafts),i=h.map(function(a){var b={};return b.json=a.data,b.time=+new Date(a.update),b.title=JSON.parse(a.data).data.text,b});delete localStorage.drafts,localStorage.draft=JSON.stringify(i)}var j=a.getUI("widget/locallist").use("draft"),k=$(f.createSub("draft")).addClass("draft-panel"),l=($("<h2></h2>").text(a.getLang("ui.menu.draftheader")).appendTo(k),$("<button></button>").addClass("clear-draft").text(a.getLang("ui.cleardraft")).appendTo(k)),m=$("<ul></ul>").addClass("draft-list").appendTo(k),n=null,o=null;return m.delegate(".draft-list-item","click",function(a){if(g.checkSaved()){var b=$(a.target).closest(".draft-list-item").data("item"),c=j.findIndex(function(a){return a==b});c>-1&&(n=b,j.remove(c),j.unshift(n),o={title:n.title,protocol:"json",content:n.json,path:n.path,source:n.source,saved:!1},g.load(o)),e.hide()}}),l.on("click",function(){window.confirm(a.getLang("ui.cleardraftconfirm"))&&(j.clear(),n=null,d())}),g.on("docsave",c),g.on("docchange",b),d(),{hasDraft:function(){return j.length},openLast:function(){m.find(".draft-list-item").eq(0).click()},last:function(){return j.get(0)||null}}}),KityMinder.registerUI("menu/save/save",function(a){return a.getUI("menu/menu").createSubMenu("save")}),KityMinder.registerUI("menu/save/netdisk",function(a){function b(){function a(a){a.saved||(clearTimeout(C),C=setTimeout(d,B))}q.on("docchange",a)}function c(){var a=q.current();return"netdisk"==a.source||m.isVisible()?void d():(m.$tabs.select(2),n.$tabs.select(0),m.show())}function d(){var b=q.current();if("netdisk"!=b.source)return Promise.resolve();var c=a.getUI("topbar/title").$title;return x.val(b.title),h(b.path,b.protocol,b,c,"leaveTheMenu")}function e(){var a=x.val(),b=fio.file.anlysisPath(a),c=b.extension;return c!=y.val()&&(x.val(c in t?b.name+y.val():a+y.val()),x[0].select()),x.val()}function f(){var a=e(),b=v.pwd()+a,c=q.current(),d=t[y.val()],f=v.select(b),g=c.path==b,h=f&&!g;return{filename:a,path:b,doc:c,protocol:d,exist:f,match:g,duplicated:h}}function g(){var b=f();(b.match||!b.exist||b.duplicated&&window.confirm(a.getLang("ui.overrideconfirm",b.filename)))&&h(b.path,b.protocol.name,b.doc,u)}function h(b,c,d,e,f,g){function h(a){return fio.file.write({path:b,content:a,ondup:fio.file.DUP_OVERWRITE})}function i(a){if(!a.modifyTime)throw new Error("File Save Error");f||m.hide(),d.path=a.path,d.title=a.filename,d.source="netdisk",d.protocol=c,q.save(d),q.unlock(),setTimeout(function(){v.list(v.pwd(),!0)},1499)}function j(a){s.error("err_save",a)}if(!D)return D=!0,q.lock(),e&&e.addClass("loading"),a.exportData(c).then(h).then(i,j).then(function(){e&&e.removeClass("loading"),D=!1})}function i(){var a=q.current();switch(a.source){case"netdisk":k(a);break;default:l(a)}x[0].select()}function j(a){x.val(a),e(a)}function k(a){if(fio.user.current()){var b=a.path,c=fio.file.anlysisPath(b);v.pwd()!=c.parentPath?v.list(c.parentPath).then(function(){v.select(b)}):v.select(b),j(c.filename)}}function l(a){j(a.title),v.select(null)}var m=a.getUI("menu/menu"),n=a.getUI("menu/save/save"),o=a.getUI("widget/netdiskfinder"),p=a.getUI("eve"),q=a.getUI("doc"),r=p.setup({}),s=a.getUI("widget/notice"),t={};a.getSupportedProtocols().forEach(function(a){a.encode&&a.decode&&(t[a.fileExtension]=a)}),delete t[".mm"],delete t[".xmind"];var u=$(n.createSub("netdisk",!0)).addClass("netdisk-save-panel"),v=o.generate(u,function(a){return t[a.extension]}),w=$('<div class="netdisk-save-select"></div>').appendTo(u);$("<label>").text(a.getLang("ui.saveas")).appendTo(w);var x=$("<input>").addClass("fui-widget fui-selectable").attr("type","text").attr("placeholder",a.getLang("ui.filename")).attr("title",a.getLang("ui.filename")).on("keydown",function(a){27==a.keyCode&&m.toggle(),13==a.keyCode&&g()}).appendTo(w),y=$("<select>").attr("title",a.getLang("ui.fileformat")).appendTo(w);for(var z in t){var A=t[z];if(!A.encode)return;$("<option>").text(A.fileDescription+"("+A.fileExtension+")").val(z).appendTo(y)}y.val(".km"),y.on("change",e);$("<button></button>").addClass("save-button").text(a.getLang("ui.save")).click(g).appendTo(w);m.on("show",i),v.on("fileclick",function(a){v.select(a.path),x.val(a.filename)}),r.quickSave=c,window.onbeforeunload=function(){var b=r.mute||window.location.href.indexOf("noask")>0;return q.checkSaved(!0)||b?void 0:a.getLang("ui.unsavedcontent","* "+q.current().title)};var B=a.getOptions("autoSave");B!==!1&&(B=isNaN(B)?3e3:1e3*B,b());var C=0,D=0;return r}),KityMinder.registerUI("menu/save/download",function(a){function b(b){var e=a.getMinderTitle()+b.fileExtension,g=b.mineType||"text/plain";f.addClass("loading");var h={download:!0,filename:e};a.exportData(b.name,h).then(function(a){if("freemind"!=b.name){switch(b.dataType){case"text":return c(d(g,a),e,"text");case"base64":return c(a,e,"base64");case"blob":return null}return null}})["catch"](function(b){var c=a.getUI("widget/notice");return c.error("err_download",b)}).then(function(a){f.removeClass("loading")})}function c(b,c,d){var e=1e5*+new Date+Math.floor(99999*Math.random());e=e.toString(36);var f=new Promise(function(a,b){function c(){return-1!=document.cookie.indexOf(e+"=1")?a([e,d]):(++d>f&&a([e,d]),void setTimeout(c,g))}var d=0,f=30,g=1e3;setTimeout(c,g)}),g=b.split(",")[1],h=$("<form></form>").attr({action:"download.php",method:"POST","accept-charset":"utf-8"});$("<input />").attr({name:"content",type:"hidden",value:decodeURIComponent(g)}).appendTo(h),$("<input />").attr({name:"type",type:"hidden",value:d}).appendTo(h),$("<input />").attr({name:"filename",type:"hidden",value:c}).appendTo(h);kity.Browser.ie&&$('<input name="iehack" value="1" />').appendTo(h),$('<input name="stamp" />').val(e).appendTo(h);var i=a.getUI("menu/save/netdisk");return i&&(i.mute=!0,setTimeout(function(){i.mute=!1},1e3)),h.appendTo("body").submit().remove(),f}function d(a,b){return"data:"+a+"; utf-8,"+encodeURIComponent(b)}var e=(a.getUI("menu/menu"),a.getUI("menu/save/save")),f=$(e.createSub("download")).addClass("download-panel"),g=($("<h2></h2>").text(a.getLang("ui.menu.downloadheader")).appendTo(f),$("<ul>").addClass("download-list").appendTo(f)),h=[];a.getSupportedProtocols().forEach(function(a){a.encode&&h.push(a)}),h.forEach(function(a){$("<li>").addClass(a.name).text(a.fileDescription+" ("+a.fileExtension+")").data("protocol",a).appendTo(g)}),g.delegate("li","click",function(a){var c=$(a.target).data("protocol");f.hasClass("loading")||b(c)})}),KityMinder.registerUI("menu/share/share",function(a){function b(b,c){function d(a,b){for(var c=0;c in a&&c in b&&a[c]==b[c];)c++;return c in b?0:c}var e=b.split("/"),f=c.split("/");H.then(function(b){var c=fio.user.check();b.forEach(function(b){var g=b.path.split("/"),h=d(g,e);if(h){var i=f.concat(g.slice(h));c.then(function(c){$.pajax({url:E,type:"POST",data:{action:"move",ak:c.access_token,id:b.id||b.shareMinder.id,path:i.join("/")}}).then(function(){C.info(a.getLang("ui.share_sync_success",b.title))})["catch"](function(a){C.error("err_share_sync_failed",a)})}),b.path=i.join("/")}}),u(b)})}function c(){var b=/(?:shareId|share_id)=(\w+)([&#]|$)/,c=b.exec(window.location)||b.exec(document.referrer);if(!c)return Promise.resolve(null);var f=c[1];$(a.getRenderTarget()).addClass("loading"),H.then(function(a){for(var b=0;b<a.length;b++){var c=a[b].id||a[b].shareMinder&&a[b].shareMinder.id;if(c==f&&a[b].path)return d(a[b])}return e(f)})}function d(b){var c=a.getUI("menu/open/netdisk");return C.info(a.getLang("ui.load_share_for_edit",b.title)),c.open(b.path,function(){return e(b)})}function e(b){function c(a){if(a.error)return void C.error("err_share_data",a.error);var b=a.shareMinder.data;return B.load({source:"share",content:b,protocol:"json",saved:!0,ownerId:a.uid,ownerName:a.uname})}var d=$(a.getRenderTarget()).addClass("loading");return $.pajax({url:"http://naotu.baidu.com/share.php",data:{action:"find",id:b},dataType:"json"}).then(c)["catch"](function(a){C.error("err_share_data",a)}).then(function(){d.removeClass("loading")})}function f(a){if(!a||!G)return null;for(var b=G.length;b--;)if(G[b].path==a)return G[b];return null}function g(a){F=a,a?s(a):r("none")}function h(){return $.pajax({url:"static/pages/createshare.html"}).then(function(b){var c=jhtmls.render(b);return y.html(c({lang:a.getLang("ui"),minder:a})),setTimeout(w,10),y})}function i(){z.append($("<h2>").text(a.getLang("ui.manage_share")).attr("id","manage-share-header"))}function j(b){b.delegate("input[name=sharetype]","click",function(a){var b={none:m,"public":p};b[a.target.value]()}),b.delegate("input#share-url","dblclick",function(){this.select()}),b.delegate("#copy-share-url","click",function(){if(kity.Browser.safari&&kity.Browser.safari<8){var b=$("#share-url");b.focus(),b.select(),window.alert(a.getLang("ui.clipboardunsupported"))}})}function k(){z.delegate(".share-item a","click",function(a){var b=$(a.target),c=b.closest(".share-item"),e=c.data("share");switch(!0){case b.hasClass("view-action"):return void window.open(q(e.id||e.shareMinder.id),"_blank");case b.hasClass("remove-action"):return c.addClass("loading"),void l(e).then(function(a){a&&a.deleted&&(G.splice(G.indexOf(e),1),c.slideUp(function(){c.remove()}),e==F&&n())}).then(function(){c.removeClass("loading")});case b.hasClass("edit-action"):return void d(e)}})}function l(b){return fio.user.check().then(function(c){return $.pajax(E,{type:"POST",data:{action:"remove",ak:c&&c.access_token,id:b.id||b.shareMinder.id},dataType:"json"})["catch"](function(b){var c=a.getUI("widget/notice");c.error("err_remove_share",b)})})}function m(){return F?(y.addClass("loading"),l(F).then(function(a){a&&a.deleted&&n(),y.removeClass("loading")})):void 0}function n(){F.$listItem&&F.$listItem.remove(),F=null,r("none")}function o(){var a=1e6;return(+new Date*a+Math.random()*--a).toString(36)}function p(b){return F?void 0:(y.addClass("loading"),fio.user.check().then(function(b){var c={shareMinder:{id:o(),data:JSON.stringify(a.exportJson())}},d=B.current();return"netdisk"==d.source&&(c.path=d.path),$.pajax(E,{type:"POST",data:{action:"insert",record:JSON.stringify(c),ak:b&&b.access_token},dataType:"json"}).then(function(a){if(a.error)throw new Error(a.error);return a})["catch"](function(b){var c=a.getUI("widget/notice");c.error("err_create_share",b)})}).then(function(a){a&&(g(a),H.then(function(){G.unshift(a),$("#manage-share-list").prepend(F.$listItem=v(a))})),y.removeClass("loading")}))}function q(a){var b=/^(.*?)(\?|\#|$)/.exec(window.location.href)[1];return b=b.split("edit.html")[0],b+"viewshare.html?shareId="+a}function r(a){var b=$("#public-share .share-body",y);"public"==a?b.show():b.hide(),$("#share-select input[name=sharetype][value="+a+"]",y).prop("checked",!0)}function s(b){var c=$("#public-share .share-body",y),d=q(b.id||b.shareMinder.id);$("#share-url",c).val(d)[0].select();var e=c.find(".share-qr-code").empty();new window.QRCode(e[0],{text:d,width:128,height:128,correctLevel:window.QRCode.CorrectLevel.M});var f=window._bd_share_config&&window._bd_share_config.common,g=window._bd_share_main&&window._bd_share_main.init;f&&g&&(f.bdTitle=f.bdText=a.getMinderTitle(),f.bdDesc=f.bdText=a.getLang("ui.sns_share_text",a.getMinderTitle(),d),f.bdUrl=d,g()),r("public")}function t(){return fio.user.check().then(function(a){return a?$.pajax(E,{type:"GET",data:{action:"list",ak:a&&a.access_token},dataType:"json"}).then(function(a){return G=a.list||[]}):void 0})}function u(b){a.getUI("widget/friendlytimespan");b&&(A.empty(),b.forEach(function(a){A.append(a.$listItem=v(a))}))}function v(b){var c=b.id||b.shareMinder&&b.shareMinder.id;if(c){var d=$("<li>").addClass("share-item").data("share",b);return $("<span>").addClass("title").text(b.title).appendTo(d),$("<span>").addClass("url").text(b.path?b.path.replace("/apps/kityminder",a.getLang("ui.mydocument")):q(c)).appendTo(d),b.ctime&&$("<span>").addClass("ctime").displayFriendlyTime(+b.ctime).appendTo(d),$("<a>").addClass("remove-action").text(a.getLang("ui.share_remove_action")).attr("title",a.getLang("ui.share_remove_action")).appendTo(d),$("<a>").addClass("view-action").text(a.getLang("ui.share_view_action")).attr("title",a.getLang("ui.share_view_action")).appendTo(d),b.path&&$("<a>").addClass("edit-action").text(a.getLang("ui.share_edit_action")).attr("title",a.getLang("ui.share_edit_action")).appendTo(d),d}}function w(){var b=$("#copy-share-url",y);if(window.ZeroClipboard){ZeroClipboard.config({swfPath:"lib/ZeroClipboard.swf",hoverClass:"hover",activeClass:"active"});var c=new window.ZeroClipboard(b);c.on("ready",function(){c.on("aftercopy",function(){b.text(a.getLang("ui.copied")).attr("disabled","disabled"),setTimeout(function(){b.text(a.getLang("ui.copy")).removeAttr("disabled")},3e3)})})}}var x=a.getUI("menu/menu").createSubMenu("share"),y=$(x.createSub("createshare")),z=$(x.createSub("manageshare")),A=$("<ul>").attr("id","manage-share-list").appendTo(z),B=a.getUI("doc"),C=a.getUI("widget/notice"),D=a.getUI("widget/netdiskfinder"),E="http://naotu.baidu.com/share.php";"local.host"==window.location.host;var F=null,G=[];h().then(j),i();var H=t();return H.then(u),H.then(k),a.on("uiready",function(){a.getUI("topbar/user").requireLogin(z)}),B.on("docload",function(a){"netdisk"!=a.source&&(F=null,r("none")),H.then(function(){var b=f(a.path);g(b)})}),B.on("docsave",function(a){if("netdisk"==a.source){var b=f(a.path);b&&fio.user.check().then(function(c){$.pajax({url:E,type:"POST",data:{action:"update",ak:c.access_token,id:b.id||b.shareMinder.id,record:a.json}}).then(function(){})["catch"](function(a){C.error("err_share_sync_fail",a)})})}}),D.on("mv",b),{$menu:x,loadShareFile:c}}),KityMinder.registerUI("menu/help/help",function(a){function b(b,d){function e(a){a=a.split("z").map(function(a){return parseInt(a,35)});var b=305,c=[],d=0;for(c.push(a[d]^b);void 0!==a[++d];)c.push(a[d]^c[d-1]);return String.fromCharCode.apply(null,c)}var g=jhtmls.render(b);f.html(g({lang:a.getLang("ui"),minder:a})),f.find(".shortcut-content").html(c(d)),kity.Browser.mac&&f.addClass("mac"),f.removeClass("loading"),f.find(".km-version").text(KityMinder.version);var h=0,i={1:"gctz8m5z8cpz61kz5vvz3uuz1a3az1hwtzbqdz124y",10:"gctz8m5z8cpz9tdz1dz2p1zcn3zalez6d3z2f7zbqdz124y",100:"hctz77uzd0az123kzr6u",1000:"gctzbs8z3kpz8nzclpz8nrzw8z8wwz3syz5oyzoiuz0zi7yzbqz7nbz77uzd0az123kzuu5z2f9z8ny",1000000:"96z1zjzoz27z2kz2oz23z22zbz2izrzoz2az5z27zpz2az3z24z3zbznzvzfzdzczez25z2cznzhzvz25z2dz2cz1z25z25z4z1vz29z1vz25z2ez2cz2nzgz1vz2lzizbzpzazjziz2nzdz1vz22z2z24z23z23zezez22z2ezsz25z22z3zbzbz25z2hzsz3z3z23z23z1vz1vzuzuziziz22z2ozmz22z5z27zpzpz22"};f.delegate(".shortcut-key","click",function(){var a=i[++h];a&&(window.alert(e(a)),h>1e6&&console.log(a))})}function c(a){function b(a){var b=d.exec(a);if(b)return f&&(c+="</section>"),c+="<section><h3>"+b[1]+"</h3>",void(f=!0);if(b=e.exec(a)){var g=b[1],h=b[2];return c+='<div class="shortcut-group"><span class="shortcut">',c+=g.replace(/\`(.+?)\`/g,function(a,b){return'<span class="shortcut-key '+b.toLowerCase()+'" title="'+b+'">'+b+"</span>"}),c+="</span>",c+='<span class="description">'+h+"</span>",void(c+="</div>")}}var c="",d=/##\s(.+)$/,e=/(.+?)\:\s(.+)$/,f=!1;return a.split("\n").forEach(b),f&&(c+="</section>"),c}var d=a.getUI("menu/menu"),e=$(d.createSub("help")),f=$('<div id="help-panel">').appendTo(e).addClass("loading");Promise.all([$.pajax({url:"static/pages/helpcontent.html",dataType:"text"}),$.pajax({url:"static/pages/operation."+a.getOptions("lang")+".txt",dataType:"text"})]).then(function(a){var c=a[0],d=a[1];b(c,d)})}),KityMinder.registerUI("menu/help/feedback",function(a){function b(b){var c=jhtmls.render(b);e.html(c({lang:a.getLang("ui"),minder:a})),e.on("click contextmenu keydown",function(a){a.stopPropagation()}),e.removeClass("loading"),e.find(".km-version").text(KityMinder.version)}var c=a.getUI("menu/menu"),d=$(c.createSub("feedback")),e=$('<div id="feedback-panel">').appendTo(d).addClass("loading");$.pajax({url:"static/pages/feedback.html",dataType:"text"}).then(b)}),KityMinder.registerUI("topbar/quickvisit",function(a){function b(b,d){var e=$('<a class="quick-visit-button"></a>').text(a.getLang("ui.quickvisit."+b)).attr("title",a.getLang("ui.quickvisit."+b)).addClass(b);return d?c.push(e):e.appendTo("#panel"),e}var c=[],d=b("new"),e=b("save"),f=b("share"),g={$new:d,$save:e,$share:f};return a.on("uiready",function(){function b(){var b=a.getUI("doc");b.checkSaved()&&b.load({content:{template:"default",version:KityMinder.version,data:{text:a.getLang("maintopic")}},saved:!0})}function h(){a.getUI("menu/save/netdisk").quickSave()}function i(){var b=a.getUI("menu/menu");b.$tabs.select(3),b.show()}for(;c.length;)$("#panel #search").after(c.shift());d.click(b),e.click(h),f.click(i),a.addShortcut("ctrl+alt+n",b),a.addShortcut("ctrl+s",h),a.addShortcut("ctrl+alt+s",i),a.addShortcut("ctrl+shift+s",function(){var b=a.getUI("menu/menu");b.$tabs.select(2),b.show()}),g.ready=!0,g.quickNew=b,g.quickSave=h,g.quickShare=i}),g.add=b,g}),KityMinder.registerUI("topbar/history",function(a){var b={},c=a.getUI("widget/commandbutton");return["undo","redo"].forEach(function(a){b[a]=c.generate(a).appendTo(document.getElementById("panel"))}),b}),KityMinder.registerUI("topbar/user",function(a){function b(){fio.user.logout(),h.show(),i.hide(),fio.user.fire("logout"),window.location.href=window.location.href.split("edit.html")[0]+"index.html"}function c(){h.setLabel(a.getLang("ui.loggingin")),fio.user.login({remember:604800})}function d(){fio.user.login({remember:604800,force:!0})}function e(b){var c=$('<p class="login-tip"></p>').html(a.getLang("ui.requirelogin"));b.append(c),fio.user.on("login",function(){b.removeClass("login-required")}),fio.user.on("logout",function(){b.addClass("login-required")})}var f,g=(a.getUI("eve"),$('<div class="user-panel"></div>').appendTo("#panel")),h=($('<span class="loading-tip"></span>').text(a.getLang("ui.checklogin")).appendTo(g),new FUI.Button({label:a.getLang("ui.login"),text:a.getLang("ui.login"),className:"login-button"}).appendTo(g[0]).hide()),i=new FUI.Button({icon:{img:"data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="},className:"user-button"}).appendTo(g[0]).hide(),j=new FUI.PopupMenu({id:"user-menu"}).appendTo(document.getElementById("content-wrapper")).positionTo(i),k=j.getMenuWidget().show();return["userinfo","gotonetdisk","fui-spliter","switchuser","logout"].forEach(function(b){k.appendItem(new FUI.Item({label:a.getLang("ui."+b),className:b,value:b}))}),i.on("click",function(){j.open();var a=$(j.getElement()),b=$(i.getElement());a.offset({left:b.offset().left-a.outerWidth()+b.outerWidth()-10,top:b.offset().top+b.outerHeight()})}),k.on("select",function(a,c){switch(c.value){case"userinfo":window.open("http://i.baidu.com");break;case"gotonetdisk":window.open("http://pan.baidu.com/disk/home#path=/apps/kityminder");break;case"switchuser":d();break;case"logout":b()}k.clearSelect(),j.hide()}),a.on("uiready",function(){/*alert("skip login")*/}),h.on("click",c),$("#content-wrapper").delegate(".login-button","click",c),{getCurrent:function(){return f},loginLink:function(){return $("<a></a>").click(c)},requireLogin:e}}),KityMinder.registerUI("topbar/feedback",function(a){function b(){var b=a.getUI("menu/menu");b.$tabs.select(5),b.show()}var c=a.getUI("topbar/quickvisit"),d=c.add("feedback","right");return d.click(b),a.addShortcut("f1",b),d}),KityMinder.registerUI("topbar/search",function(a){function b(){f=[],a.getRoot().traverse(function(a){f.push(a)})}function c(b){function d(b,c){var d=a.getUI("ribbon/idea/notepreview");d&&d.hide(),a.execCommand("camera",b,50),setTimeout(function(){a.select(b,!0),b.isExpanded()||a.execCommand("expand",!0),c&&d&&d.preview(b,c)},60)}if(!/\S/.exec(b))return e[0].focus(),void e[0].select();b=b.toLowerCase();var g=c.lastKeyword!=b;c.lastKeyword=b;for(var h=g?0:c.lastIndex+1||0,i=h+f.length-1,j=h;i>=j;j++){var k=f[j%f.length],l=k.getText().toLowerCase();if(-1!=l.indexOf(b)){d(k),c.lastIndex=j;break}var m=k.getData("note");if(m&&-1!=m.indexOf(b)){d(k,b),c.lastIndex=j;break}}}var d=$('<div id="search"><input type="search" /></div>').appendTo("#panel"),e=d.find("input");a.addShortcut("ctrl+f",function(){e[0].focus(),e[0].select()}),e.on("keydown",function(a){13==a.keyCode&&c(e.val()),27==a.keyCode&&e[0].blur()});var f;return a.on("contentchange",b),d}),KityMinder.registerUI("topbar/title",function(a){function b(){function b(){setTimeout(function(){j=!1})}function c(){d(),b()}function k(){var f=m.val(),i=fio.file.anlysisPath(n),j=fio.file.anlysisPath(f);if(!j.name.length)return c();f=j.name+i.extension;var k=fio.file.anlysisPath(o).parentPath+f;return k==o?c():(e.addClass("loading"),void fio.file.move({path:o,newPath:k}).then(function(){l.path=k,l.title=f,g.fire("mv",o,k),h.info(a.getLang("ui.rename_success",f))})["catch"](function(a){h.error("err_rename",a)}).then(function(){e.removeClass("loading"),d(),b()}))}if(i&&!j){var l=f.current(),m=$("<input>").width(e.find(".title-content").width()),n=l.title,o=l.path;m.val(n),setTimeout(function(){m[0].select()}),e.addClass("rename-mode"),e.empty(),e.append(m),j=!0,m.on("keydown",function(a){13==a.keyCode?k():27==a.keyCode&&(c(),a.stopPropagation())}).on("blur",c)}}function c(a){i=a,a?e.addClass("rename-enabled"):e.removeClass("rename-enabled")}function d(){function b(c){b.lastValue!=c&&(c=c||a.getLang("ui.untitleddoc"),e.empty().append($('<span class="title-content"></span>').text(c)),document.title=c?c+" - 众核脑图":"众核脑图",b.lastValue=c)}var d=f.current();b(d.saved?d.title:"* "+d.title),c("netdisk"==d.source&&d.saved)}var e=$("<h1>").appendTo("#panel"),f=a.getUI("doc"),g=a.getUI("widget/netdiskfinder"),h=a.getUI("widget/notice"),i=!1,j=!1;return f.on("docchange",d),e.on("click",b),d(),{$title:e,getTitle:function(){return f.current().title}}}),KityMinder.registerUI("ribbon/tabs",function(a){var b=a.getUI("memory"),c=new FUI.Tabs({buttons:["idea","appearence","view"].map(function(b){return a.getLang("ui.tabs."+b)})}),d=a.getUI("topbar/title").$title,e=$('<div id="tab-select"></div>'),f=$('<div id="tab-container"></div>');d.before(e),$("#panel").after(f),c.appendButtonTo(e[0]),c.appendPanelTo(f[0]);var g=0,h=!1;c.on("tabsselect",function(a,c){c.index==g?(f.toggleClass("collapsed"),e.toggleClass("collapsed")):(f.removeClass("collapsed"),e.removeClass("collapsed")),h||(b.set("ribbon-tab-collapsed",f.hasClass("collapsed")),b.set("ribbon-tab-index",c.index)),g=c.index}),c.idea=c.getPanel(0),c.appearence=c.getPanel(1),c.view=c.getPanel(2);var i=b.get("ribbon-tab-index"),j=b.get("ribbon-tab-collapsed");return h=!0,c.select(i||0),h=!1,j?(f.addClass("collapsed"),e.addClass("collapsed")):(f.removeClass("collapsed"),e.removeClass("collapsed")),c}),KityMinder.registerUI("ribbon/idea/insert",function(a){var b=a.getUI("widget/commandbutton"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({label:a.getLang("panels.insert"),column:!0});return b.generate("appendchildnode").appendTo(d),b.generate("appendsiblingnode").appendTo(d),c.idea.appendWidget(d),d}),KityMinder.registerUI("ribbon/idea/arrange",function(a){var b=a.getUI("ribbon/tabs"),c=a.getUI("widget/commandbutton"),d=new FUI.LabelPanel({label:a.getLang("panels.arrange"),column:!0});return c.generate("arrangeup").appendTo(d),c.generate("arrangedown").appendTo(d),b.idea.appendWidget(d),d}),KityMinder.registerUI("ribbon/idea/operation",function(a){var b=a.getUI("widget/commandbutton"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({label:a.getLang("panels.nodeop"),column:!0}).appendTo(c.idea);["editnode","removenode"].forEach(function(a){b.generate(a).appendTo(d)})}),KityMinder.registerUI("ribbon/idea/attachment",function(a){var b=a.getUI("ribbon/tabs"),c=new FUI.LabelPanel({label:a.getLang("panels.attachment"),coloum:!0}).appendTo(b.idea);return c}),KityMinder.registerUI("ribbon/idea/link",function(a){function b(a){a?(h.addClass("validate-error"),k.text("地址格式错误"),j.disable()):(h.removeClass("validate-error"),k.text(""),j.enable())}var c=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/,d=a.getUI("ribbon/idea/attachment"),e=new FUI.ButtonMenu({id:"link-button-menu",text:a.getLang("ui.link"),layout:"bottom",buttons:[{},{label:a.getLang("ui.link")}],menu:{items:[a.getLang("ui.removelink")]}}).appendTo(d);e.bindCommandState(a,"hyperlink");var f=new FUI.Dialog({width:600,height:200,prompt:!0,caption:a.getLang("ui.link")}).appendTo(document.getElementById("content-wrapper")),g=$(f.getBodyElement());g.html(['<p><label>连接地址:</label><input type="url" class="link-href fui-widget fui-selectable" /></p>','<p><label>提示文本:</label><input type="text" class="link-title fui-widget fui-selectable" /></p>'].join(""));var h=g.find(".link-href"),i=g.find(".link-title"),j=f.getButton(0),k=$('<span class="validate-error"></span>');return h.after(k),h.on("input",function(){var a=h.val();b(!c.test(a))}),e.on("buttonclick",function(){f.open(),h[0].focus()}),e.on("select",function(){a.execCommand("unhyperlink")}),f.on("ok",function(){a.execCommand("hyperlink",h.val(),i.val()||"")}),f.on("open",function(){var c=a.queryCommandValue("hyperlink");h.val(c.url),i.val(c.title),b(!1)}),$(a.getPaper().getNode()).delegate("a","click",function(b){var c=$(b.target).closest("a"),d=c.prop("href").baseVal;window.confirm(a.getLang("ui.redirect",d))&&window.open(d,"_blank"),b.preventDefault()}),e}),KityMinder.registerUI("ribbon/idea/image",function(a){function b(){this.init()}function c(a){return a?(j.addClass("validate-error"),m.text("图片无法加载")):(j.removeClass("validate-error"),m.text("")),a}var d=a.getUI("ribbon/idea/attachment"),e=new FUI.ButtonMenu({id:"image-button-menu",text:a.getLang("ui.image"),layout:"bottom",buttons:[{},{label:a.getLang("ui.image")}],menu:{items:[a.getLang("ui.removeimage")]}}).appendTo(d);e.bindCommandState(a,"image");var f=new FUI.Dialog({width:600,height:600,prompt:!0,className:"image-dialog",caption:a.getLang("ui.image")}).appendTo(document.getElementById("content-wrapper")),g=$(f.getBodyElement()),h=new FUI.Tabs({buttons:["图片搜索","插入图片"]});g.html(['<div id="img_buttons"></div>','<div id="img_panels"></div>'].join("")),h.appendButtonTo(document.getElementById("img_buttons")),h.appendPanelTo(document.getElementById("img_panels")),h.getPanel(0).getContentElement().innerHTML=['<div class="searchBar"><label>关键字:</label><input id="img_searchTxt" type="text" placeholder="请输入搜索关键词">','<button id="img_searchBtn">百度一下</button></div>','<div id="img_searchList"><ul id="img_searchListUl"></ul></div>'].join(""),h.getPanel(1).getContentElement().innerHTML=['<p><label>图片地址:</label><input type="url" class="image-url fui-widget fui-selectable" /></p>','<p><label>提示文本:</label><input type="text" class="image-title fui-widget fui-selectable" /></p>','<img class="image-preview" src="" style="max-height: 200px;" />'].join(""),$G=function(a){return document.getElementById(a)},b.prototype={lang:{searchRemind:"请输入搜索关键词",searchLoading:"图片加载中,请稍后……",searchRetry:"抱歉,没有找到图片!请重试一次!"},data:{imgUrl:"",imgTitle:""},init:function(){this.initEvents()},initEvents:function(){var a=this;$("#img_searchBtn").on("click",function(){var b=$G("img_searchTxt").value;b&&b!=a.lang.searchRemind&&a.getImageData()}),$("#img_searchTxt").on("focus",function(){var b=$G("img_searchTxt").value;b&&b==a.lang.searchRemind&&($G("img_searchTxt").value="")}),$("#img_searchTxt").on("keydown",function(a){var b=a.keyCode||a.which;return 13==b?($G("img_searchBtn").click(),!1):void 0}),$("#img_searchList").on("click",function(b){var c=b.target||b.srcElement,d=$(c).closest("li");a.data.imgUrl=d.find("img").attr("src"),a.data.imgTitle=d.find("span").attr("title"),d.siblings(".selected").removeClass("selected"),d.addClass("selected")})},scale:function(a,b,c){var d=a.width,e=a.height;d>=e?(a.width=b*d/e,a.height=c,a.style.marginLeft="-"+parseInt((a.width-b)/2)+"px"):(a.width=b,a.height=c*e/d,a.style.marginTop="-"+parseInt((a.height-c)/2)+"px")},getImageData:function(){var a=this,b=$G("img_searchTxt").value,c="1";url="http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&st=-1&tn=baiduimagejson&istype=2&rn=3200&fm=index&pv=&word="+b+"&ie=utf-8&oe=utf-8&keeporiginname="+c+"&"+ +new Date,$G("img_searchListUl").innerHTML=a.lang.searchLoading,$.ajax({url:url,dataType:"jsonp",scriptCharset:"GB18030",success:function(b){var c=[];if(b&&b.data)for(var d=0;d<b.data.length;d++)b.data[d].objURL&&c.push({title:b.data[d].fromPageTitleEnc,src:b.data[d].objURL,url:b.data[d].fromURL});a.setList(c)},error:function(){$G("img_searchListUl").innerHTML=a.lang.searchRetry}})},setList:function(a){var b,c,d,e,f=this,g=$G("img_searchListUl");if(g.innerHTML="",a.length)for(b=0;b<a.length;b++)c=document.createElement("li"),d=document.createElement("img"),e=document.createElement("span"),d.setAttribute("src",a[b].src),e.innerHTML=a[b].title,c.appendChild(d),c.appendChild(e),g.appendChild(c),d.onerror=function(){$(this).closest("li").remove()};else g.innerHTML=f.lang.searchRetry},getInsertList:function(){for(var a,b,c=getAlign(),d=[],e=$G("img_searchListUl").children,f=0;f<e.length;f++)a=e[f].firstChild&&e[f].firstChild.firstChild,a.tagName&&"img"==a.tagName.toLowerCase()&&$(e[f]).hasClass("selected")&&(b=a.src,d.push({src:b,_src:b,alt:b.substr(b.lastIndexOf("/")+1),floatStyle:c}));return d}};var i=new b,j=g.find(".image-url"),k=g.find(".image-title"),l=g.find(".image-preview"),m=$('<span class="validate-error"></span>');return f.on("ok",function(){var b=h.getSelectedIndex();switch(b){case 1:a.execCommand("image",j.val(),k.val());break;case 0:a.execCommand("image",i.data.imgUrl,i.data.imgTitle)}}),f.on("open",function(){var b=a.queryCommandValue("image");j.val(b.url),k.val(b.title),l.attr("src",b.url||""),c(!1)}),j.after(m),j.on("input",function(){var a=j.val();/^https?\:\/\/(\w+\.)+\w+/.test(a)?(l.attr("src",a),c(!1),l.addClass("loading")):c(!0)}),l.on("load",function(){c(!1),l.removeClass("loading")}).on("error",function(){l.attr("src")&&c(!0),l.removeClass("loading")}),e.on("buttonclick",function(){f.open(),j[0].focus()}),e.on("select",function(){a.execCommand("removeimage")}),e}),KityMinder.registerUI("ribbon/idea/note",function(a){function b(){if(r&&t!=a.getSelectedNode()){t=a.getSelectedNode();var b=a.queryCommandValue("note")||"";s.setValue(b),t?(k.removeAttr("disabled"),l.text("备注 - "+t.getText())):(k.attr("disabled","disabled"),l.text("选择节点添加备注")),o.hasClass(u)&&(q.html(h(marked(b))),q.find("a").attr("target","_blank"))}}function c(){t&&-1!=a.queryCommandState("note")&&a.execCommand("note",s.getValue())}function d(){if(!n.hasClass(u)){q.hide(),o.removeClass(u),p.show().addClass(u),n.addClass(u);var b=a.queryCommandValue("note")||"";s.setValue(b)}}function e(){o.hasClass(u)||(p.hide(),n.removeClass(u),q.html(h(marked(s.getValue()))).show(),q.find("a").attr("target","_blank"),
- o.addClass(u))}function f(){r=!0,k.show(),d(),b(),$("#content-wrapper").addClass("note-panel-visible")}function g(){r=!1,k.hide(),$("#content-wrapper").removeClass("note-panel-visible")}var h=a.getUI("axss");marked.setOptions({gfm:!0,breaks:!0});var i=a.getUI("ribbon/idea/attachment"),j=new FUI.ButtonMenu({id:"note-button-menu",text:a.getLang("ui.note"),layout:"bottom",buttons:[{},{label:a.getLang("ui.note")}],menu:{items:[a.getLang("ui.removenote")]}}).appendTo(i);j.on("select",function(){a.execCommand("note",null)});var k=$('<div id="note-panel"></div>'),l=$("<h2>节点备注</h2>").appendTo(k),m=($('<a class="close"></a>').appendTo(k).click(g),$('<div class="tab"><a class="edit-tab">编辑</a><a class="preview-tab">预览</a><a class="help" href="https://www.zybuluo.com/techird/note/46064" target="_blank">支持 GFM 语法书写</a></div>').appendTo(k)),n=m.find(".edit-tab"),o=m.find(".preview-tab"),p=$('<div class="note-editor"></div>').appendTo(k),q=$('<div class="note-preview"></div>').appendTo(k),r=!1;k.on("keydown keyup keypress mouedown mouseup click contextmenu",function(a){a.stopPropagation()});var s=new window.CodeMirror(p[0],{mode:"gfm",lineWrapping:!0,dragDrop:!1});a.on("uiready",function(){s.setSize("100%","100%")});var t=null;a.on("interactchange",b),s.on("change",c),j.bindCommandState(a,"note"),j.on("buttonclick",f),a.on("editnoterequest",f),$("#kityminder").after(k),g();var u="active-tab";n.click(d),o.click(e)}),KityMinder.registerUI("ribbon/idea/notepreview",function(a){function b(a,b){var d=a.getRenderer("NoteIconRenderer").getRenderShape(),g=d.getRenderBox("screen"),h=a.getData("note");e[0].scrollTop=0;var i=marked(h);b&&(i=i.replace(new RegExp("("+b+")","ig"),'<span class="highlight">$1</span>')),e.html(c(i));var j=$("#content-wrapper").width(),k=$("#content-wrapper").height(),l=e.outerWidth(),m=e.outerHeight(),n=g.cx-l/2,o=g.bottom+10;0>n&&(n=10),n+l>j&&(n=j-l-10),o+m>k&&(o=g.top-m-10),e.css({left:Math.round(n),top:Math.round(o)}),e.show();var p=e[0].querySelector(".highlight");p&&p.scrollIntoView(),f=!0}var c=a.getUI("axss");marked.setOptions({gfm:!0,breaks:!0});var d,e=$('<div id="note-previewer"></div>').appendTo("#content-wrapper");a.on("shownoterequest",function(a){d=setTimeout(function(){b(a.node)},300)}),a.on("hidenoterequest",function(){clearTimeout(d)});var f=!1;return $("#kityminder").on("mousedown mousewheel DOMMouseScroll",function(){f&&(e.fadeOut(),f=!1)}),e.hide(),e.delegate("a","click",function(b){var c=$(b.target).closest("a"),d=c.prop("href");window.confirm(a.getLang("ui.redirect",d))&&window.open(d,"_blank"),b.preventDefault()}),{preview:b,hide:function(){e.hide()}}}),KityMinder.registerUI("ribbon/idea/priority",function(a){var b=a.getUI("widget/commandbuttonset"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({label:a.getLang("panels.priority")}).appendTo(c.idea);return b.generate("priority",[1,2,3,4,5,6,7,8,9,0].map(function(b){return{label:b,text:a.getLang("ui.priority")+b,value:b,className:["priority",b].join("-")}})).appendTo(d),d}),KityMinder.registerUI("ribbon/idea/progress",function(a){var b=a.getUI("widget/commandbuttonset"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({label:a.getLang("panels.progress")}).appendTo(c.idea);return b.generate("progress",[1,2,3,4,5,6,7,8,9,0].map(function(b){return{label:b,text:a.getLang("ui.progress.p"+b),value:b,className:["progress",b].join("-")}})).appendTo(d),d}),KityMinder.registerUI("ribbon/idea/resource",function(a){function b(){var b=h.getValue(),c=a.queryCommandValue("resource");/\S/.test(b)&&(~c.indexOf(b)||c.push(b),c.sort(),a.execCommand("resource",c)),h.setValue(null),e(),h.focus()}function c(a,b){return[a.join(","),b.join(",")].join(";")}function d(a,b){var e=c(a,b);return e==d.lastHash?!1:(d.lastHash=e,!0)}function e(){var b=a.queryCommandValue("resource"),c=a.getUsedResource();switch(c.sort(),a.queryCommandState("resource")){case 0:h.enable(),i.enable(),j.enable(),l.find("input[type=checkbox]").removeAttr("disabled");break;case-1:h.disable(),i.disable(),j.disable(),l.find("input[type=checkbox]").attr("disabled",!0)}if(d(b,c)){for(var e=c.length-l.children().length;e--;)l.append('<li><label><input type="checkbox" /><span></span></label></li>');for(;++e;)l.children().first().remove();c.forEach(function(c,d){var e=l.children().eq(d),f=e.find("label"),g=f.find("input"),h=f.find("span");g.data("resource",c),g.prop("checked",~b.indexOf(c)),h.text(c);var i=a.getResourceColor(c);e.css({color:i.dec("l",60).toString(),backgroundColor:~b.indexOf(c)?i:i.dec("a",.85).toRGBA()})})}}var f=(a.getUI("widget/commandbuttonset"),a.getUI("ribbon/tabs")),g=new FUI.LabelPanel({label:a.getLang("panels.resource"),id:"resource-panel"}).appendTo(f.idea),h=(new FUI.Input).appendTo(g);h.getElement().type="text";var i=new FUI.Button({label:"添加"}).appendTo(g),j=(new FUI.DropPanel).appendTo(g),k=$(j.getPanelElement()),l=$("<ul></ul>").addClass("resource-list").appendTo(k);return h.on("inputcomplete",function(a){b()}),i.on("click",b),k.delegate("input[type=checkbox]","change",function(){a.execCommand("resource",k.find("input[type=checkbox]:checked").map(function(a,b){return $(b).data("resource")}).toArray()),e()}),a.on("interactchange",e),g}),KityMinder.registerUI("ribbon/appearence/template",function(a){var b=a.getUI("widget/commandselectmenu"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({id:"template-panel",label:a.getLang("panels.template")}),e=KityMinder.Utils.keys(KityMinder.getTemplateList()),f=b.generate("template",e,2);return c.appearence.appendWidget(d),d.appendWidget(f),d}),KityMinder.registerUI("ribbon/appearence/theme",function(a){var b=a.getUI("widget/commandselectmenu"),c=a.getUI("ribbon/tabs"),d=new FUI.LabelPanel({id:"theme-panel",label:a.getLang("panels.theme")}),e=KityMinder.Utils.keys(KityMinder.getThemeList()),f=b.generate("theme",e.map(function(b){var c=KityMinder._themes[b];return{clazz:"Button",label:{text:a.getLang("theme."+b),style:{background:c["root-background"],color:c["root-color"],borderRadius:c["root-radius"]/2}},text:a.getLang("theme."+b),value:b,className:["theme",b].join(" ")}}));return c.appearence.appendWidget(d),d.appendWidget(f),a.on("themechange",function(b){$("#content-wrapper").css("background",a.getStyle("background"))}),d}),KityMinder.registerUI("ribbon/appearence/layout",function(a){var b=a.getUI("ribbon/tabs"),c=a.getUI("widget/commandbutton"),d=new FUI.LabelPanel({id:"layout-panel",label:a.getLang("panels.layout")}).appendTo(b.appearence);return c.generate("resetlayout").appendTo(d).addClass("large"),d}),KityMinder.registerUI("ribbon/appearence/style",function(a){var b=a.getUI("ribbon/tabs"),c=a.getUI("widget/commandbutton"),d=new FUI.LabelPanel({label:a.getLang("panels.style")}).appendTo(b.appearence);c.generate("clearstyle").addClass("large").appendTo(d);var e=new FUI.Panel({column:!0}).appendTo(d);return c.generate("copystyle").appendTo(e),c.generate("pastestyle").appendTo(e),d}),KityMinder.registerUI("ribbon/appearence/font",function(a){var b=a.getUI("ribbon/tabs"),c=a.getUI("widget/commandinputmenu"),d=a.getUI("widget/commandbutton"),e=new FUI.LabelPanel({label:a.getLang("panels.font"),id:"font-panel"}),f=new FUI.Panel({column:!0}),g=new FUI.Panel({column:!0}),h=c.generate("fontfamily",a.getOptions("fontfamily").map(function(a){return{label:{text:a.name,style:{fontFamily:a.val}},text:a.name,value:a.val}})),i=c.generate("fontsize",a.getOptions("fontsize").map(function(a){return{label:{text:a,style:{fontSize:a}},text:a,value:a}}));f.appendWidgets([h,i]);var j=d.generate("bold"),k=d.generate("italic");g.appendWidgets([j,k]),e.appendWidgets([f,g]),b.appearence.appendWidget(e)}),KityMinder.registerUI("ribbon/appearence/color",function(a){function b(){return["#e75d66","#fac75b","#99ca6a","#00c5ad","#3bbce0","#c9ced1","#425b71","white"]}var c=a.getUI("widget/commandbuttonset"),d=a.getUI("ribbon/tabs"),e=new FUI.LabelPanel({label:a.getLang("panels.color")}).appendTo(d.appearence),f=new FUI.LabelPanel({label:a.getLang("panels.background")}).appendTo(d.appearence),g=b();return e.appendWidget(c.generate("forecolor",g.map(function(a){return{icon:{style:{background:a}},label:a,text:a,value:a}})).addClass("color-picker")),f.appendWidget(c.generate("background",g.map(function(a){return{icon:{style:{background:a}},label:a,text:a,value:a}})).addClass("color-picker")),{color:e,background:f}}),KityMinder.registerUI("ribbon/view/fullscreen",function(a){function b(){$("#content-wrapper").toggleClass("fullscreen").hasClass("fullscreen")&&e.info(a.getLang("ui.fullscreen_exit_hint"),!1,4e3)}var c=a.getUI("widget/commandbutton"),d=a.getUI("ribbon/tabs"),e=a.getUI("widget/notice"),f=new FUI.LabelPanel({label:a.getLang("panels.level"),column:!0}).appendTo(d.view),g=c.generate("fullscreen",b).addClass("large").appendTo(f);return a.addShortcut("F11",b),a.addShortcut("Esc",function(){$("#content-wrapper").hasClass("fullscreen")&&$("#content-wrapper").removeClass("fullscreen")}),g}),KityMinder.registerUI("ribbon/view/level",function(a){var b=(a.getUI("widget/commandbutton"),a.getUI("ribbon/tabs")),c=new FUI.LabelPanel({label:a.getLang("panels.level"),column:!0}).appendTo(b.view),d=new FUI.ButtonMenu({id:"level-button-menu",text:a.getLang("ui.level"),layout:"bottom",buttons:[{},{label:a.getLang("ui.expandtoleaf")}],menu:{items:[1,2,3,4,5,6].map(function(b){return{label:a.getLang("ui.command.expandtolevel"+b),value:b}})}}).appendTo(c);d.on("buttonclick",function(){a.execCommand("expandtolevel",9999)}),d.on("select",function(b,c){a.execCommand("expandtolevel",c.value)})}),KityMinder.registerUI("ribbon/view/select",function(a){var b=a.getUI("ribbon/tabs"),c=new FUI.LabelPanel({label:a.getLang("panels.level"),column:!0}).appendTo(b.view),d=new FUI.ButtonMenu({id:"select-button-menu",text:a.getLang("ui.select"),layout:"bottom",buttons:[{},{label:a.getLang("ui.selectall")}],menu:{items:["revert","siblings","level","path","tree"].map(function(b){return{label:a.getLang("ui.select"+b),value:b}})}}).appendTo(c),e={all:function(){var b=[];a.getRoot().traverse(function(a){b.push(a)}),a.select(b,!0)},revert:function(){var b=a.getSelectedNodes(),c=[];a.getRoot().traverse(function(a){-1==b.indexOf(a)&&c.push(a)}),a.select(c,!0)},siblings:function(){var b=a.getSelectedNodes(),c=[];b.forEach(function(a){a.parent&&a.parent.children.forEach(function(a){-1==c.indexOf(a)&&c.push(a)})}),a.select(c,!0)},level:function(){var b=a.getSelectedNodes().map(function(a){return a.getLevel()}),c=[];a.getRoot().traverse(function(a){-1!=b.indexOf(a.getLevel())&&c.push(a)}),a.select(c,!0)},path:function(){var b=a.getSelectedNodes(),c=[];b.forEach(function(a){for(;a&&-1==c.indexOf(a);)c.push(a),a=a.parent}),a.select(c,!0)},tree:function(){var b=a.getSelectedNodes(),c=[];b.forEach(function(a){a.traverse(function(a){-1==c.indexOf(a)&&c.push(a)})}),a.select(c,!0)}};d.on("buttonclick",e.all),d.on("select",function(a,b){e[b.value]()})})}(window);
- //# sourceMappingURL=kityminder.edit.min.map
|