diff --git a/dist/regular.js b/dist/regular.js index c327521..5570654 100644 --- a/dist/regular.js +++ b/dist/regular.js @@ -1886,7 +1886,9 @@ dom.attr = function(node, name, value){ dom.on = function(node, type, handler){ var types = type.split(' '); handler.real = function(ev){ - handler.call(node, new Event(ev)); + var $event = new Event(ev); + $event.origin = node; + handler.call(node, $event); } types.forEach(function(type){ type = fixEventName(node, type); diff --git a/dist/regular.min.js b/dist/regular.min.js index e357666..45d2296 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 a=t.modules[s];if(!a._resolving&&!a.exports){var o={};o.exports={},o.client=o.component=!0,a._resolving=!0,a.call(this,o.exports,t.relative(s),o),delete a._resolving,a.exports=o.exports}return a.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;ro;o++){r=a[o];var l=r.regexp.test(t);if(l)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=g.plugin(t)),"function"!=typeof t?this:(t(this,g),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),a[n]=t[n];e&&r.setup()},expression:p.expression,parse:p.parse,Parser:i,Lexer:r,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(g._addProtoInheritCache);var n="_"+t+"s";g._protoInheritCache.push(t),g[n]={},g[t]||(g[t]=function(r,i){var s=this[n];if("object"==typeof r){for(var a in r)r.hasOwnProperty(a)&&this[t](a,r[a]);return this}return null==i?s[r]:(s[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=g._protoInheritCache,r=u.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=u.createObject(e[r]))}),t}}),c(g),g._addProtoInheritCache("component"),g._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),l.mixTo(g),f.mixTo(g),g.implement({init:function(){},config:function(){},destroy:function(){this.$context===this&&this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new i(t).parse());var n,r=this.__ns__,s=e.record;e.namespace&&(this.__ns__=e.namespace),s&&this._record();var a=this._walk(t,e);if(s){n=this._release();var o=this;n.length&&(a.ondestroy=function(){o.$unwatch(n)})}return e.namespace&&(this.__ns__=r),a},$bind:function(t,e,n){var r=u.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(){},$inject:function(t,e){var n=h.node(this);if(t===!1)return this._fragContainer||(this._fragContainer=s.fragment()),this.$inject(this._fragContainer);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):this},$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof g))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=p.expression(e),n=p.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"===u.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?v.createTextNode(t):y[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,a=this.constructor,o="function"!=typeof n?u.handleEvent.call(this,n,e):n,c=a.event(e);return c?i=c.call(this,t,o,r):s.on(t,e,o),c?i:function(){s.off(t,e,o)}},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw"filter "+t+" is undefined";return n},_sg_:function(t,e,n){if(n){var r=this.computed,i=r[t];if(i){if(i.get)return i.get(this);u.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","error")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:e[t]},_ss_:function(t,e,n,r,i){var s,i=this.computed,r=r||"=",a=i?i[t]:null;if("="!==r)switch(s=a?a.get(this):n[t],r){case"+=":e=s+e;break;case"-=":e=s-e;break;case"*=":e=s*e;break;case"/=":e=s/e;break;case"%=":e=s%e}if(a){if(a.set)return a.set(this,e);u.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","error")}return n[t]=e,e}}),g.prototype.inject=function(){u.log("use $inject instead of inject","error"),this.$inejct.apply(this,arguments)},g.filter(d),n.exports=g;var x=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,a={};for(var o in n)r=n[o],s=typeof r,"expression"!==r.type?"string"===s?a[o]=p.expression(r):(i=a[o]={type:"expression"},"function"===s?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):a[o]=r;return a}}}()}),t.register("regularjs/src/util.js",function(t,e,n){e("./helper/shim.js");var r=n.exports,i=e("./helper/entities.js"),s=[].slice,a=({}.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(a):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 a=t[i];r.push(a)}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 a=n[i];t[a]=e[a]}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),a=s.line.length,o=s.start-10;0>o&&(o=0);var u=s.start+10;u>a&&(u=a);var c=s.line.slice(o,u),l=s.num+1+"> "+(o>0?"...":""),h=a>u?"...":"";return l+c+h+"\n"+new Array(s.start+l.length+1).join(" ")+"^"}}();var u=/\((\?\!|\?\:|\?\=)/g;r.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(u);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})};var c=new RegExp("&("+Object.keys(i).join("|")+");","gi");r.convertEntity=function(t){return(""+t).replace(c,function(t,e){return String.fromCharCode(i[e])})},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=l(t,e||[]);return i}return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var l=function(){function t(t,e){return t===e}function e(e,n){for(var r=e.length,i=n.length,s=[],a=0;r>=a;a++)s.push([a]);for(var o=1;i>=o;o++)s[0][o]=o;for(var a=1;r>=a;a++)for(var o=1;i>=o;o++)s[a][o]=t(e[a-1],n[o-1])?s[a-1][o-1]:Math.min(s[a-1][o]+1,s[a][o-1]+1);return s}function n(t,n){for(var r=e(n,t),i=n.length,s=i,a=t.length,o=a,u=[],c=r[s][o];s>0||o>0;)if(0!==s)if(0!==o){var l=r[s-1][o-1],h=r[s-1][o],f=r[s][o-1],p=Math.min(f,h,l);p===h?(u.unshift(2),s--,c=h):p===l?(l===c?u.unshift(0):(u.unshift(1),c=l),s--,o--):(u.unshift(3),o--,c=f)}else u.unshift(2),s--;else u.unshift(3),o--;var d=0,v=3,m=2,g=1,i=0;a=0;for(var y=[],x={index:null,add:0,removed:[]},s=0;s0?null===x.index&&(x.index=a):null!=x.index&&(y.push(x),x={index:null,add:0,removed:[]}),u[s]){case d:i++,a++;break;case v:x.add++,a++;break;case m:x.removed.push(n[i]),i++;break;case g:x.add++,x.removed.push(n[i]),i++,a++}return null!=x.index&&y.push(x),y}return n}();r.throttle=function(t,e){var n,r,i,e=e||100,s=null,a=0,o=function(){a=+new Date,s=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-a);return n=this,r=arguments,0>=c||c>e?(clearTimeout(s),s=null,a=u,i=t.apply(n,r),n=r=null):s||(s=setTimeout(o,c)),i}},r.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,s=/[&<>\"\']/;return function(a){return s.test(a)?a.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):a}}(),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===!1&&t&&t.preventDefault&&t.preventDefault(),delete n.data.$event,n.$update()}:function(){var e=s.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){"undefined"!=typeof console&&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"),a=e("./group.js"),o=e("./util"),u=e("./helper/combine.js"),c=n.exports={};c.list=function(t){function e(t,e){if(t=t||[],e&&e.length){for(var n=0,r=t.length,a=(e[0].index,0);am;m++){var g=f.get(m+1);g.data[p]=m}for(var y=0,x=c.removed.length;x>y;y++){var _=f.children.splice(v+1,1)[0];_.destroy(!0)}for(var E=v;En?0:n}if(r>n)for(var a=n;r>a;a++){var $=f.get(a+1);$.data[p]=a}}}var n=c.Regular,r=document.createComment("Regular list"),i=this.__ns__,l=n.extend({template:t.body,$context:this.$context,$on:this.$context.$on.bind(this.$context),$off:this.$context.$off.bind(this.$context),$emit:this.$context.$emit.bind(this.$context)});n._inheritConfig(l,this.constructor);var h=this,f=new a;f.push(r);var p=t.variable+"_index",d=t.variable;return this.$watch(t.sequence,e,{init:!0}),f},c.template=function(t){var e,e,n=t.content,r=document.createComment("inlcude"),i=this.__ns__,o=new a;if(o.push(r),n){var c=this;this.$watch(n,function(t){(e=o.get(1))&&(e.destroy(!0),o.children.pop()),o.push(e=c.$compile(t,{record:!0,namespace:i})),r.parentNode&&s.inject(u.node(e),r,"before")},{init:!0})}return o};var l=0;c["if"]=function(t,e){var n,r,i=this;if(e&&e.element){var o=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,o,{force:!0}),{destroy:function(){n?u.destroy(n):r&&u.destroy(r)}}}var n,r,c=document.createComment("Regular if"+l++),h=new a;h.push(c);var f=null,p=this.__ns__,o=function(e){var a=!!e;a!==f&&(f=a,h.children[1]&&(h.children[1].destroy(!0),h.children.pop()),a?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,namespace:p}),h.push(n),c.parentNode&&s.inject(u.node(n),c,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,namespace:p}),h.push(r),c.parentNode&&s.inject(u.node(r),c,"before")))};return this.$watch(t.test,o,{force:!0,init:!0}),h},c.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){i.text(e,""+(null==t?"":""+t))}),e},c.text=function(t){var e=document.createTextNode(o.convertEntity(t.text));return e};var h=/^on-(.+)$/;c.element=function(t){var e,n,a,c=t.attrs,l=this,f=this.constructor,p=t.children,d=this.__ns__,v=f.component(t.tag);if("svg"===t.tag)var d="svg";if(p&&p.length&&(a=this.$compile(p,{namespace:d})),v){for(var m,g={},y=0,x=c.length;x>y;y++){var _=c[y],E=_.value||"";o.touchExpression(E);var T=_.name,w=T.match(h);w?(m=m||{},m[w[1]]=o.handleEvent.call(this,E,w[1])):(g[_.name]="expression"!==E.type?E:E.get(l),"ref"===_.name&&null!=E&&(n="expression"===E.type?E.get(l):E))}var N;t.children&&(N=t.children);var e=new v({data:g,events:m,$body:N,$parent:this,namespace:d});n&&l.$context.$refs&&(l.$context.$refs[n]=e);for(var y=0,x=c.length;x>y;y++){var _=c[y],E=_.value||"";"expression"===E.type&&-1===_.name.indexOf("on-")&&(this.$watch(E,e.$update.bind(e,_.name)),E.set&&e.$watch(_.name,l.$update.bind(l,E)))}return n&&e.$on("destroy",function(){l.$context.$refs&&(l.$context.$refs[n]=null)}),e}if("r-content"===t.tag&&this.$body)return this.$body;var j=i.create(t.tag,d,c);a&&!o.isVoidTag(t.tag)&&i.inject(u.node(a),j),c.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1});var $=r.call(this,c,j,$),b={type:"element",group:a,node:function(){return j},last:function(){return j},destroy:function(t){t?s.remove(j,a?a.destroy.bind(a):o.noop):a&&a.destroy(),$.length&&$.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}};return b},c.attribute=function(t,e){var n=t,r=this.constructor,s=this,a=e.element,u=n.name,c=n.value||"",l=r.directive(u);if(o.touchExpression(c),l&&l.link){var h=l.link.call(s,a,c,u,e.attrs);return"function"==typeof h&&(h={destroy:h}),h}if("ref"===u&&null!=c&&e.fromElement){var f="expression"===c.type?c.get(s):c,p=this.$context.$refs;if(p)return p[f]=a,{destroy:function(){p[f]=null}}}return"expression"===c.type?this.$watch(c,function(t){i.attr(a,u,t)},{init:!0}):o.isBooleanAttr(u)?i.attr(a,u,!0):i.attr(a,u,c),e.fromElement?void 0:{destroy:function(){i.attr(a,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(1e3),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"),n.exports.env=e("./env.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(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var a,o,u=n.exports,c=e("./env.js"),l=e("./util"),h=document.createElement("div"),f=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=h,h.addEventListener?(a=function(t,e,n){t.addEventListener(e,n,!1)},o=function(t,e,n){t.removeEventListener(e,n,!1)}):(a=function(t,e,n){t.attachEvent("on"+e,n)},o=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 a,o;switch(n){case"bottom":e.appendChild(t);break;case"top":(a=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(o=e.nextSibling)?o.parentNode.insertBefore(t,o):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(l.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)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){n.call(t,new s(e))},r.forEach(function(e){e=i(t,e),a(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),o(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"!==l.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 v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,l.extend(s.prototype,{immediateStop:l.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=function(t){u.nextFrame(function(){g=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/config.js",function(t,e,n){n.exports={BEGIN:"{",END:"}"}}),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){h[l.END]&&(this.markStart=h[l.END],this.markEnd=l.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?o:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}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 a(r)}function a(t){function e(t,e){return"string"==typeof f[e]?c.escapeRegExp(f[e]):String(f[e]).slice(1,-1)}var n,i,s,a,o,u,l;for(var h in t){n=t[h],n.curIndex=1,i=n.rules,s=[];for(var p=0,d=i.length;d>p;p++)l=i[p],o=l[0],a=l[1],"string"==typeof a&&(a=r(a)),"regexp"===c.typeOf(o)&&(o=o.toString().slice(1,-1)),o=o.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(o)+1,n.links.push([n.curIndex,u,a]),n.curIndex+=u,s.push(o);n.TRUNK=new RegExp("^(?:("+s.join(")|(")+"))")}return t}var o,u,c=e("../util.js"),l=e("../config.js"),h={"}":"{","]":"["},f={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,s,a=[];this.input=t,this.marks=0,this.index=0;for(var o=0;t;)o++,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&&a.push(i),this.index+=r;return a.push({type:"EOF"}),a},v.error=function(t){throw"Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index)},v._process=function(t,e,n){for(var r,i=e.links,s=!1,a=i.length,o=0;a>o;o++){var u=i[o],c=u[2],l=u[0];if(d(t[l])){s=!0,c&&(r=c.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},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){f.END=l.END,f.BEGIN=l.BEGIN,o=s([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=s([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00<>]*?(?=<)/,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}},"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(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),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("../config.js"),a=e("./node.js"),o=e("./Lexer.js"),u=i.varName,c=i.ctxName,l=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"),f=r.prototype;f.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},f.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]},f.la=function(t){return(this.ll(t)||"").type},f.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))},f.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)},f.next=function(t){t=t||1,this.pos+=t},f.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 +!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 a=t.modules[s];if(!a._resolving&&!a.exports){var o={};o.exports={},o.client=o.component=!0,a._resolving=!0,a.call(this,o.exports,t.relative(s),o),delete a._resolving,a.exports=o.exports}return a.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;ro;o++){r=a[o];var l=r.regexp.test(t);if(l)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=g.plugin(t)),"function"!=typeof t?this:(t(this,g),this)},config:function(t){var e=!1;if("object"==typeof t)for(var n in t)("END"===n||"BEGIN"===n)&&(e=!0),a[n]=t[n];e&&r.setup()},expression:p.expression,parse:p.parse,Parser:i,Lexer:r,_addProtoInheritCache:function(t,e){if(Array.isArray(t))return t.forEach(g._addProtoInheritCache);var n="_"+t+"s";g._protoInheritCache.push(t),g[n]={},g[t]||(g[t]=function(r,i){var s=this[n];if("object"==typeof r){for(var a in r)r.hasOwnProperty(a)&&this[t](a,r[a]);return this}return null==i?s[r]:(s[r]=e?e(i):i,this)})},_inheritConfig:function(t,e){var n=g._protoInheritCache,r=u.slice(n);return r.forEach(function(n){t[n]=e[n];var r="_"+n+"s";e[r]&&(t[r]=u.createObject(e[r]))}),t}}),c(g),g._addProtoInheritCache("component"),g._addProtoInheritCache("filter",function(t){return"function"==typeof t?{get:t}:t}),l.mixTo(g),f.mixTo(g),g.implement({init:function(){},config:function(){},destroy:function(){this.$context===this&&this.$emit("$destroy"),this.group&&this.group.destroy(!0),this.group=null,this.parentNode=null,this._watchers=null,this._children=[];var t=this.$parent;if(t){var e=t._children.indexOf(this);t._children.splice(e,1)}this.$parent=null,this.$root=null,this._handles=null,this.$refs=null},$compile:function(t,e){e=e||{},"string"==typeof t&&(t=new i(t).parse());var n,r=this.__ns__,s=e.record;e.namespace&&(this.__ns__=e.namespace),s&&this._record();var a=this._walk(t,e);if(s){n=this._release();var o=this;n.length&&(a.ondestroy=function(){o.$unwatch(n)})}return e.namespace&&(this.__ns__=r),a},$bind:function(t,e,n){var r=u.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(){},$inject:function(t,e){var n=h.node(this);if(t===!1)return this._fragContainer||(this._fragContainer=s.fragment()),this.$inject(this._fragContainer);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):this},$mute:function(t){t=!!t;var e=t===!1&&this._mute;return this._mute=!!t,e&&this.$update(),this},_bind:function(t,e,n){var r=this;if(!(t&&t instanceof g))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=p.expression(e),n=p.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"===u.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?v.createTextNode(t):y[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,a=this.constructor,o="function"!=typeof n?u.handleEvent.call(this,n,e):n,c=a.event(e);return c?i=c.call(this,t,o,r):s.on(t,e,o),c?i:function(){s.off(t,e,o)}},_f_:function(t){var e=this.constructor,n=e.filter(t);if(!n)throw"filter "+t+" is undefined";return n},_sg_:function(t,e,n){if(n){var r=this.computed,i=r[t];if(i){if(i.get)return i.get(this);u.log("the computed '"+t+"' don't define the get function, get data."+t+" altnately","error")}}return"undefined"==typeof e||"undefined"==typeof t?void 0:e[t]},_ss_:function(t,e,n,r,i){var s,i=this.computed,r=r||"=",a=i?i[t]:null;if("="!==r)switch(s=a?a.get(this):n[t],r){case"+=":e=s+e;break;case"-=":e=s-e;break;case"*=":e=s*e;break;case"/=":e=s/e;break;case"%=":e=s%e}if(a){if(a.set)return a.set(this,e);u.log("the computed '"+t+"' don't define the set function, assign data."+t+" altnately","error")}return n[t]=e,e}}),g.prototype.inject=function(){u.log("use $inject instead of inject","error"),this.$inejct.apply(this,arguments)},g.filter(d),n.exports=g;var x=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,a={};for(var o in n)r=n[o],s=typeof r,"expression"!==r.type?"string"===s?a[o]=p.expression(r):(i=a[o]={type:"expression"},"function"===s?i.get=t(r):(r.get&&(i.get=t(r.get)),r.set&&(i.set=e(r.set)))):a[o]=r;return a}}}()}),t.register("regularjs/src/util.js",function(t,e,n){e("./helper/shim.js");var r=n.exports,i=e("./helper/entities.js"),s=[].slice,a=({}.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(a):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 a=t[i];r.push(a)}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 a=n[i];t[a]=e[a]}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),a=s.line.length,o=s.start-10;0>o&&(o=0);var u=s.start+10;u>a&&(u=a);var c=s.line.slice(o,u),l=s.num+1+"> "+(o>0?"...":""),h=a>u?"...":"";return l+c+h+"\n"+new Array(s.start+l.length+1).join(" ")+"^"}}();var u=/\((\?\!|\?\:|\?\=)/g;r.findSubCapture=function(t){var e=0,n=0,r=t.length,i=t.match(u);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})};var c=new RegExp("&("+Object.keys(i).join("|")+");","gi");r.convertEntity=function(t){return(""+t).replace(c,function(t,e){return String.fromCharCode(i[e])})},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=l(t,e||[]);return i}return"number"===n&&"number"==typeof e&&isNaN(t)&&isNaN(e)?!0:t===e};var l=function(){function t(t,e){return t===e}function e(e,n){for(var r=e.length,i=n.length,s=[],a=0;r>=a;a++)s.push([a]);for(var o=1;i>=o;o++)s[0][o]=o;for(var a=1;r>=a;a++)for(var o=1;i>=o;o++)s[a][o]=t(e[a-1],n[o-1])?s[a-1][o-1]:Math.min(s[a-1][o]+1,s[a][o-1]+1);return s}function n(t,n){for(var r=e(n,t),i=n.length,s=i,a=t.length,o=a,u=[],c=r[s][o];s>0||o>0;)if(0!==s)if(0!==o){var l=r[s-1][o-1],h=r[s-1][o],f=r[s][o-1],p=Math.min(f,h,l);p===h?(u.unshift(2),s--,c=h):p===l?(l===c?u.unshift(0):(u.unshift(1),c=l),s--,o--):(u.unshift(3),o--,c=f)}else u.unshift(2),s--;else u.unshift(3),o--;var d=0,v=3,m=2,g=1,i=0;a=0;for(var y=[],x={index:null,add:0,removed:[]},s=0;s0?null===x.index&&(x.index=a):null!=x.index&&(y.push(x),x={index:null,add:0,removed:[]}),u[s]){case d:i++,a++;break;case v:x.add++,a++;break;case m:x.removed.push(n[i]),i++;break;case g:x.add++,x.removed.push(n[i]),i++,a++}return null!=x.index&&y.push(x),y}return n}();r.throttle=function(t,e){var n,r,i,e=e||100,s=null,a=0,o=function(){a=+new Date,s=null,i=t.apply(n,r),n=r=null};return function(){var u=+new Date,c=e-(u-a);return n=this,r=arguments,0>=c||c>e?(clearTimeout(s),s=null,a=u,i=t.apply(n,r),n=r=null):s||(s=setTimeout(o,c)),i}},r.escape=function(){var t=/&/g,e=//g,r=/\'/g,i=/\"/g,s=/[&<>\"\']/;return function(a){return s.test(a)?a.replace(t,"&").replace(e,"<").replace(n,">").replace(r,"'").replace(i,"""):a}}(),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===!1&&t&&t.preventDefault&&t.preventDefault(),delete n.data.$event,n.$update()}:function(){var e=s.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){"undefined"!=typeof console&&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"),a=e("./group.js"),o=e("./util"),u=e("./helper/combine.js"),c=n.exports={};c.list=function(t){function e(t,e){if(t=t||[],e&&e.length){for(var n=0,r=t.length,a=(e[0].index,0);am;m++){var g=f.get(m+1);g.data[p]=m}for(var y=0,x=c.removed.length;x>y;y++){var _=f.children.splice(v+1,1)[0];_.destroy(!0)}for(var E=v;En?0:n}if(r>n)for(var a=n;r>a;a++){var $=f.get(a+1);$.data[p]=a}}}var n=c.Regular,r=document.createComment("Regular list"),i=this.__ns__,l=n.extend({template:t.body,$context:this.$context,$on:this.$context.$on.bind(this.$context),$off:this.$context.$off.bind(this.$context),$emit:this.$context.$emit.bind(this.$context)});n._inheritConfig(l,this.constructor);var h=this,f=new a;f.push(r);var p=t.variable+"_index",d=t.variable;return this.$watch(t.sequence,e,{init:!0}),f},c.template=function(t){var e,e,n=t.content,r=document.createComment("inlcude"),i=this.__ns__,o=new a;if(o.push(r),n){var c=this;this.$watch(n,function(t){(e=o.get(1))&&(e.destroy(!0),o.children.pop()),o.push(e=c.$compile(t,{record:!0,namespace:i})),r.parentNode&&s.inject(u.node(e),r,"before")},{init:!0})}return o};var l=0;c["if"]=function(t,e){var n,r,i=this;if(e&&e.element){var o=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,o,{force:!0}),{destroy:function(){n?u.destroy(n):r&&u.destroy(r)}}}var n,r,c=document.createComment("Regular if"+l++),h=new a;h.push(c);var f=null,p=this.__ns__,o=function(e){var a=!!e;a!==f&&(f=a,h.children[1]&&(h.children[1].destroy(!0),h.children.pop()),a?t.consequent&&t.consequent.length&&(n=i.$compile(t.consequent,{record:!0,namespace:p}),h.push(n),c.parentNode&&s.inject(u.node(n),c,"before")):t.alternate&&t.alternate.length&&(r=i.$compile(t.alternate,{record:!0,namespace:p}),h.push(r),c.parentNode&&s.inject(u.node(r),c,"before")))};return this.$watch(t.test,o,{force:!0,init:!0}),h},c.expression=function(t){var e=document.createTextNode("");return this.$watch(t,function(t){i.text(e,""+(null==t?"":""+t))}),e},c.text=function(t){var e=document.createTextNode(o.convertEntity(t.text));return e};var h=/^on-(.+)$/;c.element=function(t){var e,n,a,c=t.attrs,l=this,f=this.constructor,p=t.children,d=this.__ns__,v=f.component(t.tag);if("svg"===t.tag)var d="svg";if(p&&p.length&&(a=this.$compile(p,{namespace:d})),v){for(var m,g={},y=0,x=c.length;x>y;y++){var _=c[y],E=_.value||"";o.touchExpression(E);var T=_.name,w=T.match(h);w?(m=m||{},m[w[1]]=o.handleEvent.call(this,E,w[1])):(g[_.name]="expression"!==E.type?E:E.get(l),"ref"===_.name&&null!=E&&(n="expression"===E.type?E.get(l):E))}var N;t.children&&(N=t.children);var e=new v({data:g,events:m,$body:N,$parent:this,namespace:d});n&&l.$context.$refs&&(l.$context.$refs[n]=e);for(var y=0,x=c.length;x>y;y++){var _=c[y],E=_.value||"";"expression"===E.type&&-1===_.name.indexOf("on-")&&(this.$watch(E,e.$update.bind(e,_.name)),E.set&&e.$watch(_.name,l.$update.bind(l,E)))}return n&&e.$on("destroy",function(){l.$context.$refs&&(l.$context.$refs[n]=null)}),e}if("r-content"===t.tag&&this.$body)return this.$body;var j=i.create(t.tag,d,c);a&&!o.isVoidTag(t.tag)&&i.inject(u.node(a),j),c.sort(function(t,e){var n=f.directive(t.name),r=f.directive(e.name);return n&&r?(r.priority||1)-(n.priority||1):n?1:r?-1:"type"===e.name?1:-1});var $=r.call(this,c,j,$),b={type:"element",group:a,node:function(){return j},last:function(){return j},destroy:function(t){t?s.remove(j,a?a.destroy.bind(a):o.noop):a&&a.destroy(),$.length&&$.forEach(function(t){t&&("function"==typeof t.destroy?t.destroy():t())})}};return b},c.attribute=function(t,e){var n=t,r=this.constructor,s=this,a=e.element,u=n.name,c=n.value||"",l=r.directive(u);if(o.touchExpression(c),l&&l.link){var h=l.link.call(s,a,c,u,e.attrs);return"function"==typeof h&&(h={destroy:h}),h}if("ref"===u&&null!=c&&e.fromElement){var f="expression"===c.type?c.get(s):c,p=this.$context.$refs;if(p)return p[f]=a,{destroy:function(){p[f]=null}}}return"expression"===c.type?this.$watch(c,function(t){i.attr(a,u,t)},{init:!0}):o.isBooleanAttr(u)?i.attr(a,u,!0):i.attr(a,u,c),e.fromElement?void 0:{destroy:function(){i.attr(a,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(1e3),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"),n.exports.env=e("./env.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(v.test(e)&&(this.pageX=null!=t.pageX?t.pageX:t.clientX+m.scrollLeft,this.pageY=null!=t.pageX?t.pageY:t.clientY+m.scrollTop,"mouseover"===e||"mouseout"===e)){for(var r=t.relatedTarget||t[("mouseover"===e?"from":"to")+"Element"];r&&3===r.nodeType;)r=r.parentNode;this.relatedTarget=r}("DOMMouseScroll"===e||"mousewheel"===e)&&(this.wheelDelta=t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3),this.which=t.which||t.keyCode,this.which||void 0===n||(this.which=1&n?1:2&n?3:4&n?2:0),this._fixed=!0}var a,o,u=n.exports,c=e("./env.js"),l=e("./util"),h=document.createElement("div"),f=function(){},p={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};u.body=document.body,u.doc=document,u.tNode=h,h.addEventListener?(a=function(t,e,n){t.addEventListener(e,n,!1)},o=function(t,e,n){t.removeEventListener(e,n,!1)}):(a=function(t,e,n){t.attachEvent("on"+e,n)},o=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 a,o;switch(n){case"bottom":e.appendChild(t);break;case"top":(a=e.firstChild)?e.insertBefore(t,e.firstChild):e.appendChild(t);break;case"after":(o=e.nextSibling)?o.parentNode.insertBefore(t,o):e.parentNode.appendChild(t);break;case"before":e.parentNode.insertBefore(t,e)}},u.id=function(t){return document.getElementById(t)},u.create=function(t,e){if("svg"===e){if(!c.svg)throw Error("the env need svg support");e=p.svg}return e?document.createElementNS(e,t):document.createElement(t)},u.fragment=function(){return document.createDocumentFragment()};var d={"class":function(t,e){"className"in t&&(t.namespaceURI===p.html||!t.namespaceURI)?t.className=e||"":t.setAttribute("class",e)},"for":function(t,e){"htmlFor"in t?t.htmlFor=e:t.setAttribute("for",e)},style:function(t,e){t.style?t.style.cssText=e:t.setAttribute("style",e)},value:function(t,e){t.value=null!=e?e:""}};u.attr=function(t,e,n){if(l.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)d[e]?d[e](t,n):null===n?t.removeAttribute(e):t.setAttribute(e,n);else if(t.getAttribute){var r=t.getAttribute(e,2);return null===r?void 0:r}},u.on=function(t,e,n){var r=e.split(" ");n.real=function(e){var r=new s(e);r.origin=t,n.call(t,r)},r.forEach(function(e){e=i(t,e),a(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),o(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"!==l.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 v=/^(?:click|dblclick|contextmenu|DOMMouseScroll|mouse(?:\w+))$/,m=document;m=m.compatMode&&"CSS1Compat"!==m.compatMode?m.body:m.documentElement,l.extend(s.prototype,{immediateStop:l.isFalse,stop:function(){this.preventDefault().stopPropagation()},preventDefault:function(){return this.event.preventDefault?this.event.preventDefault():this.event.returnValue=!1,this},stopPropagation:function(){return this.event.stopPropagation?this.event.stopPropagation():this.event.cancelBubble=!0,this},stopImmediatePropagation:function(){this.event.stopImmediatePropagation&&this.event.stopImmediatePropagation()}}),u.nextFrame=function(){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){setTimeout(t,16)},e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||function(t){clearTimeout(t)};return function(n){var r=t(n);return function(){e(r)}}}();var g;u.nextReflow=function(t){u.nextFrame(function(){g=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/config.js",function(t,e,n){n.exports={BEGIN:"{",END:"}"}}),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){h[l.END]&&(this.markStart=h[l.END],this.markEnd=l.END),this.input=(t||"").trim(),this.opts=e||{},this.map=2!==this.opts.mode?o:u,this.states=["INIT"],e&&e.expression&&(this.states.push("JST"),this.expression=!0)}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 a(r)}function a(t){function e(t,e){return"string"==typeof f[e]?c.escapeRegExp(f[e]):String(f[e]).slice(1,-1)}var n,i,s,a,o,u,l;for(var h in t){n=t[h],n.curIndex=1,i=n.rules,s=[];for(var p=0,d=i.length;d>p;p++)l=i[p],o=l[0],a=l[1],"string"==typeof a&&(a=r(a)),"regexp"===c.typeOf(o)&&(o=o.toString().slice(1,-1)),o=o.replace(/\{(\w+)\}/g,e),u=c.findSubCapture(o)+1,n.links.push([n.curIndex,u,a]),n.curIndex+=u,s.push(o);n.TRUNK=new RegExp("^(?:("+s.join(")|(")+"))")}return t}var o,u,c=e("../util.js"),l=e("../config.js"),h={"}":"{","]":"["},f={NAME:/(?:[:_A-Za-z][-\.:_0-9A-Za-z]*)/,IDENT:/[\$_A-Za-z][_0-9A-Za-z\$]*/,SPACE:/[\r\n\f ]/},p=/a|(b)/.exec("a"),d=p&&void 0===p[1]?function(t){return void 0!==t}:function(t){return!!t},v=i.prototype;v.lex=function(t){t=(t||this.input).trim();var e,n,r,i,s,a=[];this.input=t,this.marks=0,this.index=0;for(var o=0;t;)o++,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&&a.push(i),this.index+=r;return a.push({type:"EOF"}),a},v.error=function(t){throw"Parse Error: "+t+":\n"+c.trackErrorPos(this.input,this.index)},v._process=function(t,e,n){for(var r,i=e.links,s=!1,a=i.length,o=0;a>o;o++){var u=i[o],c=u[2],l=u[0];if(d(t[l])){s=!0,c&&(r=c.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},v.enter=function(t){return this.states.push(t),this},v.state=function(){var t=this.states;return t[t.length-1]},v.leave=function(t){var e=this.states;t&&e[e.length-1]!==t||e.pop()},i.setup=function(){f.END=l.END,f.BEGIN=l.BEGIN,o=s([m.ENTER_JST,m.ENTER_TAG,m.TEXT,m.TAG_NAME,m.TAG_OPEN,m.TAG_CLOSE,m.TAG_PUNCHOR,m.TAG_ENTER_JST,m.TAG_UNQ_VALUE,m.TAG_STRING,m.TAG_SPACE,m.TAG_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_COMMENT,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT]),u=s([m.ENTER_JST2,m.TEXT,m.JST_COMMENT,m.JST_OPEN,m.JST_CLOSE,m.JST_EXPR_OPEN,m.JST_IDENT,m.JST_SPACE,m.JST_LEAVE,m.JST_NUMBER,m.JST_PUNCHOR,m.JST_STRING,m.JST_COMMENT])};var m={ENTER_JST:[/[^\x00<]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_JST2:[/[^\x00]*?(?={BEGIN})/,function(t){return this.enter("JST"),t?{type:"TEXT",value:t}:void 0}],ENTER_TAG:[/[^\x00<>]*?(?=<)/,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}},"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(t){return this.markEnd===t&&this.expression?{type:this.markEnd,value:this.markEnd}:this.markEnd&&this.marks?(this.marks--,{type:this.markEnd,value:this.markEnd}):(this.firstEnterStart=!1,this.leave("JST"),{type:"END"})},"JST"],JST_CLOSE:[/{BEGIN}\s*\/({IDENT})\s*{END}/,function(t,e){return this.leave("JST"),{type:"CLOSE",value:e}},"JST"],JST_COMMENT:[/{BEGIN}\!([^\x00]*?)\!{END}/,function(){this.leave()},"JST"],JST_EXPR_OPEN:["{BEGIN}",function(t){if(t===this.markStart){if(this.expression)return{type:this.markStart,value:this.markStart};if(this.firstEnterStart||this.marks)return this.marks++,this.firstEnterStart=!1,{type:this.markStart,value:this.markStart};this.firstEnterStart=!0}return{type:"EXPR_OPEN",escape:!1}},"JST"],JST_IDENT:["{IDENT}","IDENT","JST"],JST_SPACE:[/[ \r\n\f]+/,null,"JST"],JST_PUNCHOR:[/[=!]?==|[-=><+*\/%\!]?\=|\|\||&&|\@\(|\.\.|[<\>\[\]\(\)\-\|\{}\+\*\/%?:\.!,]/,function(t){return{type:t,value:t}},"JST"],JST_STRING:[/'([^']*)'|"([^"]*)"/,function(t,e,n){return{type:"STRING",value:e||n||""}},"JST"],JST_NUMBER:[/(?:[0-9]*\.[0-9]+|[0-9]+)(e\d+)?/,function(t){return{type:"NUMBER",value:parseFloat(t,10)}},"JST"]};i.setup(),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("../config.js"),a=e("./node.js"),o=e("./Lexer.js"),u=i.varName,c=i.ctxName,l=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"),f=r.prototype;f.parse=function(){this.pos=0;var t=this.program();return"TAG_CLOSE"===this.ll().type&&this.error("You may got a unclosed Tag"),t},f.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]},f.la=function(t){return(this.ll(t)||"").type},f.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))},f.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)},f.next=function(t){t=t||1,this.pos+=t},f.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},f.program=function(){for(var t=[],e=this.ll();"EOF"!==e.type&&"TAG_CLOSE"!==e.type;)t.push(this.statement()),e=this.ll();return t},f.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 a.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())}},f.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")),a.element(t,e,n)},f.xentity=function(t){var e,n=t.value;return"NAME"===t.type?(this.eat("=")&&(e=this.attvalue()),a.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))},f.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},f.attvalue=function(){var t=this.ll();switch(t.type){case"NAME":case"UNQ":case"STRING":this.next();var e=t.value;if(~e.indexOf(s.BEGIN)&&~e.indexOf(s.END)){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=a.expression(o,null,n)}return e;case"EXPR_OPEN":return this.interplation();default:this.error("Unexpected token: "+this.la())}},f.directive=function(){var t=this.ll().value;return this.next(),"function"==typeof this[t]?this[t]():void this.error("Undefined directive["+t+"]")},f.interplation=function(){this.match("EXPR_OPEN");var t=this.expression(!0);return this.match("END"),t},f.include=function(){var t=this.expression();return this.match("END"),a.template(t)},f["if"]=function(t){var e=this.expression(),n=[],r=[],i=n,s=t?"attrs":"statement";this.match("END");for(var o,u;!(u=this.eat("CLOSE"));)if(o=this.ll(),"OPEN"===o.type)switch(o.value){case"else":i=r,this.next(),this.match("END");break;case"elseif":return this.next(),r.push(this["if"](t)),a["if"](e,n,r);default:i.push(this[s](!0))}else i.push(this[s](!0));return"if"!==u.value&&this.error("Unmatched if directive"),a["if"](e,n,r)},f.list=function(){var t,e,n=this.expression(),r=[],i=[],s=r;for(this.match("IDENT","as"),t=this.match("IDENT").value,this.match("END");!(e=this.eat("CLOSE"));)this.eat("OPEN","else")?(s=i,this.match("END")):s.push(this.statement());return"list"!==e.value&&this.error("expect list got /"+e.value+" ",e.pos),a.list(n,t,r,i)},f.expression=function(){var t;return this.eat("@(")?(t=this.expr(),t.once=!0,this.match(")")):t=this.expr(),t},f.expr=function(){this.depend=[];var t=this.filter(),e=t.get||t,n=t.set;return a.expression(e,n,!this.depend.length)},f.filter=function(){var t,e,n,r=this.assign(),s=this.eat("|"),a=[],o="_t_",u=r.set,l="";if(s){u&&(t=[]),e="(function("+o+"){";do l=o+" = "+c+"._f_('"+this.match("IDENT").value+"' ).get.call( "+i.ctxName+","+o,l+=this.eat(":")?", "+this.arguments("|").join(",")+");":");",a.push(l),t&&t.unshift(l.replace(" ).get.call"," ).set.call"));while(s=this.eat("|"));return a.push("return "+o),t&&t.push("return "+o),n=e+a.join("")+"})("+r.get+")",t&&(u=u.replace(i.setName,e+t.join("")+"})("+i.setName+")")),this.getset(n,u)}return r},f.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},f.condition=function(){var t=this.or();return this.eat("?")?this.getset([t.get+"?",this.assign().get,this.match(":").type,this.assign().get].join("")):t},f.or=function(){var t=this.and();return this.eat("||")?this.getset(t.get+"||"+this.or().get):t},f.and=function(){var t=this.equal();return this.eat("&&")?this.getset(t.get+"&&"+this.and().get):t},f.equal=function(){var t,e=this.relation();return(t=this.eat(["==","!=","===","!=="]))?this.getset(e.get+t.type+this.equal().get):e},f.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},f.additive=function(){var t,e=this.multive();return(t=this.eat(["+","-"]))?this.getset(e.get+t.value+this.additive().get):e},f.multive=function(){var t,e=this.range();return(t=this.eat(["*","/","%"]))?this.getset(e.get+t.type+this.multive().get):e},f.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},f.unary=function(){var t;return(t=this.eat(["+","-","~","!"]))?this.getset("("+t.type+this.unary().get+")"):this.member()},f.member=function(t,e,n,r){var s,a,o=!1;if(t)"string"==typeof e&&l(e)?n.push(e):(n&&n.length&&this.depend.push(n),n=null);else{a=this.primary();var h=typeof a;"string"===h?(n=[],n.push(a),e=a,t=c+"._sg_('"+a+"', "+u+", 1)",o=!0):"this"===a.get?(t=c,n=["this"]):(n=null,t=a.get)}if(s=this.eat(["[",".","("]))switch(s.type){case".":var f=this.match("IDENT").value;return r=t,"("!==this.la()?t=c+"._sg_('"+f+"', "+t+")":t+="['"+f+"']",this.member(t,f,n,r);case"[":return a=this.assign(),r=t,"("!==this.la()?t=c+"._sg_("+a.get+", "+t+")":t+="["+a.get+"]",this.match("]"),this.member(t,a,n,r);case"(":var p=this.arguments().join(",");return t=t+"("+p+")",this.match(")"),this.member(t,null,n)}n&&n.length&&this.depend.push(n);var d={get:t};return e&&(d.set=c+"._ss_("+(e.get?e.get:"'"+e+"'")+","+i.setName+","+(r?r:i.varName)+", '=', "+(o?1:0)+")"),d},f.arguments=function(t){t=t||")";var e=[];do this.la()!==t&&e.push(this.assign().get);while(this.eat(","));return e},f.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)}},f.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("")}},f.array=function(){var t,e=[this.match("[").type];if(this.eat("]"))e.push("]");else{for(;(t=this.assign())&&(e.push(t.get),this.eat(","));)e.push(",");e.push(this.match("]").type)}return{get:e.join("")}},f.paren=function(){this.match("(");var t=this.filter();return t.get="("+t.get+")",this.match(")"),t},f.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]=o(e[i])&&o(n[i])&&a.test(e[i])?r(i,e[i],n):e[i])}var s=e("../util.js"),a=/xy/.test(function(){"xy"})?/\bsupr\b/:/.*/,o=function(t){return"function"==typeof t},u=["events","data","computed"],c=u.length;n.exports=function l(t){function e(){a.apply(this,arguments)}function n(t){for(var e=c;e--;){var n=u[e];t.hasOwnProperty(n)&&r.hasOwnProperty(n)&&(s.extend(r[n],t[n],!0),delete t[n])}return i(r,t,o),this}t=t||{};var r,a=this,o=a&&a.prototype||{};return"function"==typeof t?(r=t.prototype,t.implement=n,t.extend=l,t):(r=s.createProto(e,o),e.implement=n,e.implement(t),a.__after__&&a.__after__.call(e,a,t),e.extend=l,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,{mode:2,expression:!0}).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,a={$watch:function(t,e,n){var r,a,o,u;this._watchers||(this._watchers=[]),n=n||{},n===!0&&(n={deep:!0});var c=i.uid("w_");if(Array.isArray(t)){for(var l=[],h=0,f=t.length;f>h;h++)l.push(s(t[h]).get);var p=[];o=function(t){for(var e=!0,n=0,r=l.length;r>n;n++){var s=l[n](t);i.equals(s,p[n])||(e=!1,p[n]=i.clone(s))}return e?!1:p}}else t=this.$expression?this.$expression(t):s(t),r=t.get,a=t.once||t.constant;var d={id:c,get:r,fn:e,once:a,force:n.force,test:o,deep:n.deep};return this._watchers.push(d),u=this._records&&this._records.length,u&&this._records[u-1].push(c),n.init===!0&&(this.$phase="digest",this._checkSingleWatch(d,this._watchers.length-1),this.$phase=null),c},$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._mute){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,e,n,r=this._watchers,i=!1;if(r&&r.length)for(var s=0,a=r.length;a>s;s++)e=r[s],n=this._checkSingleWatch(e,s),n&&(i=!0);if(t=this._children,t&&t.length)for(var o=0,u=t.length;u>o;o++)t[o]._digest()&&(i=!0);return i},_checkSingleWatch:function(t,e){var n=!1;if(t){if(!t.test){var r=t.get(this),s=t.last,a=!0;if("object"===i.typeOf(r)&&t.deep)if(t.last){for(var o in r)if(t.last[o]!==r[o]){a=!1;break}if(a!==!1)for(var u in s)if(s[u]!==r[u]){a=!1;break}}else a=!1;else a=i.equals(r,t.last);return a===!1||t.force?(a=!1,t.force=null,n=!0,t.fn.call(this,r,t.last),t.last="object"!=typeof r||t.deep?i.clone(r):r):"array"===i.typeOf(a)&&a.length?(t.last=i.clone(r),t.fn.call(this,r,a),n=!0):a=!0,n&&t.once&&this._watchers.splice(e,1),n}var c=t.test(this);c&&(n=!0,t.fn.apply(this,c))}},$set: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)this.$set(r,t[r])}},$get:function(t){return s(t).get(this)},$update:function(){this.$set.apply(this,arguments),this.$root&&this.$root.$digest()},_record:function(){this._records||(this._records=[]),this._records.push([])},_release:function(){return this._records.pop()}};i.extend(r.prototype,a),r.mixTo=function(t){return t="function"==typeof t?t.prototype:t,i.extend(t,a)},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"),a={$on:function(t,e){if("object"==typeof t)for(var n in t)this.$on(n,t[n]);else{var r=this,i=r._handles||(r._handles={}),s=i[t]||(i[t]=[]);s.push(e)}return this},$off:function(t,e){var n=this;if(n._handles){t||(this._handles={});var r,i=n._handles;if(r=i[t]){if(!e)return i[t]=[],n;for(var s=0,a=r.length;a>s;s++)if(e===r[s])return r.splice(s,1),n}return n}},$emit:function(t){var e,n,r,s=this,a=s._handles;if(t){var n=i.call(arguments,1),r=t;if(!a)return s;if(e=a[r.slice(1)])for(var o=0,u=e.length;u>o;o++)e[o].apply(s,n);if(!(e=a[r]))return s;for(var c=0,u=e.length;u>c;c++)e[c].apply(s,n);return s}},$broadcast:function(){}};s.extend(r.prototype,a),r.mixTo=function(t){t="function"==typeof t?t.prototype:t,s.extend(t,a)},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,a=0,o=0,u=5/3;return window.getComputedStyle&&(e=window.getComputedStyle(t),r=i(e[h+"Duration"])||r,s=i(e[h+"Delay"])||s,a=i(e[f+"Duration"])||a,o=i(e[f+"Delay"])||o,n=Math.max(r+s,a+o)),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"),a=e("../dom.js"),o={},u=e("../env.js"),c="transitionend",l="animationend",h="transition",f="animation";"ontransitionend"in window||("onwebkittransitionend"in window?(c+=" webkitTransitionEnd",h="webkitTransition"):("onotransitionend"in a.tNode||"Opera"===navigator.appName)&&(c+=" oTransitionEnd",h="oTransition")),"onanimationend"in window||("onwebkitanimationend"in window?(l+=" webkitAnimationEnd",f="webkitAnimation"):"onoanimationend"in a.tNode&&(l+=" oAnimationEnd",f="oAnimation")),o.inject=function(t,e,n,r){if(r=r||s.noop,Array.isArray(t)){for(var i=a.fragment(),o=0,u=0,c=t.length;c>u;u++)i.appendChild(t[u]);a.inject(i,e,n);var l=function(){o++,o===c&&r()};for(c===o&&r(),u=0;c>u;u++)t[u].onenter?t[u].onenter(l):l()}else a.inject(t,e,n),t.onenter?t.onenter(r):r()},o.remove=function(t,e){t.onleave?t.onleave(function(){p(t,e)}):p(t,e)};var p=function(t,e){a.remove(t),e&&e()};o.startClassAnimate=function(t,e,n,i){var o,h,f,p;return!l&&!c||u.isRunning?n():(p=s.once(function(){f&&clearTimeout(f),2===i&&a.delClass(t,o),3!==i&&a.delClass(t,e),a.off(t,l,p),a.off(t,c,p),n()}),2===i?(a.addClass(t,e),o=e.split(/\s+/).map(function(t){return t+"-active"}).join(" "),a.nextReflow(function(){a.addClass(t,o),h=r(t),f=setTimeout(p,h)})):a.nextReflow(function(){a.addClass(t,e),h=r(t),f=setTimeout(p,h)}),a.on(t,l,p),a.on(t,c,p),p)},o.startStyleAnimate=function(t,e,n){var i,o,u;return a.nextReflow(function(){a.css(t,e),i=r(t),u=setTimeout(o,i)}),o=s.once(function(){u&&clearTimeout(u),a.off(t,l,o),a.off(t,c,o),n()}),a.on(t,l,o),a.on(t,c,o),o},n.exports=o}),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,a=e.length;a>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 a=t.children;if("function"==typeof t.destroy)return t.destroy(e);"number"==typeof t.nodeType&&e&&r.remove(t),a&&a.length&&(i.destroy(a,!0),t.children=null)}}}}),t.register("regularjs/src/helper/entities.js",function(t,e,n){var r={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,fnof:402,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,bull:8226,hellip:8230,prime:8242,Prime:8243,oline:8254,frasl:8260,weierp:8472,image:8465,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,circ:710,tilde:732,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,permil:8240,lsaquo:8249,rsaquo:8250,euro:8364};n.exports=r}),t.register("regularjs/src/helper/filter.js",function(t,e,n){var r=n.exports={};r.json={get:function(t){return"undefined"!=typeof JSON?JSON.stringify(t):t},set:function(t){return"undefined"!=typeof JSON?JSON.parse(t):t}},r.last=function(t){return t&&t[t.length-1]},r.every={get:function(t,e){e=e||"checked",t=t||[];for(var n=t.length;n--;)if(!t[n][e])return!1;return!0},set:function(t,e,n){n=n||[],t=!!t;for(var r=n.length;r--;)n[r][e]=t;return n}}}),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),e.last=this.value,r.$update()}var r=this;return this.$watch(e,function(e){var n=a.slice(t.getElementsByTagName("option"));n.forEach(function(n,r){n.value==e&&(t.selectedIndex=r)})}),o.on(t,"change",n),void 0===e.get(r)&&t.value&&e.set(r,t.value),function(){o.off(t,"change",n)}}function r(t,e){var n=this;this.$watch(e,function(e){t.value!==e&&(t.value=null==e?"":""+e)});var r=function(t){var r=this;if("cut"===t.type||"paste"===t.type)a.nextTick(function(){var t=r.value;e.set(n,t),e.last=t,n.$update()});else{var i=r.value;e.set(n,i),n.$update()}};return 9!==o.msie&&"oninput"in o.tNode?t.addEventListener("input",r):(o.on(t,"paste",r),o.on(t,"keyup",r),o.on(t,"cut",r),o.on(t,"change",r)),void 0===e.get(n)&&t.value&&e.set(n,t.value),function(){9!==o.msie&&"oninput"in o.tNode?t.removeEventListener("input",r):(o.off(t,"paste",r),o.off(t,"keyup",r),o.off(t,"cut",r),o.off(t,"change",r))}}function i(t,e){var n=this;this.$watch(e,function(e){o.attr(t,"checked",!!e)});var r=function(){var t=this.checked;e.set(n,t),e.last=t,n.$update()};return e.set&&o.on(t,"change",r),void 0===e.get(n)&&e.set(n,!!t.checked),function(){e.set&&o.off(t,"change",r)}}function s(t,e){var n=this;this.$watch(e,function(e){t.checked=e==t.value?!0:!1});var r=function(){var t=this.value;e.set(n,t),e.last=t,n.$update()};return e.set&&o.on(t,"change",r),void 0===e.get(n)&&t.checked&&e.set(n,t.value),function(){e.set&&o.off(t,"change",r)}}var a=e("../util.js"),o=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,a={type:t,start:function(t){return e=i.uid(),"function"==typeof t&&(s=t),r>0?r=0:a.step(),a.compelete},compelete:function(){e=null,s&&s(),s=i.noop,r=0},step:function(){n[r]&&n[r](a.done.bind(a,e))},done:function(t){t===e&&(rx;x++)if(o=m[x],d=o.split(":"),f=d[0]&&d[0].trim(),p=d[1]&&d[1].trim(),f)if(f!==u)if(f!==c){var v=a.animation(f);if(!v||!l)throw"you need start with `on` or `event` in r-animation";l.push(v.call(this,{element:t,done:l.done,param:p}))}else r(p),"leave"===p?t.onleave=l.start:"enter"===p?t.onenter=l.start:(this.$on(p,l.start),h=this.$off.bind(this,p,l.start)),y.push(h?h:s(t)),h=null;else r("when"),this.$watch(p,i.bind(this,l.start));return y.length?function(){y.forEach(function(t){t()})}:void 0}var i=e("../util.js"),s=e("../helper/animate.js"),a=(e("../dom.js"),e("../Regular.js")),o=/\s+/,u="when",c="on";a._addProtoInheritCache("animation"),a.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=a.expression(t.param).get,n=this;return function(t){e(n),n.$update(),t()}},emit:function(t){var e=t.param,n=e.split(","),r=n[0]||"",i=n[1]?a.expression(n[1]).get:null;if(!r)throw"you shoud specified a eventname in emit command";var s=this;return function(t){s.$emit(r,i?i(s):void 0),t()}},style:function(t){var e,n={},r=t.param,i=r.split(",");return i.forEach(function(t){if(t=t.trim()){var r=t.split(o),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()}}}),a.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 r.log("on-enter will be removed in 0.4.0","error"),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 a(t){n(t,u[c])}var o=this.$root,u=o._delegates||(o._delegates={});if(s&&e){var c=s.split("-")[1],l=r.handleEvent.call(this,e,c);u[c]||(u[c]=[],o.$on("$inject",function(t){var e=this.parentNode;e&&i.off(e,c,a),i.on(t,c,a)}),o.$on("$destroy",function(){o.parentNode&&i.off(o.parentNode,c,a),o._delegates[c]=null}));var h={element:t,fire:l};return u[c].push(h),function(){var t=u[c];if(t&&t.length)for(var e=0,n=t.length;n>e;e++)t[e]===h&&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),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/dom.js b/src/dom.js index 531f436..744bd0b 100644 --- a/src/dom.js +++ b/src/dom.js @@ -177,7 +177,9 @@ dom.attr = function(node, name, value){ dom.on = function(node, type, handler){ var types = type.split(' '); handler.real = function(ev){ - handler.call(node, new Event(ev)); + var $event = new Event(ev); + $event.origin = node; + handler.call(node, $event); } types.forEach(function(type){ type = fixEventName(node, type); diff --git a/test/regular.js b/test/regular.js index 08cc69f..ebc0f06 100644 --- a/test/regular.js +++ b/test/regular.js @@ -1884,7 +1884,9 @@ dom.attr = function(node, name, value){ dom.on = function(node, type, handler){ var types = type.split(' '); handler.real = function(ev){ - handler.call(node, new Event(ev)); + var $event = new Event(ev); + $event.origin = node; + handler.call(node, $event); } types.forEach(function(type){ type = fixEventName(node, type); diff --git a/test/runner/vendor/util.js b/test/runner/vendor/util.js index 8f616df..678aee6 100644 --- a/test/runner/vendor/util.js +++ b/test/runner/vendor/util.js @@ -45,13 +45,13 @@ var dispatchMockEvent = (function(){ case 'MouseEvent': ev = document.createEvent('MouseEvent'); - ev.initMouseEvent(type, true, true, null, 1, 0, 0, 0, 0, false, false, false, false, 0, null) + ev.initMouseEvent(type, true, true) break; case 'KeyboardEvent': ev = document.createEvent(EventType || 'MouseEvent'), initMethod = ev.initKeyboardEvent ? 'initKeyboardEvent': 'initKeyEvent'; - ev[initMethod]( type, true, true, null, false, false, false, false, 9, 0 ) + ev[initMethod]( type, true, true) break; case 'HTMLEvents': diff --git a/test/spec/browser-dom.js b/test/spec/browser-dom.js index 333aa8b..724c2f1 100644 --- a/test/spec/browser-dom.js +++ b/test/spec/browser-dom.js @@ -186,6 +186,23 @@ void function(){ }) + it("$event.origin should point to the element that bingding the event", function(done){ + var container = document.createElement('div'); + document.body.appendChild(container); + var component = new Regular({ + template: "", + data: { test: 0 , name: 'hahah'}, + hello2: function($event){ + $event.preventDefault(); + expect($event.origin).to.equal(this.$refs.div); + done(); + document.body.removeChild(container); + this.destroy(); + } + }).$inject(container); + dispatchMockEvent(component.$refs.a, "click"); + }) + }) describe("delegate Event via `delegate-*`", function(){