(function(e,t){if(typeof module==="object"&&typeof module.exports==="object"){module.exports=e.document?t(e,true):function(e){if(!e.document){throw new Error("Avalon requires a window with a document")}return t(e)}}else{t(e)}})(typeof window!=="undefined"?window:this,function(e,t){var r=new Date-0;var n=e.document;var i=n.getElementsByTagName("head")[0];var o=i.insertBefore(document.createElement("avalon"),i.firstChild);o.innerHTML="X";o.setAttribute("ms-skip","1");o.className="avalonHide";var l=/\[native code\]/;function s(){if(e.console&&avalon.config.debug){Function.apply.call(console.log,console,arguments)}}var u="$"+r;var f=e.require;var c=e.define;var v;var p=false;var d=/[^, ]+/g;var h=/^(?:object|array)$/;var m=/^\[object SVG\w*Element\]$/;var g=/^\[object (?:Window|DOMWindow|global)\]$/;var y=Object.prototype;var b=y.hasOwnProperty;var x=y.toString;var w=Array.prototype;var $=w.slice;var C={};var T=e.dispatchEvent;var E=n.documentElement;var k=n.createDocumentFragment();var _=n.createElement("div");var A={};"Boolean Number String Function Array Date RegExp Object Error".replace(d,function(e){A["[object "+e+"]"]=e.toLowerCase()});function N(){}function O(e,t){if(typeof e==="string"){e=e.match(d)||[]}var r={},a=t!==void 0?t:1;for(var n=0,i=e.length;n>>0){var r=x.call(e).slice(8,-1);if(/(?:regexp|string|function|window|global)$/i.test(r))return false;if(r==="Array")return true;try{if({}.propertyIsEnumerable.call(e,"length")===false){return/^\s?function/.test(e.item||e.callee)}return true}catch(a){return!e.window}}return false}var V=new function(){function e(e){this.size=0;this.limit=e;this.head=this.tail=void 0;this._keymap={}}var t=e.prototype;t.put=function(e,t){var r={key:e,value:t};this._keymap[e]=r;if(this.tail){this.tail.newer=r;r.older=this.tail}else{this.head=r}this.tail=r;if(this.size===this.limit){this.shift()}else{this.size++}return t};t.shift=function(){var e=this.head;if(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(t===void 0)return;if(t===this.tail){return t.value}if(t.newer){if(t===this.head){this.head=t.newer}t.newer.older=t.older}if(t.older){t.older.newer=t.newer}t.newer=void 0;t.older=this.tail;if(this.tail){this.tail.newer=t}this.tail=t;return t.value};return e};if(!"司徒正美".trim){var U=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(U,"")}}var q=!{toString:null}.propertyIsEnumerable("toString"),W=function(){}.propertyIsEnumerable("prototype"),z=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],X=z.length;if(!Object.keys){Object.keys=function(e){var t=[];var r=W&&typeof e==="function";if(typeof e==="string"||e&&e.callee){for(var a=0;a=0;a--)if(this[a]===e)return a;return-1},forEach:Y("","_",""),filter:Y("r=[],j=0,","if(_)r[j++]=this[i]","return r"),map:Y("r=[],","r[i]=_","return r"),some:Y("","if(_)return true","return false"),every:Y("","if(!_)return false","return true")})}function G(e,t){try{while(t=t.parentNode)if(t===e)return true;return false}catch(r){return false}}avalon.contains=G;if(!n.contains){n.contains=function(e){return G(n,e)}}function J(){return(new XMLSerializer).serializeToString(this)}if(e.SVGElement){if(!n.createTextNode("x").contains){Node.prototype.contains=function(e){return!!(this.compareDocumentPosition(e)&16)}}var Z="http://www.w3.org/2000/svg";var Q=n.createElementNS(Z,"svg");Q.innerHTML='';if(!m.test(Q.firstChild)){function K(e,t){if(e&&e.childNodes){var r=e.childNodes;for(var a=0,i;i=r[a++];){if(i.tagName){var o=n.createElementNS(Z,i.tagName.toLowerCase());w.forEach.call(i.attributes,function(e){o.setAttribute(e.name,e.value)});K(i,o);t.appendChild(o)}}}}Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:true,configurable:true,get:J,set:function(e){var t=this.tagName.toLowerCase(),r=this.parentNode,a=avalon.parseHTML(e);if(t==="svg"){r.insertBefore(a,this)}else{var i=n.createDocumentFragment();K(a,i);r.insertBefore(i,this)}r.removeChild(this)}},innerHTML:{enumerable:true,configurable:true,get:function(){var e=this.outerHTML;var t=new RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i");var r=new RegExp("$","i");return e.replace(t,"").replace(r,"")},set:function(e){if(avalon.clearHTML){avalon.clearHTML(this);var t=avalon.parseHTML(e);K(t,this)}}}})}}if(!E.outerHTML&&e.HTMLElement){HTMLElement.prototype.__defineGetter__("outerHTML",J)}var ee=/^(?:mouse|contextmenu|drag)|click/;function te(e){var t={};for(var r in e){t[r]=e[r]}var a=t.target=e.srcElement;if(e.type.indexOf("key")===0){t.which=e.charCode!=null?e.charCode:e.keyCode}else if(ee.test(e.type)){var i=a.ownerDocument||n;var o=i.compatMode==="BackCompat"?i.body:i.documentElement;t.pageX=e.clientX+(o.scrollLeft>>0)-(o.clientLeft>>0);t.pageY=e.clientY+(o.scrollTop>>0)-(o.clientTop>>0);t.wheelDeltaY=t.wheelDelta;t.wheelDeltaX=0}t.timeStamp=new Date-0;t.originalEvent=e;t.preventDefault=function(){e.returnValue=false};t.stopPropagation=function(){e.cancelBubble=true};return t}var re=avalon.eventHooks;if(!("onmouseenter"in E)){avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){re[e]={type:t,deel:function(t,r,a){return function(r){var n=r.relatedTarget;if(!n||n!==t&&!(t.compareDocumentPosition(n)&16)){delete r.type;r.type=e;return a.call(t,r)}}}}})}avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(t,r){if(e[t]&&!re.animationend){re.animationend={type:r}}});if(!("oninput"in n.createElement("input"))){re.input={type:"propertychange",deel:function(e,t,r){return function(t){if(t.propertyName==="value"){t.type="input";return r.call(e,t)}}}}}if(n.onmousewheel===void 0){var ae=n.onwheel!==void 0?"wheel":"DOMMouseScroll";var ne=ae==="wheel"?"deltaY":"detail";re.mousewheel={type:ae,deel:function(e,t,r){return function(t){t.wheelDeltaY=t.wheelDelta=t[ne]>0?-120:120;t.wheelDeltaX=0;if(Object.defineProperty){Object.defineProperty(t,"type",{value:"mousewheel"})}r.call(e,t)}}}}function ie(e){for(var t in e){if(!b.call(e,t))continue;var r=e[t];if(typeof ie.plugins[t]==="function"){ie.plugins[t](r)}else if(typeof ie[t]==="object"){avalon.mix(ie[t],r)}else{ie[t]=r}}return this}var oe,le,se,ue,fe,ce=/[-.*+?^${}()|[\]\/\\]/g;function ve(e){return(e+"").replace(ce,"\\$&")}var pe={loader:function(t){var r=v&&t;e.require=r?v:f;e.define=r?v.define:c},interpolate:function(e){oe=e[0];le=e[1];if(oe===le){throw new SyntaxError("openTag!==closeTag")}else if(e+""===""){ie.commentInterpolate=true}else{var t=oe+"test"+le;_.innerHTML=t;if(_.innerHTML!==t&&_.innerHTML.indexOf("<")>-1){throw new SyntaxError("此定界符不合法")}_.innerHTML=""}var r=ve(oe),a=ve(le);se=new RegExp(r+"(.*?)"+a);ue=new RegExp(r+"(.*?)"+a,"g");fe=new RegExp(r+".*?"+a+"|\\sms-")}};ie.debug=true;ie.plugins=pe;ie.plugins["interpolate"](["{{","}}"]);ie.paths={};ie.shim={};ie.maxRepeatSize=100;avalon.config=ie;var de=/(\w+)\[(avalonctrl)="(\S+)"\]/;var he=n.querySelectorAll?function(e){return n.querySelectorAll(e)}:function(e){var t=e.match(de);var r=n.getElementsByTagName(t[1]);var a=[];for(var i=0,o;o=r[i++];){if(o.getAttribute(t[2])===t[3]){a.push(o)}}return a};var me={$watch:function(e,t){if(typeof t==="function"){var r=this.$events[e];if(r){r.push(t)}else{this.$events[e]=[t]}}else{this.$events=this.$watch.backup}return this},$unwatch:function(e,t){var r=arguments.length;if(r===0){this.$watch.backup=this.$events;this.$events={}}else if(r===1){this.$events[e]=[]}else{var a=this.$events[e]||[];var n=a.length;while(~--n<0){if(a[n]===t){return a.splice(n,1)}}}return this},$fire:function(e){var t,r,a,i;if(/^(\w+)!(\S+)$/.test(e)){t=RegExp.$1;e=RegExp.$2}var o=this.$events;if(!o)return;var l=$.call(arguments,1);var s=[e].concat(l);if(t==="all"){for(r in avalon.vmodels){a=avalon.vmodels[r];if(a!==this){a.$fire.apply(a,s)}}}else if(t==="up"||t==="down"){var u=o.expr?he(o.expr):[];if(u.length===0)return;for(r in avalon.vmodels){a=avalon.vmodels[r];if(a!==this){if(a.$events.expr){var f=he(a.$events.expr);if(f.length===0){continue}w.forEach.call(f,function(e){w.forEach.call(u,function(r){var n=t==="down"?r.contains(e):e.contains(r);if(n){e._avalon=a}})})}}}var c=n.getElementsByTagName("*");var v=[];w.forEach.call(c,function(e){if(e._avalon){v.push(e._avalon);e._avalon="";e.removeAttribute("_avalon")}});if(t==="up"){v.reverse()}for(r=0;i=v[r++];){if(i.$fire.apply(i,s)===false){break}}}else{var p=o[e]||[];var d=o.$all||[];for(r=0;i=p[r++];){if(L(i))i.apply(this,l)}for(r=0;i=d[r++];){if(L(i))i.apply(this,arguments)}}}};var ge=avalon.vmodels={};avalon.define=function(e,t){var r=e.$id||e;if(!r){s("warning: vm必须指定$id")}if(ge[r]){s("warning: "+r+" 已经存在于avalon.vmodels中")}if(typeof e==="object"){var a=Ce(e)}else{var n={$watch:N};t(n);a=Ce(n);p=true;t(a);p=false}a.$id=r;return ge[r]=a};var ye=String("$id,$watch,$unwatch,$fire,$events,$model,$skipArray,$proxy").match(d);var be=Object.defineProperty;var xe=true;try{be({},"_",{value:"x"});var we=Object.defineProperties}catch($e){xe=false}function Ce(e,t,r){if(Array.isArray(e)){var a=e.concat();e.length=0;var n=De(e);n.pushArray(a);return n}if(!e||e.nodeType>0||e.$id&&e.$events){return e}var i=Array.isArray(e.$skipArray)?e.$skipArray:[];i.$special=t||{};var o={};r=r||{};var l={};var s={};var f=[];ye.forEach(function(t){delete e[t]});for(var c in e){(function(e,t,a){r[e]=t;if(!Se(e,t,i)){return}l[e]=[];var n=avalon.type(t);if(n==="object"&&L(t.get)&&Object.keys(t).length<=2){a=Ee(e,t);f.push(a)}else if(h.test(n)){a=ke(e,t,n);f.push(function(){var t=a._vmodel;t.$events[u]=this.$events[e]})}else{a=Te(e,t)}s[e]=a})(c,e[c])}o=we(o,je(s),e);for(var v in e){if(!s[v]){o[v]=e[v]}}o.$id=M();o.$model=r;o.$events=l;for(c in me){var p=me[c];if(!T){p=p.bind(o)}o[c]=p}if(xe){Object.defineProperty(o,"hasOwnProperty",{value:function(e){return e in this.$model},writable:false,enumerable:false,configurable:true})}else{o.hasOwnProperty=function(e){return e in o.$model}}f.forEach(function(e){e.call(o)});return o}function Te(e,t){function r(e){var t=r._value;if(arguments.length>0){if(p){return this}if(!Me(e,t)){r.updateValue(this,e);r.notify(this,e,t)}return this}else{We.collectDependency(this,r);return t}}Oe(r,e);r._value=t;return r}function Ee(e,t){t.set=t.set||N;function r(e){var t=r._value;var a="_value"in r;if(arguments.length>0){if(p){return this}r.set.call(this,e);return this}else{We.collectDependency(this,r);if(!r.digest){var n=this;var i;r.digest=function(){r.updateValue=Ae;r.notify=N;r.call(n);clearTimeout(i);i=setTimeout(function(){Oe(r,r._name);r.call(n)})}}We.begin({callback:function(e,t){var a=t._name;if(t!==r){var n=e.$events[a];Xe(n,r.digest)}}});try{e=r.get.call(this)}finally{We.end()}if(t!==e){r.updateValue(this,e);a&&r.notify(this,e,t)}return e}}r.set=t.set||N;r.get=t.get;Oe(r,e);return r}function ke(e,t,r){function a(t){var n=a._value;var i=a._vmodel;if(arguments.length>0){if(p){return this}if(r==="array"){var o=i._;i._=[];i.clear();i._=o;i.pushArray(t)}else if(r==="object"){var l=i.$proxy;var s=this.$events[e]||[];i=a._vmodel=Ce(t);i.$proxy=l;if(s.length){s.forEach(function(e){if(e.rollback){e.rollback();B[e.type](e,e.vmodels)}});i.$events[e]=s}}a.updateValue(this,i.$model);a.notify(this,this._value,n);return this}else{We.collectDependency(this,a);return i}}Oe(a,e);a._vmodel=Ce(t);return a}function _e(e,t){e.$model[this._name]=this._value=t}function Ae(e,t){e.$model[this._name]=t}function Ne(e,t,r){var a=this._name;var n=e.$events[a];if(n){Ye(n);me.$fire.call(e,a,t,r)}}function Oe(e,t){e._name=t;e.updateValue=_e;e.notify=Ne}var Me=Object.is||function(e,t){if(e===0&&t===0){return 1/e===1/t}else if(e!==e){return t!==t}else{return e===t}};function Se(e,t,r){if(L(t)||t&&t.nodeType){return false}if(r.indexOf(e)!==-1){return false}var a=r.$special;if(e&&e.charAt(0)==="$"&&!a[e]){return false}return true}var je=T?function(e){var t={};for(var r in e){t[r]={get:e[r],set:e[r],enumerable:true,configurable:true}}return t}:function(e){return e};if(!xe){if("__defineGetter__"in avalon){be=function(e,t,r){if("value"in r){e[t]=r.value}if("get"in r){e.__defineGetter__(t,r.get)}if("set"in r){e.__defineSetter__(t,r.set)}return e};we=function(e,t){for(var r in t){if(t.hasOwnProperty(r)){be(e,r,t[r])}}return e}}if(j){var Le={};e.execScript(["Function parseVB(code)"," ExecuteGlobal(code)","End Function"].join("\n"),"VBScript");function He(e,t,r,a){var n=t[r];if(arguments.length===4){n.call(e,a)}else{return n.call(e)}}we=function(t,a,n){var i=[];i.push("\r\n Private [__data__], [__proxy__]"," Public Default Function [__const__](d, p)"," Set [__data__] = d: set [__proxy__] = p"," Set [__const__] = Me"," End Function");for(t in n){if(!a.hasOwnProperty(t)){i.push(" Public ["+t+"]")}}ye.forEach(function(e){if(!a.hasOwnProperty(e)){i.push(" Public ["+e+"]")}});i.push(" Public ["+"hasOwnProperty"+"]");for(t in a){i.push(" Public Property Let ["+t+"](val"+r+")",' Call [__proxy__](Me,[__data__], "'+t+'", val'+r+")"," End Property"," Public Property Set ["+t+"](val"+r+")",' Call [__proxy__](Me,[__data__], "'+t+'", val'+r+")"," End Property"," Public Property Get ["+t+"]"," On Error Resume Next"," Set["+t+'] = [__proxy__](Me,[__data__],"'+t+'")'," If Err.Number <> 0 Then"," ["+t+'] = [__proxy__](Me,[__data__],"'+t+'")'," End If"," On Error Goto 0"," End Property")}i.push("End Class");var o=i.join("\r\n");var l=Le[o];if(!l){l=M("VBClass");e.parseVB("Class "+l+o);e.parseVB(["Function "+l+"Factory(a, b)"," Dim o"," Set o = (New "+l+")(a, b)"," Set "+l+"Factory = o","End Function"].join("\r\n"));Le[o]=l}var s=e[l+"Factory"](a,He);return s}}}function De(e){var t=[];t.$id=M();t.$model=e;t.$events={};t.$events[u]=[];t._=Ce({length:e.length});t._.$watch("length",function(e,r){t.$fire("length",e,r)});for(var r in me){t[r]=me[r]}t.$map={el:1};t.$proxy=[];avalon.mix(t,Be);return t}function Pe(e,t,r,a,n,i,o){var l=this.length,s=2;while(--s){switch(e){case"add":var u=t+r;var f=this.$model.slice(t,u).map(function(e){if(h.test(avalon.type(e))){return e.$id?e:Ce(e,0,e)}else{return e}});Fe.apply(this,[t,0].concat(f));for(var c=t;c2){if(a){r.splice(3,1,0,"add",e,t-2)}else{r.push("add",e,t-2,0)}a=true}if(a){return Pe.apply(this,r)}else{return[]}},contains:function(e){return this.indexOf(e)!==-1},remove:function(e){return this.removeAt(this.indexOf(e))},removeAt:function(e){if(e>=0){this.$model.splice(e,1);return Pe.call(this,"del",e,1,0)}return[]},clear:function(){ca(this.$proxy,"each");this.$model.length=this.$proxy.length=this.length=this._.length=0;this._fire("clear",0);return this},removeAll:function(e){if(Array.isArray(e)){for(var t=this.length-1;t>=0;t--){if(e.indexOf(this[t])!==-1){this.removeAt(t)}}}else if(typeof e==="function"){for(t=this.length-1;t>=0;t--){if(e(this[t],t)){this.removeAt(t)}}}else{this.clear()}},ensure:function(e){if(!this.contains(e)){this.push(e)}return this},set:function(e,t){if(e>=0){var r=avalon.type(t);if(t&&t.$model){t=t.$model}var a=this[e];if(r==="object"){for(var n in t){if(a.hasOwnProperty(n)){a[n]=t[n]}}}else if(r==="array"){a.clear().push.apply(a,t)}else if(a!==t){this[e]=t;this.$model[e]=t;var i=this.$proxy[e];if(i){Ye(i.$events.el)}}}return this}};function Ie(e,t){var r=e.length-1;for(var a;a=e[t];t++){a.$index=t;a.$first=t===0;a.$last=t===r}}function Re(e,t){var r={};for(var a=0,n=t.length;a444&&typeof e[0]==="object"){tt()}var t=$.call(arguments,1);for(var r=e.length,a;a=e[--r];){var n=a.element;if(n&&n.parentNode){if(a.$repeat){a.handler.apply(a,t)}else if(a.type!=="on"){var i=a.evaluator||N;a.handler(i.apply(0,a.args||[]),n,a)}}}}}var Ge=0;var Je=avalon.$$subscribers=[];var Ze=new Date;var Qe={};function Ke(e){return e.uniqueNumber||(e.uniqueNumber=++Ge)}function et(e,t){var r=e.element;if(!e.uuid){if(r.nodeType!==1){e.uuid=e.type+(e.pos||0)+"-"+Ke(r.parentNode)}else{e.uuid=e.name+"-"+Ke(r)}}var a=e.lists||(e.lists=[]);avalon.Array.ensure(a,t);t.$uuid=t.$uuid||M();if(!Je[e.uuid]){Je[e.uuid]=1;Je.push(e)}}function tt(e){var t=Je.length;var r=t;var a=[];var n={};var i={};while(e=Je[--t]){var o=e.type;if(i[o]){i[o]++}else{i[o]=1;a.push(o)}}var l=false;a.forEach(function(e){if(Qe[e]!==i[e]){n[e]=1;l=true}});t=r;if(l){while(e=Je[--t]){if(!e.element)continue;if(n[e.type]&&at(e.element)){Je.splice(t,1);delete Je[e.uuid];var s=e.lists;for(var u=0,f;f=s[u++];){avalon.Array.remove(s,f);avalon.Array.remove(f,e)}rt(e)}}}Qe=i;Ze=new Date}function rt(e){e.element=null;e.rollback&&e.rollback();for(var t in e){e[t]=null}}function at(e){try{if(!e.parentNode){return true}}catch(t){return true}return e.msRetain?0:e.nodeType===1?!E.contains(e):!avalon.contains(E,e)}var nt={area:[1,"",""],param:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],option:[1,""],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],g:[1,'',""],_default:T?[0,"",""]:[1,"X
","
"]};nt.th=nt.td;nt.optgroup=nt.option;nt.tbody=nt.tfoot=nt.colgroup=nt.caption=nt.thead;String("circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use").replace(d,function(e){nt[e]=nt.g});var it=/<([\w:]+)/;var ot=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;var lt=T?/[^\d\D]/:/(<(?:script|link|style|meta|noscript))/gi;var st=O(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]);var ut=/<(?:tb|td|tf|th|tr|col|opt|leg|cap|area)/;var ft=n.createElement("script");var ct=/<|&#?\w+;/;avalon.parseHTML=function(e){var t=k.cloneNode(false);if(typeof e!=="string"){return t}if(!ct.test(e)){t.appendChild(n.createTextNode(e));return t}e=e.replace(ot,"<$1>").trim();var r=(it.exec(e)||["",""])[1].toLowerCase(),a=nt[r]||nt._default,i=_,o,l;if(!T){e=e.replace(lt,"
$1")}i.innerHTML=a[1]+e+a[2];var s=i.getElementsByTagName("script");if(s.length){for(var u=0,f;f=s[u++];){if(st[f.type]){l=ft.cloneNode(false);w.forEach.call(f.attributes,function(e){if(e&&e.specified){l[e.name]=e.value;l.setAttribute(e.name,e.value)}});l.text=f.text;f.parentNode.replaceChild(l,f)}}}if(!T){var c=a[1]==="X
"?i.lastChild.firstChild:i.lastChild;if(c&&c.tagName==="TABLE"&&r!=="tbody"){for(s=c.childNodes,u=0;f=s[u++];){if(f.tagName==="TBODY"&&!f.innerHTML){c.removeChild(f);break}}}s=i.getElementsByTagName("br");var v=s.length;while(f=s[--v]){if(f.className==="msNoScope"){f.parentNode.removeChild(f)}}for(s=i.all,u=0;f=s[u++];){if(vt(f)){pt(f)}}}for(u=a[0];u--;i=i.lastChild){}while(o=i.firstChild){t.appendChild(o)}return t};function vt(e){var t=e.nodeName;return t.toLowerCase()===t&&e.scopeName&&e.outerText===""}function pt(e){if(e.currentStyle.behavior!=="url(#default#VML)"){e.style.behavior="url(#default#VML)";e.style.display="inline-block";e.style.zoom=1}}avalon.innerHTML=function(e,t){if(!T&&(!lt.test(t)&&!ut.test(t))){try{e.innerHTML=t;return}catch(r){}}var a=this.parseHTML(t);this.clearHTML(e).appendChild(a)};avalon.clearHTML=function(e){e.textContent="";while(e.firstChild){e.removeChild(e.firstChild)}return e};function dt(e){return e.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function ht(e){if(!e||e.indexOf("-")<0&&e.indexOf("_")<0){return e}return e.replace(/[-_][^-_]/g,function(e){return e.charAt(1).toUpperCase()})}var mt={_toString:function(){var e=this.node;var t=e.className;var r=typeof t==="string"?t:t.baseVal;return r.split(/\s+/).join(" ")},_contains:function(e){return(" "+this+" ").indexOf(" "+e+" ")>-1},_add:function(e){if(!this.contains(e)){this._set(this+" "+e)}},_remove:function(e){this._set((" "+this+" ").replace(" "+e+" "," "))},__set:function(e){e=e.trim();var t=this.node;if(m.test(t)){t.setAttribute("class",e)}else{t.className=e}}};function gt(e){if(!("classList"in e)){e.classList={node:e};for(var t in mt){e.classList[t.slice(1)]=mt[t]}}return e.classList}"add,remove".replace(d,function(e){avalon.fn[e+"Class"]=function(t){var r=this[0];if(t&&typeof t==="string"&&r&&r.nodeType===1){t.replace(/\S+/g,function(t){gt(r)[e](t)})}return this}});avalon.fn.mix({hasClass:function(e){var t=this[0]||{};return t.nodeType===1&>(t).contains(e)},toggleClass:function(e,t){var r,a=0;var n=String(e).split(/\s+/);var i=typeof t==="boolean";while(r=n[a++]){var o=i?t:!this.hasClass(r);this[o?"addClass":"removeClass"](r)}return this},attr:function(e,t){if(arguments.length===2){this[0].setAttribute(e,t);return this}else{return this[0].getAttribute(e)}},data:function(e,t){e="data-"+dt(e||"");switch(arguments.length){case 2:this.attr(e,t);return this;case 1:var r=this.attr(e);return yt(r);case 0:var a={};w.forEach.call(this[0].attributes,function(t){if(t){e=t.name;if(!e.indexOf("data-")){e=ht(e.slice(5));a[e]=yt(t.value)}}});return a}},removeData:function(e){e="data-"+dt(e);this[0].removeAttribute(e);return this},css:function(e,t){if(avalon.isPlainObject(e)){for(var r in e){avalon.css(this,r,e[r])}}else{var a=avalon.css(this,e,t)}return a!==void 0?a:this},position:function(){var e,t,r=this[0],a={top:0,left:0};if(!r){return}if(this.css("position")==="fixed"){t=r.getBoundingClientRect()}else{e=this.offsetParent();t=this.offset();if(e[0].tagName!=="HTML"){a=e.offset()}a.top+=avalon.css(e[0],"borderTopWidth",true);a.left+=avalon.css(e[0],"borderLeftWidth",true);a.top-=e.scrollTop();a.left-=e.scrollLeft()}return{top:t.top-a.top-avalon.css(r,"marginTop",true),left:t.left-a.left-avalon.css(r,"marginLeft",true)}},offsetParent:function(){var e=this[0].offsetParent;while(e&&avalon.css(e,"position")==="static"){e=e.offsetParent}return avalon(e||E)},bind:function(e,t,r){if(this[0]){return avalon.bind(this[0],e,t,r)}},unbind:function(e,t,r){if(this[0]){avalon.unbind(this[0],e,t,r)}return this},val:function(e){var t=this[0];if(t&&t.nodeType===1){var r=arguments.length===0;var a=r?":get":":set";var n=Bt[Pt(t)+a];if(n){var i=n(t,e)}else if(r){return(t.value||"").replace(/\r/g,"")}else{t.value=e}}return r?i:this}});function yt(e){try{if(typeof e==="object")return e;e=e==="true"?true:e==="false"?false:e==="null"?null:+e+""===e?+e:bt.test(e)?avalon.parseJSON(e):e}catch(t){}return e}var bt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,xt=/^[\],:{}\s]*$/,wt=/(?:^|:|,)(?:\s*\[)+/g,$t=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,Ct=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g;avalon.parseJSON=e.JSON?JSON.parse:function(e){if(typeof e==="string"){e=e.trim();if(e){if(xt.test(e.replace($t,"@").replace(Ct,"]").replace(wt,""))){return new Function("return "+e)()}}avalon.error("Invalid JSON: "+e)}return e};avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){avalon.fn[e]=function(r){var a=this[0]||{},n=Tt(a),i=e==="scrollTop";if(!arguments.length){return n?t in n?n[t]:E[e]:a[e]}else{if(n){n.scrollTo(!i?r:avalon(n).scrollLeft(),i?r:avalon(n).scrollTop())}else{a[e]=r}}}});function Tt(e){return e.window&&e.document?e:e.nodeType===9?e.defaultView||e.parentWindow:false}var Et=avalon.cssHooks={};var kt=["","-webkit-","-o-","-moz-","-ms-"];var _t={"float":T?"cssFloat":"styleFloat"};avalon.cssNumber=O("columnCount,order,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom");avalon.cssName=function(e,t,r){if(_t[e]){return _t[e]}t=t||E.style;for(var a=0,n=kt.length;a]+))?)*\s+value[\s=]/i;var Bt={"option:get":j?function(e){return Ft.test(e.outerHTML)?e.value:e.text.trim()}:function(e){return e.value},"select:get":function(e,t){var r,a=e.options,n=e.selectedIndex,i=Bt["option:get"],o=e.type==="select-one"||n<0,l=o?null:[],s=o?n+1:a.length,u=n<0?s:o?n:0;for(;u-1){r=true}}if(!r){e.selectedIndex=-1}}};var It={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var Rt=e.JSON&&JSON.stringify||function(e){return'"'+e.replace(/[\\\"\x00-\x1f]/g,function(e){var t=It[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"'};var Vt=["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(",");var Ut=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g;var qt=/[^\w$]+/g;var Wt=new RegExp(["\\b"+Vt.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g");var zt=/\b\d[^,]*/g;var Xt=/^,+|,+$/g;var Yt=new V(512);var Gt=function(e){var t=","+e.trim();var r=Yt.get(t);if(r){return r}var a=e.replace(Ut,"").replace(qt,",").replace(Wt,"").replace(zt,"").replace(Xt,"").split(/^$|,+/);return Yt.put(t,Zt(a))};function Jt(e,t,r,a){var n=[],i=" = "+r+".";var o=/\$proxy\$each/.test(t.$id);for(var l=e.length,s;s=e[--l];){var u=o&&t.$map[s]?"el":s;if(t.hasOwnProperty(u)){n.push(s+i+u);a.vars.push(s);if(a.type==="duplex"){e.get=r+"."+u}e.splice(l,1)}}return n}function Zt(e){var t=[],r={};for(var a=0;a-1||e.indexOf("&&")>-1)){a.vars.forEach(function(t){var r=new RegExp("\\b"+t+"(?:\\.\\w+|\\[\\w+\\])+","ig");e=e.replace(r,function(r){var a=r.charAt(t.length);var n=j?e.slice(arguments[1]+r.length):RegExp.rightContext;var i=/^\s*\(/.test(n);if(a==="."||a==="["||i){var o="var"+String(Math.random()).replace(/^0\./,"");if(i){var l=r.split(".");if(l.length>2){var s=l.pop();u.push(o+" = "+l.join("."));return o+"."+s}else{return r}}u.push(o+" = "+r);return o}else{return r}})})}a.args=c;delete a.vars;var m=Qt.get(o);if(m){a.evaluator=m;return}v=u.join(", ");if(v){v="var "+v}if(/\S/.test(i)){if(!/text|html/.test(a.type)){throw Error("ms-"+a.type+"不支持过滤器")}e="\nvar ret"+r+" = "+e+";\r\n";e+=or("ret"+r,i)}else if(n==="duplex"){var g="'use strict';\nreturn function(vvv){\n "+v+";\n if(!arguments.length){\n return "+e+"\n }\n "+(!Kt.test(e)?l.get:e)+"= vvv;\n} ";try{m=Function.apply(N,f.concat(g));a.evaluator=Qt.put(o,m)}catch(y){s("debug: parse error,"+y.message)}return}else if(n==="on"){if(e.indexOf("(")===-1){e+=".call(this, $event)"}else{e=e.replace("(",".call(this,")}f.push("$event");e="\nreturn "+e+";";var b=e.lastIndexOf("\nreturn");var x=e.slice(0,b);var w=e.slice(b);e=x+"\n"+w}else{e="\nreturn "+e+";"}try{m=Function.apply(N,f.concat("'use strict';\n"+v+e));a.evaluator=Qt.put(o,m)}catch(y){s("debug: parse error,"+y.message)}finally{l=u=f=null}}function sr(e,t,r,a,n){if(Array.isArray(a)){e=a.map(function(e){return e.expr?"("+e.value+")":Rt(e.value)}).join(" + ")}lr(e,t,r);if(r.evaluator&&!n){r.handler=I[r.handlerName||r.type];avalon.injectBinding(r)}}avalon.parseExprProxy=sr;avalon.scan=function(e,t){e=e||E;var r=t?[].concat(t):[];Sr(e,r)};var ur=O("area,base,basefont,br,col,command,embed,hr,img,input,link,meta,param,source,track,wbr,noscript,script,style,textarea".toUpperCase());function fr(e,t,r){var a=setTimeout(function(){var n=e.innerHTML;clearTimeout(a);if(n===r){t()}else{fr(e,t,n)}})}function cr(e,t){var r=e.getAttribute("avalonctrl")||t.$id;e.setAttribute("avalonctrl",r);t.$events.expr=e.tagName+'[avalonctrl="'+r+'"]'}var vr=function(e,t,r){var a=e.getAttribute(t);if(a){for(var n=0,i;i=r[n++];){if(i.hasOwnProperty(a)&&typeof i[a]==="function"){return i[a]}}}};function pr(e,t){for(var r=0,a;a=e[r++];){a.vmodels=t;B[a.type](a,t);if(a.evaluator&&a.element&&a.element.nodeType===1){a.element.removeAttribute(a.name)}}e.length=0}var dr=j&&e.MutationObserver?function(e){var t=e.firstChild,r;while(t){var a=t.nextSibling;if(t.nodeType===3){if(r){r.nodeValue+=t.nodeValue;e.removeChild(t)}else{r=t}}else{r=null}t=a}}:0;var hr=/ms-(\w+)-?(.*)/;var mr={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2e3,on:3e3};var gr=O("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit");var yr=O("value,title,alt,checked,selected,disabled,readonly,enabled");function br(e,t){return e.priority-t.priority}function xr(e,t,r){var a=true;if(t.length){var n=Ar?Ar(e):e.attributes;var i=[];var o=[];var l={};for(var u=0,f;f=n[u++];){if(f.specified){if(r=f.name.match(hr)){var c=r[1];var v=r[2]||"";var p=f.value;var d=f.name;if(gr[c]){v=c;c="on"}else if(yr[c]){if(c==="enabled"){s("warning!ms-enabled或ms-attr-enabled已经被废弃");c="disabled";p="!("+p+")"}v=c;c="attr";d="ms-"+c+"-"+v;o.push([f.name,d,p])}l[d]=p;if(typeof B[c]==="function"){var h={type:c,param:v,element:e,name:d,value:p,priority:(mr[c]||c.charCodeAt(0)*10)+(Number(v.replace(/\D/g,""))||0)};if(c==="html"||c==="text"){var m=Fr(p);avalon.mix(h,m);h.filters=h.filters.replace(jr,function(){h.type="html";h.group=1;return""})}else if(c==="duplex"){var g=d}else if(d==="ms-if-loop"){h.priority+=100}i.push(h);if(c==="widget"){e.msData=e.msData||l}}}}}if(i.length){i.sort(br);o.forEach(function(t){s("warning!请改用"+t[1]+"代替"+t[0]+"!");e.removeAttribute(t[0]);e.setAttribute(t[1],t[2])});if(g){if(l["ms-attr-checked"]){s("warning!一个控件不能同时定义ms-attr-checked与"+g)}if(l["ms-attr-value"]){s("warning!一个控件不能同时定义ms-attr-value与"+g)}}for(u=0;h=i[u];u++){c=h.type;if(wr.test(c)){return pr(i.slice(0,u+1),t)}else if(a){a=!$r.test(c)}}pr(i,t)}}if(a&&!ur[e.tagName]&&fe.test(e.innerHTML.replace(Hr,"<").replace(Dr,">"))){dr&&dr(e);Nr(e,t)}}var wr=/^if|widget|repeat$/;var $r=/^each|with|html|include$/;if(!"1"[0]){var Cr=new V(512);var Tr=/\s+(ms-[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,Er=/^['"]/,kr=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/i,_r=/&/g;var Ar=function(e){var t=e.outerHTML;if(t.slice(0,2)==="0){var r=e.replace(Pr,function(e){return Array(e.length+1).join("1")});var a=r.replace(Lr,"ᄢ㍄").indexOf("|");if(a>-1){return{filters:e.slice(a),value:e.slice(0,a),pos:t||0,expr:true}}}return{value:e,filters:"",expr:true}}function Br(e){var t=[],r,a=0,n;do{n=e.indexOf(oe,a);if(n===-1){break}r=e.slice(a,n);if(r){t.push({value:r,filters:"",expr:false})}a=n+oe.length;n=e.indexOf(le,a);if(n===-1){break}r=e.slice(a,n);if(r){t.push(Fr(r,a))}a=n+le.length}while(1);r=e.slice(a);if(r){t.push({value:r,expr:false,filters:""})}return t}function Ir(e,t){var r=[];if(e.nodeType===8){var a=Fr(e.nodeValue);var i=[a]}else{i=Br(e.data)}if(i.length){for(var o=0;a=i[o++];){var l=n.createTextNode(a.value);if(a.expr){a.type="text";a.element=l;a.filters=a.filters.replace(jr,function(){a.type="html";return""});r.push(a)}k.appendChild(l)}e.parentNode.replaceChild(k,e);if(r.length)pr(r,t)}}var Rr=["autofocus,autoplay,async,allowTransparency,checked,controls","declare,disabled,defer,defaultChecked,defaultSelected","contentEditable,isMap,loop,multiple,noHref,noResize,noShade","open,readOnly,selected"].join(",");var Vr={};Rr.replace(d,function(e){Vr[e.toLowerCase()]=e});var Ur={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"};var qr=["accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan","dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight","rowSpan,tabIndex,useMap,vSpace,valueType,vAlign"].join(",");qr.replace(d,function(e){Ur[e.toLowerCase()]=e});var Wr=/(?:[\s\S]+?)<\/noscript>/gim;var zr=/([\s\S]+?)<\/noscript>/im;var Xr=function(){return new(e.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP")};var Yr=avalon.templateCache={};B.attr=function(e,t){var r=e.value.trim(),a=true;if(r.indexOf(oe)>-1&&r.indexOf(le)>2){a=false;if(se.test(r)&&RegExp.rightContext===""&&RegExp.leftContext===""){a=true;r=RegExp.$1}}if(e.type==="include"){var i=e.element;e.includeRendered=vr(i,"data-include-rendered",t);e.includeLoaded=vr(i,"data-include-loaded",t);var o=e.includeReplace=!!avalon(i).data("includeReplace");if(avalon(i).data("includeCache")){e.templateCache={}}e.startInclude=n.createComment("ms-include");e.endInclude=n.createComment("ms-include-end");if(o){e.element=e.startInclude;i.parentNode.insertBefore(e.startInclude,i);i.parentNode.insertBefore(e.endInclude,i.nextSibling)}else{i.insertBefore(e.startInclude,i.firstChild);i.appendChild(e.endInclude)}}e.handlerName="attr";sr(r,t,e,a?0:Br(e.value))};I.attr=function(t,r,a){var i=a.type,l=a.param;if(i==="css"){avalon(r).css(l,t)}else if(i==="attr"){var s=t===false||t===null||t===void 0;if(!T&&Ur[l]){l=Ur[l]}var u=Vr[l];if(typeof r[u]==="boolean"){r[u]=!!t;if(!t){s=true}}if(s){return r.removeAttribute(l)}var f=m.test(r)?false:n.namespaces&&vt(r)?true:l in r.cloneNode(false);if(f){r[l]=t}else{r.setAttribute(l,t)}}else if(i==="include"&&t){var c=a.vmodels;var v=a.includeRendered;var p=a.includeLoaded;var d=a.includeReplace;var h=d?r.parentNode:r;var g=function(e){if(p){var r=p.apply(h,[e].concat(c));if(typeof r==="string")e=r}if(v){fr(h,function(){v.call(h)},NaN)}var i=a.includeLastID;if(a.templateCache&&i&&i!==t){var l=a.templateCache[i];if(!l){l=a.templateCache[i]=n.createElement("div");o.appendChild(l)}}a.includeLastID=t;while(true){var s=a.startInclude.nextSibling;if(s&&s!==a.endInclude){h.removeChild(s);if(l)l.appendChild(s)}else{break}}var u=Gr(a,t,e);var f=avalon.slice(u.childNodes);h.insertBefore(u,a.endInclude);Or(f,c)};if(a.param==="src"){if(typeof Yr[t]==="string"){avalon.nextTick(function(){g(Yr[t])})}else if(Array.isArray(Yr[t])){Yr[t].push(g)}else{var y=Xr();y.onreadystatechange=function(){if(y.readyState===4){var e=y.status;if(e>=200&&e<300||e===304||e===1223){var r=y.responseText;for(var a=0,n;n=Yr[t][a++];){n(r)}Yr[t]=r}}};Yr[t]=[g];y.open("GET",t,true);if("withCredentials"in y){y.withCredentials=true}y.setRequestHeader("X-Requested-With","XMLHttpRequest");y.send(null)}}else{var b=t&&t.nodeType===1?t:n.getElementById(t);if(b){if(b.tagName==="NOSCRIPT"&&!(b.innerHTML||b.fixIE78)){y=Xr();y.open("GET",location,false);y.send(null);var x=n.getElementsByTagName("noscript");var w=(y.responseText||"").match(Wr)||[];var $=w.length;for(var C=0;C<$;C++){var k=x[C];if(k){k.style.display="none";k.fixIE78=(w[C].match(zr)||[""," "])[1]}}}avalon.nextTick(function(){g(b.fixIE78||b.value||b.innerText||b.innerHTML)})}}}else{if(!E.hasAttribute&&typeof t==="string"&&(i==="src"||i==="href")){t=t.replace(/&/g,"&")}r[i]=t;if(e.chrome&&r.tagName==="EMBED"){var _=r.parentNode;var A=document.createComment("ms-src");_.replaceChild(A,r);_.replaceChild(r,A)}}};function Gr(e,t,r){var a=e.templateCache&&e.templateCache[t];if(a){var i=n.createDocumentFragment(),o;while(o=a.firstChild){i.appendChild(o)}return i}return avalon.parseHTML(r)}"title,alt,src,value,css,include,href".replace(d,function(e){B[e]=B.attr});B["class"]=function(e,t){var r=e.param,a=e.value,n;e.handlerName="class";if(!r||isFinite(r)){e.param="";var i=a.replace(ue,function(e){return e.replace(/./g,"0")});var o=i.indexOf(":");if(o===-1){var l=a}else{l=a.slice(0,o);n=a.slice(o+1);lr(n,t,e);if(!e.evaluator){s("debug: ms-class '"+(n||"").trim()+"' 不存在于VM中");return false}else{e._evaluator=e.evaluator;e._args=e.args}}var u=se.test(l);if(!u){e.immobileClass=l}sr("",t,e,u?Br(l):0)}else{e.immobileClass=e.oldStyle=e.param;sr(a,t,e)}};I["class"]=function(e,t,r){var a=avalon(t),n=r.type;if(n==="class"&&r.oldStyle){a.toggleClass(r.oldStyle,!!e)}else{r.toggleClass=r._evaluator?!!r._evaluator.apply(t,r._args):true;r.newClass=r.immobileClass||e;if(r.oldClass&&r.newClass!==r.oldClass){a.removeClass(r.oldClass)}r.oldClass=r.newClass;switch(n){case"class":a.toggleClass(r.newClass,r.toggleClass);break;case"hover":case"active":if(!r.hasBindEvent){var i="mouseenter";var o="mouseleave";if(n==="active"){t.tabIndex=t.tabIndex||-1;i="mousedown";o="mouseup";var l=a.bind("mouseleave",function(){r.toggleClass&&a.removeClass(r.newClass)})}var s=a.bind(i,function(){r.toggleClass&&a.addClass(r.newClass)});var u=a.bind(o,function(){r.toggleClass&&a.removeClass(r.newClass)});r.rollback=function(){a.unbind("mouseleave",l);a.unbind(i,s);a.unbind(o,u)};r.hasBindEvent=true}break}}};"hover,active".replace(d,function(e){B[e]=B["class"]});I.data=function(e,t,r){var a="data-"+r.param;if(e&&typeof e==="object"){t[a]=e}else{t.setAttribute(a,String(e))}};var Jr=B.duplex=function(e,t){var r=e.element,a;sr(e.value,t,e,0,1);e.changed=vr(r,"data-duplex-changed",t)||N;if(e.evaluator&&e.args){var n=[];var i=O("string,number,boolean,checked");if(r.type==="radio"&&e.param===""){e.param="checked"}if(r.msData){r.msData["ms-duplex"]=e.value}e.param.replace(/\w+/g,function(t){if(/^(checkbox|radio)$/.test(r.type)&&/^(radio|checked)$/.test(t)){if(t==="radio")s("ms-duplex-radio已经更名为ms-duplex-checked");t="checked";e.isChecked=true}if(t==="bool"){t="boolean";s("ms-duplex-bool已经更名为ms-duplex-boolean")}else if(t==="text"){t="string";s("ms-duplex-text已经更名为ms-duplex-string")}if(i[t]){a=true}avalon.Array.ensure(n,t)});if(!a){n.push("string")}e.param=n.join("-");e.bound=function(t,a){if(r.addEventListener){r.addEventListener(t,a,false)}else{r.attachEvent("on"+t,a)}var n=e.rollback;e.rollback=function(){r.avalonSetter=null;avalon.unbind(r,t,a);n&&n()}};for(var o in avalon.vmodels){var l=avalon.vmodels[o];l.$fire("avalon-ms-duplex-init",e)}var u=e.pipe||(e.pipe=Qr);u(null,e,"init");var f=r.tagName;Jr[f]&&Jr[f](r,e.evaluator.apply(null,e.args),e)}};function Zr(e){return e==null?"":e}avalon.duplexHooks={checked:{get:function(e,t){return!t.element.oldValue}},string:{get:function(e){return e},set:Zr},"boolean":{get:function(e){return e==="true"},set:Zr},number:{get:function(e,t){var r=parseFloat(e);if(-e===-r){return r}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:Zr}};function Qr(e,t,r,a){t.param.replace(/\w+/g,function(a){var n=avalon.duplexHooks[a];if(n&&typeof n[r]==="function"){e=n[r](e,t)}});return e}var Kr,ea=[];avalon.tick=function(e){if(ea.push(e)===1){Kr=setInterval(ta,60)}};function ta(){for(var e=ea.length-1;e>=0;e--){var t=ea[e];if(t()===false){ea.splice(e,1)}}if(!ea.length){clearInterval(Kr)}}var ra=N;var aa=/text|password|hidden/;new function(){try{var e={};var t=HTMLInputElement.prototype;var r=HTMLTextAreaElement.prototype;function a(t){if(avalon.contains(E,this)){e[this.tagName].call(this,t);if(!aa.test(this.type))return;if(!this.msFocus&&this.avalonSetter){this.avalonSetter()}}}var n=HTMLInputElement.prototype;Object.getOwnPropertyNames(n);e["INPUT"]=Object.getOwnPropertyDescriptor(t,"value").set;Object.defineProperty(t,"value",{set:a});e["TEXTAREA"]=Object.getOwnPropertyDescriptor(r,"value").set;Object.defineProperty(r,"value",{set:a})}catch(i){ra=avalon.tick}};if(j){avalon.bind(n,"selectionchange",function(e){var t=n.activeElement;if(t&&typeof t.avalonSetter==="function"){t.avalonSetter()}})}Jr.INPUT=function(e,t,r){var a=e.type,n=r.bound,i=avalon(e),o=false;function l(e){r.changed.call(this,e,r)}function u(){o=true}function f(){o=false}var c=function(){if(o)return;var a=e.oldValue=e.value;var n=r.pipe(a,r,"get");if(i.data("duplexObserve")!==false){t(n);l.call(e,n);if(i.data("duplex-focus")){avalon.nextTick(function(){e.focus()})}}};r.handler=function(){var a=r.pipe(t(),r,"set")+"";if(a!==e.oldValue){e.value=a}};if(r.isChecked||a==="radio"){var v=j===6;c=function(){if(i.data("duplexObserve")!==false){var a=r.pipe(e.value,r,"get");t(a);l.call(e,a)}};r.handler=function(){var a=t();var n=r.isChecked?!!a:a+""===e.value;e.oldValue=n;if(v){setTimeout(function(){e.defaultChecked=n;e.checked=n},31)}else{e.checked=n}};n("click",c)}else if(a==="checkbox"){c=function(){if(i.data("duplexObserve")!==false){var a=e.checked?"ensure":"remove";var n=t();if(!Array.isArray(n)){s("ms-duplex应用于checkbox上要对应一个数组");n=[n]}avalon.Array[a](n,r.pipe(e.value,r,"get"));l.call(e,n)}};r.handler=function(){var a=[].concat(t());e.checked=a.indexOf(r.pipe(e.value,r,"get"))>-1};n(T?"change":"click",c)}else{var p=e.getAttribute("data-duplex-event")||"input";if(e.attributes["data-event"]){s("data-event指令已经废弃,请改用data-duplex-event")}function h(e){setTimeout(function(){c(e)})}p.replace(d,function(e){switch(e){case"input":if(!j){n("input",c);n("compositionstart",u);n("compositionend",f);n("DOMAutoComplete",c)}else{if(j>8){n("input",c)}else{n("propertychange",function(e){if(e.propertyName==="value"){c()}})}n("dragend",h)}break;default:n(e,c);break}});n("focus",function(){e.msFocus=true});n("blur",function(){e.msFocus=false});if(aa.test(a)){ra(function(){if(E.contains(e)){if(!e.msFocus&&e.oldValue!==e.value){c()}}else if(!e.msRetain){return false}})}e.avalonSetter=c}e.oldValue=e.value;avalon.injectBinding(r);l.call(e,e.value)};Jr.TEXTAREA=Jr.INPUT;Jr.SELECT=function(e,t,r){var a=avalon(e);function n(){if(a.data("duplexObserve")!==false){var n=a.val();if(Array.isArray(n)){n=n.map(function(e){return r.pipe(e,r,"get")})}else{n=r.pipe(n,r,"get")}if(n+""!==e.oldValue){t(n)}r.changed.call(e,n,r)}}r.handler=function(){var r=t();r=r&&r.$model||r;if(Array.isArray(r)){if(!e.multiple){s("ms-duplex在不能对应一个数组")}}r=Array.isArray(r)?r.map(String):r+"";if(r+""!==e.oldValue){a.val(r);e.oldValue=r+""}};r.bound("change",n);e.msCallback=function(){avalon.injectBinding(r);r.changed.call(e,t(),r)}};I.html=function(e,t,r){var a=t.nodeType!==1;var i=a?t.parentNode:t;if(!i)return;e=e==null?"":e;if(t.nodeType===3){var o=M("html");i.insertBefore(n.createComment(o),t);r.element=n.createComment(o+":end");i.replaceChild(r.element,t);t=r.element}if(typeof e!=="object"){var l=avalon.parseHTML(String(e))}else if(e.nodeType===11){l=e}else if(e.nodeType===1||e.item){var s=e.nodeType===1?e.childNodes:e.item;l=k.cloneNode(true);while(s[0]){l.appendChild(s[0])}}s=avalon.slice(l.childNodes);if(a){var u=t.nodeValue.slice(0,-4);while(true){var f=t.previousSibling;if(!f||f.nodeType===8&&f.nodeValue===u){break}else{i.removeChild(f)}}i.insertBefore(l,t)}else{avalon.clearHTML(t).appendChild(l)}Or(s,r.vmodels)};B["if"]=B.data=B.text=B.html=function(e,t){sr(e.value,t,e)};I["if"]=function(e,t,r){try{if(!t.parentNode)return}catch(a){return}if(e){if(t.nodeType===8){t.parentNode.replaceChild(r.template,t);t=r.element=r.template}if(t.getAttribute(r.name)){t.removeAttribute(r.name);xr(t,r.vmodels)}r.rollback=null}else{if(t.nodeType===1){var i=r.element=n.createComment("ms-if");t.parentNode.replaceChild(i,t);r.template=t;o.appendChild(t);r.rollback=function(){if(t.parentNode===o){o.removeChild(t)}}}}};var na=/\(([^)]*)\)/;B.on=function(e,t){var r=e.value;e.type="on";var a=e.param.replace(/-\d+$/,"");if(typeof B.on[a+"Hook"]==="function"){B.on[a+"Hook"](e)}if(r.indexOf("(")>0&&r.indexOf(")")>-1){var n=(r.match(na)||["",""])[1].trim();if(n===""||n==="$event"){r=r.replace(na,"")}}sr(r,t,e)};I.on=function(e,t,r){e=function(e){var t=r.evaluator||N;return t.apply(this,r.args.concat(e))};var a=r.param.replace(/-\d+$/,"");if(a==="scan"){e.call(t,{type:a})}else if(typeof r.specialBind==="function"){r.specialBind(t,e)}else{var n=avalon.bind(t,a,e)}r.rollback=function(){if(typeof r.specialUnbind==="function"){r.specialUnbind()}else{avalon.unbind(t,a,n)}}};B.repeat=function(e,t){var r=e.type;sr(e.value,t,e,0,1);var a=false;try{var i=e.$repeat=e.evaluator.apply(0,e.args||[]);var o=avalon.type(i);if(o!=="object"&&o!=="array"){a=true;avalon.log("warning:"+e.value+"只能是对象或数组")}}catch(l){a=true}var s=e.value.split(".")||[];if(s.length>1){s.pop();var f=s[0];for(var c=0,v;v=t[c++];){if(v&&v.hasOwnProperty(f)){var p=v[f].$events||{};p[u]=p[u]||[];p[u].push(e);break}}}var d=e.element;if(d.nodeType===1){d.removeAttribute(e.name);e.sortedCallback=vr(d,"data-with-sorted",t);e.renderedCallback=vr(d,"data-"+r+"-rendered",t);var h=M(r);var m=n.createComment(h);var g=n.createComment(h+":end");e.signature=h;e.template=k.cloneNode(false);if(r==="repeat"){var y=d.parentNode;y.replaceChild(g,d);y.insertBefore(m,g);e.template.appendChild(d)}else{while(d.firstChild){e.template.appendChild(d.firstChild)}d.appendChild(m);d.appendChild(g)}e.element=g;e.handler=I.repeat;e.rollback=function(){var t=e.element;if(!t)return;e.handler("clear")}}if(a){return}e.$outer={};var b="$key";var x="$val";if(Array.isArray(i)){if(!i.$map){i.$map={el:1};var w=i.length;var $=[];for(c=0;cie.maxRepeatSize){t.pop()}}I.text=function(e,t){e=e==null?"":e;if(t.nodeType===3){try{t.data=e}catch(r){}}else{if("textContent"in t){t.textContent=e}else{t.innerText=e}}};function pa(e,t){var r="_"+e;if(!pa[r]){var a=n.createElement(e);E.appendChild(a);if(T){t=getComputedStyle(a,null).display}else{t=a.currentStyle.display}E.removeChild(a);pa[r]=t}return pa[r]}avalon.parseDisplay=pa;B.visible=function(e,t){var r=avalon(e.element);var a=r.css("display");if(a==="none"){var n=r[0].style;var i=/visibility/i.test(n.cssText);var o=r.css("visibility");n.display="";n.visibility="hidden";a=r.css("display");if(a==="none"){a=pa(r[0].nodeName)}n.visibility=i?o:""}e.display=a;sr(e.value,t,e)};I.visible=function(e,t,r){t.style.display=e?r.display:"none"};B.widget=function(t,r){var a=t.value.match(d);var n=t.element;var i=a[0];var o=a[1];if(!o||o==="$"){o=M(i)}var l=a[2]||i;var u=avalon.ui[i];if(typeof u==="function"){r=n.vmodels||r;for(var f=0,c;c=r[f++];){if(c.hasOwnProperty(l)&&typeof c[l]==="object"){var v=c[l];v=v.$model||v;break}}if(v){var p=v[i+"Id"];if(typeof p==="string"){s("warning!不再支持"+i+"Id");o=p}}var h=avalon.getWidgetData(n,i);t.value=[i,o,l].join(",");t[i+"Id"]=o;t.evaluator=N;n.msData["ms-widget-id"]=o;var m=t[i+"Options"]=avalon.mix({},u.defaults,v||{},h);n.removeAttribute("ms-widget");var g=u(n,t,r)||{};if(g.$id){avalon.vmodels[o]=g;cr(n,g);try{g.$init(function(){avalon.scan(n,[g].concat(r));if(typeof m.onInit==="function"){m.onInit.call(n,g,m,r)}})}catch(y){console.error(y)}t.rollback=function(){try{g.widgetElement=null;g.$remove()}catch(e){}n.msData={};delete avalon.vmodels[g.$id]};et(t,da);if(e.chrome){n.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(tt)})}}else{avalon.scan(n,r)}}else if(r.length){n.vmodels=r}};var da=[];var ha=/]*>([\S\s]*?)<\/script\s*>/gim;var ma=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g;var ga=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/gi;var ya={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/gi,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/gi,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/gi};var ba=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;var xa=/([^\#-~| |!])/g;function wa(e,t,r,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var n=!isFinite(+e)?0:+e,i=!isFinite(+t)?3:Math.abs(t),o=a||",",l=r||".",s="",u=function(e,t){var r=Math.pow(10,t);return""+(Math.round(e*r)/r).toFixed(t)};s=(i?u(n,i):""+Math.round(n)).split(".");if(s[0].length>3){s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)}if((s[1]||"").lengtht?e.slice(0,t-r.length)+r:String(e)},$filter:function(e){for(var t=1,r=arguments.length;t/g,">")},currency:function(e,t,r){return(t||"¥")+wa(e,isFinite(r)?r:2)},number:wa};new function(){function e(e){return parseInt(e,10)||0}function t(e,t,r){var a="";if(e<0){a="-";e=-e}e=""+e;while(e.length0||o>-a)o+=a;if(o===0&&a===-12){o=12}return t(o,r,n)}}function a(e,t){return function(r,a){var n=r["get"+e]();var i=(t?"SHORT"+e:e).toUpperCase();return a[i][n]}}function n(e){var r=-1*e.getTimezoneOffset();var a=r>=0?"+":"";a+=t(Math[r>0?"floor":"ceil"](r/60),2)+t(Math.abs(r%60),2);return a}function i(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}var o={yyyy:r("FullYear",4),yy:r("FullYear",2,0,true),y:r("FullYear",1),MMMM:a("Month"),MMM:a("Month",true),MM:r("Month",2,1),M:r("Month",1,1),dd:r("Date",2),d:r("Date",1),HH:r("Hours",2),H:r("Hours",1),hh:r("Hours",2,-12),h:r("Hours",1,-12),mm:r("Minutes",2),m:r("Minutes",1),ss:r("Seconds",2),s:r("Seconds",1),sss:r("Milliseconds",3),EEEE:a("Day"),EEE:a("Day",true),a:i,Z:n};var l=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/;var s=/^\/Date\((\d+)\)\/$/;$a.date=function(t,r){var a=$a.date.locate,n="",i=[],u,f;r=r||"mediumDate";r=a[r]||r;if(typeof t==="string"){if(/^\d+$/.test(t)){t=e(t)}else if(s.test(t)){t=+RegExp.$1}else{var c=t.trim();var v=[0,0,0,0,0,0,0];var p=new Date(0);c=c.replace(/^(\d+)\D(\d+)\D(\d+)/,function(t,r,a,n){var i=n.length===4?[n,r,a]:[r,a,n];v[0]=e(i[0]);v[1]=e(i[1])-1;v[2]=e(i[2]);return""});var d=p.setFullYear;var h=p.setHours;c=c.replace(/[T\s](\d+):(\d+):?(\d+)?\.?(\d)?/,function(t,r,a,n,i){v[3]=e(r);v[4]=e(a);v[5]=e(n);if(i){v[6]=Math.round(parseFloat("0."+i)*1e3)}return""});var m=0;var g=0;c=c.replace(/Z|([+-])(\d\d):?(\d\d)/,function(t,r,a,n){d=p.setUTCFullYear;h=p.setUTCHours;if(r){m=e(r+a);g=e(r+n)}return""});v[3]-=m;v[4]-=g;d.apply(p,v.slice(0,3));h.apply(p,v.slice(3));t=p}}if(typeof t==="number"){t=new Date(t)}if(avalon.type(t)!=="date"){return}while(r){f=l.exec(r);if(f){i=i.concat(f.slice(1));r=i.pop()}else{i.push(r);r=null}}i.forEach(function(e){u=o[e];n+=u?u(t,a):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return n};var u={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"};u.SHORTMONTH=u.MONTH;$a.date.locate=u};var Ca=avalon.modules={"domReady!":{exports:avalon,state:3},avalon:{exports:avalon,state:4}};Ca.exports=Ca.avalon;new function(){var t=[];var r=[];var o=/\.js$/i;function l(e,t){var r="js";e=e.replace(/^(\w+)\!/,function(e,t){r=t;return""});if(r==="ready"){s("debug: ready!已经被废弃,请使用domReady!");r="domReady"}var a="";e=e.replace(E,function(e){a=e;return""});var n="."+r;var i=/js|css/.test(n)?n:"";e=e.replace(/\.[a-z0-9]+$/g,function(e){if(e===n){i=e;return""}else{return e}});var o=avalon.mix({query:a,ext:i,res:r,name:e,toUrl:j},t);o.toUrl(e);return o}function f(e){var t=e.name;var r=e.res;var a=Ca[t];var n=t&&e.urlNoQuery;if(a&&a.state>=1){return t}a=Ca[n];if(a&&a.state>=3){v(a.deps||[],a.factory,n);return n}if(t&&!a){a=Ca[n]={id:n,state:1};var i=function(n){T[r]=n;n.load(t,e,function(e){if(arguments.length&&e!==void 0){a.exports=e}a.state=4;w()})};if(!T[r]){v([r],i)}else{i(T[r])}}return t?n:r+"!"}var c=[];var p=false;v=avalon.require=function(e,r,a,n){if(!p){c.push(avalon.slice(arguments));if(arguments.length<=2){p=true;var i=c.splice(0,c.length),s;while(s=i.shift()){v.apply(null,s)}}return}if(!Array.isArray(e)){avalon.error("require方法的第一个参数应为数组 "+e)}var u=[];var d={};var h=a||"callback"+setTimeout("1");n=n||{};n.baseUrl=ie.baseUrl;var m=!!n.built;if(a){n.parentUrl=a.substr(0,a.lastIndexOf("/"));n.mapUrl=a.replace(o,"")}if(m){var g=l(n.defineName,n);h=g.urlNoQuery}else{e.forEach(function(e){var t=l(e,n);var r=f(t);if(r){if(!d[r]){u.push(r);d[r]="司徒正美"}}})}var y=Ca[h];if(!y||y.state!==4){Ca[h]={id:h,deps:m?e.concat():u,factory:r||N,state:3}}if(!y){t.push(h)}w()};v.define=function(e,t,a){if(typeof e!=="string"){a=t;t=e;e="anonymous"}if(!Array.isArray(t)){a=t;t=[]}var n={built:!p,defineName:e};var i=[t,a,n];a.require=function(e){i.splice(2,0,e);if(Ca[e]){Ca[e].state=3;var t=false;try{t=y(Ca[e].deps,e)}catch(r){}if(t){avalon.error(e+"模块与之前的模块存在循环依赖,请不要直接用script标签引入"+e+"模块")}}delete a.require;v.apply(null,i)};var o=n.built?"unknown":O();if(o){var l=Ca[o];if(l){l.state=2}a.require(o)}else{r.push(a)}};v.config=ie;v.define.amd=Ca;var d=ie["orig.paths"]={};var h=ie["orig.map"]={};var m=ie["packages"]=[];var g=ie["orig.args"]={};avalon.mix(pe,{paths:function(e){avalon.mix(d,e);ie.paths=L(d)},map:function(e){avalon.mix(h,e);var t=L(h,1,1);avalon.each(t,function(e,t){t.val=L(t.val)});ie.map=t},packages:function(e){e=e.concat(m);var t={};var r=[];for(var a=0,n;n=e[a++];){n=typeof n==="string"?{name:n}:n;var i=n.name;if(!t[i]){var l=R(n.location||i,n.main||"main");l=l.replace(o,"");r.push(n);t[i]=n.location=l;n.reg=H(i)}}ie.packages=r.sort()},urlArgs:function(e){if(typeof e==="string"){e={"*":e}}avalon.mix(g,e);ie.urlArgs=L(g,1)},baseUrl:function(e){if(!_(e)){var t=i.getElementsByTagName("base")[0];if(t){i.removeChild(t)}var r=n.createElement("a");r.href=e;e=A(r,"href");if(t){i.insertBefore(t,i.firstChild)}}if(e.length>3)ie.baseUrl=e},shim:function(e){for(var t in e){var r=e[t];if(Array.isArray(r)){r=e[t]={deps:r}}if(!r.exportsFn&&(r.exports||r.init)){r.exportsFn=D(r)}}ie.shim=e}});function y(e,t){for(var r=0,a;a=e[r++];){if(Ca[a].state!==4&&(a===t||y(Ca[a].deps,t))){return true}}}function x(e,t,r){var a=k(e.src);e.onload=e.onreadystatechange=e.onerror=null;if(t||r&&Ca[a]&&!Ca[a].state){setTimeout(function(){i.removeChild(e);e=null});s("debug: 加载 "+a+" 失败"+t+" "+!Ca[a].state)}else{return true}}function w(){e:for(var e=t.length,r;r=t[--e];){var a=Ca[r],n=a.deps;if(!n)continue;for(var i=0,o;o=n[i];i++){if(Object(Ca[o]).state!==4){continue e}}if(a.state!==4){t.splice(e,1);S(a.id,a.deps,a.factory);w()}}}var $=/complete|loaded/;function C(e,a,o){var l=n.createElement("script");l.className=u;var f="onload"in l;var c=f?"onload":"onreadystatechange";function v(){var n=r.pop();n&&n.require(a);if(o){o()}if(x(l,false,!f)){s("debug: 已成功加载 "+e);a&&t.push(a);w()}}var p=0,d;l[c]=f?v:function(){if($.test(l.readyState)){++p;if(p===1){d=setTimeout(v,500)}else{clearTimeout(d);v()}}};l.onerror=function(){x(l,true)};i.insertBefore(l,i.firstChild);l.src=e;s("debug: 正准备加载 "+e)}var T=v.plugins={ready:{load:N},js:{load:function(e,t,r){var a=t.url;var n=t.urlNoQuery;var i=ie.shim[e.replace(o,"")];if(i){v(i.deps||[],function(){var e=avalon.slice(arguments);C(a,n,function(){r(i.exportsFn?i.exportsFn.apply(0,e):void 0)})})}else{C(a,n)}}},css:{load:function(e,t,r){var a=t.url;var o=n.createElement("link");o.rel="stylesheet";o.href=a;i.insertBefore(o,i.firstChild);s("debug: 已成功加载 "+a);r()}},text:{load:function(e,t,r){var a=t.url;var n=Xr();n.onreadystatechange=function(){if(n.readyState===4){var e=n.status;if(e>399&&e<600){avalon.error(a+" 对应资源不存在或没有开启 CORS")}else{s("debug: 已成功加载 "+a);r(n.responseText)}}};var i="_="+(new Date-0);var o=a.indexOf("?")===-1?a+"?"+i:a+"&"+i;n.open("GET",o,true);if("withCredentials"in n){n.withCredentials=true}n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.send();s("debug: 正准备加载 "+a)}}};v.checkDeps=w;var E=/(\?[^#]*)$/;function k(e){return(e||"").replace(E,"")}function _(e){return/^(?:[a-z]+:)?\/\//i.test(String(e))}function A(e,t){return"1"[0]?e[t]:e.getAttribute(t,4)}function O(){var t;try{a.b.c()}catch(r){t=r.stack;if(!t&&e.opera){t=(String(r).match(/of linked script \S+/g)||[]).join(" ")}}if(t){t=t.split(/[@ ]/g).pop();t=t[0]==="("?t.slice(1,-1):t.replace(/\s/,"");return k(t.replace(/(:\d+)?:\d+$/i,""))}var n=i.getElementsByTagName("script");for(var o=n.length,l;l=n[--o];){if(l.className===u&&l.readyState==="interactive"){var s=A(l,"src");return l.className=k(s)}}}var M=/^callback\d+$/;function S(t,r,a){var n=Object(Ca[t]);n.state=4;for(var i=0,o=[],l;l=r[i++];){if(l==="exports"){var u=n.exports||(n.exports={});o.push(u)}else{o.push(Ca[l].exports)}}try{var f=a.apply(e,o)}catch(c){s("执行["+t+"]模块的factory抛错: "+c)}if(f!==void 0){n.exports=f}if(M.test(t)){delete Ca[t]}delete n.factory;return f}function j(e){if(e.indexOf(this.res+"!")===0){e=e.slice(this.res.length+1)}var t=e;var r=0;var a=this.baseUrl;var n=this.parentUrl||a;F(e,ie.paths,function(e,a){t=t.replace(a,e);r=1});if(!r){F(e,ie.packages,function(e,r,a){t=t.replace(a.name,a.location)})}if(this.mapUrl){F(this.mapUrl,ie.map,function(e){F(t,e,function(e,r){t=t.replace(r,e);n=a})})}var i=this.ext;if(i&&r&&t.slice(-i.length)===i){t=t.slice(0,-i.length)}if(!_(t)){n=this.built||/^\w/.test(t)?a:n;t=R(n,t)}var o=t+i;t=o+this.query;F(e,ie.urlArgs,function(e){t+=(t.indexOf("?")===-1?"?":"&")+e});this.url=t;return this.urlNoQuery=o}function L(e,t,r){var a=P(e,t,r);a.sort(B);return a}function H(e){return new RegExp("^"+e+"(/|$)")}function D(t){return function(){var r;if(t.init){r=t.init.apply(e,arguments)}return r||t.exports&&V(t.exports)}}function P(e,t,r){var a=[];for(var n in e){if(b.call(e,n)){var i={name:n,val:e[n]};a.push(i);i.reg=n==="*"&&t?/^/:H(n);if(r&&n!=="*"){i.reg=new RegExp("/"+n.replace(/^\//,"")+"(/|$)")}}}return a}function F(e,t,r){t=t||[];for(var a=0,n;n=t[a++];){if(n.reg.test(e)){r(n.val,n.name,n);return false}}}function B(e,t){var r=e.name;var a=t.name;if(a==="*"){return-1}if(r==="*"){return 1}return a.length-r.length}var I=/\/\w+\/\.\./;function R(e,t){if(e.charAt(e.length-1)!=="/"){e+="/"}if(t.slice(0,2)==="./"){return e+t.slice(2)}if(t.slice(0,2)===".."){e+=t;while(I.test(e)){e=e.replace(I,"")}return e}if(t.slice(0,1)==="/"){return e+t.slice(1)}return e+t}function V(t){if(!t){return t}var r=e;t.split(".").forEach(function(e){r=r[e]});return r}var U=n.scripts[n.scripts.length-1];var q=U.getAttribute("data-main");if(q){pe.baseUrl(q);var W=ie.baseUrl;ie.baseUrl=W.slice(0,W.lastIndexOf("/")+1);C(W.replace(o,"")+".js")}else{var z=k(A(U,"src"));ie.baseUrl=z.slice(0,z.lastIndexOf("/")+1)}};var Ta=[],Ea;var ka=function(e){Ea=true;if(v){Ca["domReady!"].state=4;v.checkDeps()}while(e=Ta.shift()){e(avalon)}};function _a(){try{E.doScroll("left");ka()}catch(e){setTimeout(_a)}}if(n.readyState==="complete"){setTimeout(ka)}else if(T){n.addEventListener("DOMContentLoaded",ka)}else{n.attachEvent("onreadystatechange",function(){if(n.readyState==="complete"){ka()}});try{var Aa=e.frameElement===null}catch($e){}if(E.doScroll&&Aa&&e.external){_a()}}avalon.bind(e,"load",ka);avalon.ready=function(e){if(!Ea){Ta.push(e)}else{e(avalon)}};avalon.config({loader:false});avalon.ready(function(){avalon.scan(n.body)});if(typeof define==="function"&&define.amd){define("avalon",[],function(){return avalon})}var Na=e.avalon;avalon.noConflict=function(t){if(t&&e.avalon===avalon){e.avalon=Na}return avalon};if(t===void 0){e.avalon=avalon}return avalon});