From bdad75e1ea62e173dec6fe3e92fe4203deb03b6f Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Fri, 20 Nov 2015 17:50:03 +0800 Subject: [PATCH 1/8] fix animation in ie --- dist/regular.js | 4 ++-- dist/regular.min.js | 2 +- src/directive/animation.js | 4 ++-- test/runner/dom.bundle.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/regular.js b/dist/regular.js index ce80392..90f84e5 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1820,8 +1820,8 @@ return /******/ (function(modules) { // webpackBootstrap function animationDestroy(element){ return function(){ - delete element.onenter; - delete element.onleave; + element.onenter = null; + element.onleave = null; } } diff --git a/dist/regular.min.js b/dist/regular.min.js index 22394d5..48bc904 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(ry;y++)if(s=v[y],p=s.split(":"),f=p[0]&&p[0].trim(),l=p[1]&&p[1].trim(),f)if(f!==c)if(f!==h){var d=o.animation(f);if(!d||!u)throw Error(d?"you should start with `on` or `event` in animation":"undefined animator 【"+f+"】");u.push(d.call(this,{element:t,done:u.done,param:l}))}else n(l),"leave"===l?(t.onleave=u.start,g.push(a(t))):"enter"===l?(t.onenter=u.start,g.push(a(t))):"on"+l in t?g.push(this._handleEvent(t,l,u.start)):(this.$on(l,u.start),g.push(this.$off.bind(this,l,u.start)));else n("when"),this.$watch(l,i.bind(this,u.start));return g.length?function(){g.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1);r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"==typeof t?t():c.$compile(t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(ry;y++)if(s=v[y],p=s.split(":"),f=p[0]&&p[0].trim(),l=p[1]&&p[1].trim(),f)if(f!==c)if(f!==h){var d=o.animation(f);if(!d||!u)throw Error(d?"you should start with `on` or `event` in animation":"undefined animator 【"+f+"】");u.push(d.call(this,{element:t,done:u.done,param:l}))}else n(l),"leave"===l?(t.onleave=u.start,g.push(a(t))):"enter"===l?(t.onenter=u.start,g.push(a(t))):"on"+l in t?g.push(this._handleEvent(t,l,u.start)):(this.$on(l,u.start),g.push(this.$off.bind(this,l,u.start)));else n("when"),this.$watch(l,i.bind(this,u.start));return g.length?function(){g.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1);r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"==typeof t?t():c.$compile(t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} },"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diffArray:n.diffArray,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,s,u,c,h;if(t.test){var f=t.test(this);f&&(n=!0,t.fn.apply(this,f))}else if(r=t.get(this),a=t.last,s=i.typeOf(a),u=i.typeOf(r),c=!0,h,"object"===u&&"object"===s&&t.deep){for(var l in r)if(a[l]!==r[l]){n=!0;break}if(n!==!0)for(var p in a)if(a[p]!==r[p]){n=!0;break}}else"array"!==u||"undefined"!=s&&"array"!==s?(c=i.equals(r,a),(!c||t.force)&&(t.force=null,n=!0)):(h=o(r,t.last||[],t.diffArray),("array"!==s||h===!0||h.length)&&(n=!0));return n&&!t.test&&(t.last="object"===u&&t.deep||"array"===u?i.clone(r):r,t.fn.call(this,r,a,h),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,s),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,s)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t){function e(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function n(t,e){return t===e}function r(t,e){for(var r=t.length,i=e.length,a=[],o=0;r>=o;o++)a.push([o]);for(var s=1;i>=s;s++)a[0][s]=s;for(var o=1;r>=o;o++)for(var s=1;i>=s;s++)a[o][s]=n(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function i(t,n,i){if(!i)return e(t,n);for(var a=r(n,t),o=n.length,s=o,u=t.length,c=u,h=[],f=a[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=a[s-1][c-1],p=a[s-1][c],d=a[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(n[o]),o++;break;case x:_.add++,_.removed.push(n[o]),o++,u++}return null!=_.index&&E.push(_),E}t.exports=i},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/src/directive/animation.js b/src/directive/animation.js index 8c1364a..8b72812 100644 --- a/src/directive/animation.js +++ b/src/directive/animation.js @@ -160,8 +160,8 @@ function processAnimate( element, value ){ function animationDestroy(element){ return function(){ - delete element.onenter; - delete element.onleave; + element.onenter = null; + element.onleave = null; } } diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index 9bcc2ef..80b0271 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -9877,8 +9877,8 @@ function animationDestroy(element){ return function(){ - delete element.onenter; - delete element.onleave; + element.onenter = null; + element.onleave = null; } } From c842f87564811e2feec4c55cbf4f8fa6afeb2ef9 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Thu, 3 Dec 2015 19:12:09 +0800 Subject: [PATCH 2/8] fix #61 --- .gitignore | 2 +- dist/regular.js | 5 +++++ dist/regular.min.js | 2 +- src/directive/animation.js | 5 +++++ test/runner/dom.bundle.js | 32 ++++++++++++++++++++++++++++++++ test/spec/browser-animate.js | 27 +++++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 11a9152..cf679a1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ example npm-debug.log */tmp/* test/tmp/* -test/runner/dom.bundle.js +*test/runner/dom.* test/coverage/* coverage* out/* diff --git a/dist/regular.js b/dist/regular.js index 90f84e5..1c7e20a 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1803,6 +1803,11 @@ return /******/ (function(modules) { // webpackBootstrap // value: the directive value function processAnimate( element, value ){ var Component = this.constructor; + + if(_.isExpr(value)){ + value = value.get(this); + } + value = value.trim(); var composites = value.split(";"), diff --git a/dist/regular.min.js b/dist/regular.min.js index 48bc904..642e85a 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(ry;y++)if(s=v[y],p=s.split(":"),f=p[0]&&p[0].trim(),l=p[1]&&p[1].trim(),f)if(f!==c)if(f!==h){var d=o.animation(f);if(!d||!u)throw Error(d?"you should start with `on` or `event` in animation":"undefined animator 【"+f+"】");u.push(d.call(this,{element:t,done:u.done,param:l}))}else n(l),"leave"===l?(t.onleave=u.start,g.push(a(t))):"enter"===l?(t.onenter=u.start,g.push(a(t))):"on"+l in t?g.push(this._handleEvent(t,l,u.start)):(this.$on(l,u.start),g.push(this.$off.bind(this,l,u.start)));else n("when"),this.$watch(l,i.bind(this,u.start));return g.length?function(){g.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1);r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"==typeof t?t():c.$compile(t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1);r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"==typeof t?t():c.$compile(t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} },"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diffArray:n.diffArray,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,s,u,c,h;if(t.test){var f=t.test(this);f&&(n=!0,t.fn.apply(this,f))}else if(r=t.get(this),a=t.last,s=i.typeOf(a),u=i.typeOf(r),c=!0,h,"object"===u&&"object"===s&&t.deep){for(var l in r)if(a[l]!==r[l]){n=!0;break}if(n!==!0)for(var p in a)if(a[p]!==r[p]){n=!0;break}}else"array"!==u||"undefined"!=s&&"array"!==s?(c=i.equals(r,a),(!c||t.force)&&(t.force=null,n=!0)):(h=o(r,t.last||[],t.diffArray),("array"!==s||h===!0||h.length)&&(n=!0));return n&&!t.test&&(t.last="object"===u&&t.deep||"array"===u?i.clone(r):r,t.fn.call(this,r,a,h),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,s),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,s)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t){function e(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function n(t,e){return t===e}function r(t,e){for(var r=t.length,i=e.length,a=[],o=0;r>=o;o++)a.push([o]);for(var s=1;i>=s;s++)a[0][s]=s;for(var o=1;r>=o;o++)for(var s=1;i>=s;s++)a[o][s]=n(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function i(t,n,i){if(!i)return e(t,n);for(var a=r(n,t),o=n.length,s=o,u=t.length,c=u,h=[],f=a[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=a[s-1][c-1],p=a[s-1][c],d=a[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(n[o]),o++;break;case x:_.add++,_.removed.push(n[o]),o++,u++}return null!=_.index&&E.push(_),E}t.exports=i},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/src/directive/animation.js b/src/directive/animation.js index 8b72812..eae7e7f 100644 --- a/src/directive/animation.js +++ b/src/directive/animation.js @@ -143,6 +143,11 @@ Regular.animation({ // value: the directive value function processAnimate( element, value ){ var Component = this.constructor; + + if(_.isExpr(value)){ + value = value.get(this); + } + value = value.trim(); var composites = value.split(";"), diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index 80b0271..40dbf70 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -918,6 +918,33 @@ }) + it("#issue 61: parse value before start animation", function(done){ + var div1 =document.createElement("div"); + var i = 0; + Component.animation({ + "custom": function( step ){ + i++; + expect(step.param).to.equal("animated") + }, + "custom2": function( step ){ + i++; + expect(step.param).to.equal("static") + expect(i).to.equal(2); + done(); + } + }) + + + var component = new Component({ + data: { + className: "animated" + }, + template: "
" + }); + var i =0; + + }) + it("animate.inject&animate.remove with callback", function(done){ var div1 =document.createElement("div"); var div2 =document.createElement("div"); @@ -9860,6 +9887,11 @@ // value: the directive value function processAnimate( element, value ){ var Component = this.constructor; + + if(_.isExpr(value)){ + value = value.get(this); + } + value = value.trim(); var composites = value.split(";"), diff --git a/test/spec/browser-animate.js b/test/spec/browser-animate.js index f21874e..ee9b558 100644 --- a/test/spec/browser-animate.js +++ b/test/spec/browser-animate.js @@ -125,6 +125,33 @@ describe("Animation", function(){ }) + it("#issue 61: parse value before start animation", function(done){ + var div1 =document.createElement("div"); + var i = 0; + Component.animation({ + "custom": function( step ){ + i++; + expect(step.param).to.equal("animated") + }, + "custom2": function( step ){ + i++; + expect(step.param).to.equal("static") + expect(i).to.equal(2); + done(); + } + }) + + + var component = new Component({ + data: { + className: "animated" + }, + template: "
" + }); + var i =0; + + }) + it("animate.inject&animate.remove with callback", function(done){ var div1 =document.createElement("div"); var div2 =document.createElement("div"); From d65857e896d0c7db1c3321f7de661f58378f7f82 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Thu, 3 Dec 2015 19:41:35 +0800 Subject: [PATCH 3/8] #fix 67 --- .gitignore | 2 +- dist/regular.js | 7 ++++++- dist/regular.min.js | 2 +- src/walkers.js | 7 ++++++- test/runner/dom.bundle.js | 35 +++++++++++++++++++++++++++++++++-- test/spec/browser-bugfix.js | 28 +++++++++++++++++++++++++++- 6 files changed, 74 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index cf679a1..08b9b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ example npm-debug.log */tmp/* test/tmp/* -*test/runner/dom.* +test/runner/*.js test/coverage/* coverage* out/* diff --git a/dist/regular.js b/dist/regular.js index 1c7e20a..aae9755 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -2134,7 +2134,12 @@ return /******/ (function(modules) { // webpackBootstrap group.children.pop(); } if(!value) return; - group.push( compiled = (typeof value === 'function') ? value(): self.$compile(value, {record: true, outer: options.outer,namespace: namespace, extra: extra}) ); + + group.push( compiled = type === 'function' ? value(): self.$compile( type !== 'object'? String(value): value, { + record: true, + outer: options.outer, + namespace: namespace, + extra: extra}) ); if(placeholder.parentNode) { compiled.$inject(placeholder, 'before') } diff --git a/dist/regular.min.js b/dist/regular.min.js index 642e85a..9bc92da 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1);r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"==typeof t?t():c.$compile(t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1),s=typeof t;r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"===s?t():c.$compile("object"!==s?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var b,$={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h($,e);r&&this.$refs&&(b=h.directive("ref").link,this.$on("$destroy",b.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e($),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} },"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diffArray:n.diffArray,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,s,u,c,h;if(t.test){var f=t.test(this);f&&(n=!0,t.fn.apply(this,f))}else if(r=t.get(this),a=t.last,s=i.typeOf(a),u=i.typeOf(r),c=!0,h,"object"===u&&"object"===s&&t.deep){for(var l in r)if(a[l]!==r[l]){n=!0;break}if(n!==!0)for(var p in a)if(a[p]!==r[p]){n=!0;break}}else"array"!==u||"undefined"!=s&&"array"!==s?(c=i.equals(r,a),(!c||t.force)&&(t.force=null,n=!0)):(h=o(r,t.last||[],t.diffArray),("array"!==s||h===!0||h.length)&&(n=!0));return n&&!t.test&&(t.last="object"===u&&t.deep||"array"===u?i.clone(r):r,t.fn.call(this,r,a,h),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,s),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,s)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t){function e(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function n(t,e){return t===e}function r(t,e){for(var r=t.length,i=e.length,a=[],o=0;r>=o;o++)a.push([o]);for(var s=1;i>=s;s++)a[0][s]=s;for(var o=1;r>=o;o++)for(var s=1;i>=s;s++)a[o][s]=n(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function i(t,n,i){if(!i)return e(t,n);for(var a=r(n,t),o=n.length,s=o,u=t.length,c=u,h=[],f=a[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=a[s-1][c-1],p=a[s-1][c],d=a[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(n[o]),o++;break;case x:_.add++,_.removed.push(n[o]),o++,u++}return null!=_.index&&E.push(_),E}t.exports=i},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/src/walkers.js b/src/walkers.js index 4db7665..c7fb440 100644 --- a/src/walkers.js +++ b/src/walkers.js @@ -189,7 +189,12 @@ walkers.template = function(ast, options){ group.children.pop(); } if(!value) return; - group.push( compiled = (typeof value === 'function') ? value(): self.$compile(value, {record: true, outer: options.outer,namespace: namespace, extra: extra}) ); + + group.push( compiled = type === 'function' ? value(): self.$compile( type !== 'object'? String(value): value, { + record: true, + outer: options.outer, + namespace: namespace, + extra: extra}) ); if(placeholder.parentNode) { compiled.$inject(placeholder, 'before') } diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index 40dbf70..ae6ed63 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -762,7 +762,6 @@ }) }).to.not.throwException(); }) - }) it('bugfix #50', function(){ // https://github.com/regularjs/regular/issues/50 @@ -784,6 +783,33 @@ }) + it('bugfix #67', function(){ + // https://github.com/regularjs/regular/issues/50 + var template = "{#include a}"; + + expect(function(){ + var component = new Regular({ + data: { + a: 1, + b: true, + c: undefined, + d: null, + e: '123', + }, + template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" + }) + }).to.not.throwException(); + + + + var ps = nes.all('p' ,container); + + + + + }) + }) + @@ -11306,7 +11332,12 @@ group.children.pop(); } if(!value) return; - group.push( compiled = (typeof value === 'function') ? value(): self.$compile(value, {record: true, outer: options.outer,namespace: namespace, extra: extra}) ); + + group.push( compiled = type === 'function' ? value(): self.$compile( type !== 'object'? String(value): value, { + record: true, + outer: options.outer, + namespace: namespace, + extra: extra}) ); if(placeholder.parentNode) { compiled.$inject(placeholder, 'before') } diff --git a/test/spec/browser-bugfix.js b/test/spec/browser-bugfix.js index 5ae78cd..b1c04c3 100644 --- a/test/spec/browser-bugfix.js +++ b/test/spec/browser-bugfix.js @@ -509,7 +509,6 @@ describe("Milestones v0.4.*", function(){ }) }).to.not.throwException(); }) -}) it('bugfix #50', function(){ // https://github.com/regularjs/regular/issues/50 @@ -531,4 +530,31 @@ it('bugfix #50', function(){ }) +it('bugfix #67', function(){ + // https://github.com/regularjs/regular/issues/50 + var template = "{#include a}"; + + expect(function(){ + var component = new Regular({ + data: { + a: 1, + b: true, + c: undefined, + d: null, + e: '123', + }, + template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" + }) + }).to.not.throwException(); + + + + var ps = nes.all('p' ,container); + + + + +}) +}) + From 10a33dff1a1b14629c4b8c004dadaae0d6521959 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Thu, 3 Dec 2015 19:44:22 +0800 Subject: [PATCH 4/8] fix #76 --- bower.json | 2 +- dist/regular.js | 2 +- package.json | 4 +- test/runner/dom.bundle.js | 82 +++++++++++++++++++-------------------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/bower.json b/bower.json index fde0c79..795e13c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "regularjs", - "version": "0.4.2", + "version": "0.4.3", "main": "dist/regular.js", "description": "reactjs + angularjs = regularjs", "authors": "@leeluolee <87399126@163.com>", diff --git a/dist/regular.js b/dist/regular.js index aae9755..2640e6e 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1,6 +1,6 @@ /** @author leeluolee -@version 0.4.2 +@version 0.4.3 @homepage http://regularjs.github.io */ (function webpackUniversalModuleDefinition(root, factory) { diff --git a/package.json b/package.json index eb0e8a6..11265dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "regularjs", - "version": "0.4.2", + "version": "0.4.3", "author": { "name": "leeluolee" }, @@ -47,4 +47,4 @@ "through2": "~0.4.1", "yargs": "^3.26.0" } -} +} \ No newline at end of file diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index ae6ed63..b5bb387 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -12406,8 +12406,8 @@ */ var base64 = __webpack_require__(48) - var ieee754 = __webpack_require__(46) - var isArray = __webpack_require__(47) + var ieee754 = __webpack_require__(47) + var isArray = __webpack_require__(46) exports.Buffer = Buffer exports.SlowBuffer = Buffer @@ -13473,6 +13473,45 @@ /* 46 */ /***/ function(module, exports, __webpack_require__) { + + /** + * isArray + */ + + var isArray = Array.isArray; + + /** + * toString + */ + + var str = Object.prototype.toString; + + /** + * Whether or not the given `val` + * is an array. + * + * example: + * + * isArray([]); + * // > true + * isArray(arguments); + * // > false + * isArray(''); + * // > false + * + * @param {mixed} val + * @return {bool} + */ + + module.exports = isArray || function (val) { + return !! val && '[object Array]' == str.call(val); + }; + + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + exports.read = function(buffer, offset, isLE, mLen, nBytes) { var e, m, eLen = nBytes * 8 - mLen - 1, @@ -13559,45 +13598,6 @@ }; -/***/ }, -/* 47 */ -/***/ function(module, exports, __webpack_require__) { - - - /** - * isArray - */ - - var isArray = Array.isArray; - - /** - * toString - */ - - var str = Object.prototype.toString; - - /** - * Whether or not the given `val` - * is an array. - * - * example: - * - * isArray([]); - * // > true - * isArray(arguments); - * // > false - * isArray(''); - * // > false - * - * @param {mixed} val - * @return {bool} - */ - - module.exports = isArray || function (val) { - return !! val && '[object Array]' == str.call(val); - }; - - /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { From 5cab9110a5e150bbe16f35ac26b5a4f227e789f8 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Thu, 3 Dec 2015 20:17:42 +0800 Subject: [PATCH 5/8] fix ie7 bug to remove comma --- test/runner/dom.bundle.js | 184 ++++++++++++++++++------------------ test/spec/browser-bugfix.js | 2 +- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index b5bb387..eabd899 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -66,7 +66,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); function destroy(component, container){ component.destroy(); @@ -253,7 +253,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); var dom = Regular.dom; function destroy(component, container){ @@ -794,7 +794,7 @@ b: true, c: undefined, d: null, - e: '123', + e: '123' }, template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" }) @@ -817,9 +817,9 @@ /* 3 */ /***/ function(module, exports, __webpack_require__) { - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); var animate = __webpack_require__(19); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); function destroy(component, container){ component.destroy(); @@ -1256,8 +1256,8 @@ var expect = __webpack_require__(26); // contains basic dom && event specs - var dom = __webpack_require__(17); - var Regular = __webpack_require__(16); + var dom = __webpack_require__(16); + var Regular = __webpack_require__(17); function destroy(component, container){ component.destroy(); @@ -1657,7 +1657,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); var combine = __webpack_require__(20); function destroy(component, container){ component.destroy(); @@ -1831,7 +1831,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); function reset(){} @@ -2051,7 +2051,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); function destroy(component, container){ component.destroy(); @@ -2680,8 +2680,8 @@ var expect = __webpack_require__(26); - var dom = __webpack_require__(17); - var Regular = __webpack_require__(16); + var dom = __webpack_require__(16); + var Regular = __webpack_require__(17); var container = document.createElement('div'); function destroy(component, container){ @@ -3105,7 +3105,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); var container = document.createElement('div'); function destroy(component, container){ @@ -3332,7 +3332,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); function destroy(component, container){ component.destroy(); @@ -4081,7 +4081,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); describe("Filter", function(){ @@ -4282,8 +4282,8 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); - var parse = __webpack_require__(21); + var Regular = __webpack_require__(17); + var parse = __webpack_require__(24); var Component = Regular.extend(); @@ -4916,7 +4916,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(16); + var Regular = __webpack_require__(17); var Component = Regular.extend(); function destroy(component, container){ @@ -5411,9 +5411,9 @@ var expect = __webpack_require__(26); var _ = __webpack_require__(18); - var shim = __webpack_require__(22); - var extend = __webpack_require__(23); - var diffArray = __webpack_require__(24); + var shim = __webpack_require__(21); + var extend = __webpack_require__(22); + var diffArray = __webpack_require__(23); @@ -5813,39 +5813,6 @@ /* 16 */ /***/ function(module, exports, __webpack_require__) { - var env = __webpack_require__(27); - var config = __webpack_require__(28); - var Regular = module.exports = __webpack_require__(29); - var Parser = Regular.Parser; - var Lexer = Regular.Lexer; - - if(env.browser){ - __webpack_require__(31); - __webpack_require__(32); - __webpack_require__(33); - Regular.dom = __webpack_require__(17); - } - Regular.env = env; - Regular.util = __webpack_require__(18); - Regular.parse = function(str, options){ - options = options || {}; - - if(options.BEGIN || options.END){ - if(options.BEGIN) config.BEGIN = options.BEGIN; - if(options.END) config.END = options.END; - Lexer.setup(); - } - var ast = new Parser(str).parse(); - return !options.stringify? ast : JSON.stringify(ast); - } - - - - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - // thanks for angular && mootools for some concise&cross-platform implemention // ===================================== @@ -6237,11 +6204,44 @@ +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + var env = __webpack_require__(27); + var config = __webpack_require__(28); + var Regular = module.exports = __webpack_require__(29); + var Parser = Regular.Parser; + var Lexer = Regular.Lexer; + + if(env.browser){ + __webpack_require__(31); + __webpack_require__(32); + __webpack_require__(33); + Regular.dom = __webpack_require__(16); + } + Regular.env = env; + Regular.util = __webpack_require__(18); + Regular.parse = function(str, options){ + options = options || {}; + + if(options.BEGIN || options.END){ + if(options.BEGIN) config.BEGIN = options.BEGIN; + if(options.END) config.END = options.END; + Lexer.setup(); + } + var ast = new Parser(str).parse(); + return !options.stringify? ast : JSON.stringify(ast); + } + + + + /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(22)(); + /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(21)(); @@ -6686,7 +6686,7 @@ /***/ function(module, exports, __webpack_require__) { var _ = __webpack_require__(18); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var animate = {}; var env = __webpack_require__(27); @@ -6942,7 +6942,7 @@ // some nested operation in ast // -------------------------------- - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var animate = __webpack_require__(19); var combine = module.exports = { @@ -7048,28 +7048,6 @@ /***/ }, /* 21 */ -/***/ function(module, exports, __webpack_require__) { - - var exprCache = __webpack_require__(27).exprCache; - var _ = __webpack_require__(18); - var Parser = __webpack_require__(34); - module.exports = { - expression: function(expr, simple){ - // @TODO cache - if( typeof expr === 'string' && ( expr = expr.trim() ) ){ - expr = exprCache.get( expr ) || exprCache.set( expr, new Parser( expr, { mode: 2, expression: true } ).expression() ) - } - if(expr) return expr; - }, - parse: function(template){ - return new Parser(template).parse(); - } - } - - - -/***/ }, -/* 22 */ /***/ function(module, exports, __webpack_require__) { // shim for es5 @@ -7177,7 +7155,7 @@ /***/ }, -/* 23 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { // (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -7263,7 +7241,7 @@ /***/ }, -/* 24 */ +/* 23 */ /***/ function(module, exports, __webpack_require__) { @@ -7401,6 +7379,28 @@ } module.exports = whole; +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + var exprCache = __webpack_require__(27).exprCache; + var _ = __webpack_require__(18); + var Parser = __webpack_require__(34); + module.exports = { + expression: function(expr, simple){ + // @TODO cache + if( typeof expr === 'string' && ( expr = expr.trim() ) ){ + expr = exprCache.get( expr ) || exprCache.set( expr, new Parser( expr, { mode: 2, expression: true } ).expression() ) + } + if(expr) return expr; + }, + parse: function(template){ + return new Parser(template).parse(); + } + } + + + /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { @@ -8810,10 +8810,10 @@ var Parser = __webpack_require__(34); var config = __webpack_require__(28); var _ = __webpack_require__(18); - var extend = __webpack_require__(23); + var extend = __webpack_require__(22); var combine = {}; if(env.browser){ - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var walkers = __webpack_require__(36); var Group = __webpack_require__(37); var doc = dom.doc; @@ -8821,7 +8821,7 @@ } var events = __webpack_require__(25); var Watcher = __webpack_require__(38); - var parse = __webpack_require__(21); + var parse = __webpack_require__(24); var filter = __webpack_require__(39); @@ -9654,7 +9654,7 @@ // Regular var _ = __webpack_require__(18); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var animate = __webpack_require__(19); var Regular = __webpack_require__(29); var consts = __webpack_require__(40); @@ -9771,7 +9771,7 @@ var // packages _ = __webpack_require__(18), animate = __webpack_require__(19), - dom = __webpack_require__(17), + dom = __webpack_require__(16), Regular = __webpack_require__(29); @@ -11141,12 +11141,12 @@ /* 36 */ /***/ function(module, exports, __webpack_require__) { - var diffArray = __webpack_require__(24); + var diffArray = __webpack_require__(23); var combine = __webpack_require__(20); var animate = __webpack_require__(19); var node = __webpack_require__(43); var Group = __webpack_require__(37); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var _ = __webpack_require__(18); @@ -11736,8 +11736,8 @@ /***/ function(module, exports, __webpack_require__) { var _ = __webpack_require__(18); - var parseExpression = __webpack_require__(21).expression; - var diffArray = __webpack_require__(24); + var parseExpression = __webpack_require__(24).expression; + var diffArray = __webpack_require__(23); function Watcher(){} @@ -12085,7 +12085,7 @@ * */ var _ = __webpack_require__(18); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var Regular = __webpack_require__(29); Regular._addProtoInheritCache("event"); @@ -12166,7 +12166,7 @@ // Regular var _ = __webpack_require__(18); - var dom = __webpack_require__(17); + var dom = __webpack_require__(16); var Regular = __webpack_require__(29); var modelHandlers = { diff --git a/test/spec/browser-bugfix.js b/test/spec/browser-bugfix.js index b1c04c3..f54e18f 100644 --- a/test/spec/browser-bugfix.js +++ b/test/spec/browser-bugfix.js @@ -541,7 +541,7 @@ it('bugfix #67', function(){ b: true, c: undefined, d: null, - e: '123', + e: '123' }, template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" }) From 4408e0caf37493fce94a726a1237d8e64fdc1a81 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Sat, 5 Dec 2015 20:30:10 +0800 Subject: [PATCH 6/8] fix #68: isolate with transcludetent --- dist/regular.js | 103 +++++-- dist/regular.min.js | 4 +- src/Regular.js | 9 +- src/helper/{arrayDiff.js => diff.js} | 45 ++- src/helper/watcher.js | 24 +- src/walkers.js | 23 +- test/runner/dom.bundle.js | 406 ++++++++++++++++++--------- test/spec/browser-bugfix.js | 55 ++-- test/spec/browser-list.js | 78 +++++ test/spec/browser-watcher.js | 4 +- test/spec/test-util.js | 2 +- 11 files changed, 547 insertions(+), 206 deletions(-) rename src/helper/{arrayDiff.js => diff.js} (80%) diff --git a/dist/regular.js b/dist/regular.js index 2640e6e..eea5057 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -189,14 +189,17 @@ return /******/ (function(modules) { // webpackBootstrap } this.$emit("$config"); this.config && this.config(this.data); - if(this._body && this._body.length){ - this.$body = _.getCompileFn(this._body, this.$parent, { + + var body = this._body; + this._body = null; + + if(body && body.ast && body.ast.length){ + this.$body = _.getCompileFn(body.ast, body.ctx , { outer: this, namespace: options.namespace, extra: options.extra, record: true }) - this._body = null; } // handle computed if(template){ @@ -1943,7 +1946,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 9 */ /***/ function(module, exports, __webpack_require__) { - var diffArray = __webpack_require__(25); + var diffArray = __webpack_require__(25).diffArray; var combine = __webpack_require__(14); var animate = __webpack_require__(21); var node = __webpack_require__(26); @@ -1966,6 +1969,7 @@ return /******/ (function(modules) { // webpackBootstrap var variable = ast.variable; var alternate = ast.alternate; var track = ast.track, keyOf, extraObj; + if( track && track !== true ){ track = this._touchExpr(track); extraObj = _.createObject(extra); @@ -1975,6 +1979,7 @@ return /******/ (function(modules) { // webpackBootstrap return track.get( self, extraObj ); } } + function removeRange(index, rlen){ for(var j = 0; j< rlen; j++){ //removed var removed = group.children.splice( index + 1, 1)[0]; @@ -2015,6 +2020,18 @@ return /******/ (function(modules) { // webpackBootstrap } } + // update object type + function updateObject(newValue, oldValue, splices){ + // if type doesn't equal Object, we remove all of them directly + // if(oldType !== 'object'){ + // removeRange(0, group.children.length-1); + // } + + var keys = Object.keys(newValue); + + + } + function updateLD(newValue, oldValue, splices){ if(!oldValue) oldValue = []; if(!newValue) newValue = []; @@ -2116,7 +2133,7 @@ return /******/ (function(modules) { // webpackBootstrap } } } - this.$watch(ast.sequence, update, { init: true, diffArray: track !== true }); + this.$watch(ast.sequence, update, { init: true, diff: track !== true }); return group; } // {#include } or {#inc template} @@ -2390,7 +2407,10 @@ return /******/ (function(modules) { // webpackBootstrap $parent: (isolate & 2)? null: this, $root: this.$root, $outer: options.outer, - _body: ast.children + _body: { + ctx: this, + ast: ast.children + } } var options = { namespace: namespace, @@ -3904,7 +3924,9 @@ return /******/ (function(modules) { // webpackBootstrap var _ = __webpack_require__(5); var parseExpression = __webpack_require__(17).expression; - var diffArray = __webpack_require__(25); + var diff = __webpack_require__(25); + var diffArray = diff.diffArray; + var diffObject = diff.diffObject; function Watcher(){} @@ -3952,7 +3974,7 @@ return /******/ (function(modules) { // webpackBootstrap once: once, force: options.force, // don't use ld to resolve array diff - diffArray: options.diffArray, + diff: options.diff, test: test, deep: options.deep, last: options.sync? get(this): options.last @@ -4054,7 +4076,7 @@ return /******/ (function(modules) { // webpackBootstrap if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){ // Array if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){ - diff = diffArray(now, watcher.last || [], watcher.diffArray) + diff = diffArray(now, watcher.last || [], watcher.diff) if( tlast !== 'array' || diff === true || diff.length ) dirty = true; }else{ eq = _.equals( now, last ); @@ -4064,20 +4086,8 @@ return /******/ (function(modules) { // webpackBootstrap } } }else{ - for(var j in now){ - if(last[j] !== now[j]){ - dirty = true; - break; - } - } - if(dirty !== true){ - for(var n in last){ - if(last[n] !== now[n]){ - dirty = true; - break; - } - } - } + diff = diffObject( now, last, watcher.diff ); + if( diff === true || diff.length ) dirty = true; } } else{ // @TODO 是否把多重改掉 @@ -5152,7 +5162,8 @@ return /******/ (function(modules) { // webpackBootstrap /* 25 */ /***/ function(module, exports, __webpack_require__) { - + var _ = __webpack_require__(5); + function simpleDiff(now, old){ var nlen = now.length; var olen = old.length; @@ -5193,8 +5204,8 @@ return /******/ (function(modules) { // webpackBootstrap } return matrix; } - function whole(arr2, arr1, diffArray) { - if(!diffArray) return simpleDiff(arr2, arr1); + function diffArray(arr2, arr1, diff) { + if(!diff) return simpleDiff(arr2, arr1); var matrix = ld(arr1, arr2) var n = arr1.length; var i = n; @@ -5285,7 +5296,45 @@ return /******/ (function(modules) { // webpackBootstrap } return steps } - module.exports = whole; + + + + // diffObject + // ---- + // test if obj1 deepEqual obj2 + function diffObject( now, last, diff ){ + + + if(!diff){ + + for( var j in now ){ + if( last[j] !== now[j] ) return true + } + + for( var n in last ){ + if(last[n] !== now[n]) return true; + } + + }else{ + + var nKeys = _.keys(now); + var lKeys = _.keys(last); + + return diffArray(nKeys, lKeys, diff, function(a, b){ + return a === b; + }); + + } + + return false; + + + } + + module.exports = { + diffArray: diffArray, + diffObject: diffObject + } /***/ }, /* 26 */ diff --git a/dist/regular.min.js b/dist/regular.min.js index 9bc92da..9388a37 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data),this._body&&this._body.length&&(this.$body=s.getCompileFn(this._body,this.$parent,{outer:this,namespace:e.namespace,extra:e.extra,record:!0}),this._body=null),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25),a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diffArray:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1),s=typeof t;r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"===s?t():c.$compile("object"!==s?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var b,$={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:t.children},e={namespace:d,extra:e.extra},A=new h($,e);r&&this.$refs&&(b=h.directive("ref").link,this.$on("$destroy",b.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e($),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} -},"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diffArray:n.diffArray,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,s,u,c,h;if(t.test){var f=t.test(this);f&&(n=!0,t.fn.apply(this,f))}else if(r=t.get(this),a=t.last,s=i.typeOf(a),u=i.typeOf(r),c=!0,h,"object"===u&&"object"===s&&t.deep){for(var l in r)if(a[l]!==r[l]){n=!0;break}if(n!==!0)for(var p in a)if(a[p]!==r[p]){n=!0;break}}else"array"!==u||"undefined"!=s&&"array"!==s?(c=i.equals(r,a),(!c||t.force)&&(t.force=null,n=!0)):(h=o(r,t.last||[],t.diffArray),("array"!==s||h===!0||h.length)&&(n=!0));return n&&!t.test&&(t.last="object"===u&&t.deep||"array"===u?i.clone(r):r,t.fn.call(this,r,a,h),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,s),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,s)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t){function e(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function n(t,e){return t===e}function r(t,e){for(var r=t.length,i=e.length,a=[],o=0;r>=o;o++)a.push([o]);for(var s=1;i>=s;s++)a[0][s]=s;for(var o=1;r>=o;o++)for(var s=1;i>=s;s++)a[o][s]=n(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function i(t,n,i){if(!i)return e(t,n);for(var a=r(n,t),o=n.length,s=o,u=t.length,c=u,h=[],f=a[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=a[s-1][c-1],p=a[s-1][c],d=a[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(n[o]),o++;break;case x:_.add++,_.removed.push(n[o]),o++,u++}return null!=_.index&&E.push(_),E}t.exports=i},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data);var u=this._body;this._body=null,u&&u.ast&&u.ast.length&&(this.$body=s.getCompileFn(u.ast,u.ctx,{outer:this,namespace:e.namespace,extra:e.extra,record:!0})),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25).diffArray,a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diff:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1),s=typeof t;r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"===s?t():c.$compile("object"!==s?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:{ctx:this,ast:t.children}},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} +},"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s=o.diffArray,u=o.diffObject,c={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diff:n.diff,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,o,c,h,f;if(t.test){var l=t.test(this);l&&(n=!0,t.fn.apply(this,l))}else r=t.get(this),a=t.last,o=i.typeOf(a),c=i.typeOf(r),h=!0,f,"object"===c&&"object"===o&&t.deep?(f=u(r,a,t.diff),(f===!0||f.length)&&(n=!0)):"array"!==c||"undefined"!=o&&"array"!==o?(h=i.equals(r,a),(!h||t.force)&&(t.force=null,n=!0)):(f=s(r,t.last||[],t.diff),("array"!==o||f===!0||f.length)&&(n=!0));return n&&!t.test&&(t.last="object"===c&&t.deep||"array"===c?i.clone(r):r,t.fn.call(this,r,a,f),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,c),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,c)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t,e,n){function r(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function i(t,e){return t===e}function a(t,e){for(var n=t.length,r=e.length,a=[],o=0;n>=o;o++)a.push([o]);for(var s=1;r>=s;s++)a[0][s]=s;for(var o=1;n>=o;o++)for(var s=1;r>=s;s++)a[o][s]=i(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function o(t,e,n){if(!n)return r(t,e);for(var i=a(e,t),o=e.length,s=o,u=t.length,c=u,h=[],f=i[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=i[s-1][c-1],p=i[s-1][c],d=i[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(e[o]),o++;break;case x:_.add++,_.removed.push(e[o]),o++,u++}return null!=_.index&&E.push(_),E}function s(t,e,n){if(n){var r=u.keys(t),i=u.keys(e);return o(r,i,n,function(t,e){return t===e})}for(var a in t)if(e[a]!==t[a])return!0;for(var s in e)if(e[s]!==t[s])return!0;return!1}var u=n(5);t.exports={diffArray:o,diffObject:s}},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/src/Regular.js b/src/Regular.js index e8bc48d..5400e7c 100644 --- a/src/Regular.js +++ b/src/Regular.js @@ -67,14 +67,17 @@ var Regular = function(definition, options){ } this.$emit("$config"); this.config && this.config(this.data); - if(this._body && this._body.length){ - this.$body = _.getCompileFn(this._body, this.$parent, { + + var body = this._body; + this._body = null; + + if(body && body.ast && body.ast.length){ + this.$body = _.getCompileFn(body.ast, body.ctx , { outer: this, namespace: options.namespace, extra: options.extra, record: true }) - this._body = null; } // handle computed if(template){ diff --git a/src/helper/arrayDiff.js b/src/helper/diff.js similarity index 80% rename from src/helper/arrayDiff.js rename to src/helper/diff.js index 5005642..c1b118a 100644 --- a/src/helper/arrayDiff.js +++ b/src/helper/diff.js @@ -1,3 +1,4 @@ +var _ = require('../util.js'); function simpleDiff(now, old){ var nlen = now.length; @@ -39,8 +40,8 @@ function ld(array1, array2){ } return matrix; } -function whole(arr2, arr1, diffArray) { - if(!diffArray) return simpleDiff(arr2, arr1); +function diffArray(arr2, arr1, diff) { + if(!diff) return simpleDiff(arr2, arr1); var matrix = ld(arr1, arr2) var n = arr1.length; var i = n; @@ -131,4 +132,42 @@ function whole(arr2, arr1, diffArray) { } return steps } -module.exports = whole; \ No newline at end of file + + + +// diffObject +// ---- +// test if obj1 deepEqual obj2 +function diffObject( now, last, diff ){ + + + if(!diff){ + + for( var j in now ){ + if( last[j] !== now[j] ) return true + } + + for( var n in last ){ + if(last[n] !== now[n]) return true; + } + + }else{ + + var nKeys = _.keys(now); + var lKeys = _.keys(last); + + return diffArray(nKeys, lKeys, diff, function(a, b){ + return a === b; + }); + + } + + return false; + + +} + +module.exports = { + diffArray: diffArray, + diffObject: diffObject +} \ No newline at end of file diff --git a/src/helper/watcher.js b/src/helper/watcher.js index a7f8420..752c162 100644 --- a/src/helper/watcher.js +++ b/src/helper/watcher.js @@ -1,6 +1,8 @@ var _ = require('../util.js'); var parseExpression = require('./parse.js').expression; -var diffArray = require('./arrayDiff.js'); +var diff = require('./diff.js'); +var diffArray = diff.diffArray; +var diffObject = diff.diffObject; function Watcher(){} @@ -48,7 +50,7 @@ var methods = { once: once, force: options.force, // don't use ld to resolve array diff - diffArray: options.diffArray, + diff: options.diff, test: test, deep: options.deep, last: options.sync? get(this): options.last @@ -150,7 +152,7 @@ var methods = { if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){ // Array if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){ - diff = diffArray(now, watcher.last || [], watcher.diffArray) + diff = diffArray(now, watcher.last || [], watcher.diff) if( tlast !== 'array' || diff === true || diff.length ) dirty = true; }else{ eq = _.equals( now, last ); @@ -160,20 +162,8 @@ var methods = { } } }else{ - for(var j in now){ - if(last[j] !== now[j]){ - dirty = true; - break; - } - } - if(dirty !== true){ - for(var n in last){ - if(last[n] !== now[n]){ - dirty = true; - break; - } - } - } + diff = diffObject( now, last, watcher.diff ); + if( diff === true || diff.length ) dirty = true; } } else{ // @TODO 是否把多重改掉 diff --git a/src/walkers.js b/src/walkers.js index c7fb440..3becb17 100644 --- a/src/walkers.js +++ b/src/walkers.js @@ -1,4 +1,4 @@ -var diffArray = require('./helper/arrayDiff.js'); +var diffArray = require('./helper/diff.js').diffArray; var combine = require('./helper/combine.js'); var animate = require("./helper/animate.js"); var node = require("./parser/node.js"); @@ -21,6 +21,7 @@ walkers.list = function(ast, options){ var variable = ast.variable; var alternate = ast.alternate; var track = ast.track, keyOf, extraObj; + if( track && track !== true ){ track = this._touchExpr(track); extraObj = _.createObject(extra); @@ -30,6 +31,7 @@ walkers.list = function(ast, options){ return track.get( self, extraObj ); } } + function removeRange(index, rlen){ for(var j = 0; j< rlen; j++){ //removed var removed = group.children.splice( index + 1, 1)[0]; @@ -70,6 +72,18 @@ walkers.list = function(ast, options){ } } + // update object type + function updateObject(newValue, oldValue, splices){ + // if type doesn't equal Object, we remove all of them directly + // if(oldType !== 'object'){ + // removeRange(0, group.children.length-1); + // } + + var keys = Object.keys(newValue); + + + } + function updateLD(newValue, oldValue, splices){ if(!oldValue) oldValue = []; if(!newValue) newValue = []; @@ -171,7 +185,7 @@ walkers.list = function(ast, options){ } } } - this.$watch(ast.sequence, update, { init: true, diffArray: track !== true }); + this.$watch(ast.sequence, update, { init: true, diff: track !== true }); return group; } // {#include } or {#inc template} @@ -445,7 +459,10 @@ walkers.component = function(ast, options){ $parent: (isolate & 2)? null: this, $root: this.$root, $outer: options.outer, - _body: ast.children + _body: { + ctx: this, + ast: ast.children + } } var options = { namespace: namespace, diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index eabd899..10fe2d4 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -66,7 +66,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); function destroy(component, container){ component.destroy(); @@ -253,7 +253,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); var dom = Regular.dom; function destroy(component, container){ @@ -783,32 +783,51 @@ }) - it('bugfix #67', function(){ - // https://github.com/regularjs/regular/issues/50 - var template = "{#include a}"; - expect(function(){ - var component = new Regular({ - data: { - a: 1, - b: true, - c: undefined, - d: null, - e: '123' - }, - template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" - }) - }).to.not.throwException(); - + it('bugfix #67', function(){ + // https://github.com/regularjs/regular/issues/50 + var template = "{#include a}"; - var ps = nes.all('p' ,container); + expect(function(){ + var component = new Regular({ + data: { + a: 1, + b: true, + c: undefined, + d: null, + e: '123' + }, + template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" + }) + }).to.not.throwException(); + + var ps = nes.all('p' ,container); + }) + it('bugfix #68, isolate with transclude content', function(){ + + var XSelect = Regular.extend({ + name: 'xselect', + template: '
{#inc this.$body }
' + }) + + + var component = new Regular({ + data: { name: 'leeluolee' }, + template: '
{name}
' + }) + + expect(component.$refs.a.innerHTML).to.equal('leeluolee'); + component.destroy(); + + }) }) - }) + + @@ -817,9 +836,9 @@ /* 3 */ /***/ function(module, exports, __webpack_require__) { - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); var animate = __webpack_require__(19); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); function destroy(component, container){ component.destroy(); @@ -1256,8 +1275,8 @@ var expect = __webpack_require__(26); // contains basic dom && event specs - var dom = __webpack_require__(16); - var Regular = __webpack_require__(17); + var dom = __webpack_require__(17); + var Regular = __webpack_require__(16); function destroy(component, container){ component.destroy(); @@ -1657,7 +1676,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); var combine = __webpack_require__(20); function destroy(component, container){ component.destroy(); @@ -1831,7 +1850,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); function reset(){} @@ -2051,7 +2070,8 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); + var _ = Regular.util; function destroy(component, container){ component.destroy(); @@ -2669,6 +2689,83 @@ expect(divs[1]).to.equal(divs2[1]); expect(divs[2]).to.not.equal(divs2[2]); + }) + it("list track non-index expression" , function(){ + var List = Regular.extend({ + template: '
{#list list as item by item.a}\ +
{item.a}
{/list}
' + }) + var list = new List({ + data: { + list: [{a: 1}, {a: 2} , {a: 3}] + } + }) + var divs = nes.all('div', list.$refs.cnt); + + list.data.list = [{a: 4},{a: 2} , {a: 6}] + list.$update(); + + var divs2 = nes.all('div', list.$refs.cnt); + + expect(divs[0]).to.not.equal(divs2[0]); + expect(divs[1]).to.equal(divs2[1]); + expect(divs[2]).to.not.equal(divs2[2]); + + }) + }) + + describe("List with Object", function(){ + it("items should list by Object.keys", function( done){ + + var component = new Regular({ + template: "
\ + {#list json as item by item_index}\ +
{item.age}:{item_key}
\ + {/list}\ +
", + data: { + json: { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + } + }) + + // only make sure + var json = component.data.json; + var keys = _.keys(json); + + var divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + keys[index]); + }) + + component.destroy(); + + + }) + + it("items converted from Object to Array", function(){ + + }) + it("items converted from Array to Object", function(){ + + }) + it("items converted from null to Object", function(){ + + }) + it("items converted from Object to null", function(){ + + }) + it("items converted from Object to other dataType", function(){ + + }) + it("items converted from other dataType to Object", function(){ + }) }) }) @@ -2680,8 +2777,8 @@ var expect = __webpack_require__(26); - var dom = __webpack_require__(16); - var Regular = __webpack_require__(17); + var dom = __webpack_require__(17); + var Regular = __webpack_require__(16); var container = document.createElement('div'); function destroy(component, container){ @@ -3105,7 +3202,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); var container = document.createElement('div'); function destroy(component, container){ @@ -3332,7 +3429,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); function destroy(component, container){ component.destroy(); @@ -4081,7 +4178,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); describe("Filter", function(){ @@ -4282,8 +4379,8 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); - var parse = __webpack_require__(24); + var Regular = __webpack_require__(16); + var parse = __webpack_require__(21); var Component = Regular.extend(); @@ -4892,10 +4989,10 @@ i++; }) watcher.$watch('list', function(nList, oList, splice){ - expect(splice).to.not.equal(undefined); + expect(splice).to.not.equal(true); i++; },{ - diffArray: true + diff: true }) watcher.$update('list', [1,2,3]) @@ -4916,7 +5013,7 @@ var expect = __webpack_require__(26); - var Regular = __webpack_require__(17); + var Regular = __webpack_require__(16); var Component = Regular.extend(); function destroy(component, container){ @@ -5411,9 +5508,9 @@ var expect = __webpack_require__(26); var _ = __webpack_require__(18); - var shim = __webpack_require__(21); - var extend = __webpack_require__(22); - var diffArray = __webpack_require__(23); + var shim = __webpack_require__(22); + var extend = __webpack_require__(23); + var diffArray = __webpack_require__(24).diffArray; @@ -5813,6 +5910,39 @@ /* 16 */ /***/ function(module, exports, __webpack_require__) { + var env = __webpack_require__(27); + var config = __webpack_require__(28); + var Regular = module.exports = __webpack_require__(29); + var Parser = Regular.Parser; + var Lexer = Regular.Lexer; + + if(env.browser){ + __webpack_require__(31); + __webpack_require__(32); + __webpack_require__(33); + Regular.dom = __webpack_require__(17); + } + Regular.env = env; + Regular.util = __webpack_require__(18); + Regular.parse = function(str, options){ + options = options || {}; + + if(options.BEGIN || options.END){ + if(options.BEGIN) config.BEGIN = options.BEGIN; + if(options.END) config.END = options.END; + Lexer.setup(); + } + var ast = new Parser(str).parse(); + return !options.stringify? ast : JSON.stringify(ast); + } + + + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + // thanks for angular && mootools for some concise&cross-platform implemention // ===================================== @@ -6204,44 +6334,11 @@ -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - var env = __webpack_require__(27); - var config = __webpack_require__(28); - var Regular = module.exports = __webpack_require__(29); - var Parser = Regular.Parser; - var Lexer = Regular.Lexer; - - if(env.browser){ - __webpack_require__(31); - __webpack_require__(32); - __webpack_require__(33); - Regular.dom = __webpack_require__(16); - } - Regular.env = env; - Regular.util = __webpack_require__(18); - Regular.parse = function(str, options){ - options = options || {}; - - if(options.BEGIN || options.END){ - if(options.BEGIN) config.BEGIN = options.BEGIN; - if(options.END) config.END = options.END; - Lexer.setup(); - } - var ast = new Parser(str).parse(); - return !options.stringify? ast : JSON.stringify(ast); - } - - - - /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(21)(); + /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(22)(); @@ -6686,7 +6783,7 @@ /***/ function(module, exports, __webpack_require__) { var _ = __webpack_require__(18); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var animate = {}; var env = __webpack_require__(27); @@ -6942,7 +7039,7 @@ // some nested operation in ast // -------------------------------- - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var animate = __webpack_require__(19); var combine = module.exports = { @@ -7048,6 +7145,28 @@ /***/ }, /* 21 */ +/***/ function(module, exports, __webpack_require__) { + + var exprCache = __webpack_require__(27).exprCache; + var _ = __webpack_require__(18); + var Parser = __webpack_require__(34); + module.exports = { + expression: function(expr, simple){ + // @TODO cache + if( typeof expr === 'string' && ( expr = expr.trim() ) ){ + expr = exprCache.get( expr ) || exprCache.set( expr, new Parser( expr, { mode: 2, expression: true } ).expression() ) + } + if(expr) return expr; + }, + parse: function(template){ + return new Parser(template).parse(); + } + } + + + +/***/ }, +/* 22 */ /***/ function(module, exports, __webpack_require__) { // shim for es5 @@ -7155,7 +7274,7 @@ /***/ }, -/* 22 */ +/* 23 */ /***/ function(module, exports, __webpack_require__) { // (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -7241,10 +7360,11 @@ /***/ }, -/* 23 */ +/* 24 */ /***/ function(module, exports, __webpack_require__) { - + var _ = __webpack_require__(18); + function simpleDiff(now, old){ var nlen = now.length; var olen = old.length; @@ -7285,8 +7405,8 @@ } return matrix; } - function whole(arr2, arr1, diffArray) { - if(!diffArray) return simpleDiff(arr2, arr1); + function diffArray(arr2, arr1, diff) { + if(!diff) return simpleDiff(arr2, arr1); var matrix = ld(arr1, arr2) var n = arr1.length; var i = n; @@ -7377,29 +7497,45 @@ } return steps } - module.exports = whole; -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - var exprCache = __webpack_require__(27).exprCache; - var _ = __webpack_require__(18); - var Parser = __webpack_require__(34); - module.exports = { - expression: function(expr, simple){ - // @TODO cache - if( typeof expr === 'string' && ( expr = expr.trim() ) ){ - expr = exprCache.get( expr ) || exprCache.set( expr, new Parser( expr, { mode: 2, expression: true } ).expression() ) + + // diffObject + // ---- + // test if obj1 deepEqual obj2 + function diffObject( now, last, diff ){ + + + if(!diff){ + + for( var j in now ){ + if( last[j] !== now[j] ) return true } - if(expr) return expr; - }, - parse: function(template){ - return new Parser(template).parse(); + + for( var n in last ){ + if(last[n] !== now[n]) return true; + } + + }else{ + + var nKeys = _.keys(now); + var lKeys = _.keys(last); + + return diffArray(nKeys, lKeys, diff, function(a, b){ + return a === b; + }); + } - } + + return false; + } + + module.exports = { + diffArray: diffArray, + diffObject: diffObject + } /***/ }, /* 25 */ @@ -8810,10 +8946,10 @@ var Parser = __webpack_require__(34); var config = __webpack_require__(28); var _ = __webpack_require__(18); - var extend = __webpack_require__(22); + var extend = __webpack_require__(23); var combine = {}; if(env.browser){ - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var walkers = __webpack_require__(36); var Group = __webpack_require__(37); var doc = dom.doc; @@ -8821,7 +8957,7 @@ } var events = __webpack_require__(25); var Watcher = __webpack_require__(38); - var parse = __webpack_require__(24); + var parse = __webpack_require__(21); var filter = __webpack_require__(39); @@ -8873,14 +9009,17 @@ } this.$emit("$config"); this.config && this.config(this.data); - if(this._body && this._body.length){ - this.$body = _.getCompileFn(this._body, this.$parent, { + + var body = this._body; + this._body = null; + + if(body && body.ast && body.ast.length){ + this.$body = _.getCompileFn(body.ast, body.ctx , { outer: this, namespace: options.namespace, extra: options.extra, record: true }) - this._body = null; } // handle computed if(template){ @@ -9654,7 +9793,7 @@ // Regular var _ = __webpack_require__(18); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var animate = __webpack_require__(19); var Regular = __webpack_require__(29); var consts = __webpack_require__(40); @@ -9771,7 +9910,7 @@ var // packages _ = __webpack_require__(18), animate = __webpack_require__(19), - dom = __webpack_require__(16), + dom = __webpack_require__(17), Regular = __webpack_require__(29); @@ -11141,12 +11280,12 @@ /* 36 */ /***/ function(module, exports, __webpack_require__) { - var diffArray = __webpack_require__(23); + var diffArray = __webpack_require__(24).diffArray; var combine = __webpack_require__(20); var animate = __webpack_require__(19); var node = __webpack_require__(43); var Group = __webpack_require__(37); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var _ = __webpack_require__(18); @@ -11164,6 +11303,7 @@ var variable = ast.variable; var alternate = ast.alternate; var track = ast.track, keyOf, extraObj; + if( track && track !== true ){ track = this._touchExpr(track); extraObj = _.createObject(extra); @@ -11173,6 +11313,7 @@ return track.get( self, extraObj ); } } + function removeRange(index, rlen){ for(var j = 0; j< rlen; j++){ //removed var removed = group.children.splice( index + 1, 1)[0]; @@ -11213,6 +11354,18 @@ } } + // update object type + function updateObject(newValue, oldValue, splices){ + // if type doesn't equal Object, we remove all of them directly + // if(oldType !== 'object'){ + // removeRange(0, group.children.length-1); + // } + + var keys = Object.keys(newValue); + + + } + function updateLD(newValue, oldValue, splices){ if(!oldValue) oldValue = []; if(!newValue) newValue = []; @@ -11314,7 +11467,7 @@ } } } - this.$watch(ast.sequence, update, { init: true, diffArray: track !== true }); + this.$watch(ast.sequence, update, { init: true, diff: track !== true }); return group; } // {#include } or {#inc template} @@ -11588,7 +11741,10 @@ $parent: (isolate & 2)? null: this, $root: this.$root, $outer: options.outer, - _body: ast.children + _body: { + ctx: this, + ast: ast.children + } } var options = { namespace: namespace, @@ -11736,8 +11892,10 @@ /***/ function(module, exports, __webpack_require__) { var _ = __webpack_require__(18); - var parseExpression = __webpack_require__(24).expression; - var diffArray = __webpack_require__(23); + var parseExpression = __webpack_require__(21).expression; + var diff = __webpack_require__(24); + var diffArray = diff.diffArray; + var diffObject = diff.diffObject; function Watcher(){} @@ -11785,7 +11943,7 @@ once: once, force: options.force, // don't use ld to resolve array diff - diffArray: options.diffArray, + diff: options.diff, test: test, deep: options.deep, last: options.sync? get(this): options.last @@ -11887,7 +12045,7 @@ if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){ // Array if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){ - diff = diffArray(now, watcher.last || [], watcher.diffArray) + diff = diffArray(now, watcher.last || [], watcher.diff) if( tlast !== 'array' || diff === true || diff.length ) dirty = true; }else{ eq = _.equals( now, last ); @@ -11897,20 +12055,8 @@ } } }else{ - for(var j in now){ - if(last[j] !== now[j]){ - dirty = true; - break; - } - } - if(dirty !== true){ - for(var n in last){ - if(last[n] !== now[n]){ - dirty = true; - break; - } - } - } + diff = diffObject( now, last, watcher.diff ); + if( diff === true || diff.length ) dirty = true; } } else{ // @TODO 是否把多重改掉 @@ -12085,7 +12231,7 @@ * */ var _ = __webpack_require__(18); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var Regular = __webpack_require__(29); Regular._addProtoInheritCache("event"); @@ -12166,7 +12312,7 @@ // Regular var _ = __webpack_require__(18); - var dom = __webpack_require__(16); + var dom = __webpack_require__(17); var Regular = __webpack_require__(29); var modelHandlers = { diff --git a/test/spec/browser-bugfix.js b/test/spec/browser-bugfix.js index f54e18f..163ba40 100644 --- a/test/spec/browser-bugfix.js +++ b/test/spec/browser-bugfix.js @@ -530,31 +530,50 @@ it('bugfix #50', function(){ }) -it('bugfix #67', function(){ - // https://github.com/regularjs/regular/issues/50 - var template = "{#include a}"; - expect(function(){ - var component = new Regular({ - data: { - a: 1, - b: true, - c: undefined, - d: null, - e: '123' - }, - template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" - }) - }).to.not.throwException(); - + it('bugfix #67', function(){ + // https://github.com/regularjs/regular/issues/50 + var template = "{#include a}"; - var ps = nes.all('p' ,container); + expect(function(){ + var component = new Regular({ + data: { + a: 1, + b: true, + c: undefined, + d: null, + e: '123' + }, + template: "{#inc a}{#inc b}{#inc c}{#inc d}{#inc e}" + }) + }).to.not.throwException(); + + var ps = nes.all('p' ,container); + }) + it('bugfix #68, isolate with transclude content', function(){ + + var XSelect = Regular.extend({ + name: 'xselect', + template: '
{#inc this.$body }
' + }) + + + var component = new Regular({ + data: { name: 'leeluolee' }, + template: '
{name}
' + }) + + expect(component.$refs.a.innerHTML).to.equal('leeluolee'); + component.destroy(); + + }) }) -}) + + diff --git a/test/spec/browser-list.js b/test/spec/browser-list.js index 4bf36b2..b2834a4 100644 --- a/test/spec/browser-list.js +++ b/test/spec/browser-list.js @@ -1,5 +1,6 @@ var expect = require('expect.js'); var Regular = require("../../src/index.js"); +var _ = Regular.util; function destroy(component, container){ component.destroy(); @@ -617,6 +618,83 @@ it("list with else should also works under track mode", function(){ expect(divs[1]).to.equal(divs2[1]); expect(divs[2]).to.not.equal(divs2[2]); + }) + it("list track non-index expression" , function(){ + var List = Regular.extend({ + template: '
{#list list as item by item.a}\ +
{item.a}
{/list}
' + }) + var list = new List({ + data: { + list: [{a: 1}, {a: 2} , {a: 3}] + } + }) + var divs = nes.all('div', list.$refs.cnt); + + list.data.list = [{a: 4},{a: 2} , {a: 6}] + list.$update(); + + var divs2 = nes.all('div', list.$refs.cnt); + + expect(divs[0]).to.not.equal(divs2[0]); + expect(divs[1]).to.equal(divs2[1]); + expect(divs[2]).to.not.equal(divs2[2]); + + }) + }) + + describe("List with Object", function(){ + it("items should list by Object.keys", function( done){ + + var component = new Regular({ + template: "
\ + {#list json as item by item_index}\ +
{item.age}:{item_key}
\ + {/list}\ +
", + data: { + json: { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + } + }) + + // only make sure + var json = component.data.json; + var keys = _.keys(json); + + var divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + keys[index]); + }) + + component.destroy(); + + + }) + + it("items converted from Object to Array", function(){ + + }) + it("items converted from Array to Object", function(){ + + }) + it("items converted from null to Object", function(){ + + }) + it("items converted from Object to null", function(){ + + }) + it("items converted from Object to other dataType", function(){ + + }) + it("items converted from other dataType to Object", function(){ + }) }) }) \ No newline at end of file diff --git a/test/spec/browser-watcher.js b/test/spec/browser-watcher.js index ad898a8..f5d43d1 100644 --- a/test/spec/browser-watcher.js +++ b/test/spec/browser-watcher.js @@ -609,10 +609,10 @@ describe("component.watcher", function(){ i++; }) watcher.$watch('list', function(nList, oList, splice){ - expect(splice).to.not.equal(undefined); + expect(splice).to.not.equal(true); i++; },{ - diffArray: true + diff: true }) watcher.$update('list', [1,2,3]) diff --git a/test/spec/test-util.js b/test/spec/test-util.js index 06f5335..a605e1c 100644 --- a/test/spec/test-util.js +++ b/test/spec/test-util.js @@ -2,7 +2,7 @@ var expect = require('expect.js'); var _ = require("../../src/util.js"); var shim = require("../../src/helper/shim.js"); var extend = require("../../src/helper/extend.js"); -var diffArray = require("../../src/helper/arrayDiff.js"); +var diffArray = require("../../src/helper/diff.js").diffArray; From 1629974416aa2aa9d28710607a9cd8a047dd0695 Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Tue, 8 Dec 2015 00:08:27 +0800 Subject: [PATCH 7/8] fix #62 --- dist/regular.js | 139 ++- dist/regular.min.js | 4 +- src/helper/diff.js | 22 +- src/walkers.js | 117 ++- test/runner/dom.bundle.js | 1801 +++++++++++++++++++++---------------- test/spec/browser-list.js | 202 ++++- test/spec/test-util.js | 57 +- 7 files changed, 1477 insertions(+), 865 deletions(-) diff --git a/dist/regular.js b/dist/regular.js index eea5057..76535b1 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1966,6 +1966,7 @@ return /******/ (function(modules) { // webpackBootstrap var self = this; var group = new Group([placeholder]); var indexName = ast.variable + '_index'; + var keyName = ast.variable + '_key'; var variable = ast.variable; var alternate = ast.alternate; var track = ast.track, keyOf, extraObj; @@ -1976,6 +1977,7 @@ return /******/ (function(modules) { // webpackBootstrap keyOf = function( item, index ){ extraObj[ variable ] = item; extraObj[ indexName ] = index; + // @FIX keyName return track.get( self, extraObj ); } } @@ -1986,13 +1988,13 @@ return /******/ (function(modules) { // webpackBootstrap if(removed) removed.destroy(true); } } - function addRange(index, end, newValue){ + + function addRange(index, end, newList, rawNewValue){ for(var o = index; o < end; o++){ //add // prototype inherit - var item = newValue[o]; + var item = newList[o]; var data = {}; - data[indexName] = o; - data[variable] = item; + updateTarget(data, o, item, rawNewValue); data = _.createObject(extra, data); var section = self.$compile(ast.body, { @@ -2012,36 +2014,33 @@ return /******/ (function(modules) { // webpackBootstrap } } - function updateRange(start, end, newValue){ - for(var k = start; k < end; k++){ // no change - var sect = group.get( k + 1 ); - sect.data[ indexName ] = k; - sect.data[ variable ] = newValue[k]; - } - } + function updateTarget(target, index, item, rawNewValue){ - // update object type - function updateObject(newValue, oldValue, splices){ - // if type doesn't equal Object, we remove all of them directly - // if(oldType !== 'object'){ - // removeRange(0, group.children.length-1); - // } + target[ indexName ] = index; + if( rawNewValue ){ + target[ keyName ] = item; + target[ variable ] = rawNewValue[ item ]; + }else{ + target[ variable ] = item; + target[keyName] = null + } + } - var keys = Object.keys(newValue); - + function updateRange(start, end, newList, rawNewValue){ + for(var k = start; k < end; k++){ // no change + var sect = group.get( k + 1 ), item = newList[ k ]; + updateTarget(sect.data, k, item, rawNewValue); + } } - function updateLD(newValue, oldValue, splices){ - if(!oldValue) oldValue = []; - if(!newValue) newValue = []; - + function updateLD(newList, oldList, splices , rawNewValue ){ var cur = placeholder; - var m = 0, len = newValue.length; + var m = 0, len = newList.length; - if(!splices && (len !==0 || oldValue.length !==0) ){ - splices = diffArray(newValue, oldValue, true); + if(!splices && (len !==0 || oldList.length !==0) ){ + splices = diffArray(newList, oldList, true); } if(!splices || !splices.length) return; @@ -2057,9 +2056,9 @@ return /******/ (function(modules) { // webpackBootstrap var minar = Math.min(rlen, add); var tIndex = 0; while(tIndex < minar){ - if( keyOf(newValue[index], index) !== keyOf( removed[0], index ) ){ + if( keyOf(newList[index], index) !== keyOf( removed[0], index ) ){ removeRange(index, 1) - addRange(index, index+1, newValue) + addRange(index, index+1, newList, rawNewValue) } removed.shift(); add--; @@ -2069,10 +2068,11 @@ return /******/ (function(modules) { // webpackBootstrap rlen = removed.length; } // update - updateRange(m, index, newValue); + updateRange(m, index, newList, rawNewValue); + removeRange( index ,rlen) - addRange(index, index+add, newValue) + addRange(index, index+add, newList, rawNewValue) m = index + add - rlen; m = m < 0? 0 : m; @@ -2082,41 +2082,50 @@ return /******/ (function(modules) { // webpackBootstrap for(var i = m; i < len; i++){ var pair = group.get(i + 1); pair.data[indexName] = i; + // @TODO fix keys } } } // if the track is constant test. - function updateSimple(newValue, oldValue){ - - newValue = newValue || []; - oldValue = oldValue || []; + function updateSimple(newList, oldList, rawNewValue ){ - var nlen = newValue.length || 0; - var olen = oldValue.length || 0; + var nlen = newList.length; + var olen = oldList.length; var mlen = Math.min(nlen, olen); - - updateRange(0, mlen, newValue) + updateRange(0, mlen, newList, rawNewValue) if(nlen < olen){ //need add removeRange(nlen, olen-nlen); }else if(nlen > olen){ - addRange(olen, nlen, newValue); + addRange(olen, nlen, newList, rawNewValue); } } function update(newValue, oldValue, splices){ - var nlen = newValue && newValue.length; - var olen = oldValue && oldValue.length; - if( !olen && nlen && group.get(1)){ + + var nType = _.typeOf( newValue ); + var oType = _.typeOf( oldValue ); + + var newList = getListFromValue( newValue, nType ); + var oldList = getListFromValue( oldValue, oType ); + + + var nlen = newList && newList.length; + var olen = oldList && oldList.length; + + // if previous list has , we need to remove the altnated section. + if( !olen && nlen && group.get(1) ){ var altGroup = group.children.pop(); if(altGroup.destroy) altGroup.destroy(true); } + if( nType === 'object' ) var rawNewValue = newValue; + if(track === true){ - updateSimple(newValue, oldValue, splices) + updateSimple( newList, oldList, rawNewValue ); }else{ - updateLD(newValue, oldValue, splices) + updateLD( newList, oldList, splices, rawNewValue ); } // @ {#list} {#else} @@ -2133,9 +2142,21 @@ return /******/ (function(modules) { // webpackBootstrap } } } - this.$watch(ast.sequence, update, { init: true, diff: track !== true }); + + this.$watch(ast.sequence, update, { + init: true, + diff: track !== true , + deep: true + }); return group; } + + + function updateItem(){ + + } + + // {#include } or {#inc template} walkers.template = function(ast, options){ var content = ast.content, compiled; @@ -2167,6 +2188,12 @@ return /******/ (function(modules) { // webpackBootstrap return group; }; + function getListFromValue(value, type){ + return type === 'object'? _.keys(value): ( + type === 'array'? value: [] + ) + } + // how to resolve this problem var ii = 0; @@ -5180,9 +5207,13 @@ return /******/ (function(modules) { // webpackBootstrap function equals(a,b){ return a === b; } - function ld(array1, array2){ + + // array1 - old array + // array2 - new array + function ld(array1, array2, equalFn){ var n = array1.length; var m = array2.length; + var equalFn = equalFn || equals; var matrix = []; for(var i = 0; i <= n; i++){ matrix.push([i]); @@ -5192,7 +5223,7 @@ return /******/ (function(modules) { // webpackBootstrap } for(var i = 1; i <= n; i++){ for(var j = 1; j <= m; j++){ - if(equals(array1[i-1], array2[j-1])){ + if(equalFn(array1[i-1], array2[j-1])){ matrix[i][j] = matrix[i-1][j-1]; }else{ matrix[i][j] = Math.min( @@ -5204,9 +5235,11 @@ return /******/ (function(modules) { // webpackBootstrap } return matrix; } - function diffArray(arr2, arr1, diff) { + // arr2 - new array + // arr1 - old array + function diffArray(arr2, arr1, diff, diffFn) { if(!diff) return simpleDiff(arr2, arr1); - var matrix = ld(arr1, arr2) + var matrix = ld(arr1, arr2, diffFn) var n = arr1.length; var i = n; var m = arr2.length; @@ -5320,8 +5353,14 @@ return /******/ (function(modules) { // webpackBootstrap var nKeys = _.keys(now); var lKeys = _.keys(last); + /** + * [description] + * @param {[type]} a [description] + * @param {[type]} b){ return now[b] [description] + * @return {[type]} [description] + */ return diffArray(nKeys, lKeys, diff, function(a, b){ - return a === b; + return now[b] === last[a]; }); } diff --git a/dist/regular.min.js b/dist/regular.min.js index 9388a37..58948d4 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data);var u=this._body;this._body=null,u&&u.ast&&u.ast.length&&(this.$body=s.getCompileFn(u.ast,u.ctx,{outer:this,namespace:e.namespace,extra:e.extra,record:!0})),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var i=n(25).diffArray,a=n(14),o=n(21),s=(n(26),n(10)),u=n(4),c=n(5),h=t.exports={};h.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=E.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function r(n,r,i){for(var s=n;r>s;s++){var u=i[s],h={};h[_]=s,h[N]=u,h=c.createObject(y,h);var f=x.$compile(t.body,{extra:h,namespace:g,record:!0,outer:e.outer});f.data=h;var l=a.last(E.get(s));l.parentNode&&o.inject(a.node(f),l,"after"),E.children.splice(s+1,0,f)}}function u(t,e,n){for(var r=t;e>r;r++){var i=E.get(r+1);i.data[_]=r,i.data[N]=n[r]}}function f(t,e,a){e||(e=[]),t||(t=[]);var o=0,s=t.length;if(a||0===s&&0===e.length||(a=i(t,e,!0)),a&&a.length){for(var c=0;cg;)d(t[f],f)!==d(l[0],f)&&(n(f,1),r(f,f+1,t)),l.shift(),p--,f++,g++;v=l.length}u(o,f,t),n(f,v),r(f,f+p,t),o=f+p-v,o=0>o?0:o}if(s>o)for(var c=o;s>c;c++){var y=E.get(c+1);y.data[_]=c}}}function l(t,e){t=t||[],e=e||[];var i=t.length||0,a=e.length||0,o=Math.min(i,a);u(0,o,t),a>i?n(i,a-i):i>a&&r(a,i,t)}function p(t,n,r){var i=t&&t.length,s=n&&n.length;if(!s&&i&&E.get(1)){var u=E.children.pop();u.destroy&&u.destroy(!0)}if(w===!0?l(t,n,r):f(t,n,r),!i&&T&&T.length){var c=x.$compile(T,{extra:y,record:!0,outer:e.outer,namespace:g});E.children.push(c),m.parentNode&&o.inject(a.node(c),m,"after")}}var d,v,m=(h.Regular,document.createComment("Regular list")),g=e.namespace,y=e.extra,x=this,E=new s([m]),_=t.variable+"_index",N=t.variable,T=t.alternate,w=t.track;return w&&w!==!0&&(w=this._touchExpr(w),v=c.createObject(y),d=function(t,e){return v[N]=t,v[_]=e,w.get(x,v)}),this.$watch(t.sequence,p,{init:!0,diff:w!==!0}),E},h.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,u=new s([i]);if(r){var c=this;this.$watch(r,function(t){var r=u.get(1),s=typeof t;r&&(r.destroy(!0),u.children.pop()),t&&(u.push(n="function"===s?t():c.$compile("object"!==s?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return u};var f=0;h["if"]=function(t,e){var n,r,i=this,u=e.extra;if(e&&e.element){var c=function(o){o?(r&&a.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:u}))):(n&&a.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:u})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?a.destroy(n):r&&a.destroy(r)}}}var n,r,h=document.createComment("Regular if"+f++),l=new s;l.push(h);var p=null,d=e.namespace,c=function(s){var c=!!s;c!==p&&(p=c,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(n),h.parentNode&&o.inject(a.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:u}),l.push(r),h.parentNode&&o.inject(a.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),l},h.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){u.text(e,""+(null==t?"":""+t))},{init:!0}),e},h.text=function(t){var e=document.createTextNode(c.convertEntity(t.text));return e};var l=/^on-(.+)$/;h.element=function(t,e){var n,i,s=t.attrs,f=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=f.component(v);if("r-content"===v)return c.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,h.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),i=u.create(v,p,s),n&&!c.isVoidTag(v)&&u.inject(a.node(n),i),t.touched||(s.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=r.call(this,s,i,d);return{type:"element",group:n,node:function(){return i},last:function(){return i},destroy:function(t){t?o.remove(i,n?n.destroy.bind(n):c.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},h.component=function(t,e){for(var n,r,i,o,u=t.attrs,h=e.Component,f=this.constructor,p=e.extra,d=e.namespace,v=this,m={},g=0,y=u.length;y>g;g++){var x=u[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(l);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=c.getCompileFn(E,this,{record:!0,namespace:d,extra:p,outer:e.outer})),"is"===_&&!h){i=E;var T=this.$get(E,!0);if(h=f.component(T),"function"!=typeof h)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(o=o||{},o[w]=c.handleEvent.call(this,E,w)):(_=x.name=c.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var $,b={data:m,events:o,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:{ctx:this,ast:t.children}},e={namespace:d,extra:e.extra},A=new h(b,e);r&&this.$refs&&($=h.directive("ref").link,this.$on("$destroy",$.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=u.length;y>g;g++){var x=u[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new s;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e(b),i=S.children.pop();S.push(n),n.$inject(a.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},h.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),h=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,h,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){u.attr(h,r,t)},{init:!0}):c.isBooleanAttr(r)?u.attr(h,r,!0):u.attr(h,r,i),e.fromElement?void 0:{destroy:function(){u.attr(h,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e} -},"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s=o.diffArray,u=o.diffObject,c={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diff:n.diff,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,o,c,h,f;if(t.test){var l=t.test(this);l&&(n=!0,t.fn.apply(this,l))}else r=t.get(this),a=t.last,o=i.typeOf(a),c=i.typeOf(r),h=!0,f,"object"===c&&"object"===o&&t.deep?(f=u(r,a,t.diff),(f===!0||f.length)&&(n=!0)):"array"!==c||"undefined"!=o&&"array"!==o?(h=i.equals(r,a),(!h||t.force)&&(t.force=null,n=!0)):(f=s(r,t.last||[],t.diff),("array"!==o||f===!0||f.length)&&(n=!0));return n&&!t.test&&(t.last="object"===c&&t.deep||"array"===c?i.clone(r):r,t.fn.call(this,r,a,f),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,c),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,c)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t,e,n){function r(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function i(t,e){return t===e}function a(t,e){for(var n=t.length,r=e.length,a=[],o=0;n>=o;o++)a.push([o]);for(var s=1;r>=s;s++)a[0][s]=s;for(var o=1;n>=o;o++)for(var s=1;r>=s;s++)a[o][s]=i(t[o-1],e[s-1])?a[o-1][s-1]:Math.min(a[o-1][s]+1,a[o][s-1]+1);return a}function o(t,e,n){if(!n)return r(t,e);for(var i=a(e,t),o=e.length,s=o,u=t.length,c=u,h=[],f=i[s][c];s>0||c>0;)if(0!==s)if(0!==c){var l=i[s-1][c-1],p=i[s-1][c],d=i[s][c-1],v=Math.min(d,p,l);v===p?(h.unshift(2),s--,f=p):v===l?(l===f?h.unshift(0):(h.unshift(1),f=l),s--,c--):(h.unshift(3),c--,f=d)}else h.unshift(2),s--;else h.unshift(3),c--;var m=0,g=3,y=2,x=1,o=0;u=0;for(var E=[],_={index:null,add:0,removed:[]},s=0;s0?null===_.index&&(_.index=u):null!=_.index&&(E.push(_),_={index:null,add:0,removed:[]}),h[s]){case m:o++,u++;break;case g:_.add++,u++;break;case y:_.removed.push(e[o]),o++;break;case x:_.add++,_.removed.push(e[o]),o++,u++}return null!=_.index&&E.push(_),E}function s(t,e,n){if(n){var r=u.keys(t),i=u.keys(e);return o(r,i,n,function(t,e){return t===e})}for(var a in t)if(e[a]!==t[a])return!0;for(var s in e)if(e[s]!==t[s])return!0;return!1}var u=n(5);t.exports={diffArray:o,diffObject:s}},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data);var u=this._body;this._body=null,u&&u.ast&&u.ast.length&&(this.$body=s.getCompileFn(u.ast,u.ctx,{outer:this,namespace:e.namespace,extra:e.extra,record:!0})),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e){return"object"===e?h.keys(t):"array"===e?t:[]}function i(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var a=n(25).diffArray,o=n(14),s=n(21),u=(n(26),n(10)),c=n(4),h=n(5),f=t.exports={};f.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=N.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function i(n,r,i,a){for(var u=n;r>u;u++){var f=i[u],l={};c(l,u,f,a),l=h.createObject(E,l);var p=_.$compile(t.body,{extra:l,namespace:x,record:!0,outer:e.outer});p.data=l;var d=o.last(N.get(u));d.parentNode&&s.inject(o.node(p),d,"after"),N.children.splice(u+1,0,p)}}function c(t,e,n,r){t[T]=e,r?(t[w]=n,t[b]=r[n]):(t[b]=n,t[w]=null)}function l(t,e,n,r){for(var i=t;e>i;i++){var a=N.get(i+1),o=n[i];c(a.data,i,o,r)}}function p(t,e,r,o){var s=0,u=t.length;if(r||0===u&&0===e.length||(r=a(t,e,!0)),r&&r.length){for(var c=0;cy;)m(t[f],f)!==m(p[0],f)&&(n(f,1),i(f,f+1,t,o)),p.shift(),d--,f++,y++;v=p.length}l(s,f,t,o),n(f,v),i(f,f+d,t,o),s=f+d-v,s=0>s?0:s}if(u>s)for(var c=s;u>c;c++){var x=N.get(c+1);x.data[T]=c}}}function d(t,e,r){var a=t.length,o=e.length,s=Math.min(a,o);l(0,s,t,r),o>a?n(a,o-a):a>o&&i(o,a,t,r)}function v(t,n,i){var a=h.typeOf(t),u=h.typeOf(n),c=r(t,a),f=r(n,u),l=c&&c.length,v=f&&f.length;if(!v&&l&&N.get(1)){var m=N.children.pop();m.destroy&&m.destroy(!0)}if("object"===a)var g=t;if(A===!0?d(c,f,g):p(c,f,i,g),!l&&$&&$.length){var T=_.$compile($,{extra:E,record:!0,outer:e.outer,namespace:x});N.children.push(T),y.parentNode&&s.inject(o.node(T),y,"after")}}var m,g,y=(f.Regular,document.createComment("Regular list")),x=e.namespace,E=e.extra,_=this,N=new u([y]),T=t.variable+"_index",w=t.variable+"_key",b=t.variable,$=t.alternate,A=t.track;return A&&A!==!0&&(A=this._touchExpr(A),g=h.createObject(E),m=function(t,e){return g[b]=t,g[T]=e,A.get(_,g)}),this.$watch(t.sequence,v,{init:!0,diff:A!==!0,deep:!0}),N},f.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,s=new u([i]);if(r){var c=this;this.$watch(r,function(t){var r=s.get(1),u=typeof t;r&&(r.destroy(!0),s.children.pop()),t&&(s.push(n="function"===u?t():c.$compile("object"!==u?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return s};var l=0;f["if"]=function(t,e){var n,r,i=this,a=e.extra;if(e&&e.element){var c=function(s){s?(r&&o.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:a}))):(n&&o.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:a})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?o.destroy(n):r&&o.destroy(r)}}}var n,r,h=document.createComment("Regular if"+l++),f=new u;f.push(h);var p=null,d=e.namespace,c=function(u){var c=!!u;c!==p&&(p=c,f.children[1]&&(f.children[1].destroy(!0),f.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(n),h.parentNode&&s.inject(o.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(r),h.parentNode&&s.inject(o.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),f},f.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){c.text(e,""+(null==t?"":""+t))},{init:!0}),e},f.text=function(t){var e=document.createTextNode(h.convertEntity(t.text));return e};var p=/^on-(.+)$/;f.element=function(t,e){var n,r,a=t.attrs,u=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=u.component(v);if("r-content"===v)return h.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,f.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),r=c.create(v,p,a),n&&!h.isVoidTag(v)&&c.inject(o.node(n),r),t.touched||(a.sort(function(t,e){var n=u.directive(t.name),r=u.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=i.call(this,a,r,d);return{type:"element",group:n,node:function(){return r},last:function(){return r},destroy:function(t){t?s.remove(r,n?n.destroy.bind(n):h.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},f.component=function(t,e){for(var n,r,i,a,s=t.attrs,c=e.Component,f=this.constructor,l=e.extra,d=e.namespace,v=this,m={},g=0,y=s.length;y>g;g++){var x=s[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(p);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=h.getCompileFn(E,this,{record:!0,namespace:d,extra:l,outer:e.outer})),"is"===_&&!c){i=E;var T=this.$get(E,!0);if(c=f.component(T),"function"!=typeof c)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(a=a||{},a[w]=h.handleEvent.call(this,E,w)):(_=x.name=h.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var b,$={data:m,events:a,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:{ctx:this,ast:t.children}},e={namespace:d,extra:e.extra},A=new c($,e);r&&this.$refs&&(b=c.directive("ref").link,this.$on("$destroy",b.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=s.length;y>g;g++){var x=s[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new u;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e($),i=S.children.pop();S.push(n),n.$inject(o.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},f.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),u=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,u,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){c.attr(u,r,t)},{init:!0}):h.isBooleanAttr(r)?c.attr(u,r,!0):c.attr(u,r,i),e.fromElement?void 0:{destroy:function(){c.attr(u,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e} +},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e}},"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s=o.diffArray,u=o.diffObject,c={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diff:n.diff,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,o,c,h,f;if(t.test){var l=t.test(this);l&&(n=!0,t.fn.apply(this,l))}else r=t.get(this),a=t.last,o=i.typeOf(a),c=i.typeOf(r),h=!0,f,"object"===c&&"object"===o&&t.deep?(f=u(r,a,t.diff),(f===!0||f.length)&&(n=!0)):"array"!==c||"undefined"!=o&&"array"!==o?(h=i.equals(r,a),(!h||t.force)&&(t.force=null,n=!0)):(f=s(r,t.last||[],t.diff),("array"!==o||f===!0||f.length)&&(n=!0));return n&&!t.test&&(t.last="object"===c&&t.deep||"array"===c?i.clone(r):r,t.fn.call(this,r,a,f),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,c),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,c)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t,e,n){function r(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function i(t,e){return t===e}function a(t,e,n){for(var r=t.length,a=e.length,n=n||i,o=[],s=0;r>=s;s++)o.push([s]);for(var u=1;a>=u;u++)o[0][u]=u;for(var s=1;r>=s;s++)for(var u=1;a>=u;u++)o[s][u]=n(t[s-1],e[u-1])?o[s-1][u-1]:Math.min(o[s-1][u]+1,o[s][u-1]+1);return o}function o(t,e,n,i){if(!n)return r(t,e);for(var o=a(e,t,i),s=e.length,u=s,c=t.length,h=c,f=[],l=o[u][h];u>0||h>0;)if(0!==u)if(0!==h){var p=o[u-1][h-1],d=o[u-1][h],v=o[u][h-1],m=Math.min(v,d,p);m===d?(f.unshift(2),u--,l=d):m===p?(p===l?f.unshift(0):(f.unshift(1),l=p),u--,h--):(f.unshift(3),h--,l=v)}else f.unshift(2),u--;else f.unshift(3),h--;var g=0,y=3,x=2,E=1,s=0;c=0;for(var _=[],N={index:null,add:0,removed:[]},u=0;u0?null===N.index&&(N.index=c):null!=N.index&&(_.push(N),N={index:null,add:0,removed:[]}),f[u]){case g:s++,c++;break;case y:N.add++,c++;break;case x:N.removed.push(e[s]),s++;break;case E:N.add++,N.removed.push(e[s]),s++,c++}return null!=N.index&&_.push(N),_}function s(t,e,n){if(n){var r=u.keys(t),i=u.keys(e);return o(r,i,n,function(n,r){return t[r]===e[n]})}for(var a in t)if(e[a]!==t[a])return!0;for(var s in e)if(e[s]!==t[s])return!0;return!1}var u=n(5);t.exports={diffArray:o,diffObject:s}},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/src/helper/diff.js b/src/helper/diff.js index c1b118a..9d9b37e 100644 --- a/src/helper/diff.js +++ b/src/helper/diff.js @@ -16,9 +16,13 @@ function simpleDiff(now, old){ function equals(a,b){ return a === b; } -function ld(array1, array2){ + +// array1 - old array +// array2 - new array +function ld(array1, array2, equalFn){ var n = array1.length; var m = array2.length; + var equalFn = equalFn || equals; var matrix = []; for(var i = 0; i <= n; i++){ matrix.push([i]); @@ -28,7 +32,7 @@ function ld(array1, array2){ } for(var i = 1; i <= n; i++){ for(var j = 1; j <= m; j++){ - if(equals(array1[i-1], array2[j-1])){ + if(equalFn(array1[i-1], array2[j-1])){ matrix[i][j] = matrix[i-1][j-1]; }else{ matrix[i][j] = Math.min( @@ -40,9 +44,11 @@ function ld(array1, array2){ } return matrix; } -function diffArray(arr2, arr1, diff) { +// arr2 - new array +// arr1 - old array +function diffArray(arr2, arr1, diff, diffFn) { if(!diff) return simpleDiff(arr2, arr1); - var matrix = ld(arr1, arr2) + var matrix = ld(arr1, arr2, diffFn) var n = arr1.length; var i = n; var m = arr2.length; @@ -156,8 +162,14 @@ function diffObject( now, last, diff ){ var nKeys = _.keys(now); var lKeys = _.keys(last); + /** + * [description] + * @param {[type]} a [description] + * @param {[type]} b){ return now[b] [description] + * @return {[type]} [description] + */ return diffArray(nKeys, lKeys, diff, function(a, b){ - return a === b; + return now[b] === last[a]; }); } diff --git a/src/walkers.js b/src/walkers.js index 3becb17..1a80db6 100644 --- a/src/walkers.js +++ b/src/walkers.js @@ -18,6 +18,7 @@ walkers.list = function(ast, options){ var self = this; var group = new Group([placeholder]); var indexName = ast.variable + '_index'; + var keyName = ast.variable + '_key'; var variable = ast.variable; var alternate = ast.alternate; var track = ast.track, keyOf, extraObj; @@ -28,6 +29,7 @@ walkers.list = function(ast, options){ keyOf = function( item, index ){ extraObj[ variable ] = item; extraObj[ indexName ] = index; + // @FIX keyName return track.get( self, extraObj ); } } @@ -38,13 +40,13 @@ walkers.list = function(ast, options){ if(removed) removed.destroy(true); } } - function addRange(index, end, newValue){ + + function addRange(index, end, newList, rawNewValue){ for(var o = index; o < end; o++){ //add // prototype inherit - var item = newValue[o]; + var item = newList[o]; var data = {}; - data[indexName] = o; - data[variable] = item; + updateTarget(data, o, item, rawNewValue); data = _.createObject(extra, data); var section = self.$compile(ast.body, { @@ -64,36 +66,33 @@ walkers.list = function(ast, options){ } } - function updateRange(start, end, newValue){ - for(var k = start; k < end; k++){ // no change - var sect = group.get( k + 1 ); - sect.data[ indexName ] = k; - sect.data[ variable ] = newValue[k]; - } - } + function updateTarget(target, index, item, rawNewValue){ - // update object type - function updateObject(newValue, oldValue, splices){ - // if type doesn't equal Object, we remove all of them directly - // if(oldType !== 'object'){ - // removeRange(0, group.children.length-1); - // } + target[ indexName ] = index; + if( rawNewValue ){ + target[ keyName ] = item; + target[ variable ] = rawNewValue[ item ]; + }else{ + target[ variable ] = item; + target[keyName] = null + } + } - var keys = Object.keys(newValue); - + function updateRange(start, end, newList, rawNewValue){ + for(var k = start; k < end; k++){ // no change + var sect = group.get( k + 1 ), item = newList[ k ]; + updateTarget(sect.data, k, item, rawNewValue); + } } - function updateLD(newValue, oldValue, splices){ - if(!oldValue) oldValue = []; - if(!newValue) newValue = []; - + function updateLD(newList, oldList, splices , rawNewValue ){ var cur = placeholder; - var m = 0, len = newValue.length; + var m = 0, len = newList.length; - if(!splices && (len !==0 || oldValue.length !==0) ){ - splices = diffArray(newValue, oldValue, true); + if(!splices && (len !==0 || oldList.length !==0) ){ + splices = diffArray(newList, oldList, true); } if(!splices || !splices.length) return; @@ -109,9 +108,9 @@ walkers.list = function(ast, options){ var minar = Math.min(rlen, add); var tIndex = 0; while(tIndex < minar){ - if( keyOf(newValue[index], index) !== keyOf( removed[0], index ) ){ + if( keyOf(newList[index], index) !== keyOf( removed[0], index ) ){ removeRange(index, 1) - addRange(index, index+1, newValue) + addRange(index, index+1, newList, rawNewValue) } removed.shift(); add--; @@ -121,10 +120,11 @@ walkers.list = function(ast, options){ rlen = removed.length; } // update - updateRange(m, index, newValue); + updateRange(m, index, newList, rawNewValue); + removeRange( index ,rlen) - addRange(index, index+add, newValue) + addRange(index, index+add, newList, rawNewValue) m = index + add - rlen; m = m < 0? 0 : m; @@ -134,41 +134,50 @@ walkers.list = function(ast, options){ for(var i = m; i < len; i++){ var pair = group.get(i + 1); pair.data[indexName] = i; + // @TODO fix keys } } } // if the track is constant test. - function updateSimple(newValue, oldValue){ + function updateSimple(newList, oldList, rawNewValue ){ - newValue = newValue || []; - oldValue = oldValue || []; - - var nlen = newValue.length || 0; - var olen = oldValue.length || 0; + var nlen = newList.length; + var olen = oldList.length; var mlen = Math.min(nlen, olen); - - updateRange(0, mlen, newValue) + updateRange(0, mlen, newList, rawNewValue) if(nlen < olen){ //need add removeRange(nlen, olen-nlen); }else if(nlen > olen){ - addRange(olen, nlen, newValue); + addRange(olen, nlen, newList, rawNewValue); } } function update(newValue, oldValue, splices){ - var nlen = newValue && newValue.length; - var olen = oldValue && oldValue.length; - if( !olen && nlen && group.get(1)){ + + var nType = _.typeOf( newValue ); + var oType = _.typeOf( oldValue ); + + var newList = getListFromValue( newValue, nType ); + var oldList = getListFromValue( oldValue, oType ); + + + var nlen = newList && newList.length; + var olen = oldList && oldList.length; + + // if previous list has , we need to remove the altnated section. + if( !olen && nlen && group.get(1) ){ var altGroup = group.children.pop(); if(altGroup.destroy) altGroup.destroy(true); } + if( nType === 'object' ) var rawNewValue = newValue; + if(track === true){ - updateSimple(newValue, oldValue, splices) + updateSimple( newList, oldList, rawNewValue ); }else{ - updateLD(newValue, oldValue, splices) + updateLD( newList, oldList, splices, rawNewValue ); } // @ {#list} {#else} @@ -185,9 +194,21 @@ walkers.list = function(ast, options){ } } } - this.$watch(ast.sequence, update, { init: true, diff: track !== true }); + + this.$watch(ast.sequence, update, { + init: true, + diff: track !== true , + deep: true + }); return group; } + + +function updateItem(){ + +} + + // {#include } or {#inc template} walkers.template = function(ast, options){ var content = ast.content, compiled; @@ -219,6 +240,12 @@ walkers.template = function(ast, options){ return group; }; +function getListFromValue(value, type){ + return type === 'object'? _.keys(value): ( + type === 'array'? value: [] + ) +} + // how to resolve this problem var ii = 0; diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index 10fe2d4..e8ebe30 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -837,7 +837,7 @@ /***/ function(module, exports, __webpack_require__) { var Regular = __webpack_require__(16); - var animate = __webpack_require__(19); + var animate = __webpack_require__(18); var dom = __webpack_require__(17); function destroy(component, container){ @@ -1677,7 +1677,7 @@ var expect = __webpack_require__(26); var Regular = __webpack_require__(16); - var combine = __webpack_require__(20); + var combine = __webpack_require__(19); function destroy(component, container){ component.destroy(); expect(container.innerHTML).to.equal(''); @@ -2715,12 +2715,33 @@ }) describe("List with Object", function(){ - it("items should list by Object.keys", function( done){ + + var obj = { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + var arr = [ + {age:11}, + {age:12}, + {age:13} + ] + + var ComplexList = Regular.extend({ + template: "
\ + {#list json as item}\ +
{item.age}:{item_key}:{item_index}
\ + {/list}\ +
" + }) + + + it("items should list by Object.keys", function( ){ var component = new Regular({ template: "
\ - {#list json as item by item_index}\ -
{item.age}:{item_key}
\ + {#list json as item by item_key}\ +
{item.age}:{item_key}:{item_index}
\ {/list}\
", data: { @@ -2741,35 +2762,207 @@ expect(divs.length).to.equal(3); divs.forEach(function(div, index){ - expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + keys[index]); + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + ':' + keys[index] + ':' + index); + }) + + delete json.xiaomin; + json.xiaoli = {age: 33} + + component.$update(); + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(2); + + expect(divs[0].innerHTML).to.equal('33:xiaoli:0') + + component.destroy(); + + + + }) + it("items should works under complex mode: item_index & item_key & item", function( ){ + + var component = new ComplexList({ + data: { + json: { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + } + }) + + // only make sure + var json = component.data.json; + var keys = _.keys(json); + + var divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + ':' + keys[index]+ ':' + index); }) + delete json.xiaomin; + json.xiaoli = {age: 33} + + component.$update(); + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(2); + + expect(divs[0].innerHTML).to.equal('33:xiaoli:0') + expect(divs[1].innerHTML).to.equal('13:xiaogang:1') + component.destroy(); }) it("items converted from Object to Array", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + + component.$update('json', arr) + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + '::' + index); + }) + + component.destroy(); }) it("items converted from Array to Object", function(){ + var component = new ComplexList({ + data: { json: arr } + }) + + var divs = nes.all('div', component.$refs.container ); + var keys = _.keys(obj); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + '::' + index); + }) + + + component.$update('json', obj ) + divs = nes.all('div', component.$refs.container ); + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + ':'+keys[index]+':' + index); + }) + + component.destroy(); }) it("items converted from null to Object", function(){ + var component = new ComplexList({ + data: { json: null } + }) + var divs = nes.all('div', component.$refs.container ); + var keys = _.keys(obj); + expect(divs.length).to.equal(0); + + component.$update('json', obj ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + component.destroy(); }) it("items converted from Object to null", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + var keys = _.keys(obj); + + component.$update('json', null ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + + component.destroy(); + }) it("items converted from Object to other dataType", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + var keys = _.keys(obj); + + component.$update('json', 100 ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + + component.destroy(); }) it("items converted from other dataType to Object", function(){ + var component = new ComplexList({ + data: { json: true } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + var keys = _.keys(obj); + + component.$update('json', obj ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + + component.destroy(); + }) + + it("items key should update if only value is changed", function(){ + + var raw = {a: {age: 1}, b:{age: 2}, c:{age:3}}; + var component = new ComplexList({ + data: { json: raw} + }) + + raw.b = raw.a; + delete raw.a; + component.$update(); + + expect(component.$refs.container) + + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(2); + var keys = _.keys(raw); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + raw[keys[index]].age + ':'+keys[index]+':' + index); + }) + + }) + }) }) + + + + + + + + + + + /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { @@ -4380,7 +4573,7 @@ var expect = __webpack_require__(26); var Regular = __webpack_require__(16); - var parse = __webpack_require__(21); + var parse = __webpack_require__(20); var Component = Regular.extend(); @@ -5507,10 +5700,12 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var _ = __webpack_require__(18); + var _ = __webpack_require__(21); var shim = __webpack_require__(22); var extend = __webpack_require__(23); - var diffArray = __webpack_require__(24).diffArray; + var diff = __webpack_require__(24) + var diffArray = diff.diffArray; + var diffObject = diff.diffObject; @@ -5643,6 +5838,59 @@ expect(diffArray([1,2], [1,2])).to.equal(false) }) + it('complex diffObject should work as expect when the values are deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:3}; + + expect( diffObject(obj, obj2, true) ).to.eql([]) + + }) + + it('complex diffObject should work as expect when the values aren"t deep Equal', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, b:2, c:4 }; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [ 'c' ] } ] ) + + }) + + it('complex diffObject"s equalitation should judged by value, but not the key ', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, c: 2}; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [] } ] ) + + }) + + it('complex diffObject should work as expect when the keys"s number aren"t equal', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, b:2}; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [ ] } ] ) + + }) + + it('simple diffObject should work as expect when the value are deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:3}; + + expect( diffObject(obj, obj2) ).to.equal(false) + + }) + + it('simple diffObject should work as expect when the value aren"t deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:4}; + + expect( diffObject(obj, obj2) ).to.equal(true) + + }) it('_.equals should works as expect', function(){ @@ -5923,7 +6171,7 @@ Regular.dom = __webpack_require__(17); } Regular.env = env; - Regular.util = __webpack_require__(18); + Regular.util = __webpack_require__(21); Regular.parse = function(str, options){ options = options || {}; @@ -5956,7 +6204,7 @@ var dom = module.exports; var env = __webpack_require__(27); - var _ = __webpack_require__(18); + var _ = __webpack_require__(21); var tNode = document.createElement('div') var addEvent, removeEvent; var noop = function(){} @@ -6338,833 +6586,833 @@ /* 18 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(22)(); - - + var _ = __webpack_require__(21); + var dom = __webpack_require__(17); + var animate = {}; + var env = __webpack_require__(27); - var _ = module.exports; - var entities = __webpack_require__(30); - var slice = [].slice; - var o2str = ({}).toString; - var win = typeof window !=='undefined'? window: global; + var + transitionEnd = 'transitionend', + animationEnd = 'animationend', + transitionProperty = 'transition', + animationProperty = 'animation'; - _.noop = function(){}; - _.uid = (function(){ - var _uid=0; - return function(){ - return _uid++; - } - })(); + if(!('ontransitionend' in window)){ + if('onwebkittransitionend' in window) { + + // Chrome/Saf (+ Mobile Saf)/Android + transitionEnd += ' webkitTransitionEnd'; + transitionProperty = 'webkitTransition' + } else if('onotransitionend' in dom.tNode || navigator.appName === 'Opera') { - _.extend = function( o1, o2, override ){ - // if(_.typeOf(override) === 'array'){ - // for(var i = 0, len = override.length; i < len; i++ ){ - // var key = override[i]; - // o1[key] = o2[key]; - // } - // }else{ - for(var i in o2){ - if( typeof o1[i] === "undefined" || override === true ){ - o1[i] = o2[i] - } + // Opera + transitionEnd += ' oTransitionEnd'; + transitionProperty = 'oTransition'; } - // } - return o1; } + if(!('onanimationend' in window)){ + if ('onwebkitanimationend' in window){ + // Chrome/Saf (+ Mobile Saf)/Android + animationEnd += ' webkitAnimationEnd'; + animationProperty = 'webkitAnimation'; - _.keys = function(obj){ - if(Object.keys) return Object.keys(obj); - var res = []; - for(var i in obj) if(obj.hasOwnProperty(i)){ - res.push(i); + }else if ('onoanimationend' in dom.tNode){ + // Opera + animationEnd += ' oAnimationEnd'; + animationProperty = 'oAnimation'; } - return res; } - _.varName = 'd'; - _.setName = 'p_'; - _.ctxName = 'c'; - _.extName = 'e'; - - _.rWord = /^[\$\w]+$/; - _.rSimpleAccessor = /^[\$\w]+(\.[\$\w]+)*$/; - - _.nextTick = typeof setImmediate === 'function'? - setImmediate.bind(win) : - function(callback) { - setTimeout(callback, 0) - } - - - - _.prefix = "var " + _.varName + "=" + _.ctxName + ".data;" + _.extName + "=" + _.extName + "||'';"; + /** + * inject node with animation + * @param {[type]} node [description] + * @param {[type]} refer [description] + * @param {[type]} direction [description] + * @return {[type]} [description] + */ + animate.inject = function( node, refer ,direction, callback ){ + callback = callback || _.noop; + if( Array.isArray(node) ){ + var fragment = dom.fragment(); + var count=0; + for(var i = 0,len = node.length;i < len; i++ ){ + fragment.appendChild(node[i]); + } + dom.inject(fragment, refer, direction); - _.slice = function(obj, start, end){ - var res = []; - for(var i = start || 0, len = end || obj.length; i < len; i++){ - var item = obj[i]; - res.push(item) + // if all nodes is done, we call the callback + var enterCallback = function (){ + count++; + if( count === len ) callback(); + } + if(len === count) callback(); + for( i = 0; i < len; i++ ){ + if(node[i].onenter){ + node[i].onenter(enterCallback); + }else{ + enterCallback(); + } + } + }else{ + dom.inject( node, refer, direction ); + if(node.onenter){ + node.onenter(callback) + }else{ + callback(); + } } - return res; } - _.typeOf = function (o) { - return o == null ? String(o) :o2str.call(o).slice(8, -1).toLowerCase(); + /** + * remove node with animation + * @param {[type]} node [description] + * @param {Function} callback [description] + * @return {[type]} [description] + */ + animate.remove = function(node, callback){ + if(!node) return; + var count = 0; + function loop(){ + count++; + if(count === len) callback && callback() + } + if(Array.isArray(node)){ + for(var i = 0, len = node.length; i < len ; i++){ + animate.remove(node[i], loop) + } + return node; + } + if(node.onleave){ + node.onleave(function(){ + removeDone(node, callback) + }) + }else{ + removeDone(node, callback) + } } + var removeDone = function (node, callback){ + dom.remove(node); + callback && callback(); + } - _.makePredicate = function makePredicate(words, prefix) { - if (typeof words === "string") { - words = words.split(" "); - } - var f = "", - cats = []; - out: for (var i = 0; i < words.length; ++i) { - for (var j = 0; j < cats.length; ++j){ - if (cats[j][0].length === words[i].length) { - cats[j].push(words[i]); - continue out; - } - } - cats.push([words[i]]); - } - function compareTo(arr) { - if (arr.length === 1) return f += "return str === '" + arr[0] + "';"; - f += "switch(str){"; - for (var i = 0; i < arr.length; ++i){ - f += "case '" + arr[i] + "':"; - } - f += "return true}return false;"; - } - - // When there are more than three length categories, an outer - // switch first dispatches on the lengths, to save on comparisons. - if (cats.length > 3) { - cats.sort(function(a, b) { - return b.length - a.length; - }); - f += "switch(str.length){"; - for (var i = 0; i < cats.length; ++i) { - var cat = cats[i]; - f += "case " + cat[0].length + ":"; - compareTo(cat); - } - f += "}"; - // Otherwise, simply generate a flat `switch` statement. - } else { - compareTo(words); - } - return new Function("str", f); - } + animate.startClassAnimate = function ( node, className, callback, mode ){ + var activeClassName, timeout, tid, onceAnim; + if( (!animationEnd && !transitionEnd) || env.isRunning ){ + return callback(); + } - _.trackErrorPos = (function (){ - // linebreak - var lb = /\r\n|[\n\r\u2028\u2029]/g; - var minRange = 20, maxRange = 20; - function findLine(lines, pos){ - var tmpLen = 0; - for(var i = 0,len = lines.length; i < len; i++){ - var lineLen = (lines[i] || "").length; + if(mode !== 4){ + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); - if(tmpLen + lineLen > pos) { - return {num: i, line: lines[i], start: pos - i - tmpLen , prev:lines[i-1], next: lines[i+1] }; + if(mode === 2) { + dom.delClass(node, activeClassName); } - // 1 is for the linebreak - tmpLen = tmpLen + lineLen ; - } - } - function formatLine(str, start, num, target){ - var len = str.length; - var min = start - minRange; - if(min < 0) min = 0; - var max = start + maxRange; - if(max > len) max = len; + if(mode !== 3){ // mode hold the class + dom.delClass(node, className); + } + dom.off(node, animationEnd, onceAnim) + dom.off(node, transitionEnd, onceAnim) - var remain = str.slice(min, max); - var prefix = "[" +(num+1) + "] " + (min > 0? ".." : "") - var postfix = max < len ? "..": ""; - var res = prefix + remain + postfix; - if(target) res += "\n" + new Array(start-min + prefix.length + 1).join(" ") + "^^^"; - return res; + callback(); + + }); + }else{ + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); + callback(); + }); } - return function(input, pos){ - if(pos > input.length-1) pos = input.length-1; - lb.lastIndex = 0; - var lines = input.split(lb); - var line = findLine(lines,pos); - var start = line.start, num = line.num; + if(mode === 2){ // auto removed + dom.addClass( node, className ); - return (line.prev? formatLine(line.prev, start, num-1 ) + '\n': '' ) + - formatLine(line.line, start, num, true) + '\n' + - (line.next? formatLine(line.next, start, num+1 ) + '\n': '' ); + activeClassName = _.map(className.split(/\s+/), function(name){ + return name + '-active'; + }).join(" "); - } - })(); + dom.nextReflow(function(){ + dom.addClass( node, activeClassName ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); + }else if(mode===4){ + dom.nextReflow(function(){ + dom.delClass( node, className ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); - var ignoredRef = /\((\?\!|\?\:|\?\=)/g; - _.findSubCapture = function (regStr) { - var left = 0, - right = 0, - len = regStr.length, - ignored = regStr.match(ignoredRef); // ignored uncapture - if(ignored) ignored = ignored.length - else ignored = 0; - for (; len--;) { - var letter = regStr.charAt(len); - if (len === 0 || regStr.charAt(len - 1) !== "\\" ) { - if (letter === "(") left++; - if (letter === ")") right++; - } + }else{ + dom.nextReflow(function(){ + dom.addClass( node, className ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); } - if (left !== right) throw "RegExp: "+ regStr + "'s bracket is not marched"; - else return left - ignored; - }; - _.escapeRegExp = function( str){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License - return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ - return '\\' + match; + + dom.on( node, animationEnd, onceAnim ) + dom.on( node, transitionEnd, onceAnim ) + return onceAnim; + } + + + animate.startStyleAnimate = function(node, styles, callback){ + var timeout, onceAnim, tid; + + dom.nextReflow(function(){ + dom.css( node, styles ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); }); - }; - var rEntity = new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|(" + _.keys(entities).join('|') + '));', 'gi'); + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); - _.convertEntity = function(chr){ + dom.off(node, animationEnd, onceAnim) + dom.off(node, transitionEnd, onceAnim) - return ("" + chr).replace(rEntity, function(all, hex, dec, capture){ - var charCode; - if( dec ) charCode = parseInt( dec.slice(1), 10 ); - else if( hex ) charCode = parseInt( hex.slice(2), 16 ); - else charCode = entities[capture] + callback(); - return String.fromCharCode( charCode ) }); + dom.on( node, animationEnd, onceAnim ) + dom.on( node, transitionEnd, onceAnim ) + + return onceAnim; } - // simple get accessor + /** + * get maxtimeout + * @param {Node} node + * @return {[type]} [description] + */ + function getMaxTimeout(node){ + var timeout = 0, + tDuration = 0, + tDelay = 0, + aDuration = 0, + aDelay = 0, + ratio = 5 / 3, + styles ; - _.createObject = function(o, props){ - function Foo() {} - Foo.prototype = o; - var res = new Foo; - if(props) _.extend(res, props); - return res; - } + if(window.getComputedStyle){ - _.createProto = function(fn, o){ - function Foo() { this.constructor = fn;} - Foo.prototype = o; - return (fn.prototype = new Foo()); + styles = window.getComputedStyle(node), + tDuration = getMaxTime( styles[transitionProperty + 'Duration']) || tDuration; + tDelay = getMaxTime( styles[transitionProperty + 'Delay']) || tDelay; + aDuration = getMaxTime( styles[animationProperty + 'Duration']) || aDuration; + aDelay = getMaxTime( styles[animationProperty + 'Delay']) || aDelay; + timeout = Math.max( tDuration+tDelay, aDuration + aDelay ); + + } + return timeout * 1000 * ratio; } + function getMaxTime(str){ + var maxTimeout = 0, time; - /** - clone - */ - _.clone = function clone(obj){ - var type = _.typeOf(obj); - if(type === 'array'){ - var cloned = []; - for(var i=0,len = obj.length; i< len;i++){ - cloned[i] = obj[i] - } - return cloned; - } - if(type === 'object'){ - var cloned = {}; - for(var i in obj) if(obj.hasOwnProperty(i)){ - cloned[i] = obj[i]; - } - return cloned; - } - return obj; - } + if(!str) return 0; - _.equals = function(now, old){ - var type = typeof now; - if(type === 'number' && typeof old === 'number'&& isNaN(now) && isNaN(old)) return true - return now === old; - } + str.split(",").forEach(function(str){ - var dash = /-([a-z])/g; - _.camelCase = function(str){ - return str.replace(dash, function(all, capture){ - return capture.toUpperCase(); - }) + time = parseFloat(str); + if( time > maxTimeout ) maxTimeout = time; + + }); + + return maxTimeout; } + module.exports = animate; +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { - _.throttle = function throttle(func, wait){ - var wait = wait || 100; - var context, args, result; - var timeout = null; - var previous = 0; - var later = function() { - previous = +new Date; - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function() { - var now = + new Date; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; + // some nested operation in ast + // -------------------------------- - // hogan escape - // ============== - _.escape = (function(){ - var rAmp = /&/g, - rLt = //g, - rApos = /\'/g, - rQuot = /\"/g, - hChars = /[&<>\"\']/; + var dom = __webpack_require__(17); + var animate = __webpack_require__(18); - return function(str) { - return hChars.test(str) ? - str - .replace(rAmp, '&') - .replace(rLt, '<') - .replace(rGt, '>') - .replace(rApos, ''') - .replace(rQuot, '"') : - str; - } - })(); + var combine = module.exports = { - _.cache = function(max){ - max = max || 1000; - var keys = [], - cache = {}; - return { - set: function(key, value) { - if (keys.length > this.max) { - cache[keys.shift()] = undefined; + // get the initial dom in object + node: function(item){ + var children,node, nodes; + if(!item) return; + if(item.element) return item.element; + if(typeof item.node === "function") return item.node(); + if(typeof item.nodeType === "number") return item; + if(item.group) return combine.node(item.group) + if(children = item.children){ + if(children.length === 1){ + return combine.node(children[0]); } - // - if(cache[key] === undefined){ - keys.push(key); + nodes = []; + for(var i = 0, len = children.length; i < len; i++ ){ + node = combine.node(children[i]); + if(Array.isArray(node)){ + nodes.push.apply(nodes, node) + }else if(node) { + nodes.push(node) + } } - cache[key] = value; - return value; - }, - get: function(key) { - if (key === undefined) return cache; - return cache[key]; - }, - max: max, - len:function(){ - return keys.length; + return nodes; } - }; - } - - // // setup the raw Expression - // _.touchExpression = function(expr){ - // if(expr.type === 'expression'){ - // } - // return expr; - // } - - - // handle the same logic on component's `on-*` and element's `on-*` - // return the fire object - _.handleEvent = function(value, type ){ - var self = this, evaluate; - if(value.type === 'expression'){ // if is expression, go evaluated way - evaluate = value.get; - } - if(evaluate){ - return function fire(obj){ - self.$update(function(){ - var data = this.data; - data.$event = obj; - var res = evaluate(self); - if(res === false && obj && obj.preventDefault) obj.preventDefault(); - data.$event = undefined; - }) - + }, + // @TODO remove _gragContainer + inject: function(node, pos ){ + var group = this; + var fragment = combine.node(group.group || group); + if(node === false) { + animate.remove(fragment) + return group; + }else{ + if(!fragment) return group; + if(typeof node === 'string') node = dom.find(node); + if(!node) throw Error('injected node is not found'); + // use animate to animate firstchildren + animate.inject(fragment, node, pos); } - }else{ - return function fire(){ - var args = slice.call(arguments) - args.unshift(value); - self.$update(function(){ - self.$emit.apply(self, args); - }) + // if it is a component + if(group.$emit) { + var preParent = group.parentNode; + var newParent = (pos ==='after' || pos === 'before')? node.parentNode : node; + group.parentNode = newParent; + group.$emit("$inject", node, pos, preParent); } - } - } + return group; + }, - // only call once - _.once = function(fn){ - var time = 0; - return function(){ - if( time++ === 0) fn.apply(this, arguments); - } - } + // get the last dom in object(for insertion operation) + last: function(item){ + var children = item.children; - _.fixObjStr = function(str){ - if(str.trim().indexOf('{') !== 0){ - return '{' + str + '}'; - } - return str; - } + if(typeof item.last === "function") return item.last(); + if(typeof item.nodeType === "number") return item; + + if(children && children.length) return combine.last(children[children.length - 1]); + if(item.group) return combine.last(item.group); + }, - _.map= function(array, callback){ - var res = []; - for (var i = 0, len = array.length; i < len; i++) { - res.push(callback(array[i], i)); + destroy: function(item, first){ + if(!item) return; + if(Array.isArray(item)){ + for(var i = 0, len = item.length; i < len; i++ ){ + combine.destroy(item[i], first); + } + } + var children = item.children; + if(typeof item.destroy === "function") return item.destroy(first); + if(typeof item.nodeType === "number" && first) dom.remove(item); + if(children && children.length){ + combine.destroy(children, true); + item.children = null; + } } - return res; - } - function log(msg, type){ - if(typeof console !== "undefined") console[type || "log"](msg); } - _.log = log; + // @TODO: need move to dom.js + dom.element = function( component, all ){ + if(!component) return !all? null: []; + var nodes = combine.node( component ); + if( nodes.nodeType === 1 ) return all? [nodes]: nodes; + var elements = []; + for(var i = 0; i 3) { + cats.sort(function(a, b) { + return b.length - a.length; + }); + f += "switch(str.length){"; + for (var i = 0; i < cats.length; ++i) { + var cat = cats[i]; + f += "case " + cat[0].length + ":"; + compareTo(cat); + } + f += "}"; - }); - }else{ - onceAnim = _.once(function onAnimateEnd(){ - if(tid) clearTimeout(tid); - callback(); - }); - } - if(mode === 2){ // auto removed - dom.addClass( node, className ); + // Otherwise, simply generate a flat `switch` statement. + } else { + compareTo(words); + } + return new Function("str", f); + } - activeClassName = _.map(className.split(/\s+/), function(name){ - return name + '-active'; - }).join(" "); - dom.nextReflow(function(){ - dom.addClass( node, activeClassName ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); + _.trackErrorPos = (function (){ + // linebreak + var lb = /\r\n|[\n\r\u2028\u2029]/g; + var minRange = 20, maxRange = 20; + function findLine(lines, pos){ + var tmpLen = 0; + for(var i = 0,len = lines.length; i < len; i++){ + var lineLen = (lines[i] || "").length; - }else if(mode===4){ - dom.nextReflow(function(){ - dom.delClass( node, className ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); + if(tmpLen + lineLen > pos) { + return {num: i, line: lines[i], start: pos - i - tmpLen , prev:lines[i-1], next: lines[i+1] }; + } + // 1 is for the linebreak + tmpLen = tmpLen + lineLen ; + } + } + function formatLine(str, start, num, target){ + var len = str.length; + var min = start - minRange; + if(min < 0) min = 0; + var max = start + maxRange; + if(max > len) max = len; - }else{ - dom.nextReflow(function(){ - dom.addClass( node, className ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); + var remain = str.slice(min, max); + var prefix = "[" +(num+1) + "] " + (min > 0? ".." : "") + var postfix = max < len ? "..": ""; + var res = prefix + remain + postfix; + if(target) res += "\n" + new Array(start-min + prefix.length + 1).join(" ") + "^^^"; + return res; } + return function(input, pos){ + if(pos > input.length-1) pos = input.length-1; + lb.lastIndex = 0; + var lines = input.split(lb); + var line = findLine(lines,pos); + var start = line.start, num = line.num; + return (line.prev? formatLine(line.prev, start, num-1 ) + '\n': '' ) + + formatLine(line.line, start, num, true) + '\n' + + (line.next? formatLine(line.next, start, num+1 ) + '\n': '' ); + } + })(); - dom.on( node, animationEnd, onceAnim ) - dom.on( node, transitionEnd, onceAnim ) - return onceAnim; - } + var ignoredRef = /\((\?\!|\?\:|\?\=)/g; + _.findSubCapture = function (regStr) { + var left = 0, + right = 0, + len = regStr.length, + ignored = regStr.match(ignoredRef); // ignored uncapture + if(ignored) ignored = ignored.length + else ignored = 0; + for (; len--;) { + var letter = regStr.charAt(len); + if (len === 0 || regStr.charAt(len - 1) !== "\\" ) { + if (letter === "(") left++; + if (letter === ")") right++; + } + } + if (left !== right) throw "RegExp: "+ regStr + "'s bracket is not marched"; + else return left - ignored; + }; - animate.startStyleAnimate = function(node, styles, callback){ - var timeout, onceAnim, tid; - dom.nextReflow(function(){ - dom.css( node, styles ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); + _.escapeRegExp = function( str){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License + return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ + return '\\' + match; }); + }; - onceAnim = _.once(function onAnimateEnd(){ - if(tid) clearTimeout(tid); + var rEntity = new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|(" + _.keys(entities).join('|') + '));', 'gi'); - dom.off(node, animationEnd, onceAnim) - dom.off(node, transitionEnd, onceAnim) + _.convertEntity = function(chr){ - callback(); + return ("" + chr).replace(rEntity, function(all, hex, dec, capture){ + var charCode; + if( dec ) charCode = parseInt( dec.slice(1), 10 ); + else if( hex ) charCode = parseInt( hex.slice(2), 16 ); + else charCode = entities[capture] + return String.fromCharCode( charCode ) }); - dom.on( node, animationEnd, onceAnim ) - dom.on( node, transitionEnd, onceAnim ) - - return onceAnim; } - /** - * get maxtimeout - * @param {Node} node - * @return {[type]} [description] - */ - function getMaxTimeout(node){ - var timeout = 0, - tDuration = 0, - tDelay = 0, - aDuration = 0, - aDelay = 0, - ratio = 5 / 3, - styles ; - - if(window.getComputedStyle){ - - styles = window.getComputedStyle(node), - tDuration = getMaxTime( styles[transitionProperty + 'Duration']) || tDuration; - tDelay = getMaxTime( styles[transitionProperty + 'Delay']) || tDelay; - aDuration = getMaxTime( styles[animationProperty + 'Duration']) || aDuration; - aDelay = getMaxTime( styles[animationProperty + 'Delay']) || aDelay; - timeout = Math.max( tDuration+tDelay, aDuration + aDelay ); + // simple get accessor - } - return timeout * 1000 * ratio; + _.createObject = function(o, props){ + function Foo() {} + Foo.prototype = o; + var res = new Foo; + if(props) _.extend(res, props); + return res; } - function getMaxTime(str){ - - var maxTimeout = 0, time; + _.createProto = function(fn, o){ + function Foo() { this.constructor = fn;} + Foo.prototype = o; + return (fn.prototype = new Foo()); + } - if(!str) return 0; - str.split(",").forEach(function(str){ - time = parseFloat(str); - if( time > maxTimeout ) maxTimeout = time; + /** + clone + */ + _.clone = function clone(obj){ + var type = _.typeOf(obj); + if(type === 'array'){ + var cloned = []; + for(var i=0,len = obj.length; i< len;i++){ + cloned[i] = obj[i] + } + return cloned; + } + if(type === 'object'){ + var cloned = {}; + for(var i in obj) if(obj.hasOwnProperty(i)){ + cloned[i] = obj[i]; + } + return cloned; + } + return obj; + } - }); + _.equals = function(now, old){ + var type = typeof now; + if(type === 'number' && typeof old === 'number'&& isNaN(now) && isNaN(old)) return true + return now === old; + } - return maxTimeout; + var dash = /-([a-z])/g; + _.camelCase = function(str){ + return str.replace(dash, function(all, capture){ + return capture.toUpperCase(); + }) } - module.exports = animate; -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - // some nested operation in ast - // -------------------------------- + _.throttle = function throttle(func, wait){ + var wait = wait || 100; + var context, args, result; + var timeout = null; + var previous = 0; + var later = function() { + previous = +new Date; + timeout = null; + result = func.apply(context, args); + context = args = null; + }; + return function() { + var now = + new Date; + var remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0 || remaining > wait) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + context = args = null; + } else if (!timeout) { + timeout = setTimeout(later, remaining); + } + return result; + }; + }; - var dom = __webpack_require__(17); - var animate = __webpack_require__(19); + // hogan escape + // ============== + _.escape = (function(){ + var rAmp = /&/g, + rLt = //g, + rApos = /\'/g, + rQuot = /\"/g, + hChars = /[&<>\"\']/; - var combine = module.exports = { + return function(str) { + return hChars.test(str) ? + str + .replace(rAmp, '&') + .replace(rLt, '<') + .replace(rGt, '>') + .replace(rApos, ''') + .replace(rQuot, '"') : + str; + } + })(); - // get the initial dom in object - node: function(item){ - var children,node, nodes; - if(!item) return; - if(item.element) return item.element; - if(typeof item.node === "function") return item.node(); - if(typeof item.nodeType === "number") return item; - if(item.group) return combine.node(item.group) - if(children = item.children){ - if(children.length === 1){ - return combine.node(children[0]); + _.cache = function(max){ + max = max || 1000; + var keys = [], + cache = {}; + return { + set: function(key, value) { + if (keys.length > this.max) { + cache[keys.shift()] = undefined; } - nodes = []; - for(var i = 0, len = children.length; i < len; i++ ){ - node = combine.node(children[i]); - if(Array.isArray(node)){ - nodes.push.apply(nodes, node) - }else if(node) { - nodes.push(node) - } + // + if(cache[key] === undefined){ + keys.push(key); } - return nodes; - } - }, - // @TODO remove _gragContainer - inject: function(node, pos ){ - var group = this; - var fragment = combine.node(group.group || group); - if(node === false) { - animate.remove(fragment) - return group; - }else{ - if(!fragment) return group; - if(typeof node === 'string') node = dom.find(node); - if(!node) throw Error('injected node is not found'); - // use animate to animate firstchildren - animate.inject(fragment, node, pos); - } - // if it is a component - if(group.$emit) { - var preParent = group.parentNode; - var newParent = (pos ==='after' || pos === 'before')? node.parentNode : node; - group.parentNode = newParent; - group.$emit("$inject", node, pos, preParent); + cache[key] = value; + return value; + }, + get: function(key) { + if (key === undefined) return cache; + return cache[key]; + }, + max: max, + len:function(){ + return keys.length; } - return group; - }, - - // get the last dom in object(for insertion operation) - last: function(item){ - var children = item.children; + }; + } - if(typeof item.last === "function") return item.last(); - if(typeof item.nodeType === "number") return item; + // // setup the raw Expression + // _.touchExpression = function(expr){ + // if(expr.type === 'expression'){ + // } + // return expr; + // } - if(children && children.length) return combine.last(children[children.length - 1]); - if(item.group) return combine.last(item.group); - }, + // handle the same logic on component's `on-*` and element's `on-*` + // return the fire object + _.handleEvent = function(value, type ){ + var self = this, evaluate; + if(value.type === 'expression'){ // if is expression, go evaluated way + evaluate = value.get; + } + if(evaluate){ + return function fire(obj){ + self.$update(function(){ + var data = this.data; + data.$event = obj; + var res = evaluate(self); + if(res === false && obj && obj.preventDefault) obj.preventDefault(); + data.$event = undefined; + }) - destroy: function(item, first){ - if(!item) return; - if(Array.isArray(item)){ - for(var i = 0, len = item.length; i < len; i++ ){ - combine.destroy(item[i], first); - } } - var children = item.children; - if(typeof item.destroy === "function") return item.destroy(first); - if(typeof item.nodeType === "number" && first) dom.remove(item); - if(children && children.length){ - combine.destroy(children, true); - item.children = null; + }else{ + return function fire(){ + var args = slice.call(arguments) + args.unshift(value); + self.$update(function(){ + self.$emit.apply(self, args); + }) } } + } + + // only call once + _.once = function(fn){ + var time = 0; + return function(){ + if( time++ === 0) fn.apply(this, arguments); + } + } + _.fixObjStr = function(str){ + if(str.trim().indexOf('{') !== 0){ + return '{' + str + '}'; + } + return str; } - // @TODO: need move to dom.js - dom.element = function( component, all ){ - if(!component) return !all? null: []; - var nodes = combine.node( component ); - if( nodes.nodeType === 1 ) return all? [nodes]: nodes; - var elements = []; - for(var i = 0; i olen){ - addRange(olen, nlen, newValue); + addRange(olen, nlen, newList, rawNewValue); } } function update(newValue, oldValue, splices){ - var nlen = newValue && newValue.length; - var olen = oldValue && oldValue.length; - if( !olen && nlen && group.get(1)){ + + var nType = _.typeOf( newValue ); + var oType = _.typeOf( oldValue ); + + var newList = getListFromValue( newValue, nType ); + var oldList = getListFromValue( oldValue, oType ); + + + var nlen = newList && newList.length; + var olen = oldList && oldList.length; + + // if previous list has , we need to remove the altnated section. + if( !olen && nlen && group.get(1) ){ var altGroup = group.children.pop(); if(altGroup.destroy) altGroup.destroy(true); } + if( nType === 'object' ) var rawNewValue = newValue; + if(track === true){ - updateSimple(newValue, oldValue, splices) + updateSimple( newList, oldList, rawNewValue ); }else{ - updateLD(newValue, oldValue, splices) + updateLD( newList, oldList, splices, rawNewValue ); } // @ {#list} {#else} @@ -11467,9 +11736,21 @@ } } } - this.$watch(ast.sequence, update, { init: true, diff: track !== true }); + + this.$watch(ast.sequence, update, { + init: true, + diff: track !== true , + deep: true + }); return group; } + + + function updateItem(){ + + } + + // {#include } or {#inc template} walkers.template = function(ast, options){ var content = ast.content, compiled; @@ -11501,6 +11782,12 @@ return group; }; + function getListFromValue(value, type){ + return type === 'object'? _.keys(value): ( + type === 'array'? value: [] + ) + } + // how to resolve this problem var ii = 0; @@ -11857,8 +12144,8 @@ /* 37 */ /***/ function(module, exports, __webpack_require__) { - var _ = __webpack_require__(18); - var combine = __webpack_require__(20) + var _ = __webpack_require__(21); + var combine = __webpack_require__(19) function Group(list){ this.children = list || []; @@ -11891,8 +12178,8 @@ /* 38 */ /***/ function(module, exports, __webpack_require__) { - var _ = __webpack_require__(18); - var parseExpression = __webpack_require__(21).expression; + var _ = __webpack_require__(21); + var parseExpression = __webpack_require__(20).expression; var diff = __webpack_require__(24); var diffArray = diff.diffArray; var diffObject = diff.diffObject; @@ -12230,7 +12517,7 @@ * event directive bundle * */ - var _ = __webpack_require__(18); + var _ = __webpack_require__(21); var dom = __webpack_require__(17); var Regular = __webpack_require__(29); @@ -12311,7 +12598,7 @@ /***/ function(module, exports, __webpack_require__) { // Regular - var _ = __webpack_require__(18); + var _ = __webpack_require__(21); var dom = __webpack_require__(17); var Regular = __webpack_require__(29); @@ -12542,6 +12829,22 @@ /***/ }, /* 44 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } + + +/***/ }, +/* 45 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {/*! @@ -13597,23 +13900,7 @@ } } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(44).Buffer)) - -/***/ }, -/* 45 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } - + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(45).Buffer)) /***/ }, /* 46 */ diff --git a/test/spec/browser-list.js b/test/spec/browser-list.js index b2834a4..b735954 100644 --- a/test/spec/browser-list.js +++ b/test/spec/browser-list.js @@ -644,12 +644,33 @@ it("list with else should also works under track mode", function(){ }) describe("List with Object", function(){ - it("items should list by Object.keys", function( done){ + + var obj = { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + var arr = [ + {age:11}, + {age:12}, + {age:13} + ] + + var ComplexList = Regular.extend({ + template: "
\ + {#list json as item}\ +
{item.age}:{item_key}:{item_index}
\ + {/list}\ +
" + }) + + + it("items should list by Object.keys", function( ){ var component = new Regular({ template: "
\ - {#list json as item by item_index}\ -
{item.age}:{item_key}
\ + {#list json as item by item_key}\ +
{item.age}:{item_key}:{item_index}
\ {/list}\
", data: { @@ -670,31 +691,202 @@ it("list with else should also works under track mode", function(){ expect(divs.length).to.equal(3); divs.forEach(function(div, index){ - expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + keys[index]); + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + ':' + keys[index] + ':' + index); + }) + + delete json.xiaomin; + json.xiaoli = {age: 33} + + component.$update(); + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(2); + + expect(divs[0].innerHTML).to.equal('33:xiaoli:0') + + component.destroy(); + + + + }) + it("items should works under complex mode: item_index & item_key & item", function( ){ + + var component = new ComplexList({ + data: { + json: { + "xiaomin": {age:11}, + "xiaoli": {age:12}, + "xiaogang": {age:13} + } + } + }) + + // only make sure + var json = component.data.json; + var keys = _.keys(json); + + var divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + json[ keys[index] ].age + ':' + keys[index]+ ':' + index); }) + delete json.xiaomin; + json.xiaoli = {age: 33} + + component.$update(); + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(2); + + expect(divs[0].innerHTML).to.equal('33:xiaoli:0') + expect(divs[1].innerHTML).to.equal('13:xiaogang:1') + component.destroy(); }) it("items converted from Object to Array", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + + component.$update('json', arr) + + divs = nes.all('div', component.$refs.container ); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + '::' + index); + }) + + component.destroy(); }) it("items converted from Array to Object", function(){ + var component = new ComplexList({ + data: { json: arr } + }) + + var divs = nes.all('div', component.$refs.container ); + var keys = _.keys(obj); + + expect(divs.length).to.equal(3); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + '::' + index); + }) + + + component.$update('json', obj ) + divs = nes.all('div', component.$refs.container ); + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + arr[index].age + ':'+keys[index]+':' + index); + }) + + component.destroy(); }) it("items converted from null to Object", function(){ + var component = new ComplexList({ + data: { json: null } + }) + var divs = nes.all('div', component.$refs.container ); + var keys = _.keys(obj); + expect(divs.length).to.equal(0); + + component.$update('json', obj ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + component.destroy(); }) it("items converted from Object to null", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + var keys = _.keys(obj); + + component.$update('json', null ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + + component.destroy(); + }) it("items converted from Object to other dataType", function(){ + var component = new ComplexList({ + data: { json: obj } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + var keys = _.keys(obj); + + component.$update('json', 100 ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + + component.destroy(); }) it("items converted from other dataType to Object", function(){ + var component = new ComplexList({ + data: { json: true } + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(0); + var keys = _.keys(obj); + + component.$update('json', obj ) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + + component.destroy(); }) + + it("items key should update if only value is changed", function(){ + + var raw = {a: {age: 1}, b:{age: 2}, c:{age:3}}; + var component = new ComplexList({ + data: { json: raw} + }) + + raw.b = raw.a; + delete raw.a; + component.$update(); + + expect(component.$refs.container) + + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(2); + var keys = _.keys(raw); + + divs.forEach(function(div, index){ + expect(div.innerHTML).to.equal('' + raw[keys[index]].age + ':'+keys[index]+':' + index); + }) + + + }) + }) -}) \ No newline at end of file +}) + + + + + + + + + + diff --git a/test/spec/test-util.js b/test/spec/test-util.js index a605e1c..b113ccf 100644 --- a/test/spec/test-util.js +++ b/test/spec/test-util.js @@ -2,7 +2,9 @@ var expect = require('expect.js'); var _ = require("../../src/util.js"); var shim = require("../../src/helper/shim.js"); var extend = require("../../src/helper/extend.js"); -var diffArray = require("../../src/helper/diff.js").diffArray; +var diff = require("../../src/helper/diff.js") +var diffArray = diff.diffArray; +var diffObject = diff.diffObject; @@ -135,6 +137,59 @@ describe("Regular.util", function(){ expect(diffArray([1,2], [1,2])).to.equal(false) }) + it('complex diffObject should work as expect when the values are deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:3}; + + expect( diffObject(obj, obj2, true) ).to.eql([]) + + }) + + it('complex diffObject should work as expect when the values aren"t deep Equal', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, b:2, c:4 }; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [ 'c' ] } ] ) + + }) + + it('complex diffObject"s equalitation should judged by value, but not the key ', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, c: 2}; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [] } ] ) + + }) + + it('complex diffObject should work as expect when the keys"s number aren"t equal', function(){ + + var obj = { a: 1, b:2, c:3 }; + var obj2 = { a: 1, b:2}; + + expect( diffObject(obj, obj2, true) ).to.eql([ { index: 2, add: 1, removed: [ ] } ] ) + + }) + + it('simple diffObject should work as expect when the value are deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:3}; + + expect( diffObject(obj, obj2) ).to.equal(false) + + }) + + it('simple diffObject should work as expect when the value aren"t deep Equal', function(){ + + var obj = {a: 1, b:2, c:3}; + var obj2 = {a: 1, b:2, c:4}; + + expect( diffObject(obj, obj2) ).to.equal(true) + + }) it('_.equals should works as expect', function(){ From 137f15497db97da454792bccee84c3e005f3000d Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Tue, 8 Dec 2015 11:24:37 +0800 Subject: [PATCH 8/8] fix #62 --- .gitignore | 2 +- dist/regular.js | 4 +- dist/regular.min.js | 2 +- gulpfile.js | 2 +- src/walkers.js | 4 +- test/runner/dom.bundle.js | 1516 +++++++++++++++++++------------------ test/spec/browser-list.js | 24 + 7 files changed, 804 insertions(+), 750 deletions(-) diff --git a/.gitignore b/.gitignore index 08b9b2b..cd373a4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ example npm-debug.log */tmp/* test/tmp/* -test/runner/*.js +test/runner/dom* test/coverage/* coverage* out/* diff --git a/dist/regular.js b/dist/regular.js index 76535b1..c44be55 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -2110,6 +2110,8 @@ return /******/ (function(modules) { // webpackBootstrap var newList = getListFromValue( newValue, nType ); var oldList = getListFromValue( oldValue, oType ); + var rawNewValue; + var nlen = newList && newList.length; var olen = oldList && oldList.length; @@ -2120,7 +2122,7 @@ return /******/ (function(modules) { // webpackBootstrap if(altGroup.destroy) altGroup.destroy(true); } - if( nType === 'object' ) var rawNewValue = newValue; + if( nType === 'object' ) rawNewValue = newValue; if(track === true){ updateSimple( newList, oldList, rawNewValue ); diff --git a/dist/regular.min.js b/dist/regular.min.js index 58948d4..bcba847 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data);var u=this._body;this._body=null,u&&u.ast&&u.ast.length&&(this.$body=s.getCompileFn(u.ast,u.ctx,{outer:this,namespace:e.namespace,extra:e.extra,record:!0})),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e){return"object"===e?h.keys(t):"array"===e?t:[]}function i(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var a=n(25).diffArray,o=n(14),s=n(21),u=(n(26),n(10)),c=n(4),h=n(5),f=t.exports={};f.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=N.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function i(n,r,i,a){for(var u=n;r>u;u++){var f=i[u],l={};c(l,u,f,a),l=h.createObject(E,l);var p=_.$compile(t.body,{extra:l,namespace:x,record:!0,outer:e.outer});p.data=l;var d=o.last(N.get(u));d.parentNode&&s.inject(o.node(p),d,"after"),N.children.splice(u+1,0,p)}}function c(t,e,n,r){t[T]=e,r?(t[w]=n,t[b]=r[n]):(t[b]=n,t[w]=null)}function l(t,e,n,r){for(var i=t;e>i;i++){var a=N.get(i+1),o=n[i];c(a.data,i,o,r)}}function p(t,e,r,o){var s=0,u=t.length;if(r||0===u&&0===e.length||(r=a(t,e,!0)),r&&r.length){for(var c=0;cy;)m(t[f],f)!==m(p[0],f)&&(n(f,1),i(f,f+1,t,o)),p.shift(),d--,f++,y++;v=p.length}l(s,f,t,o),n(f,v),i(f,f+d,t,o),s=f+d-v,s=0>s?0:s}if(u>s)for(var c=s;u>c;c++){var x=N.get(c+1);x.data[T]=c}}}function d(t,e,r){var a=t.length,o=e.length,s=Math.min(a,o);l(0,s,t,r),o>a?n(a,o-a):a>o&&i(o,a,t,r)}function v(t,n,i){var a=h.typeOf(t),u=h.typeOf(n),c=r(t,a),f=r(n,u),l=c&&c.length,v=f&&f.length;if(!v&&l&&N.get(1)){var m=N.children.pop();m.destroy&&m.destroy(!0)}if("object"===a)var g=t;if(A===!0?d(c,f,g):p(c,f,i,g),!l&&$&&$.length){var T=_.$compile($,{extra:E,record:!0,outer:e.outer,namespace:x});N.children.push(T),y.parentNode&&s.inject(o.node(T),y,"after")}}var m,g,y=(f.Regular,document.createComment("Regular list")),x=e.namespace,E=e.extra,_=this,N=new u([y]),T=t.variable+"_index",w=t.variable+"_key",b=t.variable,$=t.alternate,A=t.track;return A&&A!==!0&&(A=this._touchExpr(A),g=h.createObject(E),m=function(t,e){return g[b]=t,g[T]=e,A.get(_,g)}),this.$watch(t.sequence,v,{init:!0,diff:A!==!0,deep:!0}),N},f.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,s=new u([i]);if(r){var c=this;this.$watch(r,function(t){var r=s.get(1),u=typeof t;r&&(r.destroy(!0),s.children.pop()),t&&(s.push(n="function"===u?t():c.$compile("object"!==u?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return s};var l=0;f["if"]=function(t,e){var n,r,i=this,a=e.extra;if(e&&e.element){var c=function(s){s?(r&&o.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:a}))):(n&&o.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:a})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?o.destroy(n):r&&o.destroy(r)}}}var n,r,h=document.createComment("Regular if"+l++),f=new u;f.push(h);var p=null,d=e.namespace,c=function(u){var c=!!u;c!==p&&(p=c,f.children[1]&&(f.children[1].destroy(!0),f.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(n),h.parentNode&&s.inject(o.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(r),h.parentNode&&s.inject(o.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),f},f.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){c.text(e,""+(null==t?"":""+t))},{init:!0}),e},f.text=function(t){var e=document.createTextNode(h.convertEntity(t.text));return e};var p=/^on-(.+)$/;f.element=function(t,e){var n,r,a=t.attrs,u=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=u.component(v);if("r-content"===v)return h.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,f.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),r=c.create(v,p,a),n&&!h.isVoidTag(v)&&c.inject(o.node(n),r),t.touched||(a.sort(function(t,e){var n=u.directive(t.name),r=u.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=i.call(this,a,r,d);return{type:"element",group:n,node:function(){return r},last:function(){return r},destroy:function(t){t?s.remove(r,n?n.destroy.bind(n):h.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},f.component=function(t,e){for(var n,r,i,a,s=t.attrs,c=e.Component,f=this.constructor,l=e.extra,d=e.namespace,v=this,m={},g=0,y=s.length;y>g;g++){var x=s[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(p);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=h.getCompileFn(E,this,{record:!0,namespace:d,extra:l,outer:e.outer})),"is"===_&&!c){i=E;var T=this.$get(E,!0);if(c=f.component(T),"function"!=typeof c)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(a=a||{},a[w]=h.handleEvent.call(this,E,w)):(_=x.name=h.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var b,$={data:m,events:a,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:{ctx:this,ast:t.children}},e={namespace:d,extra:e.extra},A=new c($,e);r&&this.$refs&&(b=c.directive("ref").link,this.$on("$destroy",b.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=s.length;y>g;g++){var x=s[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new u;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e($),i=S.children.pop();S.push(n),n.$inject(o.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},f.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),u=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,u,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){c.attr(u,r,t)},{init:!0}):h.isBooleanAttr(r)?c.attr(u,r,!0):c.attr(u,r,i),e.fromElement?void 0:{destroy:function(){c.attr(u,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e} +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.Regular=e():t.Regular=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=n(2),a=t.exports=n(3),o=a.Parser,s=a.Lexer;r.browser&&(n(6),n(7),n(8),a.dom=n(4)),a.env=r,a.util=n(5),a.parse=function(t,e){e=e||{},(e.BEGIN||e.END)&&(e.BEGIN&&(i.BEGIN=e.BEGIN),e.END&&(i.END=e.END),s.setup());var n=new o(t).parse();return e.stringify?JSON.stringify(n):n}},function(t,e,n){var r=n(5);e.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),e.browser="undefined"!=typeof document&&document.nodeType,e.exprCache=r.cache(1e3),e.isRunning=!1},function(t){t.exports={BEGIN:"{",END:"}"}},function(t,e,n){var r=n(1),i=n(11),a=n(12),o=n(2),s=n(5),u=n(13),c={};if(r.browser){var h=n(4),f=n(9),l=n(10),p=h.doc;c=n(14)}var d=n(15),v=n(16),m=n(17),g=n(18),y=function(t,e){var n=r.isRunning;r.isRunning=!0;var i,o;t=t||{},e=e||{},t.data=t.data||{},t.computed=t.computed||{},t.events=t.events||{},this.data&&s.extend(t.data,this.data),this.computed&&s.extend(t.computed,this.computed),this.events&&s.extend(t.events,this.events),s.extend(this,t,!0),this.$parent&&this.$parent._append(this),this._children=[],this.$refs={},o=this.template,"string"==typeof o&&o.length<16&&(i=h.find(o))&&(o=i.innerHTML),o&&o.nodeType&&(o=o.innerHTML),"string"==typeof o&&(this.template=new a(o).parse()),this.computed=x(this.computed),this.$root=this.$root||this,this.events&&this.$on(this.events),this.$emit("$config"),this.config&&this.config(this.data);var u=this._body;this._body=null,u&&u.ast&&u.ast.length&&(this.$body=s.getCompileFn(u.ast,u.ctx,{outer:this,namespace:e.namespace,extra:e.extra,record:!0})),o&&(this.group=this.$compile(this.template,{namespace:e.namespace}),c.node(this)),this.$parent||this.$update(),this.$ready=!0,this.$emit("$init"),this.init&&this.init(this.data),r.isRunning=n};f&&(f.Regular=y),s.extend(y,{_directives:{__regexp__:[]},_plugins:{},_protoInheritCache:["directive","use"],__after__:function(t,e){var n;if(this.__after__=t.__after__,e.name&&y.component(e.name,this),n=e.template){var r,i;"string"==typeof n&&n.length<16&&(r=h.find(n))&&(n=r.innerHTML,(i=h.attr(r,"name"))&&y.component(i,this)),n.nodeType&&(n=n.innerHTML),"string"==typeof n&&(this.prototype.template=new a(n).parse())}e.computed&&(this.prototype.computed=x(e.computed)),y._inheritConfig(this,t)},directive:function(t,e){if("object"===s.typeOf(t)){for(var n in t)t.hasOwnProperty(n)&&this.directive(n,t[n]);return this}var r,i=s.typeOf(t),a=this._directives;if(null==e){if("string"===i&&(r=a[t]))return r;for(var o=a.__regexp__,u=0,c=o.length;c>u;u++){r=o[u];var h=r.regexp.test(t);if(h)return r}return void 0}return"function"==typeof e&&(e={link:e}),"string"===i?a[t]=e:"regexp"===i&&(e.regexp=t,a.__regexp__.push(e)),this},plugin:function(t,e){var n=this._plugins;return null==e?n[t]:(n[t]=e,this)},use:function(t){return"string"==typeof t&&(t=y.plugin(t)),"function"!=typeof t?this:(t(this,y),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),o[n]=t[n];e&&i.setup()},expression:m.expression,Parser:a,Lexer:i,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(y._addProtoInheritCache);var n="_"+t+"s";y._protoInheritCache.push(t),y[n]={},y[t]||(y[t]=function(r,i){var a=this[n];if("object"==typeof r){for(var o in r)r.hasOwnProperty(o)&&this[t](o,r[o]);return this}return null==i?a[r]:(a[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=y._protoInheritCache,r=s.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=s.createObject(e[r]))}),t}}),u(y),y._addProtoInheritCache("component"),y._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),d.mixTo(y),v.mixTo(y),y.implement({init:function(){},config:function(){},destroy:function(){this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new a(t).parse());var n,r=this.__ext__,i=e.record;e.extra&&(this.__ext__=e.extra),i&&this._record();var o=this._walk(t,e);if(i){n=this._release();var s=this;n.length&&(o.ondestroy=function(){s.$unwatch(n)})}return e.extra&&(this.__ext__=r),o},$bind:function(t,e,n){var r=s.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,a=e.length;a>i;i++)this._bind(t,e[i]);else if("object"===r)for(var i in e)e.hasOwnProperty(i)&&this._bind(t,i,e[i]);return t.$update(),this},$unbind:function(){},$inject:c.inject,$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof y))throw"$bind() should pass Regular component as first argument";if(!e)throw"$bind() should pass as least one expression to bind";if(n||(n=e),e=m.expression(e),n=m.expression(n),n.set){var i=this.$watch(e,function(e){t.$update(n,e)});t.$on("$destroy",function(){r.$unwatch(i)})}if(e.set){var a=t.$watch(n,function(t){r.$update(e,t)});this.$on("$destroy",t.$unwatch.bind(t,a))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===s.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new l(n)}return"string"==typeof t?p.createTextNode(t):f[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$parent=this},_handleEvent:function(t,e,n,r){var i,a=this.constructor,o="function"!=typeof n?s.handleEvent.call(this,n,e):n,u=a.event(e);return u?i=u.call(this,t,o,r):h.on(t,e,o),u?i:function(){h.off(t,e,o)}},_touchExpr:function(t){var e,n=this.__ext__,r={};if("expression"!==t.type||t.touched)return t;if(e=t.get||(t.get=new Function(s.ctxName,s.extName,s.prefix+"return ("+t.body+")")),r.get=n?function(t){return e(t,n)}:e,t.setbody&&!t.set){var i=t.setbody;t.set=function(e,n,r){return t.set=new Function(s.ctxName,s.setName,s.extName,s.prefix+i),t.set(e,n,r)},t.setbody=null}return t.set&&(r.set=n?function(e,r){return t.set(e,r,n)}:t.set),s.extend(r,{type:"expression",touched:!0,once:t.once||t.constant}),r},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw Error("filter "+t+" is undefined");return n},_sg_:function(t,e,n){if("undefined"!=typeof n){var r=this.computed,i=r[t];if(i){if("expression"!==i.type||i.get||this._touchExpr(i),i.get)return i.get(this);s.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","warn")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:n&&"undefined"!=typeof n[t]?n[t]:e[t]},_ss_:function(t,e,n,r,i){var a,i=this.computed,r=r||"=",o=i?i[t]:null;if("="!==r)switch(a=o?o.get(this):n[t],r){case"+=":e=a+e;break;case"-=":e=a-e;break;case"*=":e=a*e;break;case"/=":e=a/e;break;case"%=":e=a%e}if(o){if(o.set)return o.set(this,e);s.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","warn")}return n[t]=e,e}}),y.prototype.inject=function(){return s.log("use $inject instead of inject","error"),this.$inject.apply(this,arguments)},y.filter(g),t.exports=y;var x=function(){function t(t){return function(e){return t.call(e,e.data)}}function e(t){return function(e,n){return t.call(e,n,e.data),n}}return function(n){if(n){var r,i,a,o={};for(var s in n)r=n[s],a=typeof r,"expression"!==r.type?"string"===a?o[s]=m.expression(r):(i=o[s]={type:"expression"},"function"===a?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[s]=r;return o}}}()},function(t,e,n){function r(t){return(""+t).replace(/-\D/g,function(t){return t.charAt(1).toUpperCase()})}function i(t,e){return"change"===e&&u.msie<9&&t&&t.tagName&&"input"===t.tagName.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)?"click":e}function a(t){if(t=t||window.event,t._fixed)return t;this.event=t,this.target=t.target||t.srcElement;var e=this.type=t.type,n=this.button=t.button;if(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var o,s,u=t.exports,c=n(1),h=n(5),f=document.createElement("div"),l=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=f,f.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},s=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},s=function(t,e,n){t.detachEvent("on"+e,n)}),u.msie=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(u.msie)&&(u.msie=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),u.find=function(t){if(document.querySelector)try{return document.querySelector(t)}catch(e){}return-1!==t.indexOf("#")?document.getElementById(t.slice(1)):void 0},u.inject=function(t,e,n){if(n=n||"bottom",t){if(Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,a=r.length;a>i;i++)t.appendChild(r[i])}var o,s;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(s=e.nextSibling)?s.parentNode.insertBefore(t,s):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(h.isBooleanAttr(e)){if("undefined"==typeof n)return t[e]||(t.attributes.getNamedItem(e)||l).specified?e:void 0;n?(t[e]=!0,t.setAttribute(e,e),u.msie&&u.msie<=7&&(t.defaultChecked=!0)):(t[e]=!1,t.removeAttribute(e))}else if("undefined"!=typeof n)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new a(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),o(t,e,n.real)})},u.off=function(t,e,n){var r=e.split(" ");n=n.real||n,r.forEach(function(e){e=i(t,e),s(t,e,n)})},u.text=function(){var t={};return u.msie&&u.msie<9?(t[1]="innerText",t[3]="nodeValue"):t[1]=t[3]="textContent",function(e,n){var r=t[e.nodeType];return null==n?r?e[r]:"":void(e[r]=n)}}(),u.html=function(t,e){return"undefined"==typeof e?t.innerHTML:void(t.innerHTML=e)},u.replace=function(t,e){e.parentNode&&e.parentNode.replaceChild(t,e)},u.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},u.css=function(t,e,n){if("object"!==h.typeOf(e)){if("undefined"==typeof n){var i;return u.msie<=8&&(i=t.currentStyle&&t.currentStyle[e],""===i&&(i="auto")),i=i||t.style[e],u.msie<=8&&(i=""===i?void 0:i),i}e=r(e),e&&(t.style[e]=n)}else for(var a in e)e.hasOwnProperty(a)&&u.css(t,a,e[a])},u.addClass=function(t,e){var n=t.className||"";-1===(" "+n+" ").indexOf(" "+e+" ")&&(t.className=n?n+" "+e:e)},u.delClass=function(t,e){var n=t.className||"";t.className=(" "+n+" ").replace(" "+e+" "," ").trim()},u.hasClass=function(t,e){var n=t.className||"";return-1!==(" "+n+" ").indexOf(" "+e+" ")};var v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,h.extend(a.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=u.msie?function(t){return u.nextFrame(function(){g=document.body.offsetWidth,t()})}:u.nextFrame},function(t,e,n){(function(e){function r(t,e){"undefined"!=typeof console&&console[e||"log"](t)}n(19)();var i=t.exports,a=n(20),o=[].slice,s={}.toString,u="undefined"!=typeof window?window:e;i.noop=function(){},i.uid=function(){var t=0;return function(){return t++}}(),i.extend=function(t,e,n){for(var r in e)("undefined"==typeof t[r]||n===!0)&&(t[r]=e[r]);return t},i.keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},i.varName="d",i.setName="p_",i.ctxName="c",i.extName="e",i.rWord=/^[\$\w]+$/,i.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,i.nextTick="function"==typeof setImmediate?setImmediate.bind(u):function(t){setTimeout(t,0)},i.prefix="var "+i.varName+"="+i.ctxName+".data;"+i.extName+"="+i.extName+"||'';",i.slice=function(t,e,n){for(var r=[],i=e||0,a=n||t.length;a>i;i++){var o=t[i];r.push(o)}return r},i.typeOf=function(t){return null==t?String(t):s.call(t).slice(8,-1).toLowerCase()},i.makePredicate=function(t){function e(t){if(1===t.length)return n+="return str === '"+t[0]+"';";n+="switch(str){";for(var e=0;e3){r.sort(function(t,e){return e.length-t.length}),n+="switch(str.length){";for(var i=0;ir;r++){var a=(t[r]||"").length;if(n+a>e)return{num:r,line:t[r],start:e-r-n,prev:t[r-1],next:t[r+1]};n+=a}}function e(t,e,n,a){var o=t.length,s=e-r;0>s&&(s=0);var u=e+i;u>o&&(u=o);var c=t.slice(s,u),h="["+(n+1)+"] "+(s>0?"..":""),f=o>u?"..":"",l=h+c+f;return a&&(l+="\n"+new Array(e-s+h.length+1).join(" ")+"^^^"),l}var n=/\r\n|[\n\r\u2028\u2029]/g,r=20,i=20;return function(r,i){i>r.length-1&&(i=r.length-1),n.lastIndex=0;var a=r.split(n),o=t(a,i),s=o.start,u=o.num;return(o.prev?e(o.prev,s,u-1)+"\n":"")+e(o.line,s,u,!0)+"\n"+(o.next?e(o.next,s,u+1)+"\n":"")}}();var c=/\((\?\!|\?\:|\?\=)/g;i.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(c);for(i=i?i.length:0;r--;){var a=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===a&&e++,")"===a&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},i.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})};var h=new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|("+i.keys(a).join("|")+"));","gi");i.convertEntity=function(t){return(""+t).replace(h,function(t,e,n,r){var i;return i=n?parseInt(n.slice(1),10):e?parseInt(e.slice(2),16):a[r],String.fromCharCode(i)})},i.createObject=function(t,e){function n(){}n.prototype=t;var r=new n;return e&&i.extend(r,e),r},i.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},i.clone=function(t){var e=i.typeOf(t);if("array"===e){for(var n=[],r=0,a=t.length;a>r;r++)n[r]=t[r];return n}if("object"===e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}return t},i.equals=function(t,e){var n=typeof t;return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var f=/-([a-z])/g;i.camelCase=function(t){return t.replace(f,function(t,e){return e.toUpperCase()})},i.throttle=function(t,e){var n,r,i,e=e||100,a=null,o=0,s=function(){o=+new Date,a=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-o);return n=this,r=arguments,0>=c||c>e?(clearTimeout(a),a=null,o=u,i=t.apply(n,r),n=r=null):a||(a=setTimeout(s,c)),i}},i.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,a=/[&<>\"\']/;return function(o){return a.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),i.cache=function(t){t=t||1e3;var e=[],n={};return{set:function(t,r){return e.length>this.max&&(n[e.shift()]=void 0),void 0===n[t]&&e.push(t),n[t]=r,r},get:function(t){return void 0===t?n:n[t]},max:t,len:function(){return e.length}}},i.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.$update(function(){var r=this.data;r.$event=t;var i=e(n);i===!1&&t&&t.preventDefault&&t.preventDefault(),r.$event=void 0})}:function(){var e=o.call(arguments);e.unshift(t),n.$update(function(){n.$emit.apply(n,e)})}},i.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},i.fixObjStr=function(t){return 0!==t.trim().indexOf("{")?"{"+t+"}":t},i.map=function(t,e){for(var n=[],r=0,i=t.length;i>r;r++)n.push(e(t[r],r));return n},i.log=r,i.isVoidTag=i.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),i.isBooleanAttr=i.makePredicate("selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple"),i.isFalse-function(){return!1},i.isTrue-function(){return!0},i.isExpr=function(t){return t&&"expression"===t.type},i.isGroup=function(t){return t.inject||t.$inject},i.getCompileFn=function(t,e,n){return e.$compile.bind(e,t,n)}}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i=n(4),a=(n(21),n(3)),o=n(22);n(23),n(24),t.exports={"r-class":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){var n=" "+t.className.replace(/\s+/g," ")+" ";for(var r in e)e.hasOwnProperty(r)&&(n=n.replace(" "+r+" "," "),e[r]===!0&&(n+=r+" "));t.className=n.trim()},!0)},"r-style":function(t,e){"string"==typeof e&&(e=r.fixObjStr(e)),this.$watch(e,function(e){for(var n in e)e.hasOwnProperty(n)&&i.css(t,n,e[n])},!0)},"r-hide":function(t,e){var n,i=null;r.isExpr(e)||"string"==typeof e?this.$watch(e,function(e){var r=!!e;r!==i&&(i=r,r?t.onleave?n=t.onleave(function(){t.style.display="none",n=null}):t.style.display="none":(n&&n(),t.style.display="",t.onenter&&t.onenter()))}):e&&(t.style.display="none")},"r-html":function(t,e){this.$watch(e,function(e){e=e||"",i.html(t,e)},{force:!0})},ref:{accept:o.COMPONENT_TYPE+o.ELEMENT_TYPE,link:function(t,e){var n,i=this.$refs||(this.$refs={});return r.isExpr(e)?this.$watch(e,function(e,r){n=e,i[r]===t&&(i[r]=null),n&&(i[n]=t)}):i[n=e]=t,function(){i[n]=null}}}},a.directive(t.exports)},function(t,e,n){function r(t){var e,n=[],r=0,i=a.noop,o={type:t,start:function(t){return e=a.uid(),"function"==typeof t&&(i=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,i&&i(),i=a.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(u=m[x],d=u.split(":"),l=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),l)if(l!==c)if(l!==h){var v=s.animation(l);if(!v||!f)throw Error(v?"you should start with `on` or `event` in animation":"undefined animator 【"+l+"】");f.push(v.call(this,{element:t,done:f.done,param:p}))}else n(p),"leave"===p?(t.onleave=f.start,y.push(o(t))):"enter"===p?(t.onenter=f.start,y.push(o(t))):"on"+p in t?y.push(this._handleEvent(t,p,f.start)):(this.$on(p,f.start),y.push(this.$off.bind(this,p,f.start)));else n("when"),this.$watch(p,i.bind(this,f.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var a=n(5),o=n(21),s=(n(4),n(3)),u=/\s+/,c="when",h="on";s._addProtoInheritCache("animation"),s.animation({wait:function(t){var e=parseInt(t.param)||0;return function(t){setTimeout(t,e)}},"class":function(t){var e=t.param.split(","),n=e[0]||"",r=parseInt(e[1])||1;return function(e){o.startClassAnimate(t.element,n,e,r)}},call:function(t){var e=this.$expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?this.$expression(n[1]).get:null;if(!r)throw Error("you shoud specified a eventname in emit command");var a=this;return function(t){a.$emit(r,i?i(a):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(u),i=r.shift(),a=r.join(" ");if(!i||!a)throw Error("invalid style in command: style");n[i]=a,e=!0}}),function(r){e?o.startStyleAnimate(t.element,n,r):r()}}}),s.directive("r-animation",i),s.directive("r-anim",i)},function(t,e,n){function r(t){t.implement({$timeout:function(t,e){return e=e||0,setTimeout(function(){t.call(this),this.$update()}.bind(this),e)},$interval:function(t,e){return e=e||1e3/60,setInterval(function(){t.call(this),this.$update()}.bind(this),e)}})}var i=n(3);i.plugin("timeout",r),i.plugin("$timeout",r)},function(t,e,n){function r(t,e){return"object"===e?h.keys(t):"array"===e?t:[]}function i(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++){var o=this._walk(t[i],{element:e,fromElement:!0,attrs:t,extra:n});o&&r.push(o)}return r}var a=n(25).diffArray,o=n(14),s=n(21),u=(n(26),n(10)),c=n(4),h=n(5),f=t.exports={};f.list=function(t,e){function n(t,e){for(var n=0;e>n;n++){var r=N.children.splice(t+1,1)[0];r&&r.destroy(!0)}}function i(n,r,i,a){for(var u=n;r>u;u++){var f=i[u],l={};c(l,u,f,a),l=h.createObject(E,l);var p=_.$compile(t.body,{extra:l,namespace:x,record:!0,outer:e.outer});p.data=l;var d=o.last(N.get(u));d.parentNode&&s.inject(o.node(p),d,"after"),N.children.splice(u+1,0,p)}}function c(t,e,n,r){t[T]=e,r?(t[w]=n,t[b]=r[n]):(t[b]=n,t[w]=null)}function l(t,e,n,r){for(var i=t;e>i;i++){var a=N.get(i+1),o=n[i];c(a.data,i,o,r)}}function p(t,e,r,o){var s=0,u=t.length;if(r||0===u&&0===e.length||(r=a(t,e,!0)),r&&r.length){for(var c=0;cy;)m(t[f],f)!==m(p[0],f)&&(n(f,1),i(f,f+1,t,o)),p.shift(),d--,f++,y++;v=p.length}l(s,f,t,o),n(f,v),i(f,f+d,t,o),s=f+d-v,s=0>s?0:s}if(u>s)for(var c=s;u>c;c++){var x=N.get(c+1);x.data[T]=c}}}function d(t,e,r){var a=t.length,o=e.length,s=Math.min(a,o);l(0,s,t,r),o>a?n(a,o-a):a>o&&i(o,a,t,r)}function v(t,n,i){var a,u=h.typeOf(t),c=h.typeOf(n),f=r(t,u),l=r(n,c),v=f&&f.length,m=l&&l.length;if(!m&&v&&N.get(1)){var g=N.children.pop();g.destroy&&g.destroy(!0)}if("object"===u&&(a=t),A===!0?d(f,l,a):p(f,l,i,a),!v&&$&&$.length){var T=_.$compile($,{extra:E,record:!0,outer:e.outer,namespace:x});N.children.push(T),y.parentNode&&s.inject(o.node(T),y,"after")}}var m,g,y=(f.Regular,document.createComment("Regular list")),x=e.namespace,E=e.extra,_=this,N=new u([y]),T=t.variable+"_index",w=t.variable+"_key",b=t.variable,$=t.alternate,A=t.track;return A&&A!==!0&&(A=this._touchExpr(A),g=h.createObject(E),m=function(t,e){return g[b]=t,g[T]=e,A.get(_,g)}),this.$watch(t.sequence,v,{init:!0,diff:A!==!0,deep:!0}),N},f.template=function(t,e){var n,n,r=t.content,i=document.createComment("inlcude"),a=e.namespace,o=e.extra,s=new u([i]);if(r){var c=this;this.$watch(r,function(t){var r=s.get(1),u=typeof t;r&&(r.destroy(!0),s.children.pop()),t&&(s.push(n="function"===u?t():c.$compile("object"!==u?String(t):t,{record:!0,outer:e.outer,namespace:a,extra:o})),i.parentNode&&n.$inject(i,"before"))},{init:!0})}return s};var l=0;f["if"]=function(t,e){var n,r,i=this,a=e.extra;if(e&&e.element){var c=function(s){s?(r&&o.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element,extra:a}))):(n&&o.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element,extra:a})))};return this.$watch(t.test,c,{force:!0}),{destroy:function(){n?o.destroy(n):r&&o.destroy(r)}}}var n,r,h=document.createComment("Regular if"+l++),f=new u;f.push(h);var p=null,d=e.namespace,c=function(u){var c=!!u;c!==p&&(p=c,f.children[1]&&(f.children[1].destroy(!0),f.children.pop()),c?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(n),h.parentNode&&s.inject(o.node(n),h,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,outer:e.outer,namespace:d,extra:a}),f.push(r),h.parentNode&&s.inject(o.node(r),h,"before")))};return this.$watch(t.test,c,{force:!0,init:!0}),f},f.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){c.text(e,""+(null==t?"":""+t))},{init:!0}),e},f.text=function(t){var e=document.createTextNode(h.convertEntity(t.text));return e};var p=/^on-(.+)$/;f.element=function(t,e){var n,r,a=t.attrs,u=this.constructor,l=t.children,p=e.namespace,d=e.extra,v=t.tag,m=u.component(v);if("r-content"===v)return h.log("r-content is deprecated, use {#inc this.$body} instead (`{#include}` as same)","warn"),this.$body&&this.$body();if(m||"r-component"===v)return e.Component=m,f.component.call(this,t,e);"svg"===v&&(p="svg"),l&&l.length&&(n=this.$compile(l,{outer:e.outer,namespace:p,extra:d})),r=c.create(v,p,a),n&&!h.isVoidTag(v)&&c.inject(o.node(n),r),t.touched||(a.sort(function(t,e){var n=u.directive(t.name),r=u.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1}),t.touched=!0);var g=i.call(this,a,r,d);return{type:"element",group:n,node:function(){return r},last:function(){return r},destroy:function(t){t?s.remove(r,n?n.destroy.bind(n):h.noop):n&&n.destroy(),g.length&&g.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}}},f.component=function(t,e){for(var n,r,i,a,s=t.attrs,c=e.Component,f=this.constructor,l=e.extra,d=e.namespace,v=this,m={},g=0,y=s.length;y>g;g++){var x=s[g],E=this._touchExpr(void 0===x.value?!0:x.value);E.constant&&(E=x.value=E.get(this)),x.value&&x.value.constant===!0&&(E=E.get(this));var _=x.name;if(!x.event){var N=_.match(p);N&&(x.event=N[1])}if("cmpl"===x.mdf&&(E=h.getCompileFn(E,this,{record:!0,namespace:d,extra:l,outer:e.outer})),"is"===_&&!c){i=E;var T=this.$get(E,!0);if(c=f.component(T),"function"!=typeof c)throw new Error("component "+T+" has not registed!")}var w;(w=x.event)?(a=a||{},a[w]=h.handleEvent.call(this,E,w)):(_=x.name=h.camelCase(_),m[_]="expression"!==E.type?E:E.get(v),"ref"===_&&null!=E&&(r=E),"isolate"===_&&(n="expression"===E.type?E.get(v):parseInt(E===!0?3:E,10),m.isolate=n))}var b,$={data:m,events:a,$parent:2&n?null:this,$root:this.$root,$outer:e.outer,_body:{ctx:this,ast:t.children}},e={namespace:d,extra:e.extra},A=new c($,e);r&&this.$refs&&(b=c.directive("ref").link,this.$on("$destroy",b.call(this,A,r))),r&&v.$refs&&(v.$refs[r]=A);for(var g=0,y=s.length;y>g;g++){var x=s[g],E=x.value||!0,_=x.name;"expression"!==E.type||x.event||(E=v._touchExpr(E),2&n||this.$watch(E,function(t,e){this.data[t]=e}.bind(A,_)),!E.set||1&n||A.$watch(_,v.$update.bind(v,E),{sync:!0}))}if(i&&"expression"===i.type){var S=new u;return S.push(A),this.$watch(i,function(t){var e=f.component(t);if(!e)throw new Error("component "+t+" has not registed!");var n=new e($),i=S.children.pop();S.push(n),n.$inject(o.last(i),"after"),i.destroy(),r&&(v.$refs[r]=n)},{sync:!0}),S}return A},f.attribute=function(t,e){var n=t,r=n.name,i=n.value||"",a=i.constant,o=this.constructor,s=o.directive(r),u=e.element,f=this;if(i=this._touchExpr(i),a&&(i=i.get(this)),s&&s.link){var l=s.link.call(f,u,i,r,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===i.type?this.$watch(i,function(t){c.attr(u,r,t)},{init:!0}):h.isBooleanAttr(r)?c.attr(u,r,!0):c.attr(u,r,i),e.fromElement?void 0:{destroy:function(){c.attr(u,r,null)}}}},function(t,e,n){function r(t){this.children=t||[]}var i=n(5),a=n(14),o=i.extend(r.prototype,{destroy:function(t){a.destroy(this.children,t),this.ondestroy&&this.ondestroy(),this.children=null},get:function(t){return this.children[t]},push:function(t){this.children.push(t)}});o.inject=o.$inject=a.inject,t.exports=r},function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){f[h.END]&&(this.markStart=f[h.END],this.markEnd=h.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?s:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}function a(t){for(var e,n,r={},i=0,a=t.length;a>i;i++)e=t[i],n=e[2]||"INIT",(r[n]||(r[n]={rules:[],links:[]})).rules.push(e);return o(r)}function o(t){function e(t,e){return"string"==typeof l[e]?c.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,a,o,s,u,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,a=[];for(var p=0,d=i.length;d>p;p++)h=i[p],s=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===c.typeOf(s)&&(s=s.toString().slice(1,-1)),s=s.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(s)+1,n.links.push([n.curIndex,u,o]),n.curIndex+=u,a.push(s);n.TRUNK=new RegExp("^(?:("+a.join(")|(")+"))")}return t}var s,u,c=n(5),h=n(2),f={"}":"{","]":"["},l={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\t\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,a,o=[];this.input=t,this.marks=0,this.index=0;for(var s=0;t;)s++,a=this.state(),e=this.map[a],n=e.TRUNK.exec(t),n||this.error("Unrecoginized Token"),r=n[0].length,t=t.slice(r),i=this._process.call(this,n,e,t),i&&o.push(i),this.index+=r;return o.push({type:"EOF"}),o},v.error=function(t){throw Error("Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index))},v._process=function(t,e,n){for(var r,i=e.links,a=!1,o=i.length,s=0;o>s;s++){var u=i[s],c=u[2],h=u[0];if(d(t[h])){a=!0,c&&(r=c.apply(this,t.slice(h,h+u[1])),r&&(r.pos=this.index));break}}if(!a)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){l.END=h.END,l.BEGIN=h.BEGIN,s=a([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=a([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00]*?(?=<[\w\/\!])/,function(t){return this.enter("TAG"),t?{type:"TEXT",value:t}:void 0}],TEXT:[/[^\x00]+/,"TEXT"],TAG_NAME:[/{NAME}/,"NAME","TAG"],TAG_UNQ_VALUE:[/[^\{}&"'=><`\r\n\f\t ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e} },"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f\t ]*>/,function(t,e){return this.leave(),{type:"TAG_CLOSE",value:e}},"TAG"],TAG_ENTER_JST:[/(?={BEGIN})/,function(){this.enter("JST")},"TAG"],TAG_PUNCHOR:[/[\>\/=&]/,function(t){return">"===t&&this.leave(),{type:t,value:t}},"TAG"],TAG_STRING:[/'([^']*)'|"([^"]*)\"/,function(t,e,n){var r=e||n||"";return{type:"STRING",value:r}},"TAG"],TAG_SPACE:[/{SPACE}+/,null,"TAG"],TAG_COMMENT:[/<\!--([^\x00]*?)--\>/,function(){this.leave()},"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),t.exports=i},function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new s(t,e).lex(),this.pos=0,this.length=this.tokens.length}var i=n(5),a=n(2),o=n(26),s=n(11),u=i.varName,c=i.ctxName,h=i.extName,f=i.makePredicate("STRING IDENT NUMBER"),l=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),p=r.prototype;p.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},p.ll=function(t){t=t||1,0>t&&(t+=1);var e=this.pos+t-1;return e>this.length-1?this.tokens[this.length-1]:this.tokens[e]},p.la=function(t){return(this.ll(t)||"").type},p.match=function(t,e){var n;return(n=this.eat(t,e))?n:(n=this.ll(),void this.error("expect ["+t+(null==e?"":":"+e)+']" -> got "['+n.type+(null==e?"":":"+n.value)+"]",n.pos))},p.error=function(t,e){throw t="\n【 parse failed 】 "+t+":\n\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},p.next=function(t){t=t||1,this.pos+=t},p.eat=function(t,e){var n=this.ll();if("string"!=typeof t){for(var r=t.length;r--;)if(n.type===t[r])return this.next(),n}else if(n.type===t&&("undefined"==typeof e||n.value===e))return this.next(),n;return!1},p.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},p.statement=function(){var t=this.ll();switch(t.type){case"NAME":case"TEXT":var e=t.value;for(this.next();t=this.eat(["NAME","TEXT"]);)e+=t.value;return o.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.xml=function(){var t,e,n,r;return t=this.match("TAG_OPEN").value,e=this.attrs(),r=this.eat("/"),this.match(">"),r||i.isVoidTag(t)||(n=this.program(),this.eat("TAG_CLOSE",t)||this.error("expect gotno matched closeTag")),o.element(t,e,n)},p.xentity=function(t){var e,n,r=t.value;if("NAME"===t.type){if(~r.indexOf(".")){var i=r.split(".");r=i[0],n=i[1]}return this.eat("=")&&(e=this.attvalue(n)),o.attribute(r,e,n)}return"if"!==r&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+r+" is invalid"),this["if"](!0)},p.attrs=function(t){var e;e=t?["NAME"]:["NAME","OPEN"];for(var n,r=[];n=this.eat(e);)r.push(this.xentity(n));return r},p.attvalue=function(t){var e=this.ll();switch(e.type){case"NAME":case"UNQ":case"STRING":this.next();var n=e.value;if(~n.indexOf(a.BEGIN)&&~n.indexOf(a.END)&&"cmpl"!==t){var i=!0,s=new r(n,{mode:2}).parse();if(1===s.length&&"expression"===s[0].type)return s[0];var u=[];s.forEach(function(t){t.constant||(i=!1),u.push(t.body||"'"+t.text.replace(/'/g,"\\'")+"'")}),u="["+u.join(",")+"].join('')",n=o.expression(u,null,i)}return n;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},p.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},p.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},p.inc=p.include=function(){var t=this.expression();return this.match("END"),o.template(t)},p["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,a=t?"attrs":"statement";this.match("END");for(var s,u;!(u=this.eat("CLOSE"));)if(s=this.ll(),"OPEN"===s.type)switch(s.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),o["if"](e,n,r);default:i.push(this[a](!0))}else i.push(this[a](!0));return"if"!==u.value&&this.error("Unmatched if directive"),o["if"](e,n,r)},p.list=function(){var t,e,n,r=this.expression(),i=[],a=[],s=i;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.eat("IDENT","by")&&(this.eat("IDENT",t+"_index")?n=!0:(n=this.expression(),n.constant&&(n=!0))),this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=a,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),o.list(r,t,i,a,n)},p.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},p.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return o.expression(e,n,!this.depend.length)},p.filter=function(){var t,e,n,r=this.assign(),a=this.eat("|"),o=[],s="t",u=r.set,h="";if(a){u&&(t=[]),e="(function("+s+"){";do h=s+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+s,h+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",o.push(h),t&&t.unshift(h.replace(" ).get.call"," ).set.call"));while(a=this.eat("|"));return o.push("return "+s),t&&t.push("return "+s),n=e+o.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},p.assign=function(){var t,e=this.condition();return(t=this.eat(["=","+=","-=","*=","/=","%="]))?(e.set||this.error("invalid lefthand expression in assignment expression"),this.getset(e.set.replace(","+i.setName,","+this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},p.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},p.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},p.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},p.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},p.relation=function(){var t,e=this.additive();return(t=this.eat(["<",">",">=","<="])||this.eat("IDENT","in"))?this.getset(e.get+t.value+this.relation().get):e},p.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},p.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},p.range=function(){var t,e,n=this.unary();if(t=this.eat("..")){e=this.unary();var r="(function(start,end){var res = [],step=end>start?1:-1; for(var i = start; end>start?i <= end: i>=end; i=i+step){res.push(i); } return res })("+n.get+","+e.get+")";return this.getset(r)}return n},p.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},p.member=function(t,e,n,r){var a,o,s,l=!1;if(t)"string"==typeof e&&f(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{o=this.primary();var p=typeof o;"string"===p?(n=[],n.push(o),e=o,s=h+"."+o,t=c+"._sg_('"+o+"', "+u+", "+h+")",l=!0):"this"===o.get?(t=c,n=["this"]):(n=null,t=o.get)}if(a=this.eat(["[",".","("]))switch(a.type){case".":var d=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+d+"', "+t+")":t+="['"+d+"']",this.member(t,d,n,r);case"[":return o=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+o.get+", "+t+")":t+="["+o.get+"]",this.match("]"),this.member(t,o,n,r);case"(":var v=this.arguments().join(",");return t=t+"("+v+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var m={get:t};return e&&(m.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(l?1:0)+")"),m},p.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},p.primary=function(){var t=this.ll();switch(t.type){case"{":return this.object();case"[":return this.array();case"(":return this.paren();case"STRING":return this.next(),this.getset("'"+t.value+"'");case"NUMBER":return this.next(),this.getset(""+t.value);case"IDENT":return this.next(),l(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},p.object=function(){for(var t=[this.match("{").type],e=this.eat(["STRING","IDENT","NUMBER"]);e;){t.push("'"+e.value+"'"+this.match(":").type);var n=this.assign().get;t.push(n),e=null,this.eat(",")&&(e=this.eat(["STRING","IDENT","NUMBER"]))&&t.push(",")}return t.push(this.match("}").type),{get:t.join("")}},p.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},p.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},p.getset=function(t,e){return{get:t,set:e}},t.exports=r},function(t,e,n){function r(t,e,n){return function(){var r=this.supr;this.supr=n[t];var i=e.apply(this,arguments);return this.supr=r,i}}function i(t,e,n){for(var i in e)e.hasOwnProperty(i)&&(t[i]=s(e[i])&&s(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var a=n(5),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,s=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;t.exports=function h(t){function e(){o.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(a.extend(r[n],t[n],!0),delete t[n])}return i(r,t,s),this}t=t||{};var r,o=this,s=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=h,t):(r=a.createProto(e,s),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=h,e)}},function(t,e,n){var r=n(4),i=n(21),a=t.exports={node:function(t){var e,n,r;if(t){if(t.element)return t.element;if("function"==typeof t.node)return t.node();if("number"==typeof t.nodeType)return t;if(t.group)return a.node(t.group);if(e=t.children){if(1===e.length)return a.node(e[0]);r=[];for(var i=0,o=e.length;o>i;i++)n=a.node(e[i]),Array.isArray(n)?r.push.apply(r,n):n&&r.push(n);return r}}},inject:function(t,e){var n=this,o=a.node(n.group||n);if(t===!1)return i.remove(o),n;if(!o)return n;if("string"==typeof t&&(t=r.find(t)),!t)throw Error("injected node is not found");if(i.inject(o,t,e),n.$emit){var s=n.parentNode,u="after"===e||"before"===e?t.parentNode:t;n.parentNode=u,n.$emit("$inject",t,e,s)}return n},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?a.last(e[e.length-1]):t.group?a.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,i=t.length;i>n;n++)a.destroy(t[n],e);var o=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),o&&o.length&&(a.destroy(o,!0),t.children=null)}}};r.element=function(t,e){if(!t)return e?[]:null;var n=a.node(t);if(1===n.nodeType)return e?[n]:n;for(var r=[],i=0;ia;a++)if(e===r[a])return r.splice(a,1),n}return n}},$emit:function(t){var e,n,r,a=this,o=a._handles;if(t){var n=i.call(arguments,1),r=t;if(!o)return a;if(e=o[r.slice(1)])for(var s=0,u=e.length;u>s;s++)e[s].apply(a,n);if(!(e=o[r]))return a;for(var c=0,u=e.length;u>c;c++)e[c].apply(a,n);return a}},$one:function(){}};a.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,a.extend(t,o)},t.exports=r},function(t,e,n){function r(){}var i=n(5),a=n(17).expression,o=n(25),s=o.diffArray,u=o.diffObject,c={$watch:function(t,e,n){var r,o,s,u,c=this.__ext__;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var h=i.uid("w_");if(Array.isArray(t)){for(var f=[],l=0,p=t.length;p>l;l++)f.push(this.$expression(t[l]).get);var d=[];s=function(t){for(var e=!0,n=0,r=f.length;r>n;n++){var a=f[n](t,c);i.equals(a,d[n])||(e=!1,d[n]=i.clone(a))}return e?!1:d}}else"function"==typeof t?r=t.bind(this):(t=this._touchExpr(a(t)),r=t.get,o=t.once);var v={id:h,get:r,fn:e,once:o,force:n.force,diff:n.diff,test:s,deep:n.deep,last:n.sync?r(this):n.last};if(this._watchers.push(v),u=this._records&&this._records.length,u&&this._records[u-1].push(h),n.init===!0){var m=this.$phase;this.$phase="digest",this._checkSingleWatch(v,this._watchers.length-1),this.$phase=m}return v},$unwatch:function(t){if(t=t.uid||t,this._watchers||(this._watchers=[]),Array.isArray(t))for(var e=0,n=t.length;n>e;e++)this.$unwatch(t[e]);else{var r,i,a=this._watchers;if(!t||!a||!(i=a.length))return;for(;i--;)r=a[i],r&&r.id===t&&a.splice(i,1)}},$expression:function(t){return this._touchExpr(a(t))},$digest:function(){if("digest"!==this.$phase&&!this._mute){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw Error("there may a circular dependencies reaches");e>0&&this.$emit&&this.$emit("$update"),this.$phase=null}},_digest:function(){var t,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var a=0,o=r.length;o>a;a++)e=r[a],n=this._checkSingleWatch(e,a),n&&(i=!0);if(t=this._children,t&&t.length)for(var s=0,u=t.length;u>s;s++){var c=t[s];c&&c._digest()&&(i=!0)}return i},_checkSingleWatch:function(t,e){var n=!1;if(t){var r,a,o,c,h,f;if(t.test){var l=t.test(this);l&&(n=!0,t.fn.apply(this,l))}else r=t.get(this),a=t.last,o=i.typeOf(a),c=i.typeOf(r),h=!0,f,"object"===c&&"object"===o&&t.deep?(f=u(r,a,t.diff),(f===!0||f.length)&&(n=!0)):"array"!==c||"undefined"!=o&&"array"!==o?(h=i.equals(r,a),(!h||t.force)&&(t.force=null,n=!0)):(f=s(r,t.last||[],t.diff),("array"!==o||f===!0||f.length)&&(n=!0));return n&&!t.test&&(t.last="object"===c&&t.deep||"array"===c?i.clone(r):r,t.fn.call(this,r,a,f),t.once&&this._watchers.splice(e,1)),n}},$set:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=this.$expression(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)this.$set(r,t[r])}},$get:function(t,e){return e&&"string"==typeof t?t:this.$expression(t).get(this)},$update:function(){var t=this;do{if(t.data.isolate||!t.$parent)break;t=t.$parent}while(t);var e=t.$phase;return t.$phase="digest",this.$set.apply(this,arguments),t.$phase=e,t.$digest(),this},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,c),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,c)},t.exports=r},function(t,e,n){var r=n(1).exprCache,i=(n(5),n(12));t.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new i(t,{mode:2,expression:!0}).expression())),t?t:void 0},parse:function(t){return new i(t).parse()}}},function(t){var e=t.exports={};e.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},e.last=function(t){return t&&t[t.length-1]},e.average=function(t,n){return t=t||[],t.length?e.total(t,n)/t.length:0},e.total=function(t,e){var n=0;if(t)return t.forEach(function(t){n+=e?t[e]:t}),n}},function(t){function e(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return e}var n=[].slice,r={}.toString;t.exports=function(){e(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),e(Array.prototype,{indexOf:function(t,e){e=e||0;for(var n=e,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},forEach:function(t,e){var n=0,r=Object(this),i=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(;i>n;){var a;n in r&&(a=r[n],t.call(e,a,n,r)),n++}},filter:function(t,e){var n=Object(this),r=n.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],a=0;r>a;a++)if(a in n){var o=n[a];t.call(e,o,a,n)&&i.push(o)}return i}}),e(Function.prototype,{bind:function(t){var e=this,r=n.call(arguments,1);return function(){var i=r.concat(n.call(arguments));return e.apply(t,i)}}}),e(Array,{isArray:function(t){return"[object Array]"===r.call(t)}})}},function(t){var e={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};t.exports=e},function(t,e,n){function r(t){var e,n=0,r=0,a=0,o=0,s=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[f+"Duration"])||r,a=i(e[f+"Delay"])||a,o=i(e[l+"Duration"])||o,s=i(e[l+"Delay"])||s,n=Math.max(r+a,o+s)),1e3*n*u}function i(t){var e,n=0;return t?(t.split(",").forEach(function(t){e=parseFloat(t),e>n&&(n=e)}),n):0}var a=n(5),o=n(4),s={},u=n(1),c="transitionend",h="animationend",f="transition",l="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",f="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",f="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",l="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",l="oAnimation")),s.inject=function(t,e,n,r){if(r=r||a.noop,Array.isArray(t)){for(var i=o.fragment(),s=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){s++,s===c&&r()};for(c===s&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(h):h()}else o.inject(t,e,n),t.onenter?t.onenter(r):r()},s.remove=function(t,e){function n(){r++,r===a&&e&&e()}if(t){var r=0;if(Array.isArray(t)){for(var i=0,a=t.length;a>i;i++)s.remove(t[i],n);return t}t.onleave?t.onleave(function(){p(t,e)}):p(t,e)}};var p=function(t,e){o.remove(t),e&&e()};s.startClassAnimate=function(t,e,n,i){var s,f,l,p;return!h&&!c||u.isRunning?n():(p=a.once(4!==i?function(){l&&clearTimeout(l),2===i&&o.delClass(t,s),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}:function(){l&&clearTimeout(l),n()}),2===i?(o.addClass(t,e),s=a.map(e.split(/\s+/),function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,s),f=r(t),l=setTimeout(p,f)})):o.nextReflow(4===i?function(){o.delClass(t,e),f=r(t),l=setTimeout(p,f)}:function(){o.addClass(t,e),f=r(t),l=setTimeout(p,f)}),o.on(t,h,p),o.on(t,c,p),p)},s.startStyleAnimate=function(t,e,n){var i,s,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(s,i)}),s=a.once(function(){u&&clearTimeout(u),o.off(t,h,s),o.off(t,c,s),n()}),o.on(t,h,s),o.on(t,c,s),s},t.exports=s},function(t){t.exports={COMPONENT_TYPE:1,ELEMENT_TYPE:2}},function(t,e,n){function r(t,e,n){if(n)for(var r,i=t.target;i&&i!==n;){for(var a=0,o=e.length;o>a;a++)r=e[a],r&&r.element===i&&r.fire(t);i=i.parentNode}}var i=n(5),a=n(4),o=n(3);o._addProtoInheritCache("event"),o.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),o.directive(/^(delegate|de)-\w+$/,function(t,e,n){function o(t){r(t,u[c],s.parentNode)}var s=this.$root,u=s._delegates||(s._delegates={});if(n&&e){var c=n.split("-")[1],h=i.handleEvent.call(this,e,c);u[c]||(u[c]=[],s.parentNode?a.on(s.parentNode,c,o):s.$on("$inject",function(t,e,n){var r=this.parentNode;n&&a.off(n,c,o),r&&a.on(this.parentNode,c,o)}),s.$on("$destroy",function(){s.parentNode&&a.off(s.parentNode,c,o),u[c]=null}));var f={element:t,fire:h};return u[c].push(f),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===f&&t.splice(e,1)}}})},function(t,e,n){function r(t,e){function n(){e.set(r,this.value),i.last=this.value,r.$update()}var r=this,i=this.$watch(e,function(e){var n=s.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})});return u.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){u.off(t,"change",n)}}function i(t,e){var n=this,r=this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)}),i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)s.nextTick(function(){var t=i.value;e.set(n,t),r.last=t,n.$update()});else{var a=i.value;e.set(n,a),r.last=a,n.$update()}};return 9!==u.msie&&"oninput"in u.tNode?t.addEventListener("input",i):(u.on(t,"paste",i),u.on(t,"keyup",i),u.on(t,"cut",i),u.on(t,"change",i)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==u.msie&&"oninput"in u.tNode?t.removeEventListener("input",i):(u.off(t,"paste",i),u.off(t,"keyup",i),u.off(t,"cut",i),u.off(t,"change",i))}}function a(t,e){var n=this,r=this.$watch(e,function(e){u.attr(t,"checked",!!e)}),i=function(){var t=this.checked;e.set(n,t),r.last=t,n.$update()};return e.set&&u.on(t,"change",i),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&u.off(t,"change",i)}}function o(t,e){var n=this,r=(this.$watch(e,function(e){t.checked=e==t.value?!0:!1}),function(){var t=this.value;e.set(n,t),n.$update()});return e.set&&u.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&u.off(t,"change",r)}}var s=n(5),u=n(4),c=n(3),h={text:i,select:r,checkbox:a,radio:o};c.directive("r-model",function(t,e){var n=t.tagName.toLowerCase(),r=n;return"input"===r?r=t.type||"text":"textarea"===r&&(r="text"),"string"==typeof e&&(e=this.$expression(e)),h[r]?h[r].call(this,t,e):"input"===n?h.text.call(this,t,e):void 0})},function(t,e,n){function r(t,e){var n=t.length,r=e.length;if(n!==r)return!0;for(var i=0;n>i;i++)if(t[i]!==e[i])return!0;return!1}function i(t,e){return t===e}function a(t,e,n){for(var r=t.length,a=e.length,n=n||i,o=[],s=0;r>=s;s++)o.push([s]);for(var u=1;a>=u;u++)o[0][u]=u;for(var s=1;r>=s;s++)for(var u=1;a>=u;u++)o[s][u]=n(t[s-1],e[u-1])?o[s-1][u-1]:Math.min(o[s-1][u]+1,o[s][u-1]+1);return o}function o(t,e,n,i){if(!n)return r(t,e);for(var o=a(e,t,i),s=e.length,u=s,c=t.length,h=c,f=[],l=o[u][h];u>0||h>0;)if(0!==u)if(0!==h){var p=o[u-1][h-1],d=o[u-1][h],v=o[u][h-1],m=Math.min(v,d,p);m===d?(f.unshift(2),u--,l=d):m===p?(p===l?f.unshift(0):(f.unshift(1),l=p),u--,h--):(f.unshift(3),h--,l=v)}else f.unshift(2),u--;else f.unshift(3),h--;var g=0,y=3,x=2,E=1,s=0;c=0;for(var _=[],N={index:null,add:0,removed:[]},u=0;u0?null===N.index&&(N.index=c):null!=N.index&&(_.push(N),N={index:null,add:0,removed:[]}),f[u]){case g:s++,c++;break;case y:N.add++,c++;break;case x:N.removed.push(e[s]),s++;break;case E:N.add++,N.removed.push(e[s]),s++,c++}return null!=N.index&&_.push(N),_}function s(t,e,n){if(n){var r=u.keys(t),i=u.keys(e);return o(r,i,n,function(n,r){return t[r]===e[n]})}for(var a in t)if(e[a]!==t[a])return!0;for(var s in e)if(e[s]!==t[s])return!0;return!1}var u=n(5);t.exports={diffArray:o,diffObject:s}},function(t){t.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e,n){return{type:"attribute",name:t,value:e,mdf:n}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n,r,i){return{type:"list",sequence:t,alternate:r,variable:e,body:n,track:i}},expression:function(t,e,n){return{type:"expression",body:t,constant:n||!1,setbody:e||!1}},text:function(t){return{type:"text",text:t}},template:function(t){return{type:"template",content:t}}}}])}); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 459ee92..bbfe1a1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -79,7 +79,7 @@ var karmaCommonConf = { // source files, that you wanna generate coverage for // do not include tests or libraries // (these files will be instrumented by Istanbul) - 'test/regular.js': ['coverage'] + 'src/**/*.js': ['coverage'] }, // optionally, configure the reporter diff --git a/src/walkers.js b/src/walkers.js index 1a80db6..fa6c516 100644 --- a/src/walkers.js +++ b/src/walkers.js @@ -162,6 +162,8 @@ walkers.list = function(ast, options){ var newList = getListFromValue( newValue, nType ); var oldList = getListFromValue( oldValue, oType ); + var rawNewValue; + var nlen = newList && newList.length; var olen = oldList && oldList.length; @@ -172,7 +174,7 @@ walkers.list = function(ast, options){ if(altGroup.destroy) altGroup.destroy(true); } - if( nType === 'object' ) var rawNewValue = newValue; + if( nType === 'object' ) rawNewValue = newValue; if(track === true){ updateSimple( newList, oldList, rawNewValue ); diff --git a/test/runner/dom.bundle.js b/test/runner/dom.bundle.js index e8ebe30..c6e1da0 100644 --- a/test/runner/dom.bundle.js +++ b/test/runner/dom.bundle.js @@ -837,7 +837,7 @@ /***/ function(module, exports, __webpack_require__) { var Regular = __webpack_require__(16); - var animate = __webpack_require__(18); + var animate = __webpack_require__(19); var dom = __webpack_require__(17); function destroy(component, container){ @@ -1677,7 +1677,7 @@ var expect = __webpack_require__(26); var Regular = __webpack_require__(16); - var combine = __webpack_require__(19); + var combine = __webpack_require__(20); function destroy(component, container){ component.destroy(); expect(container.innerHTML).to.equal(''); @@ -2949,6 +2949,30 @@ }) + it("list Object also accept #else stateman", function(){ + var component = new Regular({ + template: "
\ + {#list json as item by item_key}\ +
{item.age}:{item_key}:{item_index}
\ + {#else}
\ + {/list}\ +
", + data: { json: obj} + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + component.$update('json', null); + + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(1); + expect(divs[0].id).to.equal('notfound'); + + component.$update('json', arr); + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + + }) + }) }) @@ -4573,7 +4597,7 @@ var expect = __webpack_require__(26); var Regular = __webpack_require__(16); - var parse = __webpack_require__(20); + var parse = __webpack_require__(21); var Component = Regular.extend(); @@ -5700,7 +5724,7 @@ /***/ function(module, exports, __webpack_require__) { var expect = __webpack_require__(26); - var _ = __webpack_require__(21); + var _ = __webpack_require__(18); var shim = __webpack_require__(22); var extend = __webpack_require__(23); var diff = __webpack_require__(24) @@ -6171,7 +6195,7 @@ Regular.dom = __webpack_require__(17); } Regular.env = env; - Regular.util = __webpack_require__(21); + Regular.util = __webpack_require__(18); Regular.parse = function(str, options){ options = options || {}; @@ -6204,7 +6228,7 @@ var dom = module.exports; var env = __webpack_require__(27); - var _ = __webpack_require__(21); + var _ = __webpack_require__(18); var tNode = document.createElement('div') var addEvent, removeEvent; var noop = function(){} @@ -6586,833 +6610,833 @@ /* 18 */ /***/ function(module, exports, __webpack_require__) { - var _ = __webpack_require__(21); - var dom = __webpack_require__(17); - var animate = {}; - var env = __webpack_require__(27); + /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(22)(); - var - transitionEnd = 'transitionend', - animationEnd = 'animationend', - transitionProperty = 'transition', - animationProperty = 'animation'; - if(!('ontransitionend' in window)){ - if('onwebkittransitionend' in window) { - - // Chrome/Saf (+ Mobile Saf)/Android - transitionEnd += ' webkitTransitionEnd'; - transitionProperty = 'webkitTransition' - } else if('onotransitionend' in dom.tNode || navigator.appName === 'Opera') { + var _ = module.exports; + var entities = __webpack_require__(30); + var slice = [].slice; + var o2str = ({}).toString; + var win = typeof window !=='undefined'? window: global; - // Opera - transitionEnd += ' oTransitionEnd'; - transitionProperty = 'oTransition'; - } - } - if(!('onanimationend' in window)){ - if ('onwebkitanimationend' in window){ - // Chrome/Saf (+ Mobile Saf)/Android - animationEnd += ' webkitAnimationEnd'; - animationProperty = 'webkitAnimation'; - }else if ('onoanimationend' in dom.tNode){ - // Opera - animationEnd += ' oAnimationEnd'; - animationProperty = 'oAnimation'; + _.noop = function(){}; + _.uid = (function(){ + var _uid=0; + return function(){ + return _uid++; } - } - - /** - * inject node with animation - * @param {[type]} node [description] - * @param {[type]} refer [description] - * @param {[type]} direction [description] - * @return {[type]} [description] - */ - animate.inject = function( node, refer ,direction, callback ){ - callback = callback || _.noop; - if( Array.isArray(node) ){ - var fragment = dom.fragment(); - var count=0; - - for(var i = 0,len = node.length;i < len; i++ ){ - fragment.appendChild(node[i]); - } - dom.inject(fragment, refer, direction); + })(); - // if all nodes is done, we call the callback - var enterCallback = function (){ - count++; - if( count === len ) callback(); - } - if(len === count) callback(); - for( i = 0; i < len; i++ ){ - if(node[i].onenter){ - node[i].onenter(enterCallback); - }else{ - enterCallback(); - } - } - }else{ - dom.inject( node, refer, direction ); - if(node.onenter){ - node.onenter(callback) - }else{ - callback(); + _.extend = function( o1, o2, override ){ + // if(_.typeOf(override) === 'array'){ + // for(var i = 0, len = override.length; i < len; i++ ){ + // var key = override[i]; + // o1[key] = o2[key]; + // } + // }else{ + for(var i in o2){ + if( typeof o1[i] === "undefined" || override === true ){ + o1[i] = o2[i] } } + // } + return o1; } - /** - * remove node with animation - * @param {[type]} node [description] - * @param {Function} callback [description] - * @return {[type]} [description] - */ - animate.remove = function(node, callback){ - if(!node) return; - var count = 0; - function loop(){ - count++; - if(count === len) callback && callback() - } - if(Array.isArray(node)){ - for(var i = 0, len = node.length; i < len ; i++){ - animate.remove(node[i], loop) - } - return node; - } - if(node.onleave){ - node.onleave(function(){ - removeDone(node, callback) - }) - }else{ - removeDone(node, callback) + _.keys = function(obj){ + if(Object.keys) return Object.keys(obj); + var res = []; + for(var i in obj) if(obj.hasOwnProperty(i)){ + res.push(i); } + return res; } - var removeDone = function (node, callback){ - dom.remove(node); - callback && callback(); - } - + _.varName = 'd'; + _.setName = 'p_'; + _.ctxName = 'c'; + _.extName = 'e'; + _.rWord = /^[\$\w]+$/; + _.rSimpleAccessor = /^[\$\w]+(\.[\$\w]+)*$/; - animate.startClassAnimate = function ( node, className, callback, mode ){ - var activeClassName, timeout, tid, onceAnim; - if( (!animationEnd && !transitionEnd) || env.isRunning ){ - return callback(); + _.nextTick = typeof setImmediate === 'function'? + setImmediate.bind(win) : + function(callback) { + setTimeout(callback, 0) } - if(mode !== 4){ - onceAnim = _.once(function onAnimateEnd(){ - if(tid) clearTimeout(tid); - if(mode === 2) { - dom.delClass(node, activeClassName); - } - if(mode !== 3){ // mode hold the class - dom.delClass(node, className); - } - dom.off(node, animationEnd, onceAnim) - dom.off(node, transitionEnd, onceAnim) - callback(); + _.prefix = "var " + _.varName + "=" + _.ctxName + ".data;" + _.extName + "=" + _.extName + "||'';"; - }); - }else{ - onceAnim = _.once(function onAnimateEnd(){ - if(tid) clearTimeout(tid); - callback(); - }); + + _.slice = function(obj, start, end){ + var res = []; + for(var i = start || 0, len = end || obj.length; i < len; i++){ + var item = obj[i]; + res.push(item) } - if(mode === 2){ // auto removed - dom.addClass( node, className ); + return res; + } - activeClassName = _.map(className.split(/\s+/), function(name){ - return name + '-active'; - }).join(" "); + _.typeOf = function (o) { + return o == null ? String(o) :o2str.call(o).slice(8, -1).toLowerCase(); + } - dom.nextReflow(function(){ - dom.addClass( node, activeClassName ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); - }else if(mode===4){ - dom.nextReflow(function(){ - dom.delClass( node, className ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); + _.makePredicate = function makePredicate(words, prefix) { + if (typeof words === "string") { + words = words.split(" "); + } + var f = "", + cats = []; + out: for (var i = 0; i < words.length; ++i) { + for (var j = 0; j < cats.length; ++j){ + if (cats[j][0].length === words[i].length) { + cats[j].push(words[i]); + continue out; + } + } + cats.push([words[i]]); + } + function compareTo(arr) { + if (arr.length === 1) return f += "return str === '" + arr[0] + "';"; + f += "switch(str){"; + for (var i = 0; i < arr.length; ++i){ + f += "case '" + arr[i] + "':"; + } + f += "return true}return false;"; + } - }else{ - dom.nextReflow(function(){ - dom.addClass( node, className ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); - } + // When there are more than three length categories, an outer + // switch first dispatches on the lengths, to save on comparisons. + if (cats.length > 3) { + cats.sort(function(a, b) { + return b.length - a.length; + }); + f += "switch(str.length){"; + for (var i = 0; i < cats.length; ++i) { + var cat = cats[i]; + f += "case " + cat[0].length + ":"; + compareTo(cat); + } + f += "}"; + // Otherwise, simply generate a flat `switch` statement. + } else { + compareTo(words); + } + return new Function("str", f); + } - dom.on( node, animationEnd, onceAnim ) - dom.on( node, transitionEnd, onceAnim ) - return onceAnim; - } + _.trackErrorPos = (function (){ + // linebreak + var lb = /\r\n|[\n\r\u2028\u2029]/g; + var minRange = 20, maxRange = 20; + function findLine(lines, pos){ + var tmpLen = 0; + for(var i = 0,len = lines.length; i < len; i++){ + var lineLen = (lines[i] || "").length; + if(tmpLen + lineLen > pos) { + return {num: i, line: lines[i], start: pos - i - tmpLen , prev:lines[i-1], next: lines[i+1] }; + } + // 1 is for the linebreak + tmpLen = tmpLen + lineLen ; + } + } + function formatLine(str, start, num, target){ + var len = str.length; + var min = start - minRange; + if(min < 0) min = 0; + var max = start + maxRange; + if(max > len) max = len; - animate.startStyleAnimate = function(node, styles, callback){ - var timeout, onceAnim, tid; + var remain = str.slice(min, max); + var prefix = "[" +(num+1) + "] " + (min > 0? ".." : "") + var postfix = max < len ? "..": ""; + var res = prefix + remain + postfix; + if(target) res += "\n" + new Array(start-min + prefix.length + 1).join(" ") + "^^^"; + return res; + } + return function(input, pos){ + if(pos > input.length-1) pos = input.length-1; + lb.lastIndex = 0; + var lines = input.split(lb); + var line = findLine(lines,pos); + var start = line.start, num = line.num; - dom.nextReflow(function(){ - dom.css( node, styles ); - timeout = getMaxTimeout( node ); - tid = setTimeout( onceAnim, timeout ); - }); + return (line.prev? formatLine(line.prev, start, num-1 ) + '\n': '' ) + + formatLine(line.line, start, num, true) + '\n' + + (line.next? formatLine(line.next, start, num+1 ) + '\n': '' ); + } + })(); - onceAnim = _.once(function onAnimateEnd(){ - if(tid) clearTimeout(tid); - dom.off(node, animationEnd, onceAnim) - dom.off(node, transitionEnd, onceAnim) + var ignoredRef = /\((\?\!|\?\:|\?\=)/g; + _.findSubCapture = function (regStr) { + var left = 0, + right = 0, + len = regStr.length, + ignored = regStr.match(ignoredRef); // ignored uncapture + if(ignored) ignored = ignored.length + else ignored = 0; + for (; len--;) { + var letter = regStr.charAt(len); + if (len === 0 || regStr.charAt(len - 1) !== "\\" ) { + if (letter === "(") left++; + if (letter === ")") right++; + } + } + if (left !== right) throw "RegExp: "+ regStr + "'s bracket is not marched"; + else return left - ignored; + }; - callback(); + _.escapeRegExp = function( str){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License + return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ + return '\\' + match; }); + }; - dom.on( node, animationEnd, onceAnim ) - dom.on( node, transitionEnd, onceAnim ) - - return onceAnim; - } + var rEntity = new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|(" + _.keys(entities).join('|') + '));', 'gi'); - /** - * get maxtimeout - * @param {Node} node - * @return {[type]} [description] - */ - function getMaxTimeout(node){ - var timeout = 0, - tDuration = 0, - tDelay = 0, - aDuration = 0, - aDelay = 0, - ratio = 5 / 3, - styles ; + _.convertEntity = function(chr){ - if(window.getComputedStyle){ + return ("" + chr).replace(rEntity, function(all, hex, dec, capture){ + var charCode; + if( dec ) charCode = parseInt( dec.slice(1), 10 ); + else if( hex ) charCode = parseInt( hex.slice(2), 16 ); + else charCode = entities[capture] - styles = window.getComputedStyle(node), - tDuration = getMaxTime( styles[transitionProperty + 'Duration']) || tDuration; - tDelay = getMaxTime( styles[transitionProperty + 'Delay']) || tDelay; - aDuration = getMaxTime( styles[animationProperty + 'Duration']) || aDuration; - aDelay = getMaxTime( styles[animationProperty + 'Delay']) || aDelay; - timeout = Math.max( tDuration+tDelay, aDuration + aDelay ); + return String.fromCharCode( charCode ) + }); - } - return timeout * 1000 * ratio; } - function getMaxTime(str){ - - var maxTimeout = 0, time; - - if(!str) return 0; - - str.split(",").forEach(function(str){ - - time = parseFloat(str); - if( time > maxTimeout ) maxTimeout = time; - }); + // simple get accessor - return maxTimeout; + _.createObject = function(o, props){ + function Foo() {} + Foo.prototype = o; + var res = new Foo; + if(props) _.extend(res, props); + return res; } - module.exports = animate; - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - // some nested operation in ast - // -------------------------------- + _.createProto = function(fn, o){ + function Foo() { this.constructor = fn;} + Foo.prototype = o; + return (fn.prototype = new Foo()); + } - var dom = __webpack_require__(17); - var animate = __webpack_require__(18); - var combine = module.exports = { - // get the initial dom in object - node: function(item){ - var children,node, nodes; - if(!item) return; - if(item.element) return item.element; - if(typeof item.node === "function") return item.node(); - if(typeof item.nodeType === "number") return item; - if(item.group) return combine.node(item.group) - if(children = item.children){ - if(children.length === 1){ - return combine.node(children[0]); - } - nodes = []; - for(var i = 0, len = children.length; i < len; i++ ){ - node = combine.node(children[i]); - if(Array.isArray(node)){ - nodes.push.apply(nodes, node) - }else if(node) { - nodes.push(node) - } + /** + clone + */ + _.clone = function clone(obj){ + var type = _.typeOf(obj); + if(type === 'array'){ + var cloned = []; + for(var i=0,len = obj.length; i< len;i++){ + cloned[i] = obj[i] } - return nodes; - } - }, - // @TODO remove _gragContainer - inject: function(node, pos ){ - var group = this; - var fragment = combine.node(group.group || group); - if(node === false) { - animate.remove(fragment) - return group; - }else{ - if(!fragment) return group; - if(typeof node === 'string') node = dom.find(node); - if(!node) throw Error('injected node is not found'); - // use animate to animate firstchildren - animate.inject(fragment, node, pos); - } - // if it is a component - if(group.$emit) { - var preParent = group.parentNode; - var newParent = (pos ==='after' || pos === 'before')? node.parentNode : node; - group.parentNode = newParent; - group.$emit("$inject", node, pos, preParent); + return cloned; } - return group; - }, - - // get the last dom in object(for insertion operation) - last: function(item){ - var children = item.children; - - if(typeof item.last === "function") return item.last(); - if(typeof item.nodeType === "number") return item; - - if(children && children.length) return combine.last(children[children.length - 1]); - if(item.group) return combine.last(item.group); - - }, - - destroy: function(item, first){ - if(!item) return; - if(Array.isArray(item)){ - for(var i = 0, len = item.length; i < len; i++ ){ - combine.destroy(item[i], first); + if(type === 'object'){ + var cloned = {}; + for(var i in obj) if(obj.hasOwnProperty(i)){ + cloned[i] = obj[i]; } + return cloned; } - var children = item.children; - if(typeof item.destroy === "function") return item.destroy(first); - if(typeof item.nodeType === "number" && first) dom.remove(item); - if(children && children.length){ - combine.destroy(children, true); - item.children = null; - } + return obj; } + _.equals = function(now, old){ + var type = typeof now; + if(type === 'number' && typeof old === 'number'&& isNaN(now) && isNaN(old)) return true + return now === old; } - - // @TODO: need move to dom.js - dom.element = function( component, all ){ - if(!component) return !all? null: []; - var nodes = combine.node( component ); - if( nodes.nodeType === 1 ) return all? [nodes]: nodes; - var elements = []; - for(var i = 0; i wait) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + context = args = null; + } else if (!timeout) { + timeout = setTimeout(later, remaining); } - if(expr) return expr; - }, - parse: function(template){ - return new Parser(template).parse(); - } - } - + return result; + }; + }; + // hogan escape + // ============== + _.escape = (function(){ + var rAmp = /&/g, + rLt = //g, + rApos = /\'/g, + rQuot = /\"/g, + hChars = /[&<>\"\']/; -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { + return function(str) { + return hChars.test(str) ? + str + .replace(rAmp, '&') + .replace(rLt, '<') + .replace(rGt, '>') + .replace(rApos, ''') + .replace(rQuot, '"') : + str; + } + })(); - /* WEBPACK VAR INJECTION */(function(global) {__webpack_require__(22)(); + _.cache = function(max){ + max = max || 1000; + var keys = [], + cache = {}; + return { + set: function(key, value) { + if (keys.length > this.max) { + cache[keys.shift()] = undefined; + } + // + if(cache[key] === undefined){ + keys.push(key); + } + cache[key] = value; + return value; + }, + get: function(key) { + if (key === undefined) return cache; + return cache[key]; + }, + max: max, + len:function(){ + return keys.length; + } + }; + } + // // setup the raw Expression + // _.touchExpression = function(expr){ + // if(expr.type === 'expression'){ + // } + // return expr; + // } - var _ = module.exports; - var entities = __webpack_require__(30); - var slice = [].slice; - var o2str = ({}).toString; - var win = typeof window !=='undefined'? window: global; + // handle the same logic on component's `on-*` and element's `on-*` + // return the fire object + _.handleEvent = function(value, type ){ + var self = this, evaluate; + if(value.type === 'expression'){ // if is expression, go evaluated way + evaluate = value.get; + } + if(evaluate){ + return function fire(obj){ + self.$update(function(){ + var data = this.data; + data.$event = obj; + var res = evaluate(self); + if(res === false && obj && obj.preventDefault) obj.preventDefault(); + data.$event = undefined; + }) + } + }else{ + return function fire(){ + var args = slice.call(arguments) + args.unshift(value); + self.$update(function(){ + self.$emit.apply(self, args); + }) + } + } + } - _.noop = function(){}; - _.uid = (function(){ - var _uid=0; + // only call once + _.once = function(fn){ + var time = 0; return function(){ - return _uid++; + if( time++ === 0) fn.apply(this, arguments); } - })(); + } - _.extend = function( o1, o2, override ){ - // if(_.typeOf(override) === 'array'){ - // for(var i = 0, len = override.length; i < len; i++ ){ - // var key = override[i]; - // o1[key] = o2[key]; - // } - // }else{ - for(var i in o2){ - if( typeof o1[i] === "undefined" || override === true ){ - o1[i] = o2[i] - } + _.fixObjStr = function(str){ + if(str.trim().indexOf('{') !== 0){ + return '{' + str + '}'; } - // } - return o1; + return str; } - _.keys = function(obj){ - if(Object.keys) return Object.keys(obj); + + _.map= function(array, callback){ var res = []; - for(var i in obj) if(obj.hasOwnProperty(i)){ - res.push(i); + for (var i = 0, len = array.length; i < len; i++) { + res.push(callback(array[i], i)); } return res; } - _.varName = 'd'; - _.setName = 'p_'; - _.ctxName = 'c'; - _.extName = 'e'; + function log(msg, type){ + if(typeof console !== "undefined") console[type || "log"](msg); + } - _.rWord = /^[\$\w]+$/; - _.rSimpleAccessor = /^[\$\w]+(\.[\$\w]+)*$/; + _.log = log; - _.nextTick = typeof setImmediate === 'function'? - setImmediate.bind(win) : - function(callback) { - setTimeout(callback, 0) - } - _.prefix = "var " + _.varName + "=" + _.ctxName + ".data;" + _.extName + "=" + _.extName + "||'';"; + //http://www.w3.org/html/wg/drafts/html/master/single-page.html#void-elements + _.isVoidTag = _.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"); + _.isBooleanAttr = _.makePredicate('selected checked disabled readonly required open autofocus controls autoplay compact loop defer multiple'); + _.isFalse - function(){return false} + _.isTrue - function(){return true} - _.slice = function(obj, start, end){ - var res = []; - for(var i = start || 0, len = end || obj.length; i < len; i++){ - var item = obj[i]; - res.push(item) - } - return res; + _.isExpr = function(expr){ + return expr && expr.type === 'expression'; + } + // @TODO: make it more strict + _.isGroup = function(group){ + return group.inject || group.$inject; } - _.typeOf = function (o) { - return o == null ? String(o) :o2str.call(o).slice(8, -1).toLowerCase(); + _.getCompileFn = function(source, ctx, options){ + return ctx.$compile.bind(ctx,source, options) } - _.makePredicate = function makePredicate(words, prefix) { - if (typeof words === "string") { - words = words.split(" "); - } - var f = "", - cats = []; - out: for (var i = 0; i < words.length; ++i) { - for (var j = 0; j < cats.length; ++j){ - if (cats[j][0].length === words[i].length) { - cats[j].push(words[i]); - continue out; - } - } - cats.push([words[i]]); - } - function compareTo(arr) { - if (arr.length === 1) return f += "return str === '" + arr[0] + "';"; - f += "switch(str){"; - for (var i = 0; i < arr.length; ++i){ - f += "case '" + arr[i] + "':"; - } - f += "return true}return false;"; - } - // When there are more than three length categories, an outer - // switch first dispatches on the lengths, to save on comparisons. - if (cats.length > 3) { - cats.sort(function(a, b) { - return b.length - a.length; - }); - f += "switch(str.length){"; - for (var i = 0; i < cats.length; ++i) { - var cat = cats[i]; - f += "case " + cat[0].length + ":"; - compareTo(cat); - } - f += "}"; - // Otherwise, simply generate a flat `switch` statement. - } else { - compareTo(words); - } - return new Function("str", f); - } + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - _.trackErrorPos = (function (){ - // linebreak - var lb = /\r\n|[\n\r\u2028\u2029]/g; - var minRange = 20, maxRange = 20; - function findLine(lines, pos){ - var tmpLen = 0; - for(var i = 0,len = lines.length; i < len; i++){ - var lineLen = (lines[i] || "").length; +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { - if(tmpLen + lineLen > pos) { - return {num: i, line: lines[i], start: pos - i - tmpLen , prev:lines[i-1], next: lines[i+1] }; + var _ = __webpack_require__(18); + var dom = __webpack_require__(17); + var animate = {}; + var env = __webpack_require__(27); + + + var + transitionEnd = 'transitionend', + animationEnd = 'animationend', + transitionProperty = 'transition', + animationProperty = 'animation'; + + if(!('ontransitionend' in window)){ + if('onwebkittransitionend' in window) { + + // Chrome/Saf (+ Mobile Saf)/Android + transitionEnd += ' webkitTransitionEnd'; + transitionProperty = 'webkitTransition' + } else if('onotransitionend' in dom.tNode || navigator.appName === 'Opera') { + + // Opera + transitionEnd += ' oTransitionEnd'; + transitionProperty = 'oTransition'; + } + } + if(!('onanimationend' in window)){ + if ('onwebkitanimationend' in window){ + // Chrome/Saf (+ Mobile Saf)/Android + animationEnd += ' webkitAnimationEnd'; + animationProperty = 'webkitAnimation'; + + }else if ('onoanimationend' in dom.tNode){ + // Opera + animationEnd += ' oAnimationEnd'; + animationProperty = 'oAnimation'; + } + } + + /** + * inject node with animation + * @param {[type]} node [description] + * @param {[type]} refer [description] + * @param {[type]} direction [description] + * @return {[type]} [description] + */ + animate.inject = function( node, refer ,direction, callback ){ + callback = callback || _.noop; + if( Array.isArray(node) ){ + var fragment = dom.fragment(); + var count=0; + + for(var i = 0,len = node.length;i < len; i++ ){ + fragment.appendChild(node[i]); + } + dom.inject(fragment, refer, direction); + + // if all nodes is done, we call the callback + var enterCallback = function (){ + count++; + if( count === len ) callback(); + } + if(len === count) callback(); + for( i = 0; i < len; i++ ){ + if(node[i].onenter){ + node[i].onenter(enterCallback); + }else{ + enterCallback(); } - // 1 is for the linebreak - tmpLen = tmpLen + lineLen ; + } + }else{ + dom.inject( node, refer, direction ); + if(node.onenter){ + node.onenter(callback) + }else{ + callback(); } } - function formatLine(str, start, num, target){ - var len = str.length; - var min = start - minRange; - if(min < 0) min = 0; - var max = start + maxRange; - if(max > len) max = len; + } - var remain = str.slice(min, max); - var prefix = "[" +(num+1) + "] " + (min > 0? ".." : "") - var postfix = max < len ? "..": ""; - var res = prefix + remain + postfix; - if(target) res += "\n" + new Array(start-min + prefix.length + 1).join(" ") + "^^^"; - return res; + /** + * remove node with animation + * @param {[type]} node [description] + * @param {Function} callback [description] + * @return {[type]} [description] + */ + animate.remove = function(node, callback){ + if(!node) return; + var count = 0; + function loop(){ + count++; + if(count === len) callback && callback() } - return function(input, pos){ - if(pos > input.length-1) pos = input.length-1; - lb.lastIndex = 0; - var lines = input.split(lb); - var line = findLine(lines,pos); - var start = line.start, num = line.num; + if(Array.isArray(node)){ + for(var i = 0, len = node.length; i < len ; i++){ + animate.remove(node[i], loop) + } + return node; + } + if(node.onleave){ + node.onleave(function(){ + removeDone(node, callback) + }) + }else{ + removeDone(node, callback) + } + } + + var removeDone = function (node, callback){ + dom.remove(node); + callback && callback(); + } + - return (line.prev? formatLine(line.prev, start, num-1 ) + '\n': '' ) + - formatLine(line.line, start, num, true) + '\n' + - (line.next? formatLine(line.next, start, num+1 ) + '\n': '' ); + animate.startClassAnimate = function ( node, className, callback, mode ){ + var activeClassName, timeout, tid, onceAnim; + if( (!animationEnd && !transitionEnd) || env.isRunning ){ + return callback(); } - })(); + if(mode !== 4){ + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); - var ignoredRef = /\((\?\!|\?\:|\?\=)/g; - _.findSubCapture = function (regStr) { - var left = 0, - right = 0, - len = regStr.length, - ignored = regStr.match(ignoredRef); // ignored uncapture - if(ignored) ignored = ignored.length - else ignored = 0; - for (; len--;) { - var letter = regStr.charAt(len); - if (len === 0 || regStr.charAt(len - 1) !== "\\" ) { - if (letter === "(") left++; - if (letter === ")") right++; - } + if(mode === 2) { + dom.delClass(node, activeClassName); + } + if(mode !== 3){ // mode hold the class + dom.delClass(node, className); + } + dom.off(node, animationEnd, onceAnim) + dom.off(node, transitionEnd, onceAnim) + + callback(); + + }); + }else{ + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); + callback(); + }); } - if (left !== right) throw "RegExp: "+ regStr + "'s bracket is not marched"; - else return left - ignored; - }; + if(mode === 2){ // auto removed + dom.addClass( node, className ); + activeClassName = _.map(className.split(/\s+/), function(name){ + return name + '-active'; + }).join(" "); - _.escapeRegExp = function( str){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License - return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ - return '\\' + match; + dom.nextReflow(function(){ + dom.addClass( node, activeClassName ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); + + }else if(mode===4){ + dom.nextReflow(function(){ + dom.delClass( node, className ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); + + }else{ + dom.nextReflow(function(){ + dom.addClass( node, className ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); + }); + } + + + + dom.on( node, animationEnd, onceAnim ) + dom.on( node, transitionEnd, onceAnim ) + return onceAnim; + } + + + animate.startStyleAnimate = function(node, styles, callback){ + var timeout, onceAnim, tid; + + dom.nextReflow(function(){ + dom.css( node, styles ); + timeout = getMaxTimeout( node ); + tid = setTimeout( onceAnim, timeout ); }); - }; - var rEntity = new RegExp("&(?:(#x[0-9a-fA-F]+)|(#[0-9]+)|(" + _.keys(entities).join('|') + '));', 'gi'); + onceAnim = _.once(function onAnimateEnd(){ + if(tid) clearTimeout(tid); - _.convertEntity = function(chr){ + dom.off(node, animationEnd, onceAnim) + dom.off(node, transitionEnd, onceAnim) - return ("" + chr).replace(rEntity, function(all, hex, dec, capture){ - var charCode; - if( dec ) charCode = parseInt( dec.slice(1), 10 ); - else if( hex ) charCode = parseInt( hex.slice(2), 16 ); - else charCode = entities[capture] + callback(); - return String.fromCharCode( charCode ) }); + dom.on( node, animationEnd, onceAnim ) + dom.on( node, transitionEnd, onceAnim ) + + return onceAnim; } - // simple get accessor + /** + * get maxtimeout + * @param {Node} node + * @return {[type]} [description] + */ + function getMaxTimeout(node){ + var timeout = 0, + tDuration = 0, + tDelay = 0, + aDuration = 0, + aDelay = 0, + ratio = 5 / 3, + styles ; - _.createObject = function(o, props){ - function Foo() {} - Foo.prototype = o; - var res = new Foo; - if(props) _.extend(res, props); - return res; - } + if(window.getComputedStyle){ - _.createProto = function(fn, o){ - function Foo() { this.constructor = fn;} - Foo.prototype = o; - return (fn.prototype = new Foo()); + styles = window.getComputedStyle(node), + tDuration = getMaxTime( styles[transitionProperty + 'Duration']) || tDuration; + tDelay = getMaxTime( styles[transitionProperty + 'Delay']) || tDelay; + aDuration = getMaxTime( styles[animationProperty + 'Duration']) || aDuration; + aDelay = getMaxTime( styles[animationProperty + 'Delay']) || aDelay; + timeout = Math.max( tDuration+tDelay, aDuration + aDelay ); + + } + return timeout * 1000 * ratio; } + function getMaxTime(str){ + var maxTimeout = 0, time; - /** - clone - */ - _.clone = function clone(obj){ - var type = _.typeOf(obj); - if(type === 'array'){ - var cloned = []; - for(var i=0,len = obj.length; i< len;i++){ - cloned[i] = obj[i] - } - return cloned; - } - if(type === 'object'){ - var cloned = {}; - for(var i in obj) if(obj.hasOwnProperty(i)){ - cloned[i] = obj[i]; - } - return cloned; - } - return obj; - } + if(!str) return 0; - _.equals = function(now, old){ - var type = typeof now; - if(type === 'number' && typeof old === 'number'&& isNaN(now) && isNaN(old)) return true - return now === old; - } + str.split(",").forEach(function(str){ - var dash = /-([a-z])/g; - _.camelCase = function(str){ - return str.replace(dash, function(all, capture){ - return capture.toUpperCase(); - }) + time = parseFloat(str); + if( time > maxTimeout ) maxTimeout = time; + + }); + + return maxTimeout; } + module.exports = animate; +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { - _.throttle = function throttle(func, wait){ - var wait = wait || 100; - var context, args, result; - var timeout = null; - var previous = 0; - var later = function() { - previous = +new Date; - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function() { - var now = + new Date; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; + // some nested operation in ast + // -------------------------------- - // hogan escape - // ============== - _.escape = (function(){ - var rAmp = /&/g, - rLt = //g, - rApos = /\'/g, - rQuot = /\"/g, - hChars = /[&<>\"\']/; + var dom = __webpack_require__(17); + var animate = __webpack_require__(19); - return function(str) { - return hChars.test(str) ? - str - .replace(rAmp, '&') - .replace(rLt, '<') - .replace(rGt, '>') - .replace(rApos, ''') - .replace(rQuot, '"') : - str; - } - })(); + var combine = module.exports = { - _.cache = function(max){ - max = max || 1000; - var keys = [], - cache = {}; - return { - set: function(key, value) { - if (keys.length > this.max) { - cache[keys.shift()] = undefined; - } - // - if(cache[key] === undefined){ - keys.push(key); + // get the initial dom in object + node: function(item){ + var children,node, nodes; + if(!item) return; + if(item.element) return item.element; + if(typeof item.node === "function") return item.node(); + if(typeof item.nodeType === "number") return item; + if(item.group) return combine.node(item.group) + if(children = item.children){ + if(children.length === 1){ + return combine.node(children[0]); } - cache[key] = value; - return value; - }, - get: function(key) { - if (key === undefined) return cache; - return cache[key]; - }, - max: max, - len:function(){ - return keys.length; + nodes = []; + for(var i = 0, len = children.length; i < len; i++ ){ + node = combine.node(children[i]); + if(Array.isArray(node)){ + nodes.push.apply(nodes, node) + }else if(node) { + nodes.push(node) + } + } + return nodes; } - }; - } + }, + // @TODO remove _gragContainer + inject: function(node, pos ){ + var group = this; + var fragment = combine.node(group.group || group); + if(node === false) { + animate.remove(fragment) + return group; + }else{ + if(!fragment) return group; + if(typeof node === 'string') node = dom.find(node); + if(!node) throw Error('injected node is not found'); + // use animate to animate firstchildren + animate.inject(fragment, node, pos); + } + // if it is a component + if(group.$emit) { + var preParent = group.parentNode; + var newParent = (pos ==='after' || pos === 'before')? node.parentNode : node; + group.parentNode = newParent; + group.$emit("$inject", node, pos, preParent); + } + return group; + }, - // // setup the raw Expression - // _.touchExpression = function(expr){ - // if(expr.type === 'expression'){ - // } - // return expr; - // } + // get the last dom in object(for insertion operation) + last: function(item){ + var children = item.children; + if(typeof item.last === "function") return item.last(); + if(typeof item.nodeType === "number") return item; - // handle the same logic on component's `on-*` and element's `on-*` - // return the fire object - _.handleEvent = function(value, type ){ - var self = this, evaluate; - if(value.type === 'expression'){ // if is expression, go evaluated way - evaluate = value.get; - } - if(evaluate){ - return function fire(obj){ - self.$update(function(){ - var data = this.data; - data.$event = obj; - var res = evaluate(self); - if(res === false && obj && obj.preventDefault) obj.preventDefault(); - data.$event = undefined; - }) + if(children && children.length) return combine.last(children[children.length - 1]); + if(item.group) return combine.last(item.group); + + }, + destroy: function(item, first){ + if(!item) return; + if(Array.isArray(item)){ + for(var i = 0, len = item.length; i < len; i++ ){ + combine.destroy(item[i], first); + } } - }else{ - return function fire(){ - var args = slice.call(arguments) - args.unshift(value); - self.$update(function(){ - self.$emit.apply(self, args); - }) + var children = item.children; + if(typeof item.destroy === "function") return item.destroy(first); + if(typeof item.nodeType === "number" && first) dom.remove(item); + if(children && children.length){ + combine.destroy(children, true); + item.children = null; } } - } - - // only call once - _.once = function(fn){ - var time = 0; - return function(){ - if( time++ === 0) fn.apply(this, arguments); - } - } - _.fixObjStr = function(str){ - if(str.trim().indexOf('{') !== 0){ - return '{' + str + '}'; - } - return str; } - _.map= function(array, callback){ - var res = []; - for (var i = 0, len = array.length; i < len; i++) { - res.push(callback(array[i], i)); + // @TODO: need move to dom.js + dom.element = function( component, all ){ + if(!component) return !all? null: []; + var nodes = combine.node( component ); + if( nodes.nodeType === 1 ) return all? [nodes]: nodes; + var elements = []; + for(var i = 0; i true - * isArray(arguments); - * // > false - * isArray(''); - * // > false - * - * @param {mixed} val - * @return {bool} - */ - - module.exports = isArray || function (val) { - return !! val && '[object Array]' == str.call(val); - }; + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } /***/ }, -/* 47 */ +/* 46 */ /***/ function(module, exports, __webpack_require__) { exports.read = function(buffer, offset, isLE, mLen, nBytes) { @@ -14031,6 +14018,45 @@ }; +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * isArray + */ + + var isArray = Array.isArray; + + /** + * toString + */ + + var str = Object.prototype.toString; + + /** + * Whether or not the given `val` + * is an array. + * + * example: + * + * isArray([]); + * // > true + * isArray(arguments); + * // > false + * isArray(''); + * // > false + * + * @param {mixed} val + * @return {bool} + */ + + module.exports = isArray || function (val) { + return !! val && '[object Array]' == str.call(val); + }; + + /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { diff --git a/test/spec/browser-list.js b/test/spec/browser-list.js index b735954..4021325 100644 --- a/test/spec/browser-list.js +++ b/test/spec/browser-list.js @@ -878,6 +878,30 @@ it("list with else should also works under track mode", function(){ }) + it("list Object also accept #else stateman", function(){ + var component = new Regular({ + template: "
\ + {#list json as item by item_key}\ +
{item.age}:{item_key}:{item_index}
\ + {#else}
\ + {/list}\ +
", + data: { json: obj} + }) + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + component.$update('json', null); + + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(1); + expect(divs[0].id).to.equal('notfound'); + + component.$update('json', arr); + var divs = nes.all('div', component.$refs.container ); + expect(divs.length).to.equal(3); + + }) + }) })