From e7ad9c6d368c17d8dbd52b6cd4db22949a50ca1d Mon Sep 17 00:00:00 2001 From: leeluolee <87399126@163.com> Date: Thu, 4 Sep 2014 16:58:19 +0800 Subject: [PATCH] merge r-model --- README.md | 12 ++++---- dist/regular.js | 52 ++++++++++++++++++---------------- dist/regular.min.js | 4 +-- src/directive/form.js | 34 +++++++++------------- src/helper/watcher.js | 1 + src/walkers.js | 17 ++++++++--- test/regular.js | 52 ++++++++++++++++++---------------- test/spec/browser-directive.js | 34 +++++++++++++++++++++- test/spec/browser-list.js | 2 ++ 9 files changed, 124 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 161e38b..a61b1f0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![logo](http://regularjs.github.io//asserts/image/regular-icon-100.png) + # regular = react(ractive) + angular. @@ -24,10 +24,10 @@ __template__ ```html {{#list notes as c}} -

{{c.content}}remove

+ &amp;lt;p>{{c.content}}&amp;lt;a href='#' on-click={{this.remove(c)}}>remove&amp;lt;/a>&amp;lt;/p> {{/list}} - - +&amp;lt;textarea r-model={{draftComment}}>&amp;lt;/textarea> +&amp;lt;button on-click={{this.add()}}>new Note&amp;lt;/button> ``` __javascript__ @@ -59,7 +59,7 @@ then you can find `regular.js` and `regular.min.js` in `dist` folder; or.... ```html - +&amp;lt;script src="https://rawgit.com/regularjs/regular/master/dist/regular.min.js">&amp;lt;/script> ``` @@ -119,7 +119,7 @@ IE7+ and other modern browser. __In fact, most of our products need to support I 1. `@(Expression)` to create binding-once Expression 2. lightweight animation support 3. svg support - 4. `{{#if }}` can be used in tag. like `
` + 4. `{{#if }}` can be used in tag. like `&amp;lt;div {{#if !user }} on-click = {{this.login()}}{{/if}}>&amp;lt;/div>` ## TODO diff --git a/dist/regular.js b/dist/regular.js index fbb0070..fb602e6 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1470,6 +1470,19 @@ walkers.element = function(ast){ var child; + if(group && !_.isVoidTag(ast.tag)){ + dom.inject( combine.node(group) , element) + } + + // sort before + attrs.sort(function(a1, a2){ + var d1 = Constructor.directive(a1.name), + d2 = Constructor.directive(a2.name); + if(d1 && d2) return (d2.priority || 1) - (d1.priority || 1); + if(d1) return 1; + if(d2) return -1; + return -1; + }) // may distinct with if else var destroies = walkAttributes.call(this, attrs, element, destroies); @@ -1480,10 +1493,6 @@ walkers.element = function(ast){ type: "element", group: group, node: function(){ - if(!res.init && group && !_.isVoidTag(ast.tag)){ - animate.inject( combine.node(group) , element) - res.init = true; - } return element; }, last: function(){ @@ -3318,6 +3327,7 @@ var methods = { get = expr.get; once = expr.once || expr.constant; } + this._watchers.push({ id: uid, get: get, @@ -3996,12 +4006,10 @@ function initSelect( elem, parsed){ self.$update(); inProgress = false; } - dom.on(elem, "change", handler); - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }); + + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ dom.off(elem, "change", handler); } @@ -4044,11 +4052,9 @@ function initText(elem, parsed){ dom.on(elem, "cut", handler) dom.on(elem, "change", handler) } - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }) + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ if(dom.msie !== 9 && "oninput" in dom.tNode ){ elem.removeEventListener("input", handler ); @@ -4080,12 +4086,10 @@ function initCheckBox(elem, parsed){ inProgress = false; } if(parsed.set) dom.on(elem, "change", handler) - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.checked); - } - }); + if(parsed.get(self) === undefined){ + parsed.set(self, !!elem.checked); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) @@ -4113,11 +4117,9 @@ function initRadio(elem, parsed){ } if(parsed.set) dom.on(elem, "change", handler) // beacuse only after compile(init), the dom structrue is exsit. - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - if(elem.checked) parsed.set(self, elem.value); - } - }); + if(parsed.get(self) === undefined){ + if(elem.checked) parsed.set(self, elem.value); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) diff --git a/dist/regular.min.js b/dist/regular.min.js index 0661289..bc7b55d 100644 --- a/dist/regular.min.js +++ b/dist/regular.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function t(e,n,r){function i(){r=r||e,n=n||"root";var t=new Error('Failed to require "'+r+'" from "'+n+'"');throw t.path=r,t.parent=n,t.require=!0,t}var s=t.resolve(e);if(null==s)return void i();var o=t.modules[s];if(!o._resolving&&!o.exports){var a={};a.exports={},a.client=a.component=!0,o._resolving=!0,o.call(this,a.exports,t.relative(s),a),delete o._resolving,o.exports=a.exports}return o.exports}t.modules={},t.aliases={},t.exts=["",".js",".json","/index.js","/index.json"],t.resolve=function(e){"/"===e.charAt(0)&&(e=e.slice(1));for(var n=0;5>n;n++){var r=e+t.exts[n];if(t.modules.hasOwnProperty(r))return r;if(t.aliases.hasOwnProperty(r))return t.aliases[r]}},t.normalize=function(t,e){var n=[];if("."!=e.charAt(0))return e;t=t.split("/"),e=e.split("/");for(var r=0;ru;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?s[t]=e:"regexp"===i&&(e.regexp=t,s.__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=v.plugin(t)),"function"!=typeof t?this:(t(this,v),this)},expression:f.expression,parse:f.parse,Parser:i,Lexer:r,_addProtoInheritCache:function(t){if(Array.isArray(t))return t.forEach(v._addProtoInheritCache);var e="_"+t+"s";v._protoInheritCache.push(t),v[e]={},v[t]=function(n,r){var i=this[e];if("object"==typeof n){for(var s in n)n.hasOwnProperty(s)&&this[t](s,n[s]);return this}return null==r?i[n]:(i[n]=r,this)}},_inheritConfig:function(t,e){var n=v._protoInheritCache,r=a.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=a.createObject(e[r]))}),t}}),u(v),v._addProtoInheritCache(["filter","component"]),c.mixTo(v),l.mixTo(v),v.implement({init:function(){},destroy:function(){this.$emit({type:"destroy",stop:!0}),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._events=null,this.$off()},$compile:function(t,e){"string"==typeof t&&(t=new i(t).parse());var n,r=e&&e.record;r&&this._record();var s=this._walk(t,e);if(r){n=this._release();var o=this;n.length&&(s.ondestroy=function(){o.$unwatch(n)})}return s},$bind:function(t,e,n){var r=a.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,s=e.length;s>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(){},$get:function(t){return f.expression(t).get(this)},$inject:function(t,e){var n=h.node(this);if("string"==typeof t&&(t=s.find(t)),!t)throw"injected node is not found";return n?(s.inject(n,t,e),this.$emit("inject",t),this.parentNode=Array.isArray(n)?n[0].parentNode:n.parentNode,this):void 0},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof v))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=f.expression(e),n=f.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 s=t.$watch(n,function(t){r.$update(e,t)});this.$on("destroy",t.$unwatch.bind(t,s))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===a.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new o(n)}return"string"==typeof t?p.createTextNode(t):m[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$root=this.$root,t.$parent=this},_handleEvent:function(t,e,n,r){var i,o=this.constructor,u="function"!=typeof n?a.handleEvent.call(this,n,e):n,c=o.event(e);return c?i=c.call(this,t,u,r):s.on(t,e,u),c?i:function(){s.off(t,e,u)}},_f_:function(t){var e=this.constructor,n=e.filter(t);if("function"!=typeof n)throw"filter "+t+"is undefined";return n},_sg_:function(t,e){var n=this.computed,r=n[t];if(r){if(r.get)return r.get(this);a.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","error")}return e},_ss_:function(t,e,n,r){var i,s=this.computed,r=r||"=",o=s[t];if("="!==r)switch(i=o?o.get(this):n[t],r){case"+=":e=i+e;break;case"-=":e=i-e;break;case"*=":e=i*e;break;case"/=":e=i/e;break;case"%=":e=i%e}if(o){if(o.set)return o.set(this,e);a.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","error")}return n[t]=e,e}}),v.prototype.inject=v.prototype.$inject,n.exports=v;var g=function(){function t(t){return function(e){var n=e.$context;return t.call(n,n.data)}}function e(t){return function(e,n){var r=e.$context;return t.call(r,n,r.data),n}}return function(n){if(n){var r,i,s,o={};for(var a in n)r=n[a],s=typeof r,"expression"!==r.type?"string"===s?o[a]=f.expression(r):(i=o[a]={type:"expression"},"function"===s?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[a]=r;return o}}}()}),t.register("regularjs/src/util.js",function(t,e,n){e("./helper/shim.js");var r=n.exports,i=[].slice,s=({}.toString,"undefined"!=typeof window?window:global);r.noop=function(){},r.uid=function(){var t=0;return function(){return t++}}(),r.varName="_d_",r.setName="_p_",r.ctxName="_c_",r.rWord=/^[\$\w]+$/,r.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,r.nextTick="function"==typeof setImmediate?setImmediate.bind(s):function(t){setTimeout(t,0)};var o="var "+r.ctxName+"=context.$context||context;var "+r.varName+"=context.data;";r.host="data",r.slice=function(t,e,n){for(var r=[],i=e||0,s=n||t.length;s>i;i++){var o=t[i];r.push(o)}return r},r.typeOf=function(t){return null==t?String(t):{}.toString.call(t).slice(8,-1).toLowerCase()},r.extend=function(t,e,n){if("array"===r.typeOf(n))for(var i=0,s=n.length;s>i;i++){var o=n[i];t[o]=e[o]}else for(var i in e)("undefined"==typeof t[i]||n===!0)&&(t[i]=e[i]);return t},r.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 s=(t[r]||"").length;if(n+s>e)return{num:r,line:t[r],start:e-n};n=n+s+1}}var e=/\r\n|[\n\r\u2028\u2029]/g;return function(n,r){r>n.length-1&&(r=n.length-1),e.lastIndex=0;var i=n.split(e),s=t(i,r),o=s.line.length,a=s.start-10;0>a&&(a=0);var u=s.start+10;u>o&&(u=o);var c=s.line.slice(a,u),h=s.num+1+"> "+(a>0?"...":""),l=o>u?"...":"";return h+c+l+"\n"+new Array(s.start+h.length+1).join(" ")+"^"}}();var a=/\((\?\!|\?\:|\?\=)/g;r.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(a);for(i=i?i.length:0;r--;){var s=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===s&&e++,")"===s&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},r.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})},r.createObject=function(t,e){function n(){}n.prototype=t;var i=new n;return e&&r.extend(i,e),i},r.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},r.clone=function(t){var e=r.typeOf(t);if("array"===e){for(var n=[],i=0,s=t.length;s>i;i++)n[i]=t[i];return n}if("object"===e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}return t},r.equals=function(t,e){var n=r.typeOf(t);if("array"===n){var i=u(t,e||[]);return i}return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var u=function(){function t(t,e){return t===e}function e(e,n){for(var r=e.length,i=n.length,s=[],o=0;r>=o;o++)s.push([o]);for(var a=1;i>=a;a++)s[0][a]=a;for(var o=1;r>=o;o++)for(var a=1;i>=a;a++)s[o][a]=t(e[o-1],n[a-1])?s[o-1][a-1]:Math.min(s[o-1][a]+1,s[o][a-1]+1);return s}function n(t,n){for(var r=e(n,t),i=n.length,s=i,o=t.length,a=o,u=[],c=r[s][a];s>0||a>0;)if(0!==s)if(0!==a){var h=r[s-1][a-1],l=r[s-1][a],f=r[s][a-1],p=Math.min(f,l,h);p===l?(u.unshift(2),s--,c=l):p===h?(h===c?u.unshift(0):(u.unshift(1),c=h),s--,a--):(u.unshift(3),a--,c=f)}else u.unshift(2),s--;else u.unshift(3),a--;var d=0,v=3,m=2,g=1,i=0;o=0;for(var y=[],x={index:null,add:0,removed:[]},s=0;s0?null===x.index&&(x.index=o):null!=x.index&&(y.push(x),x={index:null,add:0,removed:[]}),u[s]){case d:i++,o++;break;case v:x.add++,o++;break;case m:x.removed.push(n[i]),i++;break;case g:x.add++,x.removed.push(n[i]),i++,o++}return null!=x.index&&y.push(x),y}return n}();r.throttle=function(t,e){var n,r,i,e=e||100,s=null,o=0,a=function(){o=+new Date,s=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(s),s=null,o=u,i=t.apply(n,r),n=r=null):s||(s=setTimeout(a,c)),i}},r.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,s=/[&<>\"\']/;return function(o){return s.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),r.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}}},r.touchExpression=function(t){return"expression"===t.type&&(t.get||(t.get=new Function("context",o+"return ("+t.body+")"),t.body=null,t.setbody&&(t.set=function(e,n){return t.setbody&&(t.set=new Function("context",r.setName,o+t.setbody),t.setbody=null),t.set(e,n)}))),t},r.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.data.$event=t;var r=e(n);r!==!0&&t&&t.preventDefault&&t.preventDefault(),delete n.data.$event,n.$update()}:function(){var e=i.call(arguments);e.unshift(t),n.$emit.apply(n.$context,e),n.$update()}},r.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},r.log=function(t,e){window.console&&window.console[e||"log"](t)},r.isVoidTag=r.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),r.isBooleanAttr=r.makePredicate("selected checked disabled readOnly required open autofocus controls autoplay compact loop defer multiple"),r.isFalse-function(){return!1},r.isTrue-function(){return!0},r.assert=function(t,e){if(!t)throw e},r.defineProperty=function(){}}),t.register("regularjs/src/walkers.js",function(t,e,n){function r(t,e){for(var n=[],r=0,i=t.length;i>r;r++){var s=this._walk(t[r],{element:e,fromElement:!0,attrs:t});s&&n.push(s)}return n}var i=(e("./parser/node.js"),e("./dom.js")),s=e("./helper/animate.js"),o=e("./group.js"),a=e("./util"),u=e("./helper/combine.js"),c=n.exports={};c.list=function(t){function e(t,e){if(e&&e.length){for(var n=0,r=t.length,o=(e[0].index,0);ov;v++){var m=l.get(v+1);m.data[f]=v}for(var g=0,y=c.removed.length;y>g;g++){var x=l.children.splice(d+1,1)[0];x.destroy(!0)}for(var _=d;_n?0:n}if(r>n)for(var o=n;r>o;o++){var j=l.get(o+1);j.data[f]=o}}}var n=c.Regular,r=document.createComment("Regular list"),i=n.extend({template:t.body,$context:this.$context});n._inheritConfig(i,this.constructor);var h=this,l=new o;l.push(r);{var f=t.variable+"_index",p=t.variable;this.$watch(t.sequence,e)}return l},c.template=function(t){var e,e,n=t.content,r=document.createComment("template"),i=new o;if(i.push(r),n){var a=this;this.$watch(n,function(t){(e=i.get(1))&&(e.destroy(!0),i.children.pop()),i.push(e=a.$compile(t,{record:!0})),r.parentNode&&s.inject(u.node(e),r,"before")})}return i};var h=0;c["if"]=function(t,e){var n,r,i=this;if(e&&e.element){var a=function(s){s?(r&&u.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element}))):(n&&u.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element})))};return this.$watch(t.test,a,{force:!0}),{destroy:function(){n?u.destroy(n):r&&u.destroy(r)}}}var n,r,c=document.createComment("Regular if"+h++),l=new o;l.push(c);var f=null,a=function(e){var o=!!e;o!==f&&(f=o,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),o?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0}),l.push(n),c.parentNode&&s.inject(u.node(n),c,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0}),l.push(r),c.parentNode&&s.inject(u.node(r),c,"before")))};return this.$watch(t.test,a,{force:!0}),l},c.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){i.text(e,""+(null==t?"":String(t)))}),e},c.text=function(t){var e=document.createTextNode(t.text);return e};var l=/^on-(.+)$/;c.element=function(t){var e,n,o=t.attrs,c=this,h=this.constructor,f=t.children,p=h.component(t.tag);if(f&&f.length&&(n=this.$compile(f)),p){for(var d,v={},m=0,g=o.length;g>m;m++){var y=o[m],x=y.value||"";a.touchExpression(x);var _=y.name,T=_.match(l);T?(d=d||{},d[T[1]]=a.handleEvent.call(this,x,T[1])):"expression"!==x.type&&(v[y.name]=x)}var E;t.children&&(E=this.$compile(t.children));for(var e=new p({data:v,events:d,$body:E,$parent:this}),m=0,g=o.length;g>m;m++){var y=o[m],x=y.value||"";"expression"===x.type&&-1===y.name.indexOf("on-")&&(this.$watch(x,e.$update.bind(e,y.name)),x.set&&e.$watch(y.name,c.$update.bind(c,x)))}return e}if("r-content"===t.tag&&this.$body)return this.$body;"svg"===t.tag&&(this._ns_="svg");var w=i.create(t.tag,this._ns_,o),N=r.call(this,o,w,N);"svg"===t.tag&&(this._ns_=null);var j={type:"element",group:n,node:function(){return j.init||!n||a.isVoidTag(t.tag)||(s.inject(u.node(n),w),j.init=!0),w},last:function(){return w},destroy:function(t){t&&s.remove(w,n?n.destroy.bind(n):a.noop),N.length&&N.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}};return j},c.attribute=function(t,e){var n=t,r=this.constructor,s=this,o=e.element,u=n.name,c=n.value||"",h=r.directive(u);if(a.touchExpression(c),h&&h.link){var l=h.link.call(s,o,c,u,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===c.type?this.$watch(c,function(t){i.attr(o,u,t)}):a.isBooleanAttr(u)?i.attr(o,u,!0):i.attr(o,u,c),e.fromElement?void 0:{destroy:function(){i.attr(o,u,null)}}}}),t.register("regularjs/src/env.js",function(t,e){var n=e("./util");t.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),t.transition=void 0,t.exprCache=n.cache(100),t.isRunning=!1}),t.register("regularjs/src/index.js",function(t,e,n){n.exports=e("./Regular.js"),e("./directive/base.js"),e("./directive/animation.js"),e("./module/timeout.js"),n.exports.dom=e("./dom.js"),n.exports.util=e("./util.js")}),t.register("regularjs/src/dom.js",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 s(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(d.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+v.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+v.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,a,u=n.exports,c=e("./env.js"),h=e("./util"),l=document.createElement("div"),f=function(){};u.body=document.body,u.doc=document,u.tNode=l,l.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},a=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},a=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",Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,s=r.length;s>i;i++)t.appendChild(r[i])}var o,a;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(a=e.nextSibling)?a.parentNode.insertBefore(t,a):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,n){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e="http://www.w3.org/2000/svg"}if("input"===t&&u.msie<9){for(var r="")}catch(o){return document.createElement("input")}}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var p={"class":function(t,e){"className"in t?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)||f).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)p[e]?p[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){n.call(t,new s(e))},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),a(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 s in e)e.hasOwnProperty(s)&&u.css(t,s,e[s])},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 d=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,v=document;v=v.compatMode&&"CSS1Compat"!==v.compatMode?v.body:v.documentElement,h.extend(s.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropgation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropgation: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 m;u.nextReflow=function(t){u.nextFrame(function(){m=document.body.offsetWidth,t()})}}),t.register("regularjs/src/group.js",function(t,e,n){function r(t){this.children=t||[]}var i=e("./util"),s=e("./helper/combine");i.extend(r.prototype,{destroy:function(t){s.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)}}),n.exports=r}),t.register("regularjs/src/parser/Lexer.js",function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?p:d,this.states=["INIT"],this.opts.state&&this.states.push(this.opts.state)}function s(t){for(var e,n,r={},i=0,s=t.length;s>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]?a.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,s,o,u,c,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,s=[];for(var p=0,d=i.length;d>p;p++)h=i[p],u=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===a.typeOf(u)&&(u=u.toString().slice(1,-1)),u=u.replace(/\{(\w+)\}/g,e),c=a.findSubCapture(u)+1,n.links.push([n.curIndex,c,o]),n.curIndex+=c,s.push(u);n.TRUNK=new RegExp("^(?:("+s.join(")|(")+"))")}return t}var a=e("../util.js"),u=/a|(b)/.exec("a"),c=u&&void 0===u[1]?function(t){return void 0!==t}:function(t){return!!t},h=i.prototype;h.lex=function(t){t=(t||this.input).trim();var e,n,r,i,s,o=[];this.input=t,this.index=0;for(var a=0;t;)a++,s=this.state(),e=this.map[s],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},h.error=function(t){throw"Parse Error: "+t+":\n"+a.trackErrorPos(this.input,this.index)},h._process=function(t,e,n){for(var r,i=e.links,s=!1,o=i.length,a=0;o>a;a++){var u=i[a],h=u[2],l=u[0];if(c(t[l])){s=!0,h&&(r=h.apply(this,t.slice(l,l+u[1])),r&&(r.pos=this.index));break}}if(!s)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},h.enter=function(t){return this.states.push(t),this},h.state=function(){var t=this.states;return t[t.length-1]},h.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()};var l={BEGIN:"{{",END:"}}",NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\f ]/},f={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<>]*?(?=<)/,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 ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e.toLowerCase()}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f ]*>/,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]*?)--\>/,null,"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(){return this.leave("JST"),{type:"END"}},"JST"],JST_CLOSE:[/{BEGIN}\s*\/\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,e){var n="="===e;return{type:"EXPR_OPEN",escape:n}},"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"]},p=s([f.ENTER_JST,f.ENTER_TAG,f.TEXT,f.TAG_NAME,f.TAG_OPEN,f.TAG_CLOSE,f.TAG_PUNCHOR,f.TAG_ENTER_JST,f.TAG_UNQ_VALUE,f.TAG_STRING,f.TAG_SPACE,f.TAG_COMMENT,f.JST_OPEN,f.JST_CLOSE,f.JST_COMMENT,f.JST_EXPR_OPEN,f.JST_IDENT,f.JST_SPACE,f.JST_LEAVE,f.JST_NUMBER,f.JST_PUNCHOR,f.JST_STRING,f.JST_COMMENT]),d=s([f.ENTER_JST2,f.TEXT,f.JST_COMMENT,f.JST_OPEN,f.JST_CLOSE,f.JST_EXPR_OPEN,f.JST_IDENT,f.JST_SPACE,f.JST_LEAVE,f.JST_NUMBER,f.JST_PUNCHOR,f.JST_STRING,f.JST_COMMENT]);n.exports=i}),t.register("regularjs/src/parser/node.js",function(t,e,n){n.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e){return{type:"attribute",name:t,value:e}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n){return{type:"list",sequence:t,variable:e,body:n}},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}}}}),t.register("regularjs/src/parser/Parser.js",function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new o(t,e).lex(),this.pos=0,this.noComputed=e.noComputed,this.length=this.tokens.length}var i=e("../util.js"),s=e("./node.js"),o=e("./Lexer.js"),a=i.varName,u=i.ctxName,c=i.makePredicate("STRING IDENT NUMBER"),h=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),l=r.prototype;l.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},l.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]},l.la=function(t){return(this.ll(t)||"").type},l.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))},l.error=function(t,e){throw t="Parse Error: "+t+":\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},l.next=function(t){t=t||1,this.pos+=t},l.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},l.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},l.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 s.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();case"PART_OPEN":return this.template();default:this.error("Unexpected token: "+this.la())}},l.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")),s.element(t,e,n)},l.xentity=function(t){var e,n=t.value;return"NAME"===t.type?(this.eat("=")&&(e=this.attvalue()),s.attribute(n,e)):("if"!==n&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+n+" is invalid"),this["if"](!0))},l.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},l.attvalue=function(){var t=this.ll();switch(t.type){case"NAME":case"UNQ":case"STRING":this.next();var e=t.value;if(~e.indexOf("{{")){var n=!0,i=new r(e,{mode:2}).parse();if(1===i.length&&"expression"===i[0].type)return i[0];var o=[];i.forEach(function(t){t.constant||(n=!1),o.push(t.body||"'"+t.text+"'")}),o="["+o.join(",")+"].join('')",e=s.expression(o,null,n)}return e;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},l.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},l.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},l.include=function(){var t=this.expression();return this.match("END"),s.template(t)},l["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,o=t?"attrs":"statement";this.match("END");for(var a,u;!(u=this.eat("CLOSE"));)if(a=this.ll(),"OPEN"===a.type)switch(a.value){case"else":i=r,this.next(),this.match("END"); -break;case"elseif":return this.next(),r.push(this["if"](t)),s["if"](e,n,r);default:i.push(this[o](!0))}else i.push(this[o](!0));return"if"!==u.value&&this.error("Unmatched if directive"),s["if"](e,n,r)},l.list=function(){var t,e,n=this.expression(),r=[],i=[],o=r;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(o=i,this.match("END")):o.push(this.statement());return"list"!==e.value&&this.error("expect {{/list}} got {{/"+e.value+"}}",e.pos),s.list(n,t,r,i)},l.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},l.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return s.expression(e,n,!this.depend.length)},l.filter=function(){var t,e,n=this.assign(),r=this.eat("|");if(r){t=["(function(){","var ",e="_f_","=",n.get,";"];do t.push(e+" = "+u+"._f_('"+this.match("IDENT").value+"')("+e),t.push(this.eat(":")?", "+this.arguments("|").join(",")+");":");");while(r=this.eat("|"));return t.push("return "+e+"})()"),this.getset(t.join(""))}return n},l.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("_p_",this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},l.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},l.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},l.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},l.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},l.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},l.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},l.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},l.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},l.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},l.member=function(t,e,n){var r,s,o=!1;if(t)"string"==typeof e&&c(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{s=this.primary();var h=typeof s;"string"===h?(n=[],n.push(s),e=s,t=u+"._sg_('"+s+"', "+a+"['"+s+"'])",o=!0):"this"===s.get?(t=u,n=["this"]):(n=null,t=s.get)}if(r=this.eat(["[",".","("]))switch(r.type){case".":var l=this.match("IDENT").value;return t+="['"+l+"']",this.member(t,l,n);case"[":return s=this.assign(),t+="["+s.get+"]",this.match("]"),this.member(t,s,n);case"(":var f=this.arguments().join(",");return t=t+"("+f+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var p={get:t};return e&&(p.set=o?u+"._ss_('"+s+"',"+i.setName+","+i.varName+", '=')":t+"="+i.setName),p},l.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},l.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(),h(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},l.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("")}},l.array=function(){for(var t,e=[this.match("[").type];(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");return e.push(this.match("]").type),{get:e.join("")}},l.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},l.getset=function(t,e){return{get:t,set:e}},n.exports=r}),t.register("regularjs/src/helper/extend.js",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]=a(e[i])&&a(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var s=e("../util.js"),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,a=function(t){return"function"==typeof t};n.exports=function u(t){function e(){o.apply(this,arguments)}function n(t){return i(r,t,a),this}t=t||{};var r,o=this,a=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=u,t):(r=s.createProto(e,a),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=u,e)}}),t.register("regularjs/src/helper/shim.js",function(){function t(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}var e=[].slice,n={}.toString;t(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),t(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){for(var n=0,r=this.length;r>n;n++)t.call(e,this[n],n,this)},filter:function(t,e){for(var n=[],r=0,i=this.length;i>r;r++){var s=t.call(e,this[r],r,this);s&&n.push(this[r])}return n},map:function(t,e){for(var n=[],r=0,i=this.length;i>r;r++)n.push(t.call(e,this[r],r,this));return n}}),t(Function.prototype,{bind:function(t){var n=this,r=e.call(arguments,1);return function(){var i=r.concat(e.call(arguments));return n.apply(t,i)}}}),t(Object,{keys:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}}),t(Date,{now:function(){return+new Date}}),t(Array,{isArray:function(t){return"[object Array]"===n.call(t)}})}),t.register("regularjs/src/helper/parse.js",function(t,e,n){var r=e("../env").exprCache,i=e("../util"),s=e("../parser/Parser.js");n.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new s(t,{state:"JST",mode:2}).expression())),t?i.touchExpression(t):void 0},parse:function(t){return new s(t).parse()}}}),t.register("regularjs/src/helper/watcher.js",function(t,e,n){function r(){}var i=e("../util.js"),s=e("./parse.js").expression,o={$watch:function(t,e,n){var r,o,a;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var u=i.uid("w_");if(Array.isArray(t)){for(var c=[],h=0,l=t.length;l>h;h++)c.push(s(t[h]).get);var f=[];a=function(t){for(var e=!0,n=0,r=c.length;r>n;n++){var s=c[n](t);i.equals(s,f[n])||(e=!1,f[n]=i.clone(s))}return e?!1:f}}else t=this.$expression?this.$expression(t):s(t),r=t.get,o=t.once||t.constant;return this._watchers.push({id:u,get:r,fn:e,once:o,force:n.force,test:a,deep:n.deep}),this._records&&this._records.push(u),u},$unwatch:function(t){if(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,s=this._watchers;if(!t||!s||!(i=s.length))return;for(;i--;)r=s[i],r&&r.id===t&&s.splice(i,1)}},$digest:function(){if("digest"!==this.$phase){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw"there may a circular dependencies reaches";e>0&&this.$emit&&this.$emit("update"),this.$phase=null}},_digest:function(){var t=this._watchers,e=!1;if(t&&t.length)for(var n=0,r=t.length;r>n;n++){var s=!1,o=t[n];if(o)if(o.test){var a=o.test(this);a&&(e=!0,s=!0,o.fn.apply(this,a))}else{var u=o.get(this),c=o.last,h=!0;if("object"===i.typeOf(u)&&o.deep)if(o.last){for(var l in u)if(o.last[l]!==u[l]){h=!1;break}if(h!==!1)for(var f in c)if(c[f]!==u[f]){h=!1;break}}else h=!1;else h=i.equals(u,o.last);h===!1||o.force?(h=!1,o.force=null,s=!0,o.fn.call(this,u,o.last),o.last="object"!=typeof u||o.deep?i.clone(u):u):"array"===i.typeOf(h)&&h.length?(o.fn.call(this,u,h),s=!0,o.last=i.clone(u)):h=!0,h!==!0&&(e=!0),s&&o.once&&t.splice(n,1)}}var p=this._children;if(p&&p.length)for(var d=0,v=p.length;v>d;d++)p[d]._digest()&&(e=!0);return e},$update:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=s(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)t.hasOwnProperty(r)&&(this.data[r]=t[r])}this.$root&&this.$root.$digest()},_record:function(){this._records=[]},_release:function(){var t=this._records;return this._records=null,t}};i.extend(r.prototype,o),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,o)},n.exports=r}),t.register("regularjs/src/helper/event.js",function(t,e,n){function r(){arguments.length&&this.$on.apply(this,arguments)}var i=[].slice,s=e("../util.js"),o={$on:function(t,e){if("object"==typeof t)for(var n in t)this.$on(n,t[n]);else{var r=this._handles||(this._handles={}),i=r[t]||(r[t]=[]);i.push(e)}return this},$off:function(t,e){if(this._handles){t||(this._handles=[]);var n,r=this._handles;if(n=r[t]){if(!e)return r[t]=[],this;for(var i=0,s=n.length;s>i;i++)if(e===n[i])return n.splice(i,1),this}return this}},$emit:function(t){var e,n,r,s=this._handles;if(t){if("object"==typeof t?(r=t.type,n=t.data||[]):(n=i.call(arguments,1),r=t),!s||!(e=s[r]))return this;for(var o=0,a=e.length;a>o;o++)e[o].apply(this,n);return this}},$broadcast:function(){}};s.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,s.extend(t,o)},n.exports=r}),t.register("regularjs/src/helper/animate.js",function(t,e,n){function r(t){var e,n=0,r=0,s=0,o=0,a=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[l+"Duration"])||r,s=i(e[l+"Delay"])||s,o=i(e[f+"Duration"])||o,a=i(e[f+"Delay"])||a,n=Math.max(r+s,o+a)),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 s=e("../util"),o=e("../dom.js"),a={},u=e("../env.js"),c="transitionend",h="animationend",l="transition",f="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",l="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",l="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",f="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",f="oAnimation")),a.inject=function(t,e,n,r){if(r=r||s.noop,Array.isArray(t)){for(var i=o.fragment(),a=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){a++,a===c&&r()};for(c===a&&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()},a.remove=function(t,e){e=e||s.noop,t.onleave?t.onleave(function(){o.remove(t)}):(o.remove(t),e&&e())},a.startClassAnimate=function(t,e,n,i){var a,l,f,p;return!h&&!c||u.isRunning?n():(p=s.once(function(){f&&clearTimeout(f),2===i&&o.delClass(t,a),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}),2===i?(o.addClass(t,e),a=e.split(/\s+/).map(function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,a),l=r(t),f=setTimeout(p,l)})):o.nextReflow(function(){o.addClass(t,e),l=r(t),f=setTimeout(p,l)}),o.on(t,h,p),o.on(t,c,p),p)},a.startStyleAnimate=function(t,e,n){var i,a,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(a,i)}),a=s.once(function(){u&&clearTimeout(u),o.off(t,h,a),o.off(t,c,a),n()}),o.on(t,h,a),o.on(t,c,a),a},n.exports=a}),t.register("regularjs/src/helper/combine.js",function(t,e,n){var r=e("../dom.js"),i=n.exports={node:function(t){var e,n;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 i.node(t.group);if(e=t.children){if(1===e.length)return i.node(e[0]);for(var r=[],s=0,o=e.length;o>s;s++)n=i.node(e[s]),Array.isArray(n)?r.push.apply(r,n):r.push(n);return r}},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?i.last(e[e.length-1]):t.group?i.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,s=t.length;s>n;n++)i.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&&(i.destroy(o,!0),t.children=null)}}}}),t.register("regularjs/src/directive/base.js",function(t,e){var n=(e("../util.js"),e("../dom.js")),r=(e("../helper/animate.js"),e("../Regular.js"));e("./event.js"),e("./form.js"),r.directive("r-class",function(t,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.directive("r-style",function(t,e){this.$watch(e,function(e){for(var r in e)e.hasOwnProperty(r)&&n.css(t,r,e[r])},!0)}),r.directive("r-hide",function(t,e){var n,r=null;this.$watch(e,function(e){var i=!!e;i!==r&&(r=i,i?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()))})}),r.directive("r-html",function(t,e){this.$watch(e,function(e){e=e||"",n.html(t,e)},{force:!0})})}),t.register("regularjs/src/directive/form.js",function(t,e){function n(t,e){function n(){e.set(r,this.value),i=!0,r.$update(),i=!1}var r=this,i=!1;return this.$watch(e,function(e){if(!i){var n=o.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value===e&&(t.selectedIndex=r)})}}),a.on(t,"change",n),this.$on("init",function(){void 0===e.get(r)&&e.set(r,t.value)}),function(){a.off(t,"change",n)}}function r(t,e){var n=!1,r=this;this.$watch(e,function(e){n||t.value!==e&&(t.value=null==e?"":""+e)});var i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)o.nextTick(function(){var t=i.value;e.set(r,t),n=!0,r.$update()});else{var s=i.value;e.set(r,s),n=!0,r.$update()}n=!1};return 9!==a.msie&&"oninput"in a.tNode?t.addEventListener("input",i):(a.on(t,"paste",i),a.on(t,"keyup",i),a.on(t,"cut",i),a.on(t,"change",i)),this.$on("init",function(){void 0===e.get(r)&&e.set(r,t.value)}),function(){9!==a.msie&&"oninput"in a.tNode?t.removeEventListener("input",i):(a.off(t,"paste",i),a.off(t,"keyup",i),a.off(t,"cut",i),a.off(t,"change",i))}}function i(t,e){var n=!1,r=this;this.$watch(e,function(e){n||a.attr(t,"checked",!!e)});var i=function(){var t=this.checked;e.set(r,t),n=!0,r.$update(),n=!1};return e.set&&a.on(t,"change",i),this.$on("init",function(){void 0===e.get(r)&&e.set(r,t.checked)}),function(){e.set&&a.off(t,"change",i)}}function s(t,e){var n=this,r=!1;this.$watch(e,function(e){r||e===t.value&&(t.checked=!0)});var i=function(){var t=this.value;e.set(n,t),r=!0,n.$update(),r=!1};return e.set&&a.on(t,"change",i),this.$on("init",function(){void 0===e.get(n)&&t.checked&&e.set(n,t.value)}),function(){e.set&&a.off(t,"change",i)}}var o=e("../util.js"),a=e("../dom.js"),u=e("../Regular.js"),c={text:r,select:n,checkbox:i,radio:s};u.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=u.expression(e)),c[r]?c[r].call(this,t,e):"input"===n?c.text.call(this,t,e):void 0})}),t.register("regularjs/src/directive/animation.js",function(t,e){function n(t){var e,n=[],r=0,s=i.noop,o={type:t,start:function(t){return e=i.uid(),"function"==typeof t&&(s=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,s&&s(),s=i.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(a=m[x],d=a.split(":"),f=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),f)if(f!==u)if(f!==c){var v=o.animation(f);if(!v||!h)throw"you need start with `on` or `event` in r-animation";h.push(v.call(this,{element:t,done:h.done,param:p}))}else r(p),"leave"===p?t.onleave=h.start:"enter"===p?t.onenter=h.start:l=this._handleEvent(t,p,h.start),y.push(l?l:s(t)),l=null;else r("when"),this.$watch(p,i.bind(this,h.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var i=e("../util.js"),s=e("../helper/animate.js"),o=(e("../dom.js"),e("../Regular.js")),a=/\s+/,u="when",c="on";o._addProtoInheritCache("animation"),o.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){s.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=this;return function(r){n.$emit(e,t),r()}},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(a),i=r.shift(),s=r.join(" ");if(!i||!s)throw"invalid style in command: style";n[i]=s,e=!0}}),function(r){e?s.startStyleAnimate(t.element,n,r):r()}}}),o.directive("r-animation",r)}),t.register("regularjs/src/directive/event.js",function(t,e){function n(t,e){for(var n=t.target;n&&n!==i.doc;){for(var r=0,s=e.length;s>r;r++)e[r].element===n&&e[r].fire(t);n=n.parentNode}}var r=e("../util.js"),i=e("../dom.js"),s=e("../Regular.js");s._addProtoInheritCache("event"),s.event("enter",function(t,e){function n(t){13===t.which&&(t.preventDefault(),e(t))}return i.on(t,"keypress",n),function(){i.off(t,"keypress",n)}}),s.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),s.directive(/^delegate-\w+$/,function(t,e,s){function o(t){n(t,u[c])}var a=this.$root,u=a._delegates||(a._delegates={});if(s&&e){var c=s.split("-")[1],h=r.handleEvent.call(this,e,c);u[c]||(u[c]=[],a.$on("inject",function(t){var e=this.parentNode;e&&i.off(e,c,o),i.on(t,c,o)}),a.$on("destroy",function(){a.parentNode&&i.off(a.parentNode,c,o),a._delegates[c]=null}));var l={element:t,fire:h};return u[c].push(l),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===l&&t.splice(e,1)}}})}),t.register("regularjs/src/module/timeout.js",function(t,e){function n(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 r=e("../Regular.js");r.plugin("timeout",n)}),t.alias("regularjs/src/index.js","regularjs/index.js"),"object"==typeof exports?module.exports=t("regularjs"):"function"==typeof define&&define.amd?define(function(){return t("regularjs")}):window.Regular=t("regularjs")}(); \ No newline at end of file +!function(){"use strict";function t(e,n,r){function i(){r=r||e,n=n||"root";var t=new Error('Failed to require "'+r+'" from "'+n+'"');throw t.path=r,t.parent=n,t.require=!0,t}var s=t.resolve(e);if(null==s)return void i();var o=t.modules[s];if(!o._resolving&&!o.exports){var a={};a.exports={},a.client=a.component=!0,o._resolving=!0,o.call(this,a.exports,t.relative(s),a),delete o._resolving,o.exports=a.exports}return o.exports}t.modules={},t.aliases={},t.exts=["",".js",".json","/index.js","/index.json"],t.resolve=function(e){"/"===e.charAt(0)&&(e=e.slice(1));for(var n=0;5>n;n++){var r=e+t.exts[n];if(t.modules.hasOwnProperty(r))return r;if(t.aliases.hasOwnProperty(r))return t.aliases[r]}},t.normalize=function(t,e){var n=[];if("."!=e.charAt(0))return e;t=t.split("/"),e=e.split("/");for(var r=0;ru;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?s[t]=e:"regexp"===i&&(e.regexp=t,s.__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=v.plugin(t)),"function"!=typeof t?this:(t(this,v),this)},expression:f.expression,parse:f.parse,Parser:i,Lexer:r,_addProtoInheritCache:function(t){if(Array.isArray(t))return t.forEach(v._addProtoInheritCache);var e="_"+t+"s";v._protoInheritCache.push(t),v[e]={},v[t]=function(n,r){var i=this[e];if("object"==typeof n){for(var s in n)n.hasOwnProperty(s)&&this[t](s,n[s]);return this}return null==r?i[n]:(i[n]=r,this)}},_inheritConfig:function(t,e){var n=v._protoInheritCache,r=a.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=a.createObject(e[r]))}),t}}),u(v),v._addProtoInheritCache(["filter","component"]),c.mixTo(v),l.mixTo(v),v.implement({init:function(){},destroy:function(){this.$emit({type:"destroy",stop:!0}),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._events=null,this.$off()},$compile:function(t,e){"string"==typeof t&&(t=new i(t).parse());var n,r=e&&e.record;r&&this._record();var s=this._walk(t,e);if(r){n=this._release();var o=this;n.length&&(s.ondestroy=function(){o.$unwatch(n)})}return s},$bind:function(t,e,n){var r=a.typeOf(e);if("expression"===e.type||"string"===r)this._bind(t,e,n);else if("array"===r)for(var i=0,s=e.length;s>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(){},$get:function(t){return f.expression(t).get(this)},$inject:function(t,e){var n=h.node(this);if("string"==typeof t&&(t=s.find(t)),!t)throw"injected node is not found";return n?(s.inject(n,t,e),this.$emit("inject",t),this.parentNode=Array.isArray(n)?n[0].parentNode:n.parentNode,this):void 0},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof v))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=f.expression(e),n=f.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 s=t.$watch(n,function(t){r.$update(e,t)});this.$on("destroy",t.$unwatch.bind(t,s))}n.set(t,e.get(this))},_walk:function(t,e){if("array"===a.typeOf(t)){for(var n=[],r=0,i=t.length;i>r;r++)n.push(this._walk(t[r],e));return new o(n)}return"string"==typeof t?p.createTextNode(t):m[t.type||"default"].call(this,t,e)},_append:function(t){this._children.push(t),t.$root=this.$root,t.$parent=this},_handleEvent:function(t,e,n,r){var i,o=this.constructor,u="function"!=typeof n?a.handleEvent.call(this,n,e):n,c=o.event(e);return c?i=c.call(this,t,u,r):s.on(t,e,u),c?i:function(){s.off(t,e,u)}},_f_:function(t){var e=this.constructor,n=e.filter(t);if("function"!=typeof n)throw"filter "+t+"is undefined";return n},_sg_:function(t,e){var n=this.computed,r=n[t];if(r){if(r.get)return r.get(this);a.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","error")}return e},_ss_:function(t,e,n,r){var i,s=this.computed,r=r||"=",o=s[t];if("="!==r)switch(i=o?o.get(this):n[t],r){case"+=":e=i+e;break;case"-=":e=i-e;break;case"*=":e=i*e;break;case"/=":e=i/e;break;case"%=":e=i%e}if(o){if(o.set)return o.set(this,e);a.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","error")}return n[t]=e,e}}),v.prototype.inject=v.prototype.$inject,n.exports=v;var g=function(){function t(t){return function(e){var n=e.$context;return t.call(n,n.data)}}function e(t){return function(e,n){var r=e.$context;return t.call(r,n,r.data),n}}return function(n){if(n){var r,i,s,o={};for(var a in n)r=n[a],s=typeof r,"expression"!==r.type?"string"===s?o[a]=f.expression(r):(i=o[a]={type:"expression"},"function"===s?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):o[a]=r;return o}}}()}),t.register("regularjs/src/util.js",function(t,e,n){e("./helper/shim.js");var r=n.exports,i=[].slice,s=({}.toString,"undefined"!=typeof window?window:global);r.noop=function(){},r.uid=function(){var t=0;return function(){return t++}}(),r.varName="_d_",r.setName="_p_",r.ctxName="_c_",r.rWord=/^[\$\w]+$/,r.rSimpleAccessor=/^[\$\w]+(\.[\$\w]+)*$/,r.nextTick="function"==typeof setImmediate?setImmediate.bind(s):function(t){setTimeout(t,0)};var o="var "+r.ctxName+"=context.$context||context;var "+r.varName+"=context.data;";r.host="data",r.slice=function(t,e,n){for(var r=[],i=e||0,s=n||t.length;s>i;i++){var o=t[i];r.push(o)}return r},r.typeOf=function(t){return null==t?String(t):{}.toString.call(t).slice(8,-1).toLowerCase()},r.extend=function(t,e,n){if("array"===r.typeOf(n))for(var i=0,s=n.length;s>i;i++){var o=n[i];t[o]=e[o]}else for(var i in e)("undefined"==typeof t[i]||n===!0)&&(t[i]=e[i]);return t},r.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 s=(t[r]||"").length;if(n+s>e)return{num:r,line:t[r],start:e-n};n=n+s+1}}var e=/\r\n|[\n\r\u2028\u2029]/g;return function(n,r){r>n.length-1&&(r=n.length-1),e.lastIndex=0;var i=n.split(e),s=t(i,r),o=s.line.length,a=s.start-10;0>a&&(a=0);var u=s.start+10;u>o&&(u=o);var c=s.line.slice(a,u),h=s.num+1+"> "+(a>0?"...":""),l=o>u?"...":"";return h+c+l+"\n"+new Array(s.start+h.length+1).join(" ")+"^"}}();var a=/\((\?\!|\?\:|\?\=)/g;r.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(a);for(i=i?i.length:0;r--;){var s=t.charAt(r);(0===r||"\\"!==t.charAt(r-1))&&("("===s&&e++,")"===s&&n++)}if(e!==n)throw"RegExp: "+t+"'s bracket is not marched";return e-i},r.escapeRegExp=function(t){return t.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,function(t){return"\\"+t})},r.createObject=function(t,e){function n(){}n.prototype=t;var i=new n;return e&&r.extend(i,e),i},r.createProto=function(t,e){function n(){this.constructor=t}return n.prototype=e,t.prototype=new n},r.clone=function(t){var e=r.typeOf(t);if("array"===e){for(var n=[],i=0,s=t.length;s>i;i++)n[i]=t[i];return n}if("object"===e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}return t},r.equals=function(t,e){var n=r.typeOf(t);if("array"===n){var i=u(t,e||[]);return i}return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var u=function(){function t(t,e){return t===e}function e(e,n){for(var r=e.length,i=n.length,s=[],o=0;r>=o;o++)s.push([o]);for(var a=1;i>=a;a++)s[0][a]=a;for(var o=1;r>=o;o++)for(var a=1;i>=a;a++)s[o][a]=t(e[o-1],n[a-1])?s[o-1][a-1]:Math.min(s[o-1][a]+1,s[o][a-1]+1);return s}function n(t,n){for(var r=e(n,t),i=n.length,s=i,o=t.length,a=o,u=[],c=r[s][a];s>0||a>0;)if(0!==s)if(0!==a){var h=r[s-1][a-1],l=r[s-1][a],f=r[s][a-1],p=Math.min(f,l,h);p===l?(u.unshift(2),s--,c=l):p===h?(h===c?u.unshift(0):(u.unshift(1),c=h),s--,a--):(u.unshift(3),a--,c=f)}else u.unshift(2),s--;else u.unshift(3),a--;var d=0,v=3,m=2,g=1,i=0;o=0;for(var y=[],x={index:null,add:0,removed:[]},s=0;s0?null===x.index&&(x.index=o):null!=x.index&&(y.push(x),x={index:null,add:0,removed:[]}),u[s]){case d:i++,o++;break;case v:x.add++,o++;break;case m:x.removed.push(n[i]),i++;break;case g:x.add++,x.removed.push(n[i]),i++,o++}return null!=x.index&&y.push(x),y}return n}();r.throttle=function(t,e){var n,r,i,e=e||100,s=null,o=0,a=function(){o=+new Date,s=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(s),s=null,o=u,i=t.apply(n,r),n=r=null):s||(s=setTimeout(a,c)),i}},r.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,s=/[&<>\"\']/;return function(o){return s.test(o)?o.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):o}}(),r.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}}},r.touchExpression=function(t){return"expression"===t.type&&(t.get||(t.get=new Function("context",o+"return ("+t.body+")"),t.body=null,t.setbody&&(t.set=function(e,n){return t.setbody&&(t.set=new Function("context",r.setName,o+t.setbody),t.setbody=null),t.set(e,n)}))),t},r.handleEvent=function(t){var e,n=this;return"expression"===t.type&&(e=t.get),e?function(t){n.data.$event=t;var r=e(n);r!==!0&&t&&t.preventDefault&&t.preventDefault(),delete n.data.$event,n.$update()}:function(){var e=i.call(arguments);e.unshift(t),n.$emit.apply(n.$context,e),n.$update()}},r.once=function(t){var e=0;return function(){0===e++&&t.apply(this,arguments)}},r.log=function(t,e){window.console&&window.console[e||"log"](t)},r.isVoidTag=r.makePredicate("area base br col embed hr img input keygen link menuitem meta param source track wbr r-content"),r.isBooleanAttr=r.makePredicate("selected checked disabled readOnly required open autofocus controls autoplay compact loop defer multiple"),r.isFalse-function(){return!1},r.isTrue-function(){return!0},r.assert=function(t,e){if(!t)throw e},r.defineProperty=function(){}}),t.register("regularjs/src/walkers.js",function(t,e,n){function r(t,e){for(var n=[],r=0,i=t.length;i>r;r++){var s=this._walk(t[r],{element:e,fromElement:!0,attrs:t});s&&n.push(s)}return n}var i=(e("./parser/node.js"),e("./dom.js")),s=e("./helper/animate.js"),o=e("./group.js"),a=e("./util"),u=e("./helper/combine.js"),c=n.exports={};c.list=function(t){function e(t,e){if(e&&e.length){for(var n=0,r=t.length,o=(e[0].index,0);ov;v++){var m=l.get(v+1);m.data[f]=v}for(var g=0,y=c.removed.length;y>g;g++){var x=l.children.splice(d+1,1)[0];x.destroy(!0)}for(var _=d;_n?0:n}if(r>n)for(var o=n;r>o;o++){var j=l.get(o+1);j.data[f]=o}}}var n=c.Regular,r=document.createComment("Regular list"),i=n.extend({template:t.body,$context:this.$context});n._inheritConfig(i,this.constructor);var h=this,l=new o;l.push(r);{var f=t.variable+"_index",p=t.variable;this.$watch(t.sequence,e)}return l},c.template=function(t){var e,e,n=t.content,r=document.createComment("template"),i=new o;if(i.push(r),n){var a=this;this.$watch(n,function(t){(e=i.get(1))&&(e.destroy(!0),i.children.pop()),i.push(e=a.$compile(t,{record:!0})),r.parentNode&&s.inject(u.node(e),r,"before")})}return i};var h=0;c["if"]=function(t,e){var n,r,i=this;if(e&&e.element){var a=function(s){s?(r&&u.destroy(r),t.consequent&&(n=i.$compile(t.consequent,{record:!0,element:e.element}))):(n&&u.destroy(n),t.alternate&&(r=i.$compile(t.alternate,{record:!0,element:e.element})))};return this.$watch(t.test,a,{force:!0}),{destroy:function(){n?u.destroy(n):r&&u.destroy(r)}}}var n,r,c=document.createComment("Regular if"+h++),l=new o;l.push(c);var f=null,a=function(e){var o=!!e;o!==f&&(f=o,l.children[1]&&(l.children[1].destroy(!0),l.children.pop()),o?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0}),l.push(n),c.parentNode&&s.inject(u.node(n),c,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0}),l.push(r),c.parentNode&&s.inject(u.node(r),c,"before")))};return this.$watch(t.test,a,{force:!0}),l},c.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){i.text(e,""+(null==t?"":String(t)))}),e},c.text=function(t){var e=document.createTextNode(t.text);return e};var l=/^on-(.+)$/;c.element=function(t){var e,n,o=t.attrs,c=this,h=this.constructor,f=t.children,p=h.component(t.tag);if(f&&f.length&&(n=this.$compile(f)),p){for(var d,v={},m=0,g=o.length;g>m;m++){var y=o[m],x=y.value||"";a.touchExpression(x);var _=y.name,T=_.match(l);T?(d=d||{},d[T[1]]=a.handleEvent.call(this,x,T[1])):"expression"!==x.type&&(v[y.name]=x)}var E;t.children&&(E=this.$compile(t.children));for(var e=new p({data:v,events:d,$body:E,$parent:this}),m=0,g=o.length;g>m;m++){var y=o[m],x=y.value||"";"expression"===x.type&&-1===y.name.indexOf("on-")&&(this.$watch(x,e.$update.bind(e,y.name)),x.set&&e.$watch(y.name,c.$update.bind(c,x)))}return e}if("r-content"===t.tag&&this.$body)return this.$body;"svg"===t.tag&&(this._ns_="svg");var w=i.create(t.tag,this._ns_,o);n&&!a.isVoidTag(t.tag)&&i.inject(u.node(n),w),o.sort(function(t,e){var n=h.directive(t.name),r=h.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:-1});var N=r.call(this,o,w,N);"svg"===t.tag&&(this._ns_=null);var j={type:"element",group:n,node:function(){return w},last:function(){return w},destroy:function(t){t&&s.remove(w,n?n.destroy.bind(n):a.noop),N.length&&N.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}};return j},c.attribute=function(t,e){var n=t,r=this.constructor,s=this,o=e.element,u=n.name,c=n.value||"",h=r.directive(u);if(a.touchExpression(c),h&&h.link){var l=h.link.call(s,o,c,u,e.attrs);return"function"==typeof l&&(l={destroy:l}),l}return"expression"===c.type?this.$watch(c,function(t){i.attr(o,u,t)}):a.isBooleanAttr(u)?i.attr(o,u,!0):i.attr(o,u,c),e.fromElement?void 0:{destroy:function(){i.attr(o,u,null)}}}}),t.register("regularjs/src/env.js",function(t,e){var n=e("./util");t.svg=function(){return"undefined"!=typeof document&&document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),t.transition=void 0,t.exprCache=n.cache(100),t.isRunning=!1}),t.register("regularjs/src/index.js",function(t,e,n){n.exports=e("./Regular.js"),e("./directive/base.js"),e("./directive/animation.js"),e("./module/timeout.js"),n.exports.dom=e("./dom.js"),n.exports.util=e("./util.js")}),t.register("regularjs/src/dom.js",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 s(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(d.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+v.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+v.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,a,u=n.exports,c=e("./env.js"),h=e("./util"),l=document.createElement("div"),f=function(){};u.body=document.body,u.doc=document,u.tNode=l,l.addEventListener?(o=function(t,e,n){t.addEventListener(e,n,!1)},a=function(t,e,n){t.removeEventListener(e,n,!1)}):(o=function(t,e,n){t.attachEvent("on"+e,n)},a=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",Array.isArray(t)){var r=t;t=u.fragment();for(var i=0,s=r.length;s>i;i++)t.appendChild(r[i])}var o,a;switch(n){case"bottom":e.appendChild(t);break;case"top":(o=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(a=e.nextSibling)?a.parentNode.insertBefore(t,a):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,n){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e="http://www.w3.org/2000/svg"}if("input"===t&&u.msie<9){for(var r="")}catch(o){return document.createElement("input")}}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var p={"class":function(t,e){"className"in t?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)||f).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)p[e]?p[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){n.call(t,new s(e))},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),a(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 s in e)e.hasOwnProperty(s)&&u.css(t,s,e[s])},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 d=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,v=document;v=v.compatMode&&"CSS1Compat"!==v.compatMode?v.body:v.documentElement,h.extend(s.prototype,{immediateStop:h.isFalse,stop:function(){this.preventDefault().stopPropgation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropgation: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 m;u.nextReflow=function(t){u.nextFrame(function(){m=document.body.offsetWidth,t()})}}),t.register("regularjs/src/group.js",function(t,e,n){function r(t){this.children=t||[]}var i=e("./util"),s=e("./helper/combine");i.extend(r.prototype,{destroy:function(t){s.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)}}),n.exports=r}),t.register("regularjs/src/parser/Lexer.js",function(t,e,n){function r(t){return function(e){return{type:t,value:e}}}function i(t,e){this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?p:d,this.states=["INIT"],this.opts.state&&this.states.push(this.opts.state)}function s(t){for(var e,n,r={},i=0,s=t.length;s>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]?a.escapeRegExp(l[e]):String(l[e]).slice(1,-1)}var n,i,s,o,u,c,h;for(var f in t){n=t[f],n.curIndex=1,i=n.rules,s=[];for(var p=0,d=i.length;d>p;p++)h=i[p],u=h[0],o=h[1],"string"==typeof o&&(o=r(o)),"regexp"===a.typeOf(u)&&(u=u.toString().slice(1,-1)),u=u.replace(/\{(\w+)\}/g,e),c=a.findSubCapture(u)+1,n.links.push([n.curIndex,c,o]),n.curIndex+=c,s.push(u);n.TRUNK=new RegExp("^(?:("+s.join(")|(")+"))")}return t}var a=e("../util.js"),u=/a|(b)/.exec("a"),c=u&&void 0===u[1]?function(t){return void 0!==t}:function(t){return!!t},h=i.prototype;h.lex=function(t){t=(t||this.input).trim();var e,n,r,i,s,o=[];this.input=t,this.index=0;for(var a=0;t;)a++,s=this.state(),e=this.map[s],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},h.error=function(t){throw"Parse Error: "+t+":\n"+a.trackErrorPos(this.input,this.index)},h._process=function(t,e,n){for(var r,i=e.links,s=!1,o=i.length,a=0;o>a;a++){var u=i[a],h=u[2],l=u[0];if(c(t[l])){s=!0,h&&(r=h.apply(this,t.slice(l,l+u[1])),r&&(r.pos=this.index));break}}if(!s)switch(n.charAt(0)){case"<":this.enter("TAG");break;default:this.enter("JST")}return r},h.enter=function(t){return this.states.push(t),this},h.state=function(){var t=this.states;return t[t.length-1]},h.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()};var l={BEGIN:"{{",END:"}}",NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\f ]/},f={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<>]*?(?=<)/,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 ]+/,"UNQ","TAG"],TAG_OPEN:[/<({NAME})\s*/,function(t,e){return{type:"TAG_OPEN",value:e.toLowerCase()}},"TAG"],TAG_CLOSE:[/<\/({NAME})[\r\n\f ]*>/,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]*?)--\>/,null,"TAG"],JST_OPEN:["{BEGIN}#{SPACE}*({IDENT})",function(t,e){return{type:"OPEN",value:e}},"JST"],JST_LEAVE:[/{END}/,function(){return this.leave("JST"),{type:"END"}},"JST"],JST_CLOSE:[/{BEGIN}\s*\/\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,e){var n="="===e;return{type:"EXPR_OPEN",escape:n}},"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"]},p=s([f.ENTER_JST,f.ENTER_TAG,f.TEXT,f.TAG_NAME,f.TAG_OPEN,f.TAG_CLOSE,f.TAG_PUNCHOR,f.TAG_ENTER_JST,f.TAG_UNQ_VALUE,f.TAG_STRING,f.TAG_SPACE,f.TAG_COMMENT,f.JST_OPEN,f.JST_CLOSE,f.JST_COMMENT,f.JST_EXPR_OPEN,f.JST_IDENT,f.JST_SPACE,f.JST_LEAVE,f.JST_NUMBER,f.JST_PUNCHOR,f.JST_STRING,f.JST_COMMENT]),d=s([f.ENTER_JST2,f.TEXT,f.JST_COMMENT,f.JST_OPEN,f.JST_CLOSE,f.JST_EXPR_OPEN,f.JST_IDENT,f.JST_SPACE,f.JST_LEAVE,f.JST_NUMBER,f.JST_PUNCHOR,f.JST_STRING,f.JST_COMMENT]);n.exports=i}),t.register("regularjs/src/parser/node.js",function(t,e,n){n.exports={element:function(t,e,n){return{type:"element",tag:t,attrs:e,children:n}},attribute:function(t,e){return{type:"attribute",name:t,value:e}},"if":function(t,e,n){return{type:"if",test:t,consequent:e,alternate:n}},list:function(t,e,n){return{type:"list",sequence:t,variable:e,body:n}},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}}}}),t.register("regularjs/src/parser/Parser.js",function(t,e,n){function r(t,e){e=e||{},this.input=t,this.tokens=new o(t,e).lex(),this.pos=0,this.noComputed=e.noComputed,this.length=this.tokens.length}var i=e("../util.js"),s=e("./node.js"),o=e("./Lexer.js"),a=i.varName,u=i.ctxName,c=i.makePredicate("STRING IDENT NUMBER"),h=i.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object"),l=r.prototype;l.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},l.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]},l.la=function(t){return(this.ll(t)||"").type},l.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))},l.error=function(t,e){throw t="Parse Error: "+t+":\n"+i.trackErrorPos(this.input,"number"==typeof e?e:this.ll().pos||0),new Error(t)},l.next=function(t){t=t||1,this.pos+=t},l.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},l.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},l.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 s.text(e);case"TAG_OPEN":return this.xml();case"OPEN":return this.directive();case"EXPR_OPEN":return this.interplation();case"PART_OPEN":return this.template();default:this.error("Unexpected token: "+this.la())}},l.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")),s.element(t,e,n)},l.xentity=function(t){var e,n=t.value;return"NAME"===t.type?(this.eat("=")&&(e=this.attvalue()),s.attribute(n,e)):("if"!==n&&this.error("current version. ONLY RULE #if #else #elseif is valid in tag, the rule #"+n+" is invalid"),this["if"](!0))},l.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},l.attvalue=function(){var t=this.ll();switch(t.type){case"NAME":case"UNQ":case"STRING":this.next();var e=t.value;if(~e.indexOf("{{")){var n=!0,i=new r(e,{mode:2}).parse();if(1===i.length&&"expression"===i[0].type)return i[0];var o=[];i.forEach(function(t){t.constant||(n=!1),o.push(t.body||"'"+t.text+"'")}),o="["+o.join(",")+"].join('')",e=s.expression(o,null,n)}return e;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},l.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},l.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},l.include=function(){var t=this.expression();return this.match("END"),s.template(t)},l["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,o=t?"attrs":"statement";this.match("END"); +for(var a,u;!(u=this.eat("CLOSE"));)if(a=this.ll(),"OPEN"===a.type)switch(a.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),s["if"](e,n,r);default:i.push(this[o](!0))}else i.push(this[o](!0));return"if"!==u.value&&this.error("Unmatched if directive"),s["if"](e,n,r)},l.list=function(){var t,e,n=this.expression(),r=[],i=[],o=r;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(o=i,this.match("END")):o.push(this.statement());return"list"!==e.value&&this.error("expect {{/list}} got {{/"+e.value+"}}",e.pos),s.list(n,t,r,i)},l.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},l.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return s.expression(e,n,!this.depend.length)},l.filter=function(){var t,e,n=this.assign(),r=this.eat("|");if(r){t=["(function(){","var ",e="_f_","=",n.get,";"];do t.push(e+" = "+u+"._f_('"+this.match("IDENT").value+"')("+e),t.push(this.eat(":")?", "+this.arguments("|").join(",")+");":");");while(r=this.eat("|"));return t.push("return "+e+"})()"),this.getset(t.join(""))}return n},l.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("_p_",this.condition().get).replace("'='","'"+t.type+"'"),e.set)):e},l.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},l.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},l.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},l.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},l.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},l.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},l.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},l.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},l.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},l.member=function(t,e,n){var r,s,o=!1;if(t)"string"==typeof e&&c(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{s=this.primary();var h=typeof s;"string"===h?(n=[],n.push(s),e=s,t=u+"._sg_('"+s+"', "+a+"['"+s+"'])",o=!0):"this"===s.get?(t=u,n=["this"]):(n=null,t=s.get)}if(r=this.eat(["[",".","("]))switch(r.type){case".":var l=this.match("IDENT").value;return t+="['"+l+"']",this.member(t,l,n);case"[":return s=this.assign(),t+="["+s.get+"]",this.match("]"),this.member(t,s,n);case"(":var f=this.arguments().join(",");return t=t+"("+f+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var p={get:t};return e&&(p.set=o?u+"._ss_('"+s+"',"+i.setName+","+i.varName+", '=')":t+"="+i.setName),p},l.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},l.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(),h(t.value)?this.getset(t.value):t.value;default:this.error("Unexpected Token: "+t.type)}},l.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("")}},l.array=function(){for(var t,e=[this.match("[").type];(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");return e.push(this.match("]").type),{get:e.join("")}},l.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},l.getset=function(t,e){return{get:t,set:e}},n.exports=r}),t.register("regularjs/src/helper/extend.js",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]=a(e[i])&&a(n[i])&&o.test(e[i])?r(i,e[i],n):e[i])}var s=e("../util.js"),o=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,a=function(t){return"function"==typeof t};n.exports=function u(t){function e(){o.apply(this,arguments)}function n(t){return i(r,t,a),this}t=t||{};var r,o=this,a=o&&o.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=u,t):(r=s.createProto(e,a),e.implement=n,e.implement(t),o.__after__&&o.__after__.call(e,o,t),e.extend=u,e)}}),t.register("regularjs/src/helper/shim.js",function(){function t(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}var e=[].slice,n={}.toString;t(String.prototype,{trim:function(){return this.replace(/^\s+|\s+$/g,"")}}),t(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){for(var n=0,r=this.length;r>n;n++)t.call(e,this[n],n,this)},filter:function(t,e){for(var n=[],r=0,i=this.length;i>r;r++){var s=t.call(e,this[r],r,this);s&&n.push(this[r])}return n},map:function(t,e){for(var n=[],r=0,i=this.length;i>r;r++)n.push(t.call(e,this[r],r,this));return n}}),t(Function.prototype,{bind:function(t){var n=this,r=e.call(arguments,1);return function(){var i=r.concat(e.call(arguments));return n.apply(t,i)}}}),t(Object,{keys:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}}),t(Date,{now:function(){return+new Date}}),t(Array,{isArray:function(t){return"[object Array]"===n.call(t)}})}),t.register("regularjs/src/helper/parse.js",function(t,e,n){var r=e("../env").exprCache,i=e("../util"),s=e("../parser/Parser.js");n.exports={expression:function(t){return"string"==typeof t&&(t=t.trim())&&(t=r.get(t)||r.set(t,new s(t,{state:"JST",mode:2}).expression())),t?i.touchExpression(t):void 0},parse:function(t){return new s(t).parse()}}}),t.register("regularjs/src/helper/watcher.js",function(t,e,n){function r(){}var i=e("../util.js"),s=e("./parse.js").expression,o={$watch:function(t,e,n){var r,o,a;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var u=i.uid("w_");if(Array.isArray(t)){for(var c=[],h=0,l=t.length;l>h;h++)c.push(s(t[h]).get);var f=[];a=function(t){for(var e=!0,n=0,r=c.length;r>n;n++){var s=c[n](t);i.equals(s,f[n])||(e=!1,f[n]=i.clone(s))}return e?!1:f}}else t=this.$expression?this.$expression(t):s(t),r=t.get,o=t.once||t.constant;return this._watchers.push({id:u,get:r,fn:e,once:o,force:n.force,test:a,deep:n.deep}),this._records&&this._records.push(u),u},$unwatch:function(t){if(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,s=this._watchers;if(!t||!s||!(i=s.length))return;for(;i--;)r=s[i],r&&r.id===t&&s.splice(i,1)}},$digest:function(){if("digest"!==this.$phase){this.$phase="digest";for(var t=!1,e=0;t=this._digest();)if(++e>20)throw"there may a circular dependencies reaches";e>0&&this.$emit&&this.$emit("update"),this.$phase=null}},_digest:function(){var t=this._watchers,e=!1;if(t&&t.length)for(var n=0,r=t.length;r>n;n++){var s=!1,o=t[n];if(o)if(o.test){var a=o.test(this);a&&(e=!0,s=!0,o.fn.apply(this,a))}else{var u=o.get(this),c=o.last,h=!0;if("object"===i.typeOf(u)&&o.deep)if(o.last){for(var l in u)if(o.last[l]!==u[l]){h=!1;break}if(h!==!1)for(var f in c)if(c[f]!==u[f]){h=!1;break}}else h=!1;else h=i.equals(u,o.last);h===!1||o.force?(h=!1,o.force=null,s=!0,o.fn.call(this,u,o.last),o.last="object"!=typeof u||o.deep?i.clone(u):u):"array"===i.typeOf(h)&&h.length?(o.fn.call(this,u,h),s=!0,o.last=i.clone(u)):h=!0,h!==!0&&(e=!0),s&&o.once&&t.splice(n,1)}}var p=this._children;if(p&&p.length)for(var d=0,v=p.length;v>d;d++)p[d]._digest()&&(e=!0);return e},$update:function(t,e){if(null!=t){var n=i.typeOf(t);if("string"===n||"expression"===t.type)t=s(t),t.set(this,e);else if("function"===n)t.call(this,this.data);else for(var r in t)t.hasOwnProperty(r)&&(this.data[r]=t[r])}this.$root&&this.$root.$digest()},_record:function(){this._records=[]},_release:function(){var t=this._records;return this._records=null,t}};i.extend(r.prototype,o),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,o)},n.exports=r}),t.register("regularjs/src/helper/event.js",function(t,e,n){function r(){arguments.length&&this.$on.apply(this,arguments)}var i=[].slice,s=e("../util.js"),o={$on:function(t,e){if("object"==typeof t)for(var n in t)this.$on(n,t[n]);else{var r=this._handles||(this._handles={}),i=r[t]||(r[t]=[]);i.push(e)}return this},$off:function(t,e){if(this._handles){t||(this._handles=[]);var n,r=this._handles;if(n=r[t]){if(!e)return r[t]=[],this;for(var i=0,s=n.length;s>i;i++)if(e===n[i])return n.splice(i,1),this}return this}},$emit:function(t){var e,n,r,s=this._handles;if(t){if("object"==typeof t?(r=t.type,n=t.data||[]):(n=i.call(arguments,1),r=t),!s||!(e=s[r]))return this;for(var o=0,a=e.length;a>o;o++)e[o].apply(this,n);return this}},$broadcast:function(){}};s.extend(r.prototype,o),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,s.extend(t,o)},n.exports=r}),t.register("regularjs/src/helper/animate.js",function(t,e,n){function r(t){var e,n=0,r=0,s=0,o=0,a=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[l+"Duration"])||r,s=i(e[l+"Delay"])||s,o=i(e[f+"Duration"])||o,a=i(e[f+"Delay"])||a,n=Math.max(r+s,o+a)),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 s=e("../util"),o=e("../dom.js"),a={},u=e("../env.js"),c="transitionend",h="animationend",l="transition",f="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",l="webkitTransition"):("onotransitionend"in o.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",l="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(h+=" webkitAnimationEnd",f="webkitAnimation"):"onoanimationend"in o.tNode&&(h+=" oAnimationEnd",f="oAnimation")),a.inject=function(t,e,n,r){if(r=r||s.noop,Array.isArray(t)){for(var i=o.fragment(),a=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);o.inject(i,e,n);var h=function(){a++,a===c&&r()};for(c===a&&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()},a.remove=function(t,e){e=e||s.noop,t.onleave?t.onleave(function(){o.remove(t)}):(o.remove(t),e&&e())},a.startClassAnimate=function(t,e,n,i){var a,l,f,p;return!h&&!c||u.isRunning?n():(p=s.once(function(){f&&clearTimeout(f),2===i&&o.delClass(t,a),3!==i&&o.delClass(t,e),o.off(t,h,p),o.off(t,c,p),n()}),2===i?(o.addClass(t,e),a=e.split(/\s+/).map(function(t){return t+"-active"}).join(" "),o.nextReflow(function(){o.addClass(t,a),l=r(t),f=setTimeout(p,l)})):o.nextReflow(function(){o.addClass(t,e),l=r(t),f=setTimeout(p,l)}),o.on(t,h,p),o.on(t,c,p),p)},a.startStyleAnimate=function(t,e,n){var i,a,u;return o.nextReflow(function(){o.css(t,e),i=r(t),u=setTimeout(a,i)}),a=s.once(function(){u&&clearTimeout(u),o.off(t,h,a),o.off(t,c,a),n()}),o.on(t,h,a),o.on(t,c,a),a},n.exports=a}),t.register("regularjs/src/helper/combine.js",function(t,e,n){var r=e("../dom.js"),i=n.exports={node:function(t){var e,n;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 i.node(t.group);if(e=t.children){if(1===e.length)return i.node(e[0]);for(var r=[],s=0,o=e.length;o>s;s++)n=i.node(e[s]),Array.isArray(n)?r.push.apply(r,n):r.push(n);return r}},last:function(t){var e=t.children;return"function"==typeof t.last?t.last():"number"==typeof t.nodeType?t:e&&e.length?i.last(e[e.length-1]):t.group?i.last(t.group):void 0},destroy:function(t,e){if(t){if(Array.isArray(t))for(var n=0,s=t.length;s>n;n++)i.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&&(i.destroy(o,!0),t.children=null)}}}}),t.register("regularjs/src/directive/base.js",function(t,e){var n=(e("../util.js"),e("../dom.js")),r=(e("../helper/animate.js"),e("../Regular.js"));e("./event.js"),e("./form.js"),r.directive("r-class",function(t,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.directive("r-style",function(t,e){this.$watch(e,function(e){for(var r in e)e.hasOwnProperty(r)&&n.css(t,r,e[r])},!0)}),r.directive("r-hide",function(t,e){var n,r=null;this.$watch(e,function(e){var i=!!e;i!==r&&(r=i,i?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()))})}),r.directive("r-html",function(t,e){this.$watch(e,function(e){e=e||"",n.html(t,e)},{force:!0})})}),t.register("regularjs/src/directive/form.js",function(t,e){function n(t,e){function n(){e.set(r,this.value),i=!0,r.$update(),i=!1}var r=this,i=!1;return this.$watch(e,function(e){if(!i){var n=o.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value===e&&(t.selectedIndex=r)})}}),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){a.off(t,"change",n)}}function r(t,e){var n=!1,r=this;this.$watch(e,function(e){n||t.value!==e&&(t.value=null==e?"":""+e)});var i=function(t){var i=this;if("cut"===t.type||"paste"===t.type)o.nextTick(function(){var t=i.value;e.set(r,t),n=!0,r.$update()});else{var s=i.value;e.set(r,s),n=!0,r.$update()}n=!1};return 9!==a.msie&&"oninput"in a.tNode?t.addEventListener("input",i):(a.on(t,"paste",i),a.on(t,"keyup",i),a.on(t,"cut",i),a.on(t,"change",i)),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){9!==a.msie&&"oninput"in a.tNode?t.removeEventListener("input",i):(a.off(t,"paste",i),a.off(t,"keyup",i),a.off(t,"cut",i),a.off(t,"change",i))}}function i(t,e){var n=!1,r=this;this.$watch(e,function(e){n||a.attr(t,"checked",!!e)});var i=function(){var t=this.checked;e.set(r,t),n=!0,r.$update(),n=!1};return e.set&&a.on(t,"change",i),void 0===e.get(r)&&e.set(r,!!t.checked),function(){e.set&&a.off(t,"change",i)}}function s(t,e){var n=this,r=!1;this.$watch(e,function(e){r||e===t.value&&(t.checked=!0)});var i=function(){var t=this.value;e.set(n,t),r=!0,n.$update(),r=!1};return e.set&&a.on(t,"change",i),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&a.off(t,"change",i)}}var o=e("../util.js"),a=e("../dom.js"),u=e("../Regular.js"),c={text:r,select:n,checkbox:i,radio:s};u.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=u.expression(e)),c[r]?c[r].call(this,t,e):"input"===n?c.text.call(this,t,e):void 0})}),t.register("regularjs/src/directive/animation.js",function(t,e){function n(t){var e,n=[],r=0,s=i.noop,o={type:t,start:function(t){return e=i.uid(),"function"==typeof t&&(s=t),r>0?r=0:o.step(),o.compelete},compelete:function(){e=null,s&&s(),s=i.noop,r=0},step:function(){n[r]&&n[r](o.done.bind(o,e))},done:function(t){t===e&&(rx;x++)if(a=m[x],d=a.split(":"),f=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),f)if(f!==u)if(f!==c){var v=o.animation(f);if(!v||!h)throw"you need start with `on` or `event` in r-animation";h.push(v.call(this,{element:t,done:h.done,param:p}))}else r(p),"leave"===p?t.onleave=h.start:"enter"===p?t.onenter=h.start:l=this._handleEvent(t,p,h.start),y.push(l?l:s(t)),l=null;else r("when"),this.$watch(p,i.bind(this,h.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var i=e("../util.js"),s=e("../helper/animate.js"),o=(e("../dom.js"),e("../Regular.js")),a=/\s+/,u="when",c="on";o._addProtoInheritCache("animation"),o.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){s.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=this;return function(r){n.$emit(e,t),r()}},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(a),i=r.shift(),s=r.join(" ");if(!i||!s)throw"invalid style in command: style";n[i]=s,e=!0}}),function(r){e?s.startStyleAnimate(t.element,n,r):r()}}}),o.directive("r-animation",r)}),t.register("regularjs/src/directive/event.js",function(t,e){function n(t,e){for(var n=t.target;n&&n!==i.doc;){for(var r=0,s=e.length;s>r;r++)e[r].element===n&&e[r].fire(t);n=n.parentNode}}var r=e("../util.js"),i=e("../dom.js"),s=e("../Regular.js");s._addProtoInheritCache("event"),s.event("enter",function(t,e){function n(t){13===t.which&&(t.preventDefault(),e(t))}return i.on(t,"keypress",n),function(){i.off(t,"keypress",n)}}),s.directive(/^on-\w+$/,function(t,e,n,r){if(n&&e){var i=n.split("-")[1];return this._handleEvent(t,i,e,r)}}),s.directive(/^delegate-\w+$/,function(t,e,s){function o(t){n(t,u[c])}var a=this.$root,u=a._delegates||(a._delegates={});if(s&&e){var c=s.split("-")[1],h=r.handleEvent.call(this,e,c);u[c]||(u[c]=[],a.$on("inject",function(t){var e=this.parentNode;e&&i.off(e,c,o),i.on(t,c,o)}),a.$on("destroy",function(){a.parentNode&&i.off(a.parentNode,c,o),a._delegates[c]=null}));var l={element:t,fire:h};return u[c].push(l),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===l&&t.splice(e,1)}}})}),t.register("regularjs/src/module/timeout.js",function(t,e){function n(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 r=e("../Regular.js");r.plugin("timeout",n)}),t.alias("regularjs/src/index.js","regularjs/index.js"),"object"==typeof exports?module.exports=t("regularjs"):"function"==typeof define&&define.amd?define(function(){return t("regularjs")}):window.Regular=t("regularjs")}(); \ No newline at end of file diff --git a/src/directive/form.js b/src/directive/form.js index e926f80..2c88e85 100644 --- a/src/directive/form.js +++ b/src/directive/form.js @@ -53,12 +53,10 @@ function initSelect( elem, parsed){ self.$update(); inProgress = false; } - dom.on(elem, "change", handler); - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }); + + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ dom.off(elem, "change", handler); } @@ -101,11 +99,9 @@ function initText(elem, parsed){ dom.on(elem, "cut", handler) dom.on(elem, "change", handler) } - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }) + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ if(dom.msie !== 9 && "oninput" in dom.tNode ){ elem.removeEventListener("input", handler ); @@ -137,12 +133,10 @@ function initCheckBox(elem, parsed){ inProgress = false; } if(parsed.set) dom.on(elem, "change", handler) - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.checked); - } - }); + if(parsed.get(self) === undefined){ + parsed.set(self, !!elem.checked); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) @@ -170,11 +164,9 @@ function initRadio(elem, parsed){ } if(parsed.set) dom.on(elem, "change", handler) // beacuse only after compile(init), the dom structrue is exsit. - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - if(elem.checked) parsed.set(self, elem.value); - } - }); + if(parsed.get(self) === undefined){ + if(elem.checked) parsed.set(self, elem.value); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) diff --git a/src/helper/watcher.js b/src/helper/watcher.js index 0eee434..a8a3f2f 100644 --- a/src/helper/watcher.js +++ b/src/helper/watcher.js @@ -35,6 +35,7 @@ var methods = { get = expr.get; once = expr.once || expr.constant; } + this._watchers.push({ id: uid, get: get, diff --git a/src/walkers.js b/src/walkers.js index da13712..1c32158 100644 --- a/src/walkers.js +++ b/src/walkers.js @@ -242,6 +242,19 @@ walkers.element = function(ast){ var child; + if(group && !_.isVoidTag(ast.tag)){ + dom.inject( combine.node(group) , element) + } + + // sort before + attrs.sort(function(a1, a2){ + var d1 = Constructor.directive(a1.name), + d2 = Constructor.directive(a2.name); + if(d1 && d2) return (d2.priority || 1) - (d1.priority || 1); + if(d1) return 1; + if(d2) return -1; + return -1; + }) // may distinct with if else var destroies = walkAttributes.call(this, attrs, element, destroies); @@ -252,10 +265,6 @@ walkers.element = function(ast){ type: "element", group: group, node: function(){ - if(!res.init && group && !_.isVoidTag(ast.tag)){ - animate.inject( combine.node(group) , element) - res.init = true; - } return element; }, last: function(){ diff --git a/test/regular.js b/test/regular.js index 3834b9c..afbfed6 100644 --- a/test/regular.js +++ b/test/regular.js @@ -1468,6 +1468,19 @@ walkers.element = function(ast){ var child; + if(group && !_.isVoidTag(ast.tag)){ + dom.inject( combine.node(group) , element) + } + + // sort before + attrs.sort(function(a1, a2){ + var d1 = Constructor.directive(a1.name), + d2 = Constructor.directive(a2.name); + if(d1 && d2) return (d2.priority || 1) - (d1.priority || 1); + if(d1) return 1; + if(d2) return -1; + return -1; + }) // may distinct with if else var destroies = walkAttributes.call(this, attrs, element, destroies); @@ -1478,10 +1491,6 @@ walkers.element = function(ast){ type: "element", group: group, node: function(){ - if(!res.init && group && !_.isVoidTag(ast.tag)){ - animate.inject( combine.node(group) , element) - res.init = true; - } return element; }, last: function(){ @@ -3316,6 +3325,7 @@ var methods = { get = expr.get; once = expr.once || expr.constant; } + this._watchers.push({ id: uid, get: get, @@ -3994,12 +4004,10 @@ function initSelect( elem, parsed){ self.$update(); inProgress = false; } - dom.on(elem, "change", handler); - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }); + + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ dom.off(elem, "change", handler); } @@ -4042,11 +4050,9 @@ function initText(elem, parsed){ dom.on(elem, "cut", handler) dom.on(elem, "change", handler) } - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.value); - } - }) + if(parsed.get(self) === undefined && elem.value){ + parsed.set(self, elem.value); + } return function destroy(){ if(dom.msie !== 9 && "oninput" in dom.tNode ){ elem.removeEventListener("input", handler ); @@ -4078,12 +4084,10 @@ function initCheckBox(elem, parsed){ inProgress = false; } if(parsed.set) dom.on(elem, "change", handler) - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - parsed.set(self, elem.checked); - } - }); + if(parsed.get(self) === undefined){ + parsed.set(self, !!elem.checked); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) @@ -4111,11 +4115,9 @@ function initRadio(elem, parsed){ } if(parsed.set) dom.on(elem, "change", handler) // beacuse only after compile(init), the dom structrue is exsit. - this.$on('init', function(){ - if(parsed.get(self) === undefined){ - if(elem.checked) parsed.set(self, elem.value); - } - }); + if(parsed.get(self) === undefined){ + if(elem.checked) parsed.set(self, elem.value); + } return function destroy(){ if(parsed.set) dom.off(elem, "change", handler) diff --git a/test/spec/browser-directive.js b/test/spec/browser-directive.js index 2b170eb..381fb67 100644 --- a/test/spec/browser-directive.js +++ b/test/spec/browser-directive.js @@ -193,7 +193,7 @@ describe('r-model directive', function(){ describe('checkbox binding', function(){ it('input:checkbox"s initial state should be correct', function(){ var template = - ""+ + ""+ ""+ ""; var component = new Regular({ @@ -363,6 +363,38 @@ describe('r-model directive', function(){ destroy(component, container); }) + + it("r-model in if should works as expect", function(){ + var container = document.createElement('div') + var Component = Regular.extend({}); + var component = new Regular({ + data: {test: true} , + template: "{{#if !test}}{{/if}}" + }).$inject(container) + + component.$update("test", false); + + expect(nes.one("input", container).value).to.equal('1'); + expect(component.data.item).to.equal('1'); + + destroy(component, container); + + }) + it("r-model in list should works as expect", function(){ + var container = document.createElement('div') + var Component = Regular.extend({}); + var component = new Regular({ + data: {test: true, hello: {}} , + template: "{{#list [1,2,3,4] as item}}{{/list}}" + }).$inject(container) + + expect(nes.one("input", container).value).to.equal('1'); + expect(component.data.hello.name).to.equal('1'); + + destroy(component, container); + + }) + }) }) diff --git a/test/spec/browser-list.js b/test/spec/browser-list.js index 926f86b..1143010 100644 --- a/test/spec/browser-list.js +++ b/test/spec/browser-list.js @@ -283,6 +283,8 @@ void function(){ destroy(component, container); }) + + })