forked from reference-project/taobao_thumb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavalon.modern.min.js
2 lines (2 loc) · 60.3 KB
/
avalon.modern.min.js
1
2
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("Avalon requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(){avalon.config.debug&&console.log.apply(console,arguments)}function r(){return Object.create(null)}function i(){}function o(e,t){"string"==typeof e&&(e=e.match(bt)||[]);for(var n={},a=void 0!==t?t:1,r=0,i=e.length;i>r;r++)n[e[r]]=a;return n}function l(){if(e.VBArray){var t=document.documentMode;return t?t:e.XMLHttpRequest?7:6}return 0}function s(e){if(e&&"object"==typeof e){var t=e.length,n=Tt.call(e);if(/(Array|List|Collection|Map|Arguments)\]$/.test(n))return!0;if("[object Object]"===n&&t===t>>>0)return!0}return!1}function c(e,t){if(e&&e.childNodes)for(var n,a=e.childNodes,r=0;n=a[r++];)if(n.tagName){var i=ft.createElementNS(Ft,n.tagName.toLowerCase());kt.forEach.call(n.attributes,function(e){i.setAttribute(e.name,e.value)}),c(n,i),t.appendChild(i)}}function u(e){for(var t in e)if(At.call(e,t)){var n=e[t];"function"==typeof u.plugins[t]?u.plugins[t](n):"object"==typeof u[t]?avalon.mix(u[t],n):u[t]=n}return this}function f(e){return(e+"").replace(Yt,"\\$&")}function p(e,t,n){if(Pt(t)||t&&t.nodeType)return!1;if(-1!==n.indexOf(e))return!1;if(-1!==Kt.indexOf(e))return!1;var a=n.$special;return e&&"$"===e.charAt(0)&&!a[e]?!1:!0}function d(e,t,n,a){switch(e.type){case 0:var r=e.get,i=e.set;if(Pt(i)){var o=a.$events,l=o[t];o[t]=[],i.call(a,n),o[t]=l}return r.call(a);case 1:return n;case 2:if(n!==a.$model[t]){var s=e.svmodel=m(a,t,n,e.valueType);n=s.$model;var c=en[s.$id];c&&c()}return n}}function v(e,t,n){if(Array.isArray(e)){var a=e.concat();e.length=0;var o=g(e);return o.pushArray(a),o}if(!e||e.nodeType>0||e.$id&&e.$events)return e;Array.isArray(e.$skipArray)||(e.$skipArray=[]),e.$skipArray.$special=t||r();var l={};n=n||{};var s=r(),c=r(),u=[];for(var f in e)!function(t,a){if(n[t]=a,p(t,a,e.$skipArray)){s[t]=[];var r=avalon.type(a),o=function(e){var t=o._name,n=this,a=n.$model,r=a[t],i=n.$events;return arguments.length?void(yt||(1===o.type||(e=d(o,t,e,n),o.type))&&(tn(r,e)||(a[t]=e,k(i[t]),h(n,t,e,r)))):0===o.type?(e=o.get.call(n),r!==e&&(a[t]=e,h(n,t,e,r)),e):(x(i[t]),o.svmodel||r)};"object"===r&&Pt(a.get)&&Object.keys(a).length<=2?(o.set=a.set,o.get=a.get,o.type=0,u.push(function(){var e={evaluator:function(){e.type=Math.random(),e.element=null,n[t]=o.get.call(l)},element:pt,type:Math.random(),handler:i,args:[]};Mt[ut]=e,o.call(l),delete Mt[ut]})):$t.test(r)?(o.type=2,o.valueType=r,u.push(function(){var e=v(a,0,n[t]);o.svmodel=e,e.$events[ht]=s[t]})):o.type=1,o._name=t,c[t]=o}}(f,e[f]);Kt.forEach(function(t){delete e[t],delete n[t]}),l=Object.defineProperties(l,nn(c),e);for(var m in e)c[m]||(l[m]=e[m]);l.$id=St(),l.$model=n,l.$events=s;for(f in Jt)l[f]=Jt[f];return Object.defineProperty(l,"hasOwnProperty",{value:function(e){return e in this.$model},writable:!1,enumerable:!1,configurable:!0}),u.forEach(function(e){e()}),l}function h(e,t,n,a){e.$events&&Jt.$fire.call(e,t,n,a)}function m(e,t,n,a){var r=e[t];if("array"===a)return Array.isArray(n)&&r!==n?(r._.$unwatch(),r.clear(),r._.$watch(),r.pushArray(n.concat()),r):r;var i=e.$events[t],o=r.$events.$withProxyPool;o&&(lt(o,"with"),r.$events.$withProxyPool=null);var l=v(n);return l.$events[ht]=i,en[l.$id]=function(e){for(;e=i.shift();)!function(e){avalon.nextTick(function(){var t=e.type;t&&Rt[t]&&(e.rollback&&e.rollback(),Rt[t](e,e.vmodels))})}(e);delete en[l.$id]},l}function g(e){var t=[];t.$id=St(),t.$model=e,t.$events={},t.$events[ht]=[],t._=v({length:e.length}),t._.$watch("length",function(e,n){t.$fire("length",e,n)});for(var n in Jt)t[n]=Jt[n];return avalon.mix(t,rn),t}function y(e,t,n,a,r,i,o){for(var l=this.length,s=2;--s;){switch(e){case"add":var c=this.$model.slice(t,t+n).map(function(e){return $t.test(avalon.type(e))?e.$id?e:v(e,0,e):e});an.apply(this,[t,0].concat(c)),this._fire("add",t,n);break;case"del":var u=this._splice(t,n);this._fire("del",t,n)}r&&(e=r,t=i,n=o,s=2,r=0)}return this._fire("index",a),this.length!==l&&(this._.length=this.length),u}function b(e,t){for(var n={},a=0,r=t.length;r>a;a++){n[a]=e[a];var i=t[a];i in n?(e[a]=n[i],delete n[i]):e[a]=e[i]}}function $(e){Mt[ut]=e,avalon.openComputedCollect=!0;var t=e.evaluator;if(t)try{var n=on.test(e.type)?e:t.apply(0,e.args);e.handler(n,e.element,e)}catch(a){delete e.evaluator;var r=e.element;if(3===r.nodeType){var i=r.parentNode;u.commentInterpolate?i.replaceChild(ft.createComment(e.value),r):r.data=Vt+e.value+qt}}avalon.openComputedCollect=!1,delete Mt[ut]}function x(e){var t=Mt[ut];e&&t&&avalon.Array.ensure(e,t)&&t.element&&w(t,e)}function w(e,t){e.$uuid=e.$uuid||St(),t.$uuid=t.$uuid||St();var n={data:e,list:t,$$uuid:e.$uuid+t.$uuid};ln[n.$$uuid]||(ln[n.$$uuid]=1,ln.push(n))}function C(e){e.element=null,e.rollback&&e.rollback();for(var t in e)e[t]=null}function A(e){try{if(!e.parentNode)return!0}catch(t){return!0}return e.msRetain?0:1===e.nodeType?"number"==typeof e.sourceIndex?0===e.sourceIndex:!Nt.contains(e):!avalon.contains(Nt,e)}function T(){for(var e,t=ln.length,n=t,a=0,r=[],i={},o={};e=ln[--t];){var l=e.data,s=l.type;i[s]?i[s]++:(i[s]=1,r.push(s))}var c=!1;if(r.forEach(function(e){cn[e]!==i[e]&&(o[e]=1,c=!0)}),t=n,c)for(;e=ln[--t];)l=e.data,void 0!==l.element&&o[l.type]&&A(l.element)&&(a++,ln.splice(t,1),delete ln[e.$$uuid],avalon.Array.remove(e.list,l),C(l),e.data=e.list=null);cn=i,sn=new Date}function k(e){if(e&&e.length){new Date-sn>444&&"object"==typeof e[0]&&T();for(var t,n=Et.call(arguments,1),a=e.length;t=e[--a];){var r=t.element;if(r&&r.parentNode)if(t.$repeat)t.handler.apply(t,n);else if("on"!==t.type){var o=t.evaluator||i;t.handler(o.apply(0,t.args||[]),r,t)}}}}function E(e,t,n){var a=setTimeout(function(){var r=e.innerHTML;clearTimeout(a),r===n?t():E(e,t,r)})}function M(e,t){var n=e.getAttribute("avalonctrl")||t.$id;e.setAttribute("avalonctrl",n),t.$events.expr=e.tagName+'[avalonctrl="'+n+'"]'}function O(e,t){for(var n,a=0;n=e[a++];)n.vmodels=t,Rt[n.type](n,t),n.evaluator&&n.element&&1===n.element.nodeType&&n.element.removeAttribute(n.name);e.length=0}function N(e,t){return e.priority-t.priority}function L(e,t){for(var a,i,o=e.hasAttributes()?avalon.slice(e.attributes):[],l=[],s=r(),c=0;i=o[c++];)if(i.specified&&(a=i.name.match(bn))){var u=a[1],f=a[2]||"",p=i.value,d=i.name;if(s[d]=p,xn[u]?(f=u,u="on"):wn[u]&&(n("warning!请改用ms-attr-"+u+"代替ms-"+u+"!"),"enabled"===u&&(n("warning!ms-enabled或ms-attr-enabled已经被废弃"),u="disabled",p="!("+p+")"),f=u,u="attr",e.removeAttribute(d),d="ms-attr-"+f,e.setAttribute(d,p),a=[d],s[d]=p),"function"==typeof Rt[u]){var v={type:u,param:f,element:e,name:a[0],value:p,priority:u in $n?$n[u]:10*u.charCodeAt(0)+(Number(f)||0)};if("html"===u||"text"===u){var h=P(p);avalon.mix(v,h),v.filters=v.filters.replace(Tn,function(){return v.type="html",v.group=1,""})}"ms-if-loop"===d&&(v.priority+=100),t.length&&(l.push(v),"widget"===u&&(e.msData=e.msData||s))}}var m=e.type;m&&s["ms-duplex"]&&(s["ms-attr-checked"]&&/radio|checkbox/.test(m)&&n("warning!"+m+"控件不能同时定义ms-attr-checked与ms-duplex"),s["ms-attr-value"]&&/text|password/.test(m)&&n("warning!"+m+"控件不能同时定义ms-attr-value与ms-duplex")),l.sort(N);var g=!0;for(c=0;v=l[c];c++){if(u=v.type,Cn.test(u))return O(l.slice(0,c+1),t);g&&(g=!An.test(u))}O(l,t),g&&!mn[e.tagName]&&Xt.test(e.innerHTML+e.textContent)&&(yn&&yn(e),j(e,t))}function j(e,t){for(var n=e.firstChild;n;){var a=n.nextSibling;S(n,n.nodeType,t),n=a}}function H(e,t){for(var n,a=0;n=e[a++];)S(n,n.nodeType,t)}function S(e,t,n){1===t?(D(e,n),e.msCallback&&(e.msCallback(),e.msCallback=void 0)):3===t&&zt.test(e.data)?I(e,n):u.commentInterpolate&&8===t&&!zt.test(e.nodeValue)&&I(e,n)}function D(e,t,n){var a=e.getAttribute("ms-skip"),r=e.getAttributeNode("ms-important"),i=e.getAttributeNode("ms-controller");if("string"!=typeof a){if(n=r||i){var o=avalon.vmodels[n.value];if(!o)return;t=n===r?[o]:[o].concat(t),e.removeAttribute(n.name),e.classList.remove(n.name),M(e,o)}L(e,t)}}function P(e){if(e.indexOf("|")>0){var t=e.replace(En,function(e){return Array(e.length+1).join("1")}),n=t.replace(kn,"ᄢ㍄").indexOf("|");if(n>-1)return{filters:e.slice(n),value:e.slice(0,n),expr:!0}}return{value:e,filters:"",expr:!0}}function R(e){for(var t,n,a=[],r=0;;){if(n=e.indexOf(Vt,r),-1===n)break;if(t=e.slice(r,n),t&&a.push({value:t,filters:"",expr:!1}),r=n+Vt.length,n=e.indexOf(qt,r),-1===n)break;t=e.slice(r,n),t&&a.push(P(t)),r=n+qt.length}return t=e.slice(r),t&&a.push({value:t,expr:!1,filters:""}),a}function I(e,t){var n=[];if(8===e.nodeType)var a=P(e.nodeValue),r=[a];else r=R(e.data);if(r.length){for(var i=0;a=r[i++];){var o=ft.createTextNode(a.value);a.expr&&(a.type="text",a.element=o,a.filters=a.filters.replace(Tn,function(){return a.type="html",a.group=1,""}),n.push(a)),Lt.appendChild(o)}e.parentNode.replaceChild(Lt,e),n.length&&O(n,t)}}function _(e){return e.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function F(e){return e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_][^-_]/g,function(e){return e.charAt(1).toUpperCase()})}function B(e){try{if("object"==typeof e)return e;e="true"===e?!0:"false"===e?!1:"null"===e?null:+e+""===e?+e:Mn.test(e)?JSON.parse(e):e}catch(t){}return e}function U(e){return e.window&&e.document?e:9===e.nodeType?e.defaultView:!1}function V(e,t){if(e.offsetWidth<=0){var n=getComputedStyle(e,null);if(Hn.test(n.display)){var a={node:e};for(var r in jn)a[r]=n[r],e.style[r]=jn[r];t.push(a)}var i=e.parentNode;i&&1===i.nodeType&&V(i,t)}}function q(e){var t=e.tagName.toLowerCase();return"input"===t&&/checkbox|radio/.test(e.type)?"checked":t}function z(e,t,n,a){for(var r,i=[],o=" = "+n+".",l=e.length;r=e[--l];)t.hasOwnProperty(r)&&(i.push(r+o+r),a.vars.push(r),"duplex"===a.type&&(e.get=n+"."+r),e.splice(l,1));return i}function W(e){for(var t=[],n={},a=0;a<e.length;a++){var r=e[a],i=r&&"string"==typeof r.$id?r.$id:r;n[i]||(n[i]=t.push(r))}return t}function X(e,t){return t=t.replace(Xn,"").replace(Yn,function(){return"],|"}).replace(Gn,function(e,t){return"["+Dn(t)}).replace(Zn,function(){return'"],["'}).replace(Jn,function(){return'",'})+"]","return avalon.filters.$filter("+e+", "+t+")"}function Y(e,t,a){var r=a.type,o=a.filters||"",l=t.map(function(e){return String(e.$id).replace(Wn,"$1")})+e+r+o,s=Vn(e).concat(),c=[],u=[],f=[],p="";t=W(t),a.vars=[];for(var d=0,v=t.length;v>d;d++)if(s.length){var h="vm"+ut+"_"+d;u.push(h),f.push(t[d]),c.push.apply(c,z(s,t[d],h,a))}if(c.length||"duplex"!==r){"duplex"!==r&&(e.indexOf("||")>-1||e.indexOf("&&")>-1)&&a.vars.forEach(function(t){var n=new RegExp("\\b"+t+"(?:\\.\\w+|\\[\\w+\\])+","ig");e=e.replace(n,function(n){var a=n.charAt(t.length),r=Dt?e.slice(arguments[1]+n.length):RegExp.rightContext,i=/^\s*\(/.test(r);if("."===a||"["===a||i){var o="var"+String(Math.random()).replace(/^0\./,"");if(i){var l=n.split(".");if(l.length>2){var s=l.pop();return c.push(o+" = "+l.join(".")),o+"."+s}return n}return c.push(o+" = "+n),o}return n})}),a.args=f;var m=qn.get(l);if(m)return void(a.evaluator=m);if(p=c.join(", "),p&&(p="var "+p),/\S/.test(o)){if(!/text|html/.test(a.type))throw Error("ms-"+a.type+"不支持过滤器");e="\nvar ret"+ut+" = "+e+";\r\n",e+=X("ret"+ut,o)}else{if("duplex"===r){var g="'use strict';\nreturn function(vvv){\n "+p+";\n if(!arguments.length){\n return "+e+"\n }\n "+(zn.test(e)?e:s.get)+"= vvv;\n} ";try{m=Function.apply(i,u.concat(g)),a.evaluator=qn.put(l,m)}catch(y){n("debug: parse error,"+y.message)}return}if("on"===r){-1===e.indexOf("(")?e+=".call(this, $event)":e=e.replace("(",".call(this,"),u.push("$event"),e="\nreturn "+e+";";var b=e.lastIndexOf("\nreturn"),$=e.slice(0,b),x=e.slice(b);e=$+"\n"+x}else e="\nreturn "+e+";"}try{m=Function.apply(i,u.concat("'use strict';\n"+p+e)),a.evaluator=qn.put(l,m)}catch(y){n("debug: parse error,"+y.message)}finally{s=c=u=null}}}function G(e,t,n,a,r){Array.isArray(a)&&(e=a.map(function(e){return e.expr?"("+e.value+")":Dn(e.value)}).join(" + ")),Y(e,t,n),n.evaluator&&!r&&(n.handler=It[n.handlerName||n.type],$(n))}function Z(e,t,n){var a=e.templateCache&&e.templateCache[t];if(a){for(var r,i=ft.createDocumentFragment();r=a.firstChild;)i.appendChild(r);return i}return avalon.parseHTML(n)}function J(e){return null==e?"":e}function Q(e,t,n){return t.param.replace(/\w+/g,function(a){var r=avalon.duplexHooks[a];r&&"function"==typeof r[n]&&(e=r[n](e,t))}),e}function K(){for(var e=sa.length-1;e>=0;e--){var t=sa[e];t()===!1&&sa.splice(e,1)}sa.length||clearInterval(la)}function et(e,t,n,a){var r=e.template.cloneNode(!0),i=avalon.slice(r.childNodes);n.$stamp&&r.insertBefore(n.$stamp,r.firstChild),t.appendChild(r);var o=[n].concat(e.vmodels),l={nodes:i,vmodels:o};a.push(l)}function tt(e,t){var n=e.proxies[t];return n?n.$stamp:e.element}function nt(e,t,n){for(;;){var a=t.previousSibling;if(!a)break;if(a.parentNode.removeChild(a),n&&n.call(a),a===e)break}}function at(e){var t={$host:[],$outer:{},$stamp:1,$index:0,$first:!1,$last:!1,$remove:avalon.noop};t[e]={get:function(){var t=this.$events,n=t.$index;t.$index=t[e];try{return this.$host[this.$index]}finally{t.$index=n}},set:function(e){this.$host.set(this.$index,e)}};var n={$last:1,$first:1,$index:1},a=v(t,n);return a.$id=St("$proxy$each"),a}function rt(e,t){for(var n,a=t.param||"el",r=0,i=pa.length;i>r;r++){var o=pa[r];o&&o.hasOwnProperty(a)&&(n=o,pa.splice(r,1))}n||(n=at(a));var l=t.$repeat,s=l.length-1;return n.$index=e,n.$first=0===e,n.$last=e===s,n.$host=l,n.$outer=t.$outer,n.$stamp=t.clone.cloneNode(!1),n.$remove=function(){return l.removeAt(n.$index)},n}function it(){var e=v({$key:"",$outer:{},$host:{},$val:{get:function(){return this.$host[this.$key]},set:function(e){this.$host[this.$key]=e}}},{$val:1});return e.$id=St("$proxy$with"),e}function ot(e,t){var n=da.pop();n||(n=it());var a=t.$repeat;return n.$key=e,n.$host=a,n.$outer=t.$outer,a.$events?n.$events.$val=a.$events[e]:n.$events={},n}function lt(e,t){var n="each"===t?pa:da;avalon.each(e,function(e,t){if(t.$events){for(var a in t.$events)Array.isArray(t.$events[a])&&(t.$events[a].forEach(function(e){"object"==typeof e&&C(e)}),t.$events[a].length=0);t.$host=t.$outer={},n.unshift(t)>u.maxRepeatSize&&n.pop()}}),"each"===t&&(e.length=0)}function st(e,t){var n="_"+e;if(!st[n]){var a=ft.createElement(e);Nt.appendChild(a),t=Ot?getComputedStyle(a,null).display:a.currentStyle.display,Nt.removeChild(a),st[n]=t}return st[n]}function ct(e,t,n,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var r=isFinite(+e)?+e:0,i=isFinite(+t)?Math.abs(t):3,o=a||",",l=n||".",s="",c=function(e,t){var n=Math.pow(10,t);return""+(Math.round(e*n)/n).toFixed(t)};return s=(i?c(r,i):""+Math.round(r)).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(s[1]||"").length<i&&(s[1]=s[1]||"",s[1]+=new Array(i-s[1].length+1).join("0")),s.join(l)}var ut=Date.now(),ft=e.document,pt=ft.head;pt.insertAdjacentHTML("afterBegin",'<avalon ms-skip class="avalonHide"><style id="avalonStyle">.avalonHide{ display: none!important }</style></avalon>');var dt,vt=pt.firstChild,ht="$"+ut,mt=e.require,gt=e.define,yt=!1,bt=/[^, ]+/g,$t=/^(?:object|array)$/,xt=/^\[object SVG\w*Element\]$/,wt=/^\[object (?:Window|DOMWindow|global)\]$/,Ct=Object.prototype,At=Ct.hasOwnProperty,Tt=Ct.toString,kt=Array.prototype,Et=kt.slice,Mt={},Ot=e.dispatchEvent,Nt=ft.documentElement,Lt=ft.createDocumentFragment(),jt=ft.createElement("div"),Ht={};"Boolean Number String Function Array Date RegExp Object Error".replace(bt,function(e){Ht["[object "+e+"]"]=e.toLowerCase()});var St=function(e){return e=e||"avalon",(e+Math.random()+Math.random()).replace(/0\./g,"")},Dt=l();avalon=function(e){return new avalon.init(e)},avalon.nextTick=new function(){function t(){for(var e=i.length,t=0;e>t;t++)i[t]();i=i.slice(e)}var n=e.setImmediate,a=e.MutationObserver,r=Ot&&e.postMessage;if(n)return n.bind(e);var i=[];if(a){var o=document.createTextNode("avalon");return new a(t).observe(o,{characterData:!0}),function(e){i.push(e),o.data=Math.random()}}return r?(e.addEventListener("message",function(n){var a=n.source;a!==e&&null!==a||"process-tick"!==n.data||(n.stopPropagation(),t())}),function(t){i.push(t),e.postMessage("process-tick","*")}):function(e){setTimeout(e,0)}},avalon.init=function(e){this[0]=this.element=e},avalon.fn=avalon.prototype=avalon.init.prototype,avalon.type=function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?Ht[Tt.call(e)]||"object":typeof e};var Pt=function(e){return"[object Function]"===Tt.call(e)};avalon.isFunction=Pt,avalon.isWindow=function(e){return wt.test(Tt.call(e))},avalon.isPlainObject=function(e){return"[object Object]"===Tt.call(e)&&Object.getPrototypeOf(e)===Ct},avalon.mix=avalon.fn.mix=function(){var e,t,n,a,r,i,o=arguments[0]||{},l=1,s=arguments.length,c=!1;for("boolean"==typeof o&&(c=o,o=arguments[1]||{},l++),"object"==typeof o||Pt(o)||(o={}),l===s&&(o=this,l--);s>l;l++)if(null!=(e=arguments[l]))for(t in e)n=o[t],a=e[t],o!==a&&(c&&a&&(avalon.isPlainObject(a)||(r=Array.isArray(a)))?(r?(r=!1,i=n&&Array.isArray(n)?n:[]):i=n&&avalon.isPlainObject(n)?n:{},o[t]=avalon.mix(c,i,a)):void 0!==a&&(o[t]=a));return o},avalon.mix({rword:bt,subscribers:ht,version:1.43,ui:{},log:n,slice:function(e,t,n){return Et.call(e,t,n)},noop:i,error:function(e,t){throw new(t||Error)(e)},oneObject:o,range:function(e,t,n){n||(n=1),null==t&&(t=e||0,e=0);for(var a=-1,r=Math.max(0,Math.ceil((t-e)/n)),i=new Array(r);++a<r;)i[a]=e,e+=n;return i},eventHooks:{},bind:function(e,t,n,a){var r=avalon.eventHooks,i=r[t];return"object"==typeof i&&(t=i.type,i.deel&&(n=i.deel(e,t,n,a))),n.unbind||e.addEventListener(t,n,!!a),n},unbind:function(e,t,n,a){var r=avalon.eventHooks,o=r[t],l=n||i;"object"==typeof o&&(t=o.type,o.deel&&(n=o.deel(e,t,n,!1))),e.removeEventListener(t,l,!!a)},css:function(e,t,n){e instanceof avalon&&(e=e[0]);var a,r=/[_-]/.test(t)?F(t):t;if(t=avalon.cssName(r)||r,void 0===n||"boolean"==typeof n){a=On[r+":get"]||On["@:get"],"background"===t&&(t="backgroundColor");var i=a(e,t);return n===!0?parseFloat(i)||0:i}if(""===n)e.style[t]="";else{if(null==n||n!==n)return;isFinite(n)&&!avalon.cssNumber[r]&&(n+="px"),a=On[r+":set"]||On["@:set"],a(e,t,n)}},each:function(e,t){if(e){var n=0;if(s(e))for(var a=e.length;a>n&&t(n,e[n])!==!1;n++);else for(n in e)if(e.hasOwnProperty(n)&&t(n,e[n])===!1)break}},getWidgetData:function(e,t){var n=avalon(e).data(),a={};for(var r in n)0===r.indexOf(t)&&(a[r.replace(t,"").replace(/\w/,function(e){return e.toLowerCase()})]=n[r]);return a},Array:{ensure:function(e,t){return-1===e.indexOf(t)?e.push(t):void 0},removeAt:function(e,t){return!!e.splice(t,1).length},remove:function(e,t){var n=e.indexOf(t);return~n?avalon.Array.removeAt(e,n):!1}}});var Rt=avalon.bindingHandlers={},It=avalon.bindingExecutors={},_t=new function(){function e(e){this.size=0,this.limit=e,this.head=this.tail=void 0,this._keymap={}}var t=e.prototype;return t.put=function(e,t){var n={key:e,value:t};return this._keymap[e]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit?this.shift():this.size++,t},t.shift=function(){var e=this.head;e&&(this.head=this.head.newer,this.head.older=e.newer=e.older=this._keymap[e.key]=void 0)},t.get=function(e){var t=this._keymap[e];if(void 0!==t)return t===this.tail?t.value:(t.newer&&(t===this.head&&(this.head=t.newer),t.newer.older=t.older),t.older&&(t.older.newer=t.newer),t.newer=void 0,t.older=this.tail,this.tail&&(this.tail.newer=t),this.tail=t,t.value)},e};if(ft.contains||(Node.prototype.contains=function(e){return!!(16&this.compareDocumentPosition(e))}),avalon.contains=function(e,t){try{for(;t=t.parentNode;)if(t===e)return!0;return!1}catch(n){return!1}},e.SVGElement){var Ft="http://www.w3.org/2000/svg",Bt=ft.createElementNS(Ft,"svg");Bt.innerHTML='<circle cx="50" cy="50" r="40" fill="red" />',xt.test(Bt.firstChild)||Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:function(){return(new XMLSerializer).serializeToString(this)},set:function(e){var t=this.tagName.toLowerCase(),n=this.parentNode,a=avalon.parseHTML(e);if("svg"===t)n.insertBefore(a,this);else{var r=ft.createDocumentFragment();c(a,r),n.insertBefore(r,this)}n.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var e=this.outerHTML,t=new RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),n=new RegExp("</"+this.nodeName+">$","i");return e.replace(t,"").replace(n,"")},set:function(e){if(avalon.clearHTML){avalon.clearHTML(this);var t=avalon.parseHTML(e);c(t,this)}}}})}var Ut=avalon.eventHooks;"onmouseenter"in Nt||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Ut[e]={type:t,deel:function(t,n,a){return function(n){var r=n.relatedTarget;return r&&(r===t||16&t.compareDocumentPosition(r))?void 0:(delete n.type,n.type=e,a.call(t,n))}}}}),avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(t,n){e[t]&&!Ut.animationend&&(Ut.animationend={type:n})}),void 0===ft.onmousewheel&&(Ut.mousewheel={type:"wheel",deel:function(e,t,n){return function(t){t.wheelDeltaY=t.wheelDelta=t.deltaY>0?-120:120,t.wheelDeltaX=0,Object.defineProperty(t,"type",{value:"mousewheel"}),n.call(e,t)}}});var Vt,qt,zt,Wt,Xt,Yt=/[-.*+?^${}()|[\]\/\\]/g,Gt={loader:function(t){var n=dt&&t;e.require=n?dt:mt,e.define=n?dt.define:gt},interpolate:function(e){if(Vt=e[0],qt=e[1],Vt===qt)throw new SyntaxError("openTag!==closeTag");if(e+""=="<!--,-->")u.commentInterpolate=!0;else{var t=Vt+"test"+qt;if(jt.innerHTML=t,jt.innerHTML!==t&&jt.innerHTML.indexOf("<")>-1)throw new SyntaxError("此定界符不合法");jt.innerHTML=""}var n=f(Vt),a=f(qt);zt=new RegExp(n+"(.*?)"+a),Wt=new RegExp(n+"(.*?)"+a,"g"),Xt=new RegExp(n+".*?"+a+"|\\sms-")}};u.debug=!0,u.plugins=Gt,u.plugins.interpolate(["{{","}}"]),u.paths={},u.shim={},u.maxRepeatSize=100,avalon.config=u;var Zt=function(e){return ft.querySelectorAll(e)},Jt={$watch:function(e,t){if("function"==typeof t){var n=this.$events[e];n?n.push(t):this.$events[e]=[t]}else this.$events=this.$watch.backup;return this},$unwatch:function(e,t){var n=arguments.length;if(0===n)this.$watch.backup=this.$events,this.$events={};else if(1===n)this.$events[e]=[];else for(var a=this.$events[e]||[],r=a.length;~--r<0;)if(a[r]===t)return a.splice(r,1);return this},$fire:function(e){var t,n,a,r;/^(\w+)!(\S+)$/.test(e)&&(t=RegExp.$1,e=RegExp.$2);var i=this.$events;if(i){var o=Et.call(arguments,1),l=[e].concat(o);if("all"===t)for(n in avalon.vmodels)a=avalon.vmodels[n],a!==this&&a.$fire.apply(a,l);else if("up"===t||"down"===t){var s=i.expr?Zt(i.expr):[];if(0===s.length)return;for(n in avalon.vmodels)if(a=avalon.vmodels[n],a!==this&&a.$events.expr){var c=Zt(a.$events.expr);if(0===c.length)continue;Array.prototype.forEach.call(c,function(e){Array.prototype.forEach.call(s,function(n){var r="down"===t?n.contains(e):e.contains(n);r&&(e._avalon=a)})})}var u=ft.getElementsByTagName("*"),f=[];for(Array.prototype.forEach.call(u,function(e){e._avalon&&(f.push(e._avalon),e._avalon="",e.removeAttribute("_avalon"))}),"up"===t&&f.reverse(),n=0;(r=f[n++])&&r.$fire.apply(r,l)!==!1;);}else{var p=i[e]||[],d=i.$all||[];for(n=0;r=p[n++];)Pt(r)&&r.apply(this,o);for(n=0;r=d[n++];)Pt(r)&&r.apply(this,arguments)}}}},Qt=avalon.vmodels=r();avalon.define=function(e,t){var a=e.$id||e;if(a||n("warning: vm必须指定$id"),Qt[a]&&n("warning: "+a+" 已经存在于avalon.vmodels中"),"object"==typeof e)var r=v(e);else{var o={$watch:i};t(o),r=v(o),yt=!0,t(r),yt=!1}return r.$id=a,Qt[a]=r};var Kt=String("$id,$watch,$unwatch,$fire,$events,$model,$skipArray").match(bt),en=r(),tn=Object.is||function(e,t){return 0===e&&0===t?1/e===1/t:e!==e?t!==t:e===t},nn=function(e){var t=r();for(var n in e)t[n]={get:e[n],set:e[n],enumerable:!0,configurable:!0};return t},an=kt.splice,rn={_splice:an,_fire:function(e,t,n){k(this.$events[ht],e,t,n)},size:function(){return this._.length},pushArray:function(e){var t=e.length,n=this.length;return t&&(kt.push.apply(this.$model,e),y.call(this,"add",n,t,Math.max(0,n-1))),t+n},push:function(){var e,t=[],n=arguments.length;for(e=0;n>e;e++)t[e]=arguments[e];return this.pushArray(t)},unshift:function(){var e=arguments.length,t=this.length;return e&&(kt.unshift.apply(this.$model,arguments),y.call(this,"add",0,e,0)),e+t},shift:function(){if(this.length){var e=this.$model.shift();return y.call(this,"del",0,1,0),e}},pop:function(){var e=this.length;if(e){var t=this.$model.pop();return y.call(this,"del",e-1,1,Math.max(0,e-2)),t}},splice:function(e){var t,n=arguments.length,a=[],r=an.apply(this.$model,arguments);return r.length&&(a.push("del",e,r.length,0),t=!0),n>2&&(t?a.splice(3,1,0,"add",e,n-2):a.push("add",e,n-2,0),t=!0),t?y.apply(this,a):[]},contains:function(e){return-1!==this.indexOf(e)},remove:function(e){return this.removeAt(this.indexOf(e))},removeAt:function(e){return e>=0?(this.$model.splice(e,1),y.call(this,"del",e,1,0)):[]},clear:function(){return this.$model.length=this.length=this._.length=0,this._fire("clear",0),this},removeAll:function(e){if(Array.isArray(e))e.forEach(function(e){this.remove(e)},this);else if("function"==typeof e)for(var t=this.length-1;t>=0;t--){var n=this[t];e(n,t)&&this.removeAt(t)}else this.clear()},ensure:function(e){return this.contains(e)||this.push(e),this},set:function(e,t){if(e>=0){var n=avalon.type(t);t&&t.$model&&(t=t.$model);var a=this[e];if("object"===n)for(var r in t)a.hasOwnProperty(r)&&(a[r]=t[r]);else"array"===n?a.clear().push.apply(a,t):a!==t&&(this[e]=t,this.$model[e]=t,this._fire("set",e,t))}return this}};"sort,reverse".replace(bt,function(e){rn[e]=function(){var t,n=this.$model,a=n.concat(),r=Math.random(),i=[];kt[e].apply(n,arguments);for(var o=0,l=a.length;l>o;o++){var s=n[o],c=a[o];if(tn(s,c))i.push(o);else{var u=a.indexOf(s);i.push(u),a[u]=r,t=!0}}return t&&(b(this,i),this._fire("move",i),this._fire("index",0)),this}});var on=/^(duplex|on)$/,ln=avalon.$$subscribers=[],sn=new Date,cn={},un=new function(){avalon.mix(this,{option:ft.createElement("select"),thead:ft.createElement("table"),td:ft.createElement("tr"),area:ft.createElement("map"),tr:ft.createElement("tbody"),col:ft.createElement("colgroup"),legend:ft.createElement("fieldset"),_default:ft.createElement("div"),g:ft.createElementNS("http://www.w3.org/2000/svg","svg")}),this.optgroup=this.option,this.tbody=this.tfoot=this.colgroup=this.caption=this.thead,this.th=this.td};String("circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use").replace(bt,function(e){un[e]=un.g});var fn=/<([\w:]+)/,pn=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,dn=o(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]),vn=ft.createElement("script"),hn=/<|&#?\w+;/;avalon.parseHTML=function(e){var t=Lt.cloneNode(!1);if("string"!=typeof e)return t;if(!hn.test(e))return t.appendChild(ft.createTextNode(e)),t;e=e.replace(pn,"<$1></$2>").trim();var n,a=(fn.exec(e)||["",""])[1].toLowerCase(),r=un[a]||un._default;r.innerHTML=e;var i=r.getElementsByTagName("script");if(i.length)for(var o,l=0;o=i[l++];)if(dn[o.type]){var s=vn.cloneNode(!1);kt.forEach.call(o.attributes,function(e){s.setAttribute(e.name,e.value)}),s.text=o.text,o.parentNode.replaceChild(s,o)}for(;n=r.firstChild;)t.appendChild(n);return t},avalon.innerHTML=function(e,t){var n=this.parseHTML(t);this.clearHTML(e).appendChild(n)},avalon.clearHTML=function(e){for(e.textContent="";e.firstChild;)e.removeChild(e.firstChild);return e},avalon.scan=function(e,t){e=e||Nt;var n=t?[].concat(t):[];D(e,n)};var mn=o("area,base,basefont,br,col,command,embed,hr,img,input,link,meta,param,source,track,wbr,noscript,script,style,textarea".toUpperCase()),gn=function(e,t,n){var a=e.getAttribute(t);if(a)for(var r,i=0;r=n[i++];)if(r.hasOwnProperty(a)&&"function"==typeof r[a])return r[a]},yn=Dt&&e.MutationObserver?function(e){for(var t,n=e.firstChild;n;){var a=n.nextSibling;3===n.nodeType?t?(t.nodeValue+=n.nodeValue,e.removeChild(n)):t=n:t=null,n=a}}:0,bn=/ms-(\w+)-?(.*)/,$n={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2e3,on:3e3},xn=o("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),wn=o("value,title,alt,checked,selected,disabled,readonly,enabled"),Cn=/^if|widget|repeat$/,An=/^each|with|html|include$/,Tn=/\|\s*html\s*/,kn=/\|\|/g,En=/(['"])(\\\1|.)+?\1/g;"add,remove".replace(bt,function(e){avalon.fn[e+"Class"]=function(t){var n=this[0];return t&&"string"==typeof t&&n&&1===n.nodeType&&t.replace(/\S+/g,function(t){n.classList[e](t)}),this}}),avalon.fn.mix({hasClass:function(e){var t=this[0]||{};return 1===t.nodeType&&t.classList.contains(e)},toggleClass:function(e,t){for(var n,a=0,r=String(e).split(/\s+/),i="boolean"==typeof t;n=r[a++];){var o=i?t:!this.hasClass(n);this[o?"addClass":"removeClass"](n)}return this},attr:function(e,t){return 2===arguments.length?(this[0].setAttribute(e,t),this):this[0].getAttribute(e)},data:function(e,t){switch(e="data-"+_(e||""),arguments.length){case 2:return this.attr(e,t),this;case 1:var n=this.attr(e);return B(n);case 0:var a={};return kt.forEach.call(this[0].attributes,function(t){t&&(e=t.name,e.indexOf("data-")||(e=F(e.slice(5)),a[e]=B(t.value)))}),a}},removeData:function(e){return e="data-"+_(e),this[0].removeAttribute(e),this},css:function(e,t){if(avalon.isPlainObject(e))for(var n in e)avalon.css(this,n,e[n]);else var a=avalon.css(this,e,t);return void 0!==a?a:this},position:function(){var e,t,n=this[0],a={top:0,left:0};if(n)return"fixed"===this.css("position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),"HTML"!==e[0].tagName&&(a=e.offset()),a.top+=avalon.css(e[0],"borderTopWidth",!0),a.left+=avalon.css(e[0],"borderLeftWidth",!0),a.top-=e.scrollTop(),a.left-=e.scrollLeft()),{top:t.top-a.top-avalon.css(n,"marginTop",!0),left:t.left-a.left-avalon.css(n,"marginLeft",!0)}},offsetParent:function(){for(var e=this[0].offsetParent;e&&"static"===avalon.css(e,"position");)e=e.offsetParent;return avalon(e||Nt)},bind:function(e,t,n){return this[0]?avalon.bind(this[0],e,t,n):void 0},unbind:function(e,t,n){return this[0]&&avalon.unbind(this[0],e,t,n),this},val:function(e){var t=this[0];if(t&&1===t.nodeType){var n=0===arguments.length,a=n?":get":":set",r=Sn[q(t)+a];if(r)var i=r(t,e);else{if(n)return(t.value||"").replace(/\r/g,"");t.value=e}}return n?i:this}}),Nt.dataset&&(avalon.fn.data=function(e,t){e=e&&F(e);var n=this[0].dataset;switch(arguments.length){case 2:return n[e]=t,this;case 1:return t=n[e],B(t);case 0:var a=r();for(e in n)a[e]=B(n[e]);return a}});var Mn=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/;avalon.parseJSON=JSON.parse,avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){avalon.fn[e]=function(n){var a=this[0]||{},r=U(a),i="scrollTop"===e;return arguments.length?void(r?r.scrollTo(i?r[t]:n,i?n:r[t]):a[e]=n):r?r[t]:a[e]}});var On=avalon.cssHooks=r(),Nn=["","-webkit-","-moz-","-ms-"],Ln={"float":"cssFloat"};avalon.cssNumber=o("columnCount,order,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom"),avalon.cssName=function(e,t,n){if(Ln[e])return Ln[e];t=t||Nt.style;for(var a=0,r=Nn.length;r>a;a++)if(n=F(Nn[a]+e),n in t)return Ln[e]=n;return null},On["@:set"]=function(e,t,n){e.style[t]=n},On["@:get"]=function(e,t){if(!e||!e.style)throw new Error("getComputedStyle要求传入一个节点 "+e);var n,a=getComputedStyle(e);return a&&(n="filter"===t?a.getPropertyValue(t):a[t],""===n&&(n=e.style[t])),n},On["opacity:get"]=function(e){var t=On["@:get"](e,"opacity");return""===t?"1":t},"top,left".replace(bt,function(e){On[e+":get"]=function(t){var n=On["@:get"](t,e);return/px$/.test(n)?n:avalon(t).position()[e]+"px"}});var jn={position:"absolute",visibility:"hidden",display:"block"},Hn=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(bt,function(e){var t=e.toLowerCase(),n="client"+e,a="scroll"+e,r="offset"+e;On[t+":get"]=function(t,n,a){var i=-4;"number"==typeof a&&(i=a),n="Width"===e?["Left","Right"]:["Top","Bottom"];var o=t[r];return 2===i?o+avalon.css(t,"margin"+n[0],!0)+avalon.css(t,"margin"+n[1],!0):(0>i&&(o=o-avalon.css(t,"border"+n[0]+"Width",!0)-avalon.css(t,"border"+n[1]+"Width",!0)),-4===i&&(o=o-avalon.css(t,"padding"+n[0],!0)-avalon.css(t,"padding"+n[1],!0)),o)
},On[t+"&get"]=function(e){var n=[];V(e,n);for(var a,r=On[t+":get"](e),i=0;a=n[i++];){e=a.node;for(var o in a)"string"==typeof a[o]&&(e.style[o]=a[o])}return r},avalon.fn[t]=function(i){var o=this[0];if(0===arguments.length){if(o.setTimeout)return o["inner"+e];if(9===o.nodeType){var l=o.documentElement;return Math.max(o.body[a],l[a],o.body[r],l[r],l[n])}return On[t+"&get"](o)}return this.css(t,i)},avalon.fn["inner"+e]=function(){return On[t+":get"](this[0],void 0,-2)},avalon.fn["outer"+e]=function(e){return On[t+":get"](this[0],void 0,e===!0?2:0)}}),avalon.fn.offset=function(){var e=this[0];try{var t=e.getBoundingClientRect();if(t.width||t.height||e.getClientRects().length){var n=e.ownerDocument,a=n.documentElement,r=n.defaultView;return{top:t.top+r.pageYOffset-a.clientTop,left:t.left+r.pageXOffset-a.clientLeft}}}catch(i){return{left:0,top:0}}};var Sn={"select:get":function(e,t){for(var n,a=e.options,r=e.selectedIndex,i="select-one"===e.type||0>r,o=i?null:[],l=i?r+1:a.length,s=0>r?l:i?r:0;l>s;s++)if(n=a[s],(n.selected||s===r)&&!n.disabled){if(t=n.value,i)return t;o.push(t)}return o},"select:set":function(e,t,n){t=[].concat(t);for(var a,r=0;a=e.options[r++];)(a.selected=t.indexOf(a.value)>-1)&&(n=!0);n||(e.selectedIndex=-1)}},Dn=JSON.stringify,Pn=["break,case,catch,continue,debugger,default,delete,do,else,false","finally,for,function,if,in,instanceof,new,null,return,switch,this","throw,true,try,typeof,var,void,while,with","abstract,boolean,byte,char,class,const,double,enum,export,extends","final,float,goto,implements,import,int,interface,long,native","package,private,protected,public,short,static,super,synchronized","throws,transient,volatile","arguments,let,yield,undefined"].join(","),Rn=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,In=/[^\w$]+/g,_n=new RegExp(["\\b"+Pn.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),Fn=/\b\d[^,]*/g,Bn=/^,+|,+$/g,Un=new _t(512),Vn=function(e){var t=","+e.trim(),n=Un.get(t);if(n)return n;var a=e.replace(Rn,"").replace(In,",").replace(_n,"").replace(Fn,"").replace(Bn,"").split(/^$|,+/);return Un.put(t,W(a))},qn=new _t(128),zn=/\w\[.*\]|\w\.\w/,Wn=/(\$proxy\$[a-z]+)\d+$/,Xn=/\)\s*$/,Yn=/\)\s*\|/g,Gn=/\|\s*([$\w]+)/g,Zn=/"\s*\["/g,Jn=/"\s*\(/g;avalon.parseExprProxy=G;var Qn=["autofocus,autoplay,async,allowTransparency,checked,controls","declare,disabled,defer,defaultChecked,defaultSelected","contentEditable,isMap,loop,multiple,noHref,noResize,noShade","open,readOnly,selected"].join(","),Kn={};Qn.replace(bt,function(e){Kn[e.toLowerCase()]=e});var ea={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"},ta=["accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan","dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight","rowSpan,tabIndex,useMap,vSpace,valueType,vAlign"].join(",");ta.replace(bt,function(e){ea[e.toLowerCase()]=e});var na=/<noscript.*?>(?:[\s\S]+?)<\/noscript>/gim,aa=/<noscript.*?>([\s\S]+?)<\/noscript>/im,ra=function(){return new(e.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP")},ia=avalon.templateCache={};Rt.attr=function(e,t){var n=e.value.trim(),a=!0;if(n.indexOf(Vt)>-1&&n.indexOf(qt)>2&&(a=!1,zt.test(n)&&""===RegExp.rightContext&&""===RegExp.leftContext&&(a=!0,n=RegExp.$1)),"include"===e.type){var r=e.element;e.includeRendered=gn(r,"data-include-rendered",t),e.includeLoaded=gn(r,"data-include-loaded",t);var i=e.includeReplace=!!avalon(r).data("includeReplace");avalon(r).data("includeCache")&&(e.templateCache={}),e.startInclude=ft.createComment("ms-include"),e.endInclude=ft.createComment("ms-include-end"),i?(e.element=e.startInclude,r.parentNode.insertBefore(e.startInclude,r),r.parentNode.insertBefore(e.endInclude,r.nextSibling)):(r.insertBefore(e.startInclude,r.firstChild),r.appendChild(e.endInclude))}e.handlerName="attr",G(n,t,e,a?0:R(e.value))},It.attr=function(t,n,a){var r=a.type,i=a.param;if("css"===r)avalon(n).css(i,t);else if("attr"===r){var o=t===!1||null===t||void 0===t;!Ot&&ea[i]&&(i=ea[i]);var l=Kn[i];if("boolean"==typeof n[l]&&(n[l]=!!t,t||(o=!0)),o)return n.removeAttribute(i);var s=xt.test(n)?!1:ft.namespaces&&isVML(n)?!0:i in n.cloneNode(!1);s?n[i]=t:n.setAttribute(i,t)}else if("include"===r&&t){var c=a.vmodels,u=a.includeRendered,f=a.includeLoaded,p=a.includeReplace,d=p?n.parentNode:n,v=function(e){if(f){var n=f.apply(d,[e].concat(c));"string"==typeof n&&(e=n)}u&&E(d,function(){u.call(d)},0/0);var r=a.includeLastID;if(a.templateCache&&r&&r!==t){var i=a.templateCache[r];i||(i=a.templateCache[r]=ft.createElement("div"),vt.appendChild(i))}for(a.includeLastID=t;;){var o=a.startInclude.nextSibling;if(!o||o===a.endInclude)break;d.removeChild(o),i&&i.appendChild(o)}var l=Z(a,t,e),s=avalon.slice(l.childNodes);d.insertBefore(l,a.endInclude),H(s,c)};if("src"===a.param)if("string"==typeof ia[t])avalon.nextTick(function(){v(ia[t])});else if(Array.isArray(ia[t]))ia[t].push(v);else{var h=ra();h.onreadystatechange=function(){if(4===h.readyState){var e=h.status;if(e>=200&&300>e||304===e||1223===e){for(var n,a=h.responseText,r=0;n=ia[t][r++];)n(a);ia[t]=a}}},ia[t]=[v],h.open("GET",t,!0),"withCredentials"in h&&(h.withCredentials=!0),h.setRequestHeader("X-Requested-With","XMLHttpRequest"),h.send(null)}else{var m=t&&1===t.nodeType?t:ft.getElementById(t);if(m){if("NOSCRIPT"===m.tagName&&!m.innerHTML&&!m.fixIE78){h=ra(),h.open("GET",location,!1),h.send(null);for(var g=ft.getElementsByTagName("noscript"),y=(h.responseText||"").match(na)||[],b=y.length,$=0;b>$;$++){var x=g[$];x&&(x.style.display="none",x.fixIE78=(y[$].match(aa)||[""," "])[1])}}avalon.nextTick(function(){v(m.fixIE78||m.value||m.innerText||m.innerHTML)})}}}else if(Nt.hasAttribute||"string"!=typeof t||"src"!==r&&"href"!==r||(t=t.replace(/&/g,"&")),n[r]=t,e.chrome&&"EMBED"===n.tagName){var w=n.parentNode,C=document.createComment("ms-src");w.replaceChild(C,n),w.replaceChild(n,C)}},"title,alt,src,value,css,include,href".replace(bt,function(e){Rt[e]=Rt.attr}),Rt["class"]=function(e,t){var a,r=e.param,i=e.value;if(e.handlerName="class",!r||isFinite(r)){e.param="";var o=i.replace(Wt,function(e){return e.replace(/./g,"0")}),l=o.indexOf(":");if(-1===l)var s=i;else{if(s=i.slice(0,l),a=i.slice(l+1),Y(a,t,e),!e.evaluator)return n("debug: ms-class '"+(a||"").trim()+"' 不存在于VM中"),!1;e._evaluator=e.evaluator,e._args=e.args}var c=zt.test(s);c||(e.immobileClass=s),G("",t,e,c?R(s):0)}else e.immobileClass=e.oldStyle=e.param,G(i,t,e)},It["class"]=function(e,t,n){var a=avalon(t),r=n.type;if("class"===r&&n.oldStyle)a.toggleClass(n.oldStyle,!!e);else switch(n.toggleClass=n._evaluator?!!n._evaluator.apply(t,n._args):!0,n.newClass=n.immobileClass||e,n.oldClass&&n.newClass!==n.oldClass&&a.removeClass(n.oldClass),n.oldClass=n.newClass,r){case"class":a.toggleClass(n.newClass,n.toggleClass);break;case"hover":case"active":if(!n.hasBindEvent){var i="mouseenter",o="mouseleave";if("active"===r){t.tabIndex=t.tabIndex||-1,i="mousedown",o="mouseup";var l=a.bind("mouseleave",function(){n.toggleClass&&a.removeClass(n.newClass)})}var s=a.bind(i,function(){n.toggleClass&&a.addClass(n.newClass)}),c=a.bind(o,function(){n.toggleClass&&a.removeClass(n.newClass)});n.rollback=function(){a.unbind("mouseleave",l),a.unbind(i,s),a.unbind(o,c)},n.hasBindEvent=!0}}},"hover,active".replace(bt,function(e){Rt[e]=Rt["class"]}),It.data=function(e,t,n){var a="data-"+n.param;e&&"object"==typeof e?t[a]=e:t.setAttribute(a,String(e))};var oa=Rt.duplex=function(e,t){var a,r=e.element;if(G(e.value,t,e,0,1),e.changed=gn(r,"data-duplex-changed",t)||i,e.evaluator&&e.args){var l=[],s=o("string,number,boolean,checked");"radio"===r.type&&""===e.param&&(e.param="checked"),r.msData&&(r.msData["ms-duplex"]=e.value),e.param.replace(/\w+/g,function(t){/^(checkbox|radio)$/.test(r.type)&&/^(radio|checked)$/.test(t)&&("radio"===t&&n("ms-duplex-radio已经更名为ms-duplex-checked"),t="checked",e.isChecked=!0),"bool"===t?(t="boolean",n("ms-duplex-bool已经更名为ms-duplex-boolean")):"text"===t&&(t="string",n("ms-duplex-text已经更名为ms-duplex-string")),s[t]&&(a=!0),avalon.Array.ensure(l,t)}),a||l.push("string"),e.param=l.join("-"),e.bound=function(t,n){r.addEventListener?r.addEventListener(t,n,!1):r.attachEvent("on"+t,n);var a=e.rollback;e.rollback=function(){r.avalonSetter=null,avalon.unbind(r,t,n),a&&a()}};for(var c in avalon.vmodels){var u=avalon.vmodels[c];u.$fire("avalon-ms-duplex-init",e)}var f=e.pipe||(e.pipe=Q);f(null,e,"init");var p=r.tagName;oa[p]&&oa[p](r,e.evaluator.apply(null,e.args),e)}};avalon.duplexHooks={checked:{get:function(e,t){return!t.element.oldValue}},string:{get:function(e){return e},set:J},"boolean":{get:function(e){return"true"===e},set:J},number:{get:function(e,t){var n=parseFloat(e);if(-e===-n)return n;var a=/strong|medium|weak/.exec(t.element.getAttribute("data-duplex-number"))||["medium"];switch(a[0]){case"strong":return 0;case"medium":return""===e?"":0;case"weak":return e}},set:J}};var la,sa=[];avalon.tick=function(e){1===sa.push(e)&&(la=setInterval(K,60))};var ca=i,ua=/text|password|hidden/;!new function(){function e(e){if(avalon.contains(Nt,this)){if(t[this.tagName].call(this,e),!ua.test(this.type))return;!this.msFocus&&this.avalonSetter&&this.avalonSetter()}}try{var t={},n=HTMLInputElement.prototype,a=HTMLTextAreaElement.prototype,r=HTMLInputElement.prototype;Object.getOwnPropertyNames(r),t.INPUT=Object.getOwnPropertyDescriptor(n,"value").set,Object.defineProperty(n,"value",{set:e}),t.TEXTAREA=Object.getOwnPropertyDescriptor(a,"value").set,Object.defineProperty(a,"value",{set:e})}catch(i){ca=avalon.tick}},oa.INPUT=function(e,t,a){function r(e){a.changed.call(this,e,a)}function i(){u=!0}function o(){u=!1}var l=e.type,s=a.bound,c=avalon(e),u=!1,f=function(){if(!u){var n=e.oldValue=e.value,i=a.pipe(n,a,"get");c.data("duplexObserve")!==!1&&(t(i),r.call(e,i),c.data("duplex-focus")&&avalon.nextTick(function(){e.focus()}))}};if(a.handler=function(){var n=a.pipe(t(),a,"set")+"";n!==e.oldValue&&(e.value=n)},a.isChecked||"radio"===l)f=function(){if(c.data("duplexObserve")!==!1){var n=a.pipe(e.value,a,"get");t(n),r.call(e,n)}},a.handler=function(){var n=t(),r=a.isChecked?!!n:n+""===e.value;e.checked=e.oldValue=r},s("click",f);else if("checkbox"===l)f=function(){if(c.data("duplexObserve")!==!1){var i=e.checked?"ensure":"remove",o=t();Array.isArray(o)||(n("ms-duplex应用于checkbox上要对应一个数组"),o=[o]),avalon.Array[i](o,a.pipe(e.value,a,"get")),r.call(e,o)}},a.handler=function(){var n=[].concat(t());e.checked=n.indexOf(a.pipe(e.value,a,"get"))>-1},s("change",f);else{var p=e.getAttribute("data-duplex-event")||"input";e.attributes["data-event"]&&n("data-event指令已经废弃,请改用data-duplex-event"),p.replace(bt,function(e){switch(e){case"input":s("input",f),s("DOMAutoComplete",f),Dt||(s("compositionstart",i),s("compositionend",o));break;default:s(e,f)}}),s("focus",function(){e.msFocus=!0}),s("blur",function(){e.msFocus=!1}),ua.test(l)&&ca(function(){if(Nt.contains(e))e.msFocus||e.oldValue===e.value||f();else if(!e.msRetain)return!1}),e.avalonSetter=f}e.oldValue=e.value,$(a),r.call(e,e.value)},oa.TEXTAREA=oa.INPUT,oa.SELECT=function(e,t,a){function r(){if(i.data("duplexObserve")!==!1){var n=i.val();n=Array.isArray(n)?n.map(function(e){return a.pipe(e,a,"get")}):a.pipe(n,a,"get"),n+""!==e.oldValue&&t(n),a.changed.call(e,n,a)}}var i=avalon(e);a.handler=function(){var a=t();a=a&&a.$model||a,Array.isArray(a)?e.multiple||n("ms-duplex在<select multiple=true>上要求对应一个数组"):e.multiple&&n("ms-duplex在<select multiple=false>不能对应一个数组"),a=Array.isArray(a)?a.map(String):a+"",a+""!==e.oldValue&&(i.val(a),e.oldValue=a+"")},a.bound("change",r),e.msCallback=function(){$(a),a.changed.call(e,t(),a)}},It.html=function(e,t,n){e=null==e?"":e;var a="group"in n,r=a?t.parentNode:t;if(r){if("string"==typeof e)var i=avalon.parseHTML(e);else if(11===e.nodeType)i=e;else if(1===e.nodeType||e.item){var o=1===e.nodeType?e.childNodes:e.item;for(i=Lt.cloneNode(!0);o[0];)i.appendChild(o[0])}if(i.firstChild||i.appendChild(ft.createComment("ms-html")),o=avalon.slice(i.childNodes),a){var l=n.group,s=1;for(n.group=o.length,n.element=o[0];l>s;){var c=t.nextSibling;c&&(r.removeChild(c),s++)}r.replaceChild(i,t)}else avalon.clearHTML(r).appendChild(i);H(o,n.vmodels)}},Rt["if"]=Rt.data=Rt.text=Rt.html=function(e,t){G(e.value,t,e)},It["if"]=function(e,t,n){if(e)8===t.nodeType&&(t.parentNode.replaceChild(n.template,t),t=n.element=n.template),t.getAttribute(n.name)&&(t.removeAttribute(n.name),L(t,n.vmodels)),n.rollback=null;else if(1===t.nodeType){var a=n.element=ft.createComment("ms-if");t.parentNode.replaceChild(a,t),n.template=t,vt.appendChild(t),n.rollback=function(){t.parentNode===vt&&vt.removeChild(t)}}};var fa=/\(([^)]*)\)/;Rt.on=function(e,t){var n=e.value;e.type="on";var a=e.param.replace(/-\d+$/,"");if("function"==typeof Rt.on[a+"Hook"]&&Rt.on[a+"Hook"](e),n.indexOf("(")>0&&n.indexOf(")")>-1){var r=(n.match(fa)||["",""])[1].trim();(""===r||"$event"===r)&&(n=n.replace(fa,""))}G(n,t,e)},It.on=function(e,t,n){e=function(e){var t=n.evaluator||i;return t.apply(this,n.args.concat(e))};var a=n.param.replace(/-\d+$/,"");if("scan"===a)e.call(t,{type:a});else if("function"==typeof n.specialBind)n.specialBind(t,e);else var r=avalon.bind(t,a,e);n.rollback=function(){"function"==typeof n.specialUnbind?n.specialUnbind():avalon.unbind(t,a,r)}},Rt.repeat=function(e,t){var n=e.type;G(e.value,t,e,0,1),e.proxies=[];var a=!1;try{var r=e.$repeat=e.evaluator.apply(0,e.args||[]),i=avalon.type(r);"object"!==i&&"array"!==i&&(a=!0,avalon.log("warning:"+e.value+"只能是对象或数组"))}catch(o){a=!0}var l=e.value.split(".")||[];if(l.length>1){l.pop();for(var s,c=l[0],u=0;s=t[u++];)if(s&&s.hasOwnProperty(c)){var f=s[c].$events||{};f[ht]=f[ht]||[],f[ht].push(e);break}}var p=e.element;p.removeAttribute(e.name),e.sortedCallback=gn(p,"data-with-sorted",t),e.renderedCallback=gn(p,"data-"+n+"-rendered",t);var d=St(n),v=e.element=ft.createComment(d+":end");if(e.clone=ft.createComment(d),Lt.appendChild(v),"each"===n||"with"===n?(e.template=p.innerHTML.trim(),avalon.clearHTML(p).appendChild(v)):(e.template=p.outerHTML.trim(),p.parentNode.replaceChild(v,p)),e.template=avalon.parseHTML(e.template),e.rollback=function(){var t=e.element;if(t){It.repeat.call(e,"clear");var n=t.parentNode,a=e.template,r=a.firstChild;n.replaceChild(a,t);var i=e.$stamp;i&&i.parentNode&&i.parentNode.removeChild(i),r=e.element="repeat"===e.type?r:n}},!a){e.handler=It.repeat,e.$outer={};var h="$key",m="$val";for(Array.isArray(r)&&(h="$first",m="$last"),u=0;s=t[u++];)if(s.hasOwnProperty(h)&&s.hasOwnProperty(m)){e.$outer=s;break}var g=r.$events,y=(g||{})[ht];if(y&&avalon.Array.ensure(y,e)&&w(e,y),"object"===i){e.$with=!0;var b=g?g.$withProxyPool||(g.$withProxyPool={}):{};e.handler("append",r,b)}else r.length&&e.handler("add",0,r.length)}},It.repeat=function(e,t,n){if(e){var a=this,r=a.element,o=r.parentNode,l=a.proxies,s=Lt.cloneNode(!1);switch(e){case"add":for(var c,u=t+n,f=a.$repeat,p=f.length-1,d=[],v=tt(a,t),h=t;u>h;h++){var m=rt(h,a);l.splice(h,0,m),et(a,s,m,d)}for(o.insertBefore(s,v),h=0;c=d[h++];)H(c.nodes,c.vmodels),c.nodes=c.vmodels=null;break;case"del":v=l[t].$stamp,r=tt(a,t+n),nt(v,r);var g=l.splice(t,n);lt(g,"each");break;case"clear":var y=a.$stamp||l[0];y&&(v=y.$stamp||y,nt(v,r)),lt(l,"each");break;case"move":v=l[0].$stamp;var $,x=v.nodeValue,w=[],C=[];for(nt(v,r,function(){C.unshift(this),this.nodeValue===x&&(w.unshift(C),C=[])}),b(l,t),b(w,t);C=w.shift();)for(;$=C.shift();)s.appendChild($);o.insertBefore(s,r);break;case"index":for(p=l.length-1;n=l[t];t++)n.$index=t,n.$first=0===t,n.$last=t===p;return;case"set":return m=l[t],void(m&&k(m.$events[a.param||"el"]));case"append":var A=n,T=[];d=[];for(var M in t)t.hasOwnProperty(M)&&"hasOwnProperty"!==M&&T.push(M);if(a.sortedCallback){var O=a.sortedCallback.call(o,T);O&&Array.isArray(O)&&O.length&&(T=O)}for(h=0;M=T[h++];)"hasOwnProperty"!==M&&(A[M]||(A[M]=ot(M,a)),et(a,s,A[M],d));var N=a.$stamp=a.clone;for(o.insertBefore(N,r),o.insertBefore(s,r),h=0;c=d[h++];)H(c.nodes,c.vmodels),c.nodes=c.vmodels=null}"clear"===e&&(e="del");var L=a.renderedCallback||i,j=arguments;E(o,function(){L.apply(o,j),o.oldValue&&"SELECT"===o.tagName&&avalon(o).val(o.oldValue.split(","))},0/0)}},"with,each".replace(bt,function(e){Rt[e]=Rt.repeat});var pa=[],da=[];It.text=function(e,t){if(e=null==e?"":e,3===t.nodeType)try{t.data=e}catch(n){}else t.textContent=e},avalon.parseDisplay=st,Rt.visible=function(e,t){var n=avalon(e.element),a=n.css("display");if("none"===a){var r=n[0].style,i=/visibility/i.test(r.cssText),o=n.css("visibility");r.display="",r.visibility="hidden",a=n.css("display"),"none"===a&&(a=st(n[0].nodeName)),r.visibility=i?o:""}e.display=a,G(e.value,t,e)},It.visible=function(e,t,n){t.style.display=e?n.display:"none"},Rt.widget=function(t,a){var r=t.value.match(bt),o=t.element,l=r[0],s=r[1];s&&"$"!==s||(s=St(l));var c=r[2]||l,u=avalon.ui[l];if("function"==typeof u){a=o.vmodels||a;for(var f,p=0;f=a[p++];)if(f.hasOwnProperty(c)&&"object"==typeof f[c]){var d=f[c];d=d.$model||d;break}if(d){var v=d[l+"Id"];"string"==typeof v&&(n("warning!不再支持"+l+"Id"),s=v)}var h=avalon.getWidgetData(o,l);t.value=[l,s,c].join(","),t[l+"Id"]=s,t.evaluator=i,o.msData["ms-widget-id"]=s;var m=t[l+"Options"]=avalon.mix({},u.defaults,d||{},h);o.removeAttribute("ms-widget");var g=u(o,t,a)||{};if(g.$id){avalon.vmodels[s]=g,M(o,g);try{g.$init(function(){avalon.scan(o,[g].concat(a)),"function"==typeof m.onInit&&m.onInit.call(o,g,m,a)})}catch(y){}t.rollback=function(){try{g.widgetElement=null,g.$remove()}catch(e){}o.msData={},delete avalon.vmodels[g.$id]},w(t,va),e.chrome&&o.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(T)})}else avalon.scan(o,a)}else a.length&&(o.vmodels=a)};var va=[],ha=/<script[^>]*>([\S\s]*?)<\/script\s*>/gim,ma=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,ga=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/gi,ya={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/gi,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/gi,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/gi},ba=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$a=/([^\#-~| |!])/g,xa=avalon.filters={uppercase:function(e){return e.toUpperCase()},lowercase:function(e){return e.toLowerCase()},truncate:function(e,t,n){return t=t||30,n=void 0===n?"...":n,e.length>t?e.slice(0,t-n.length)+n:String(e)},$filter:function(e){for(var t=1,n=arguments.length;n>t;t++){var a=arguments[t],r=avalon.filters[a.shift()];if("function"==typeof r){var i=[e].concat(a);e=r.apply(null,i)}}return e},camelize:F,sanitize:function(e){return e.replace(ha,"").replace(ga,function(e){var t=e.toLowerCase().match(/<(\w+)\s/);if(t){var n=ya[t[1]];n&&(e=e.replace(n,function(e,t,n){var a=n.charAt(0);return t+"="+a+"javascript:void(0)"+a}))}return e.replace(ma," ").replace(/\s+/g," ")})},escape:function(e){return String(e).replace(/&/g,"&").replace(ba,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace($a,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")},currency:function(e,t,n){return(t||"¥")+ct(e,isFinite(n)?n:2)},number:ct};!new function(){function e(e){return parseInt(e,10)||0}function t(e,t,n){var a="";for(0>e&&(a="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),a+e}function n(e,n,a,r){return function(i){var o=i["get"+e]();return(a>0||o>-a)&&(o+=a),0===o&&-12===a&&(o=12),t(o,n,r)}}function a(e,t){return function(n,a){var r=n["get"+e](),i=(t?"SHORT"+e:e).toUpperCase();return a[i][r]}}function r(e){var n=-1*e.getTimezoneOffset(),a=n>=0?"+":"";return a+=t(Math[n>0?"floor":"ceil"](n/60),2)+t(Math.abs(n%60),2)}function i(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}var o={yyyy:n("FullYear",4),yy:n("FullYear",2,0,!0),y:n("FullYear",1),MMMM:a("Month"),MMM:a("Month",!0),MM:n("Month",2,1),M:n("Month",1,1),dd:n("Date",2),d:n("Date",1),HH:n("Hours",2),H:n("Hours",1),hh:n("Hours",2,-12),h:n("Hours",1,-12),mm:n("Minutes",2),m:n("Minutes",1),ss:n("Seconds",2),s:n("Seconds",1),sss:n("Milliseconds",3),EEEE:a("Day"),EEE:a("Day",!0),a:i,Z:r},l=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,s=/^\/Date\((\d+)\)\/$/;xa.date=function(t,n){var a,r,i=xa.date.locate,c="",u=[];if(n=n||"mediumDate",n=i[n]||n,"string"==typeof t)if(/^\d+$/.test(t))t=e(t);else if(s.test(t))t=+RegExp.$1;else{var f=t.trim(),p=[0,0,0,0,0,0,0],d=new Date(0);f=f.replace(/^(\d+)\D(\d+)\D(\d+)/,function(t,n,a,r){var i=4===r.length?[r,n,a]:[n,a,r];return p[0]=e(i[0]),p[1]=e(i[1])-1,p[2]=e(i[2]),""});var v=d.setFullYear,h=d.setHours;f=f.replace(/[T\s](\d+):(\d+):?(\d+)?\.?(\d)?/,function(t,n,a,r,i){return p[3]=e(n),p[4]=e(a),p[5]=e(r),i&&(p[6]=Math.round(1e3*parseFloat("0."+i))),""});var m=0,g=0;f=f.replace(/Z|([+-])(\d\d):?(\d\d)/,function(t,n,a,r){return v=d.setUTCFullYear,h=d.setUTCHours,n&&(m=e(n+a),g=e(n+r)),""}),p[3]-=m,p[4]-=g,v.apply(d,p.slice(0,3)),h.apply(d,p.slice(3)),t=d}if("number"==typeof t&&(t=new Date(t)),"date"===avalon.type(t)){for(;n;)r=l.exec(n),r?(u=u.concat(r.slice(1)),n=u.pop()):(u.push(n),n=null);return u.forEach(function(e){a=o[e],c+=a?a(t,i):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),c}};var c={AMPMS:{0:"上午",1:"下午"},DAY:{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"},MONTH:{0:"1月",1:"2月",2:"3月",3:"4月",4:"5月",5:"6月",6:"7月",7:"8月",8:"9月",9:"10月",10:"11月",11:"12月"},SHORTDAY:{0:"周日",1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六"},fullDate:"y年M月d日EEEE",longDate:"y年M月d日",medium:"yyyy-M-d H:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"H:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};c.SHORTMONTH=c.MONTH,xa.date.locate=c};var wa=avalon.modules={"domReady!":{exports:avalon,state:3},avalon:{exports:avalon,state:4}};wa.exports=wa.avalon,new function(){function t(e,t){var a="js";e=e.replace(/^(\w+)\!/,function(e,t){return a=t,""}),"ready"===a&&(n("debug: ready!已经被废弃,请使用domReady!"),a="domReady");var r="";e=e.replace(D,function(e){return r=e,""});var i="."+a,o=/js|css/.test(i)?i:"";e=e.replace(/\.[a-z0-9]+$/g,function(e){return e===i?(o=e,""):e});var l=avalon.mix({query:r,ext:o,res:a,name:e,toUrl:m},t);return l.toUrl(e),l}function o(e){var t=e.name,n=e.res,a=wa[t],r=t&&e.urlNoQuery;if(a&&a.state>=1)return t;if(a=wa[r],a&&a.state>=3)return dt(a.deps||[],a.factory,r),r;if(t&&!a){a=wa[r]={id:r,state:1};var i=function(r){S[n]=r,r.load(t,e,function(e){arguments.length&&void 0!==e&&(a.exports=e),a.state=4,c()})};S[n]?i(S[n]):dt([n],i)}return t?r:n+"!"}function l(e,t){for(var n,a=0;n=e[a++];)if(4!==wa[n].state&&(n===t||l(wa[n].deps,t)))return!0}function s(e,t){var a=p(e.src);return e.onload=e.onerror=null,t?(setTimeout(function(){pt.removeChild(e),e=null}),void n("debug: 加载 "+a+" 失败"+t+" "+!wa[a].state)):!0}function c(){e:for(var e,t=T.length;e=T[--t];){var n=wa[e],a=n.deps;if(a){for(var r,i=0;r=a[i];i++)if(4!==Object(wa[r]).state)continue e;4!==n.state&&(T.splice(t,1),h(n.id,n.deps,n.factory),c())}}}function f(e,t,a){var r=ft.createElement("script");r.className=ht,r.onload=function(){var r=k.pop();r&&r.require(t),a&&a(),n("debug: 已成功加载 "+e),t&&T.push(t),c()},r.onerror=function(){s(r,!0)},pt.insertBefore(r,pt.firstChild),r.src=e,n("debug: 正准备加载 "+e)}function p(e){return(e||"").replace(D,"")}function d(e){return/^(?:[a-z]+:)?\/\//i.test(String(e))}function v(){var e;try{a.b.c()}catch(t){e=t.stack}if(e)return e=e.split(/[@ ]/g).pop(),e="("===e[0]?e.slice(1,-1):e.replace(/\s/,""),p(e.replace(/(:\d+)?:\d+$/i,""));for(var n,r=pt.getElementsByTagName("script"),i=r.length;n=r[--i];)if(n.className===ht&&"interactive"===n.readyState){var o=n.src;return n.className=p(o)}}function h(t,a,i){var o=Object(wa[t]);o.state=4;for(var l,s=0,c=[];l=a[s++];)if("exports"===l){var u=o.exports||(o.exports=r());c.push(u)}else c.push(wa[l].exports);try{var f=i.apply(e,c)}catch(p){n("执行["+t+"]模块的factory抛错: "+p)}return void 0!==f&&(o.exports=f),P.test(t)&&delete wa[t],delete o.factory,f}function m(e){0===e.indexOf(this.res+"!")&&(e=e.slice(this.res.length+1));var t=e,n=0,a=this.baseUrl,r=this.parentUrl||a;x(e,u.paths,function(e,a){t=t.replace(a,e),n=1}),n||x(e,u.packages,function(e,n,a){t=t.replace(a.name,a.location)}),this.mapUrl&&x(this.mapUrl,u.map,function(e){x(t,e,function(e,n){t=t.replace(n,e),r=a})});var i=this.ext;i&&n&&t.slice(-i.length)===i&&(t=t.slice(0,-i.length)),d(t)||(r=this.built||/^\w/.test(t)?a:r,t=C(r,t));var o=t+i;return t=o+this.query,x(e,u.urlArgs,function(e){t+=(-1===t.indexOf("?")?"?":"&")+e}),this.url=t,this.urlNoQuery=o}function g(e,t,n){var a=$(e,t,n);return a.sort(w),a}function y(e){return new RegExp("^"+e+"(/|$)")}function b(t){return function(){var n;return t.init&&(n=t.init.apply(e,arguments)),n||t.exports&&A(t.exports)}}function $(e,t,n){var a=[];for(var r in e){var i={name:r,val:e[r]};a.push(i),i.reg="*"===r&&t?/^/:y(r),n&&"*"!==r&&(i.reg=new RegExp("/"+r.replace(/^\//,"")+"(/|$)"))}return a}function x(e,t,n){t=t||[];for(var a,r=0;a=t[r++];)if(a.reg.test(e))return n(a.val,a.name,a),!1}function w(e,t){var n=e.name,a=t.name;return"*"===a?-1:"*"===n?1:a.length-n.length}function C(e,t){if("/"!==e.charAt(e.length-1)&&(e+="/"),"./"===t.slice(0,2))return e+t.slice(2);if(".."===t.slice(0,2)){for(e+=t;R.test(e);)e=e.replace(R,"");return e}return"/"===t.slice(0,1)?e+t.slice(1):e+t}function A(t){if(!t)return t;var n=e;return t.split(".").forEach(function(e){n=n[e]}),n}var T=[],k=[],E=/\.js$/i,M=[],O=!1;dt=avalon.require=function(e,n,a,l){if(O){Array.isArray(e)||avalon.error("require方法的第一个参数应为数组 "+e);var s=[],f=r(),p=a||"callback"+setTimeout("1");l=l||r(),l.baseUrl=u.baseUrl;var d=!!l.built;if(a&&(l.parentUrl=a.substr(0,a.lastIndexOf("/")),l.mapUrl=a.replace(E,"")),d){var v=t(l.defineName,l);p=v.urlNoQuery}else e.forEach(function(e){var n=t(e,l),a=o(n);a&&(f[a]||(s.push(a),f[a]="司徒正美"))});var h=wa[p];h&&4===h.state||(wa[p]={id:p,deps:d?e.concat():s,factory:n||i,state:3}),h||T.push(p),c()}else if(M.push(avalon.slice(arguments)),arguments.length<=2){O=!0;for(var m,g=M.splice(0,M.length);m=g.shift();)dt.apply(null,m)}},dt.define=function(e,t,n){"string"!=typeof e&&(n=t,t=e,e="anonymous"),Array.isArray(t)||(n=t,t=[]);var a={built:!O,defineName:e},r=[t,n,a];n.require=function(e){if(r.splice(2,0,e),wa[e]){wa[e].state=3;var t=!1;try{t=l(wa[e].deps,e)}catch(a){}t&&avalon.error(e+"模块与之前的模块存在循环依赖,请不要直接用script标签引入"+e+"模块")}delete n.require,dt.apply(null,r)};var i=a.built?"unknown":v();if(i){var o=wa[i];o&&(o.state=2),n.require(i)}else k.push(n)},dt.config=u,dt.define.amd=wa;var N=u["orig.paths"]=r(),L=u["orig.map"]=r(),j=u.packages=[],H=u["orig.args"]=r();avalon.mix(Gt,{paths:function(e){avalon.mix(N,e),u.paths=g(N)},map:function(e){avalon.mix(L,e);var t=g(L,1,1);avalon.each(t,function(e,t){t.val=g(t.val)}),u.map=t},packages:function(e){e=e.concat(j);for(var t,n=r(),a=[],i=0;t=e[i++];){t="string"==typeof t?{name:t}:t;var o=t.name;if(!n[o]){var l=C(t.location||o,t.main||"main");l=l.replace(E,""),a.push(t),n[o]=t.location=l,t.reg=y(o)}}u.packages=a.sort()},urlArgs:function(e){"string"==typeof e&&(e={"*":e}),avalon.mix(H,e),u.urlArgs=g(H,1)},baseUrl:function(e){if(!d(e)){var t=pt.getElementsByTagName("base")[0];t&&pt.removeChild(t);var n=ft.createElement("a");n.href=e,e=n.href,t&&pt.insertBefore(t,pt.firstChild)}e.length>3&&(u.baseUrl=e)},shim:function(e){for(var t in e){var n=e[t];Array.isArray(n)&&(n=e[t]={deps:n}),n.exportsFn||!n.exports&&!n.init||(n.exportsFn=b(n))}u.shim=e}});var S=dt.plugins={ready:{load:i},js:{load:function(e,t,n){var a=t.url,r=t.urlNoQuery,i=u.shim[e.replace(E,"")];i?dt(i.deps||[],function(){var e=avalon.slice(arguments);f(a,r,function(){n(i.exportsFn?i.exportsFn.apply(0,e):void 0)})}):f(a,r)}},css:{load:function(e,t,a){var r=t.url;pt.insertAdjacentHTML("afterBegin",'<link rel="stylesheet" href="'+r+'">'),n("debug: 已成功加载 "+r),a()}},text:{load:function(e,t,a){var r=t.url,i=ra();i.onload=function(){var e=i.status;e>399&&600>e?avalon.error(r+" 对应资源不存在或没有开启 CORS"):(n("debug: 已成功加载 "+r),a(i.responseText))},i.open("GET",r,!0),"withCredentials"in i&&(i.withCredentials=!0),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(),n("debug: 正准备加载 "+r)}}};dt.checkDeps=c;var D=/(\?[^#]*)$/,P=/^callback\d+$/,R=/\/\w+\/\.\./,I=ft.scripts[ft.scripts.length-1],_=I.getAttribute("data-main");if(_){Gt.baseUrl(_);var F=u.baseUrl;u.baseUrl=F.slice(0,F.lastIndexOf("/")+1),f(F.replace(E,"")+".js")}else{var B=p(I.src);u.baseUrl=B.slice(0,B.lastIndexOf("/")+1)}};var Ca,Aa=[],Ta=function(e){for(Ca=!0,dt&&(wa["domReady!"].state=4,dt.checkDeps());e=Aa.shift();)e(avalon)};"complete"===ft.readyState?setTimeout(Ta):ft.addEventListener("DOMContentLoaded",Ta),e.addEventListener("load",Ta),avalon.ready=function(e){Ca?e(avalon):Aa.push(e)},avalon.config({loader:!0}),avalon.ready(function(){avalon.scan(ft.body)}),"function"==typeof define&&define.amd&&define("avalon",[],function(){return avalon});var ka=e.avalon;return avalon.noConflict=function(t){return t&&e.avalon===avalon&&(e.avalon=ka),avalon},void 0===t&&(e.avalon=avalon),avalon});