!function(t){function e(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function i(t,i){var n=t.prototype,s=new Function;s.prototype=i.prototype,t.prototype=new s,t.prototype.constructor=t,e(t.prototype,n)}function n(t,e,i){if(t&&t.length>0)for(var n=0,s=t.length;s>n&&e.call(i||t,t[n],n)!==!1;n++);}function s(t,e){var i;return n(t,function(t){return i=t===e,!i}),i}function r(t,e){var i=Function.prototype.bind,n=Array.prototype.slice;if(i&&t.bind===i)return i.apply(t,n.call(arguments,1));var s=n.call(arguments,2);return function(){t.apply(e,s.concat(n.call(arguments)))}}function o(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function a(t,e,i){t.addEventListener?t.removeEventListener(e,i,!1):t.detachEvent("on"+e,i)}function h(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function p(t){return we[t]?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function c(){return"_san_"+Ce++}function u(t,e){if(e&&(t=r(t,e)),_e.push(t),!Ne)if(Ne=function(){var t=_e.slice(0);_e=[],Ne=null,n(t,function(t){t()})},"function"==typeof MutationObserver){var i=1,s=new MutationObserver(Ne),o=document.createTextNode(i);s.observe(o,{characterData:!0}),o.data=++i}else"function"==typeof setImmediate?setImmediate(Ne):setTimeout(Ne,0)}function l(){this.raw=Ee?[]:"",this.length=0}function d(){this.raw=[],this.index={}}function f(t){return/^(area|base|br|col|embed|hr|img|input|keygen|param|source|track|wbr)$/i.test(t)}function v(t){this.source=t,this.len=this.source.length,this.index=0}function y(t){t&&t.isText||(this.directives=new d,this.props=new d,this.events=new d,this.childs=[]),e(this,t)}function g(t){function e(t){t&&a.childs.push(new y({isText:!0,text:t,textExpr:C(t),parent:a}))}var i=new y;if("string"!=typeof t)return i;t=t.replace(//gm,"").replace(/(^\s+|\s+$)/g,"");for(var n,s=new v(t),r=/<(\/)?([a-z0-9-]+)\s*/gi,o=/([-:0-9a-z\(\)\[\]]+)(=(['"])([^\3]*?)\3)?\s*/gi,a=i,h=0;null!=(n=s.match(r));){var p=n[1],c=n[2].toLowerCase();if(e(t.slice(h,s.index-n[0].length)),p&&62===s.currentCode()){for(var u=a;u&&u.tagName!==c;)u=u.parent;u&&(a=u.parent),s.go(1)}else if(!p){for(var l=new y({tagName:c,parent:a}),d=f(c);;){var g=s.currentCode();if(62===g){s.go(1);break}if(47===g&&62===s.charCode(s.index+1)){s.go(2),d=!0;break}var x=s.match(o);x&&m(l,x[1],x[2]?x[4]:x[1])}a.childs.push(l),d||(a=l)}h=s.index}return e(s.cut(h)),i}function m(t,e,i,n){if("id"===e)return void(t.id=i);var s,r=e.indexOf("-");switch(r>0&&(s=e.slice(0,r),e=e.slice(r+1)),s){case"on":t.events.push({name:e,expr:E(i)});break;case"san":var o=w(e,i);o&&t.directives.push(o);break;case"prop":x(t,e,i);break;default:n||x(t,e,i)}}function x(t,e,i){var n=i.match(/^\{=\s*(\S[\s\S]*?)\s*=\}$/);if(n)return void t.props.push({name:e,expr:A(n[1]),twoWay:!0});var s=C(i);1===s.segs.length&&(s=s.segs[0]),t.props.push(N({name:e,expr:s,raw:i}))}function N(t){return"class"===t.name&&n(t.expr.segs,function(t){t.type===Re.INTERPOLATION&&t.filters.push({type:Re.CALL,name:{type:Re.IDENT,name:"join"},args:[{type:Re.STRING,value:" "}]})}),t}function w(t,e){var i=Se[t];if(i){var n=i(e);return n.name=t,n}}function C(t){function e(t){t&&o.push({type:Re.STRING,value:t})}for(var i,n=/\{\{\s*([\s\S]+?)\s*\}\}/gi,s=new v(t),r=0,o=[];null!=(i=s.match(n));)e(s.cut(r,s.index-i[0].length)),o.push(_(i[1])),r=s.index;return e(s.cut(r)),{type:Re.TEXT,segs:o}}function _(t){for(var e=new v(t),i=k(e),n=[];e.goUntil(124);)n.push(M(e));return{type:Re.INTERPOLATION,expr:i,filters:n}}function A(t){return"object"==typeof t&&t.type?t:k(new v(t))}function E(t){return M(new v(t))}function T(t){var e,i=t.currentCode(),n=t.index;t:for(;e=t.nextCode();)switch(e){case 92:t.go(1);break;case i:t.go(1);break t}var s=t.cut(n,t.index);return{type:Re.STRING,value:new Function("return "+s)()}}function R(t){var e=t.match(/\s*([\$0-9a-z_]+)/gi);return{type:Re.IDENT,name:e[1]}}function S(t){var e=t.match(/\s*(-?[0-9]+(.[0-9]+)?)/g);return{type:Re.NUMBER,value:e[1]-0}}function b(t){var e={type:Re.PROP_ACCESSOR,paths:[]},i=R(t);if(!i)return null;e.paths.push(i);t:for(;;){var n=t.currentCode();switch(n){case 46:t.go(1),e.paths.push({type:Re.STRING,value:R(t).name});break;case 91:t.go(1),e.paths.push(k(t)),t.goUntil(93);break;default:break t}}return 1===e.paths.length?i:e}function k(t){var e=O(t);if(t.goUntil(),124===t.currentCode()){if(124===t.nextCode())return t.go(1),{type:Re.BINARY,operator:248,segs:[e,k(t)]};t.go(-1)}return e}function O(t){var e=I(t);if(t.goUntil(),38===t.currentCode()){if(38===t.nextCode())return t.go(1),{type:Re.BINARY,operator:76,segs:[e,O(t)]};t.go(-1)}return e}function I(t){var e=P(t);t.goUntil();var i=t.currentCode();switch(i){case 61:case 33:if(61===t.nextCode())return i+=61,61===t.nextCode()&&(t.go(1),i+=61),{type:Re.BINARY,operator:i,segs:[e,I(t)]};t.go(-1)}return e}function P(t){var e=H(t);t.goUntil();var i=t.currentCode();switch(i){case 60:case 62:return 61===t.nextCode()&&(i+=61,t.go(1)),{type:Re.BINARY,operator:i,segs:[e,P(t)]}}return e}function H(t){var e=L(t);t.goUntil();var i=t.currentCode();switch(i){case 43:case 45:return t.go(1),{type:Re.BINARY,operator:i,segs:[e,H(t)]}}return e}function L(t){var e=U(t);t.goUntil();var i=t.currentCode();switch(i){case 42:case 47:return t.go(1),{type:Re.BINARY,operator:i,segs:[e,L(t)]}}return e}function U(t){switch(t.goUntil(),t.currentCode()){case 33:return t.go(1),{type:Re.UNARY,expr:U(t)};case 34:case 39:return T(t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return S(t);case 40:return Y(t)}return b(t)}function Y(t){t.go(1);var e=k(t);return t.goUntil(41),e}function M(t){t.goUntil();var e=R(t),i=[];if(t.goUntil(40))for(;!t.goUntil(41);)i.push(k(t)),t.goUntil(44);return{type:Re.CALL,name:e,args:i}}function D(t,e,i){var s=!1;return n(t,function(t){return s=B(t,e,i),!s}),s}function B(t,e,i){switch(e.type===Re.IDENT&&(e={type:Re.PROP_ACCESSOR,paths:[e]}),t.type){case Re.UNARY:return B(t.expr,e,i);case Re.TEXT:case Re.BINARY:return D(t.segs,e,i);case Re.IDENT:return t.name===e.paths[0].name;case Re.INTERPOLATION:if(!B(t.expr,e,i)){var s=!1;return n(t.filters,function(t){return s=D(t.args,e,i),!s}),s}return!0;case Re.PROP_ACCESSOR:for(var r=t.paths,o=e.paths,s=r[0].name===o[0].name,a=1,h=r.length,p=o.length;h>a;a++){var c=r[a];switch(c.type){case Re.PROP_ACCESSOR:case Re.IDENT:if(B(c,e,i))return!0}s&&p>a&&j(c,i)!=j(o[a],i)&&(s=!1)}return s}return!1}function F(t){this.parent=t,this.listeners=[],this.data={}}function V(t){return ke[t]}function j(t,e,i){switch(t.type){case Re.UNARY:return!j(t.expr,e,i);case Re.BINARY:var s=be[t.operator];if("function"==typeof s)return s(j(t.segs[0],e,i),j(t.segs[1],e,i));return;case Re.STRING:case Re.NUMBER:return t.value;case Re.IDENT:case Re.PROP_ACCESSOR:return e.get(t);case Re.INTERPOLATION:var r=j(t.expr,e,i);return i&&n(t.filters,function(t){var s=t.name.name,o=i.filters[s]||Oe[s];if("function"==typeof o){var a=[r];n(t.args,function(t){a.push(j(t,e,i))}),r=o.apply(i,a)}}),null==r&&(r=""),r;case Re.TEXT:var o=new l;return n(t.segs,function(t){var n=j(t,e,i);t.type!==Re.INTERPOLATION||t.filters[0]||(n=Oe.html(n)),o.push(n)}),o.toString()}}function z(t,e,i){var n=e instanceof oe?e:e.owner;i=i||(e instanceof oe?e.data:e.scope);var s={aNode:t,owner:n,scope:i,parent:e};if(t.isText)return new X(s);if(t.directives.get("if"))return new le(s);if(t.directives.get("else"))return new fe(s);if(t.directives.get("for"))return new ve(s);var r=n.components&&n.components[t.tagName];if(r){var o=new r(s);return o}return"slot"===t.tagName?new q(s):new J(s)}function W(){this.raw={}}function $(t){t=t||{},this.lifeCycle=new W,this.init(t)}function G(t){return''}function X(t){$.call(this,t)}function q(t){this.childs=[],$.call(this,t)}function J(t){this.childs=[],this.eventListeners={},this._updatedOp=0,this._updateOpCount=0,$.call(this,t)}function K(t,e){return t.propHandlers[e]||t.propHandlers["*"]}function Q(t){K(this,t.name).output(this,t)}function Z(t,e){("input"===e.type||"value"===e.propertyName)&&(e.value=(e.target||e.srcElement).value,te.call(this,t,e))}function te(t,e){var i=[],s=t.expr;n(s.args,function(t){i.push(t.type===Re.IDENT&&"$event"===t.name?this instanceof oe?e:e||window.event:this.evalExpr(t))},this);var r=this.owner;this instanceof oe&&t.isOwn&&(r=this);var o=r[s.name.name];"function"==typeof o&&o.apply(r,i)}function ee(t,e){t.tagName&&(e.push("<"),e.push(t.tagName),e.push(' id="'),e.push(t.id),e.push('"'),t.props.each(function(t){var i=this instanceof oe?j(t.expr,this.data,this):this.evalExpr(t.expr);e.push(K(this,t.name).input.attr(this,t.name,i)||"")},t),e.push(">"))}function ie(t,e){var i=t.tagName;f(i)||(e.push(""),e.push(i),e.push(">"))}function ne(t){var e=new l;return n(t.aNode.childs,function(i){var n=z(i,t);t.childs.push(n),e.push(n.genHTML())}),e.toString()}function se(t,e){return t=t.toLowerCase(),{input:{attr:function(e,i,n){return n?" "+t+'="'+t+'"':void 0},prop:function(e,i,n){var s=Le[t]||t;e.el[s]=!!n}},choose:function(i){return"function"!=typeof e||e(i)?t:void 0}}}function re(t,e,i){var n=t.option.target;return n&&n.id===e.id&&(!i||n.prop===i)}function oe(t){this.slotChilds=[],this.data=new F,J.call(this,t)}function ae(t){for(var e,i=new ue(t.el);e=i.current;){var n=he(e,t,i);n&&t.childs.push(n),i.goNext()}}function he(t,e,i){var n=e instanceof oe?e:e.owner,s=t.tagName.toLowerCase(),r=null;s.indexOf("-")>0&&(r=n.components[s]);var o=t.getAttribute("san-component");o&&(r=n.components[o]);var a={owner:n,scope:n.data,parent:e,el:t,elWalker:i};if(r)return new r(a);var h=pe(t),p=t.getAttribute("san-stump");return a.aNode=h,h.directives.get("if")||"if"===p?new le(a):h.directives.get("else")||"else"===p?new fe(a):h.directives.get("for")||"for"===p?new ve(a):ce(t)?new X(a):new J(a)}function pe(t){var e=new y;return e.tagName=t.tagName.toLowerCase(),n(t.attributes,function(t){m(e,t.name,t.value,!0)}),e}function ce(t){return"SCRIPT"===t.tagName&&"text/san"===t.type}function ue(t){this.raw=[],this.index=0;for(var e=t.firstChild;e;)1===e.nodeType&&this.raw.push(e),e=e.nextSibling;this.current=this.raw[this.index],this.next=this.raw[this.index+1]}function le(t){J.call(this,t)}function de(t){var e=t.aNode,i=new y({childs:e.childs,props:e.props,events:e.events,tagName:e.tagName});return t.aNode.directives.each(function(t){switch(t.name){case"if":case"else":break;default:i.directives.push(t)}}),z(i,t)}function fe(t){for(var e=t.parent.childs,i=e.length;i--;){var n=e[i];if(!(n instanceof X)){if(n instanceof le){var s={name:"if",value:{type:Re.UNARY,expr:n.aNode.directives.get("if").value}};return t.aNode.directives.push(s),t.aNode.directives.remove("else"),t.el&&(ce(t.el)?t.el.setAttribute("san-stump","if"):t.el.removeAttribute("san-else")),t.ifDirective=s,new le(t)}break}}throw new Error("[SAN FATEL] else not match if.")}function ve(t){J.call(this,t)}function ye(t,e){var i=t.aNode.directives.get("for");n(t.evalExpr(i.list),e,t)}function ge(t,e,i){function s(t){var e,i=t;switch(t.type){case Re.IDENT:e=t;break;case Re.PROP_ACCESSOR:e=t.paths[0]}return e&&e.name===r.item&&(i={type:Re.PROP_ACCESSOR,paths:r.list.type===Re.PROP_ACCESSOR?r.list.paths.slice(0):[r.list]},i.paths.push({type:Re.NUMBER,value:o.get(r.index)}),t.type===Re.PROP_ACCESSOR&&(i.paths=i.paths.concat(t.paths.slice(1)))),i}var r=t.aNode.directives.get("for"),o=new F(t.scope);o.set(r.item,e),o.set(r.index,i),n(["set","remove","unshift","shift","push","pop"],function(e){var i=t.scope[e];o[e]=function(e){e=s(A(e)),i.apply(t.scope,[e].concat(Array.prototype.slice.call(arguments,1)))}});var a=t.aNode,h=new y({childs:a.childs,props:a.props,events:a.events,tagName:a.tagName});a.directives.each(function(t){"for"!==t.name&&h.directives.push(t)});var p=z(h,t,o);return o.onChange(function(t){t.expr.type===Re.IDENT&&t.expr.name===r.index&&p.updateView(t)}),p}function me(t,e,i){for(var n=t.childs,s=t.aNode.directives.get("for"),r=n.length;r>e;e++){var o=n[e].scope.get(s.index);null!=o&&F.prototype.set.call(n[e].scope,s.index,i(o))}}function xe(t){function e(t){oe.call(this,t)}return e.prototype=t,i(e,oe),e}var Ne,we=function(){var t={};return n("svg,g,defs,desc,metadata,symbol,use,image,path,rect,circle,line,ellipse,polyline,polygon,text,tspan,tref,textpath,marker,pattern,clippath,mask,filter,cursor,view,animate,font,font-face,glyph,missing-glyph".split(","),function(e){t[e]=!0}),t}(),Ce=1,_e=[],Ae=function(){var t="undefined"!=typeof navigator&&navigator.userAgent.match(/msie\s*([0-9]+)/i);return t?t[1]-0:0}(),Ee=Ae&&8>Ae,Te=Ae&&9>Ae;l.prototype.toString=function(){return Ee?this.raw.join(""):this.raw},l.prototype.push=Ee?function(t){this.raw[this.length++]=t}:function(t){this.length++,this.raw+=t},d.prototype.push=function(t){if(!t.name)throw new Error('Object must have "name" property');this.index[t.name]||(this.raw.push(t),this.index[t.name]=t)},d.prototype.getAt=function(t){return this.raw[t]},d.prototype.get=function(t){return this.index[t]},d.prototype.each=function(t,e){n(this.raw,r(t,e||this))},d.prototype.removeAt=function(t){var e=this.raw[t].name;this.index[e]=null,this.raw.splice(t,1)},d.prototype.remove=function(t){this.index[t]=null;for(var e=this.raw.length;e--;)if(this.raw[e].name===t){this.raw.splice(e,1);break}},d.prototype.concat=function(t){var e=new d;return n(this.raw.concat(t.raw),function(t){e.push(t)}),e};var Re={STRING:1,NUMBER:2,IDENT:3,PROP_ACCESSOR:4,INTERPOLATION:5,CALL:6,TEXT:7,BINARY:8,UNARY:9};v.prototype.currentCode=function(){return this.charCode(this.index)},v.prototype.cut=function(t,e){return this.source.slice(t,e)},v.prototype.go=function(t){this.index+=t},v.prototype.nextCode=function(){return this.go(1),this.currentCode()},v.prototype.charCode=function(t){return this.source.charCodeAt(t)},v.prototype.goUntil=function(t){for(var e;this.indext},62:function(t,e){return t>e},76:function(t,e){return t&&e},94:function(t,e){return t!=e},121:function(t,e){return e>=t},122:function(t,e){return t==e},123:function(t,e){return t>=e},155:function(t,e){return t!==e},183:function(t,e){return t===e},248:function(t,e){return t||e}};F.ChangeType={SET:1,ARRAY_PUSH:2,ARRAY_POP:3,ARRAY_SHIFT:4,ARRAY_UNSHIFT:5,ARRAY_REMOVE:6,ARRAY_SPLICE:7},F.prototype.onChange=function(t){"function"==typeof t&&this.listeners.push(t)},F.prototype.unChange=function(t){for(var e=this.listeners.length;e--;)t&&this.listeners[e]!==t||this.listeners.splice(e,1)},F.prototype.fireChange=function(t){n(this.listeners,function(e){e.call(this,t)},this)},F.prototype.get=function(t){t=A(t);var e=null;switch(t.type){case Re.IDENT:e=this.data[t.name];break;case Re.PROP_ACCESSOR:var i=t.paths;e=this.data[i[0].name];for(var n=1,s=i.length;null!=e&&s>n;n++){var r=i[n],o=j(r,this);e=e[o]}}return null==e&&this.parent?this.parent.get(t):e},F.prototype.set=function(t,e,i){i=i||{},t=A(t);var n,s=this.data;switch(t.type){case Re.IDENT:n=t.name;break;case Re.PROP_ACCESSOR:var r=t.paths,o=r.length;if(1===o)n=r[0].name;else{s=s[r[0].name];for(var a=1;o-1>a;a++){var h=j(r[a],this);null==s[h]&&(s[h]={}),s=s[h]}n=j(r[a],this)}}null!=n&&(s[n]=e,!i.silence&&this.fireChange({type:F.ChangeType.SET,expr:t,value:e,option:i}))},F.prototype.push=function(t,e,i){i=i||{},t=A(t);var n=this.get(t);n instanceof Array&&(n.push(e),!i.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_PUSH,value:e,index:n.length-1,option:i}))},F.prototype.pop=function(t,e){e=e||{},t=A(t);var i=this.get(t);if(i instanceof Array){var n=i.pop();!e.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_POP,value:n,index:i.length,option:e})}},F.prototype.shift=function(t,e){e=e||{},t=A(t);var i=this.get(t);if(i instanceof Array){var n=i.shift();!e.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_SHIFT,value:n,option:e})}},F.prototype.unshift=function(t,e,i){i=i||{},t=A(t);var n=this.get(t);n instanceof Array&&(n.unshift(e),!i.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_UNSHIFT,value:e,option:i}))},F.prototype.removeAt=function(t,e,i){i=i||{},t=A(t);var n=this.get(t);if(n instanceof Array){if(0>e||e>=n.length)return;var s=n[e];n.splice(e,1),!i.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_REMOVE,value:s,index:e,option:i})}},F.prototype.remove=function(t,e,i){i=i||{},t=A(t);var n=this.get(t);if(n instanceof Array)for(var s=n.length;s--;)if(n[s]===e){this.removeAt(t,s,i);break}},F.prototype.splice=function(t,e,i,s,r){r=r||{},t=A(t);var o=this.get(t),a=[];if(o instanceof Array){if(0>e||e>=o.length)return;var h=[e,i];n(s,function(t){h.push(t)}),a=o.splice.apply(o,h),!r.silence&&this.fireChange({expr:t,type:F.ChangeType.ARRAY_SPLICE,index:e,deleteCount:a.length,value:a,insertions:s||[],option:r})}return a};var ke={"&":"&","<":"<",">":">",'"':""","'":"'"},Oe={html:function(t){return null==t?"":String(t).replace(/[&<>"']/g,V)},url:encodeURIComponent,raw:function(t){return t},yesToBe:function(t,e){return t?e:""},nullToBe:function(t,e){return null==t?e:t},yesOrNoToBe:function(t,e,i){return t?e:i},join:function(t,e){return t instanceof Array?t.join(e):t}},Ie={compiled:{name:"compiled",value:1},inited:{name:"inited",value:2},created:{name:"created",value:3},attached:{name:"attached",value:4,mutex:"detached"},detached:{name:"detached",value:5,mutex:"attached"},disposed:{name:"disposed",value:6,mutex:"*"}};W.prototype.set=function(t){var e=Ie[t];e&&(e.mutex&&("*"===e.mutex?this.raw={}:this.raw[Ie[e.mutex].value]=0),this.raw[e.value]=1)},W.prototype.is=function(t){var e=Ie[t];return e?!!this.raw[e.value]:!1},$.prototype._callHook=function(t){if(!this.lifeCycle.is(t)){this.lifeCycle.set(t),"function"==typeof this["_"+t]&&this["_"+t].call(this),"function"==typeof this[t]&&this[t].call(this);var e=this.hooks&&this.hooks[t];e&&e.call(this)}},$.prototype.init=function(t){this._init(t),this._callHook("inited")},$.prototype._init=function(t){this.owner=t.owner,this.parent=t.parent,this.scope=t.scope,this.aNode=this.aNode||t.aNode,this.el=t.el,this.id=this.el&&this.el.id||this.aNode&&this.aNode.id||c()},$.prototype._created=function(){this.el||(this.el=document.getElementById(this.id))},$.prototype._noticeAttached=function(){n(this.childs,function(t){t._noticeAttached()}),this._callHook("created"),this._callHook("attached")},$.prototype.dispose=function(){this._dispose(),this._callHook("disposed")},$.prototype._dispose=function(){this.el=null,this.owner=null,this.scope=null,this.aNode=null,this.parent=null},$.prototype.evalExpr=function(t){return j(t,this.scope,this.owner)},i(X,$),X.prototype._init=function(t){$.prototype._init.call(this,t),this.el&&(this.aNode.isText=!0,this.aNode.tagName=null,this.aNode.textExpr=C(this.el.innerHTML),this.parent._pushChildANode(this.aNode)),this.expr=this.aNode.textExpr},X.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},X.prototype.genHTML=function(){var t=Te?"":"";return(this.evalExpr(this.expr)||t)+G(this)},X.prototype.update=function(){if(!this.lifeCycle.is("disposed")){var t=this.el.previousSibling;if(t&&3===t.nodeType){var e="string"==typeof t.textContent?"textContent":"data";t[e]=this.evalExpr(this.expr)}else this.el.insertAdjacentHTML("beforebegin",this.evalExpr(this.expr));this.hasUpdateOpInNextTick=0,this._callHook("updated")}},X.prototype.updateView=function(t){return!this.hasUpdateOpInNextTick&&B(this.expr,t.expr,this.scope)?(this.hasUpdateOpInNextTick=1,u(this.update,this),!0):void 0},X.prototype._dispose=function(){this.expr=null,$.prototype._dispose.call(this)},i(q,$),q.prototype._init=function(t){var e=t.aNode.props.get("name");this.name=e?e.raw:"__default__";var i=t.owner,n=i.aNode.givenSlots,s=n&&n[this.name],r=new y;s?(r.childs=s,t.owner=i.owner,t.scope=i.scope):r.childs=t.aNode.childs.slice(0),t.aNode=r,$.prototype._init.call(this,t)},q.prototype._inited=function(){this.owner.slotChilds.push(this)},q.prototype.genHTML=function(){return ne(this)},q.prototype.updateView=function(){},q.prototype.slotUpdateView=function(t){if(!this.lifeCycle.is("disposed")){var e=!1;return n(this.childs,function(i){e=i.updateView(t)||e}),e}},q.prototype._dispose=function(){J.prototype._disposeChilds.call(this),this.childs=null,$.prototype._dispose.call(this)};var Pe={};i(J,$),J.prototype._init=function(t){$.prototype._init.call(this,t),this.el&&this._initFromEl(t),Pe[this.id]=this,this.tagName=this.tagName||this.aNode.tagName||"div",Ae&&9>Ae&&/^[a-z0-9]+-[a-z0-9]+$/i.test(this.tagName)&&(this.tagName="div")},J.prototype._initFromEl=function(){this.aNode=pe(this.el),this.parent._pushChildANode(this.aNode),this.tagName=this.aNode.tagName},J.prototype._inited=function(){this.props=this.binds=this.aNode.props,this._initPropHandlers(),this.el&&(this.tagName=this.el.tagName.toLowerCase(),ae(this),this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},J.prototype._create=function(){this.el||(this.el=p(this.tagName),this.el.id=this.id,this.props.each(function(t){var e=this instanceof oe?j(t.expr,this.data,this):this.evalExpr(t.expr);K(this,t.name).input.prop(this,t.name,e)},this))},J.prototype.create=function(){this.lifeCycle.is("created")||(this._create(),this._callHook("created"))},J.prototype._created=function(){$.prototype._created.call(this),this._initSelfChanger(),this.bindEvents()},J.prototype._initSelfChanger=function(){this.binds&&this.binds.each(function(t){if(t.twoWay)switch(t.name){case"value":switch(this.tagName){case"input":case"textarea":this.on("oninput"in this.el?"input":"propertychange",r(Q,this,t));break;case"select":this.on("change",r(Q,this,t))}break;case"checked":if("input"===this.tagName)switch(this.el.type){case"checkbox":case"radio":this.on("click",r(Q,this,t))}}},this)},J.prototype.attach=function(t,e){this.lifeCycle.is("attached")||(this._attach(t,e),this._noticeAttached())},J.prototype._attach=function(t,e){this.create(),this.el.innerHTML=ne(this),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el))};var He={input:function(t,e){return{name:"oninput"in t.el?"input":"propertychange",fn:r(Z,t,e)}},"*":function(t,e){return{name:e.name,fn:r(te,t,e)}}};J.prototype.bindEvents=function(){this.aNode.events.each(function(t){var e=He[t.name]||He["*"],i=e(this,t);this.on(i.name,i.fn)},this)},J.prototype.unbindEvents=function(){var t=this.eventListeners;for(var e in t)t.hasOwnProperty(e)&&this.un(e);this.eventListeners=null},J.prototype.fire=function(t,e){n(this.eventListeners[t],function(t){t.call(this,e)},this)},J.prototype.on=function(t,e){"function"==typeof e&&(this.eventListeners[t]||(this.eventListeners[t]=[]),this.eventListeners[t].push(e),o(this.el,t,e))},J.prototype.un=function(t,e){for(var i=this.eventListeners[t],n=i instanceof Array&&i.length;n--;){var s=i[n];e&&e!==s||(i.splice(n,1),a(this.el,t,s))}},J.prototype.genHTML=function(){var t=new l;return ee(this,t),t.push(ne(this)),ie(this,t),t.toString()};var Le={readonly:"readOnly",cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",usemap:"useMap",frameborder:"frameBorder","for":"htmlFor","class":"className"},Ue=[se("disabled",function(t){switch(t.tagName){case"input":case"textarea":case"button":case"select":return!0}}),se("readonly",function(t){switch(t.tagName){case"input":case"textarea":return!0}}),{input:{attr:function(t,e,i){var n=t.props.get("value");return n&&s(i,t.evalExpr(n.expr))?' checked="checked"':void 0},prop:function(t,e,i){var n=t.props.get("value");return n&&s(i,t.evalExpr(n.expr))?void(t.el.checked=!0):void(t.el.checked=!1)}},output:function(t,e){var i=t.el;t.scope[i.checked?"push":"remove"](e.expr,i.value)},choose:function(t){if(t.aNode){var e=t.props.get("type");return"input"===t.tagName&&e&&"checkbox"===t.evalExpr(e.expr)&&"checked"}}},{input:{attr:function(t,e,i){var n=t.props.get("value");return n&&i===t.evalExpr(n.expr)?' checked="checked"':void 0},prop:function(t,e,i){var n=t.props.get("value");return n&&i===t.evalExpr(n.expr)?void(t.el.checked=!0):void(t.el.checked=!1)}},output:function(t,e){var i=t.el;t.scope.set(e.expr,i.checked?i.value:"",{target:{id:t.id,prop:e.name}})},choose:function(t){if(t.aNode){var e=t.props.get("type");return"input"===t.tagName&&e&&"radio"===t.evalExpr(e.expr)&&"checked"}}},{input:{attr:function(t,e,i){i&&u(function(){t.el[e]=i})},prop:function(t,e,i){t.el[e]=i}},output:function(t,e){t.scope.set(e.expr,t.el[e.name],{target:{id:t.id,prop:e.name}})},choose:function(t){return"select"===t.tagName&&"value"}},{input:{attr:function(t,e,i){return i?' style="'+i+'"':void 0},prop:function(t,e,i){t.el.style.cssText=i}},choose:function(){return"style"}},{input:{attr:function(t,e,i){return null!=i?" "+e+'="'+i+'"':void 0},prop:function(t,e,i){e=Le[e]||e,t.el[e]=i}},output:function(t,e){t.scope.set(e.expr,t.el[e.name],{target:{id:t.id,prop:e.name}})},choose:function(){return"*"}}];J.prototype._initPropHandlers=function(){this.propHandlers={},n(Ue,function(t){var e=t.choose(this);e&&(this.propHandlers[e]=t)},this)},J.prototype.setProp=function(t,e){this.lifeCycle.is("created")&&K(this,t).input.prop(this,t,e)},J.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=!1;return this.props.each(function(i){!re(t,this,i.name)&&B(i.expr,t.expr,this.scope)&&(u(function(){this.lifeCycle.is("disposed")||this.setProp(i.name,this.evalExpr(i.expr))},this),e=!0)},this),n(this.childs,function(i){e=i.updateView(t)||e}),e&&this._noticeUpdatedSoon(),e}},J.prototype._noticeUpdatedSoon=function(){this._updateOpCount++,u(this._noticeUpdated,this)},J.prototype._noticeUpdated=function(){this._updatedOp++,this._updatedOp>=this._updateOpCount&&(this._updateOpCount=0,this._updatedOp=0,this._callHook("updated"))},J.prototype.detach=function(){this.lifeCycle.is("attached")&&(this._detach(),this._callHook("detached"))},J.prototype._detach=function(){h(this.el)},J.prototype._dispose=function(){this._disposeChilds(),this.detach(),this.unbindEvents(),this.valueSynchronizer&&a(this.el,this.valueSynchronizerEvent,this.valueSynchronizer),this.el=null,this.childs=null,this.propHandlers=null,this.props=null,this.binds=null,delete Pe[this.id],$.prototype._dispose.call(this)},J.prototype._disposeChilds=function(){n(this.childs,function(t){t.dispose()}),this.childs.length=0},J.prototype._pushChildANode=function(t){this.aNode.childs.push(t)},i(oe,J),oe.prototype.init=function(t){if(this.filters=t.filters||this.filters||{},this._compile(),!t.el){var e=this.constructor.prototype.aNode;if(t.aNode){var i=t.aNode,s={};n(i.childs,function(t){var e="__default__",i=!t.isText&&t.props.get("slot");i&&(e=i.raw),s[e]||(s[e]=[]),s[e].push(t)},this),this.aNode=new y({tagName:e.tagName||i.tagName,givenSlots:s,childs:e.childs,props:e.props,binds:i.props,events:i.events.concat(e.events),directives:i.directives.concat(e.directives)})}}this._callHook("compiled"),J.prototype._init.call(this,t),this.binds=this.aNode.binds||new d,this.props=this.aNode.props,this.owner||(this.owner=this);var r=t.data;r||"function"!=typeof this.initData||(r=this.initData());for(var o in r)r.hasOwnProperty(o)&&this.data.set(o,r[o]);this.scope&&this.binds.each(function(t){this.data.set(t.name,this.evalExpr(t.expr))},this),this._callHook("inited"),this._isInitFromEl&&(this._callHook("created"),this._callHook("attached"))},oe.prototype._inited=function(){this._initPropHandlers()},oe.prototype.ref=function(t){function e(s){for(var r=0,o=s.childs.length;o>r;r++){if(i)return;var a=s.childs[r];if(a instanceof oe){var h=a.aNode.directives.get("ref");h&&j(h.value,a.scope||n.data,n)===t&&(i=a)}else a instanceof J&&e(a)}}var i=null,n=this;return e(n),i},oe.prototype._initFromEl=function(){this._isInitFromEl=!0,this.aNode=pe(this.el),this.aNode.binds=this.aNode.props,this.aNode.props=new d,this.parent&&this.parent._pushChildANode(this.aNode),ae(this)},ue.prototype.goNext=function(){this.current=this.raw[++this.index],this.next=this.raw[this.index+1]},oe.prototype._compile=function(){var t=this.constructor.prototype;if(!t._isComponentsPreDefined){var e=t.components;for(var i in e)e.hasOwnProperty(i)&&"object"==typeof e[i]&&(e[i]=xe(e[i]));t._isComponentsPreDefined=!0}if(!t.aNode&&(t.aNode=new y,t.template)){var n=g(t.template),s=n.childs[0];if(!s||s.isText)throw new Error("[SAN FATEL] template must have a root element.");t.aNode=s,"template"===s.tagName&&(s.tagName=null),s.events.each(function(t){t.isOwn=!0}),t.template=null}},oe.prototype._initSelfChanger=function(){this.dataChanger||(this.dataChanger=r(this._dataChanger,this),this.data.onChange(this.dataChanger))},oe.prototype._dataChanger=function(t){var e=!1;this.props.each(function(e){B(e.expr,t.expr,this.data)&&u(function(){this.setProp(e.name,j(e.expr,this.data,this))},this)},this),n(this.childs,function(i){e=i.updateView(t)||e}),n(this.slotChilds,function(i){e=i.slotUpdateView(t)||e}),e&&this._noticeUpdatedSoon(),this.binds.each(function(e){if(e.twoWay&&!re(t,this.owner)&&B(A(e.name),t.expr,this.data)){var i=e.expr;if(t.expr.type===Re.PROP_ACCESSOR){switch(i={type:Re.PROP_ACCESSOR,paths:[]},e.expr.type){case Re.IDENT:i.paths.push(e.expr);break;case Re.PROP_ACCESSOR:Array.prototype.push.apply(i.paths,e.expr.paths)}Array.prototype.push.apply(i.paths,t.expr.paths.slice(1))}this.scope.set(i,j(t.expr,this.data,this),{target:{id:this.id,prop:e.name}})}},this)},oe.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=!1;return this.binds.each(function(i){!re(t,this,i.name)&&B(i.expr,t.expr,this.scope)&&(this.data.set(i.name,this.evalExpr(i.expr),{target:{id:this.owner.id}}),e=!0)},this),e}},oe.prototype.watch=function(t,e){var i=A(t);this.data.onChange(r(function(t){B(i,t.expr,this.data)&&e.call(this,j(i,this.data,this),t)},this))},oe.prototype._dispose=function(){this.slotChilds=null,this.data.unChange(),this.dataChanger=null,this.data=null,J.prototype._dispose.call(this)},i(le,J),le.prototype._initFromEl=function(t){if(t.el){if("if"===t.el.getAttribute("san-stump")){var e=g(t.el.innerHTML);e=e.childs[0],e.directives.remove("else"),this.aNode=e,this.tagName=this.aNode.tagName}else{this.el=null,this._create(),t.el.parentNode.insertBefore(this.el,t.el.nextSibling),t.el.removeAttribute("san-if");var i=he(t.el,this,t.elWalker);this.childs.push(i),this.aNode.childs=i.aNode.childs.slice(0)}t.ifDirective&&this.aNode.directives.push(t.ifDirective),this.parent._pushChildANode(this.aNode)}},le.prototype._pushChildANode=function(){},le.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},le.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},le.prototype.genHTML=function(){var t=new l,e=this.aNode.directives.get("if");if(this.evalExpr(e.value)){var i=de(this);this.childs.push(i),t.push(i.genHTML())}return Te&&!t.length&&t.push(""),t.push(G(this)),t.toString()},le.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=this.aNode.directives.get("if").value;if(B(e,t.expr,this.scope)){var i=this.childs[0];return this.evalExpr(e)&&i&&i.updateView(t),u(function(){var t=this.evalExpr(e),i=this.childs[0];t?i||(i=de(this),i.attach(this.el.parentNode,this.el),this.childs[0]=i):i&&(i.dispose(),this.childs.length=0)},this),!0}return i&&i.updateView(t)}},le.prototype._noticeAttached=function(){var t=this.aNode.directives.get("if");
this.evalExpr(t.value)&&this.childs[0]._noticeAttached(),this._callHook("created"),this._callHook("attached")},i(ve,J),ve.prototype._pushChildANode=function(){},ve.prototype.genHTML=function(){var t=new l;return ye(this,function(e,i){var n=ge(this,e,i);this.childs.push(n),t.push(n.genHTML())}),Te&&!t.length&&t.push(""),t.push(G(this)),t.toString()},ve.prototype._initFromEl=function(t){if(t.el){for(;;){var e=t.elWalker.current;if("for"===e.getAttribute("san-stump")){var i=g(e.innerHTML);i=i.childs[0],this.aNode=i,this.tagName=this.aNode.tagName;break}e.removeAttribute("san-for");var n=he(e,this,t.elWalker);this.childs.push(n);var s=t.elWalker.next;if(!s||!s.getAttribute("san-for")&&"for"!==s.getAttribute("san-stump"))break;t.elWalker.goNext()}this.parent._pushChildANode(this.aNode)}},ve.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},ve.prototype._attach=function(t,e){this.create(),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el));var i=new l;ye(this,function(t,e){var n=ge(this,t,e);this.childs.push(n),i.push(n.genHTML())}),this.el.insertAdjacentHTML("beforebegin",i.toString())},ve.prototype._detach=function(){n(this.childs,function(t){t.dispose()}),this.childs.length=0,h(this.el)},ve.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},ve.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var i=this.aNode.directives.get("for"),s=t.expr,r=s.paths;s.type===Re.IDENT&&(r=[s]);var o=r.length,a=i.list,h=a.paths;a.type===Re.IDENT&&(h=[a]);for(var p,c=h.length,d=0,f=0;o>f&&c>f;f++)if(this.evalExpr(r[f])!==this.evalExpr(h[f])){d=-1;break}d>=0&&o>c&&(p=+this.evalExpr(r[c]),d=o-c===1?1:2);var v=!1;switch(d){case-1:n(this.childs,function(e){v=e.updateView(t)||v});break;case 0:switch(t.type){case F.ChangeType.ARRAY_PUSH:u(function(){if(!this.lifeCycle.is("disposed")){var e=ge(this,t.value,t.index);this.childs.push(e),e.attach(this.el.parentNode,this.el)}},this);break;case F.ChangeType.ARRAY_POP:u(function(){if(!this.lifeCycle.is("disposed")){var t=this.childs.length-1;this.childs[t].dispose(),this.childs.splice(t,1)}},this);break;case F.ChangeType.ARRAY_UNSHIFT:u(function(){if(!this.lifeCycle.is("disposed")){var e=ge(this,t.value,0),i=this.childs[0]||this;this.childs.unshift(e),e.attach(i.el.parentNode,i.el)}},this),me(this,0,function(t){return t+1});break;case F.ChangeType.ARRAY_SHIFT:u(function(){this.lifeCycle.is("disposed")||(this.childs[0].dispose(),this.childs.splice(0,1))},this),me(this,1,function(t){return t-1});break;case F.ChangeType.ARRAY_REMOVE:u(function(){this.lifeCycle.is("disposed")||(this.childs[t.index].dispose(),this.childs.splice(t.index,1))},this),me(this,t.index+1,function(t){return t-1});break;case F.ChangeType.ARRAY_SPLICE:u(function(){if(!this.lifeCycle.is("disposed")){for(var e=[t.index,t.deleteCount],i=0;i