This repository was archived by the owner on Apr 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrexjs-template.min.js
1 lines (1 loc) · 30.1 KB
/
rexjs-template.min.js
1
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){t.exports=n(1)},function(module,exports){(function(Rexjs,Object,MODULE_CODE_STRING,defineProperty,getPrototypeOf){new function(t,e,n,r,i){"use strict";this.Rexjs=Rexjs=e.exports=function(t,e,n){return function r(i,s){var o,c,u=e(i);switch(typeof s){case"function":o=s,c=s.prototype;break;case"undefined":o=getPrototypeOf(r),c=this.constructor.prototype;break;default:o=t(null,u),c=null}return n(i,o),i.prototype=t(c,u),i}}(Object.create,function(t){return{constructor:{value:t,configurable:!0,writable:!0}}},r||(n?function(t,e){n.set.call(t,e)}:function(t,e){t.$Rexjs_prototype=e;do{i(e).forEach(function(n){t.hasOwnProperty(n)||(t[n]=e[n])}),e=getPrototypeOf(e)}while(e)})),this.value=function(t){return function(t){return Object.prototype.hasOwnProperty("__proto__")?(defineProperty(t,"__proto__",Object.getOwnPropertyDescriptor(Object.prototype,"__proto__")),t):t}(new Rexjs(Rexjs,null))}(),defineProperty(t,"Rexjs",this)}(Function("return this")(),eval(MODULE_CODE_STRING),Object.getOwnPropertyDescriptor(Object.prototype,"__proto__"),Object.setPrototypeOf,Object.getOwnPropertyNames),new function(t,e){"use strict";this.apply=t.apply,this.bind=t.bind,this.call=t.call,this.hasOwnProperty=Object.prototype.hasOwnProperty,this.static=function(t){return function(e){for(var n in e){var r=t(e,n);r.enumerable=!1,defineProperty(this,n,r)}}}(Object.getOwnPropertyDescriptor),this.props=function(t){return function(e){t.call(this.prototype,e)}}(this.static),this.toString=function(){return e===t.prototype?t.toString:function(){return"function "+(this.name||"")+"() { native code }"}}(),this.static.call(e,this)}(Function,getPrototypeOf(Rexjs)),new function(t){"use strict";this.hasOwnProperty=t.hasOwnProperty,this.isPrototypeOf=t.isPrototypeOf,this.propertyIsEnumerable=t.propertyIsEnumerable,this.toString=function(){return function(){return"[Rexjs "+this.constructor.name+"]"}}(),this.toLocaleString=function(t){return function(){return t.call(this)}}(this.toString),this.valueOf=function(){return function(){return this}}(),Rexjs.static.call(Rexjs.prototype,this)}(Object.prototype),new function(t){"use strict";this.MODULE_CODE_STRING=MODULE_CODE_STRING,this.every=function(){return function(t,e,n,r){if(r){for(var i=0,s=t.length;i<s;i++)if(!e.call(n,t[i],i,t))return!1}else for(var o in t)if(!e.call(n,t[o],o,t))return!1;return!0}}(),this.forEach=function(t){return function(t,e,n,r){if(r)for(var i=0,s=t.length;i<s;i++)e.call(n,t[i],i,t);else for(var o in t)e.call(n,t[o],o,t);return t}}(this.every),this.map=function(t){return function(e,n,r,i){var s=new e.constructor;return t(e,function(t,e,r){s[e]=n.call(this,t,e,r)},r,i),s}}(this.forEach),this.toArray=function(t){return function(e,n,r){return t.call(e,n||0,r)}}(t.prototype.slice),this.toString=function(){return function(){var t=this.name;return t?"function "+t+"() { [native code] }":"function (){ [native code] }"}}(),this.forEach(this,function(t,e,n){"function"==typeof t&&(t.toString=n.toString),this[e]=t},Rexjs)}(Array)}).call(this,null,Object,"({})",Object.defineProperty,Object.getPrototypeOf),new function(t,e,n,r,i){this.List=function(e,n,r){function i(t){}return i=new t(i),i.props({concat:function(t){return r(this).concat(r(t))},clear:function(){this.splice(0)},combine:function(t){this.push.apply(this,t)},distinct:function(){this.splice(0).forEach(function(t){this.indexOf(t)>-1||this.push(t)},this)},length:0}),n.getOwnPropertyNames(e.prototype).forEach(function(t){if(!i.prototype.hasOwnProperty(t)&&"toString"!==t){var e={};e[t]=this[t],i.props(e)}},e.prototype),i}(Array,Object,t.toArray),this.URL=function(e,n){function r(t,i){if(null!=t&&(t=e(t),!n(this,t)&&i)){var s=new r(i);n(this,s.origin+("/"===t[0]?"":s.dirname+"/")+t)}}return r=new t(r),r.props({ext:"",dirname:"",filename:"",hash:"",get host(){var t=this.hostname;if(t){var e=this.port;return t+(e?":"+e:"")}return""},hostname:"",get href(){var t=this.protocal;return(t?t+(this.host?"//"+(this.username?this.username+"@":"")+this.host:"/"):"")+this.pathname+this.search+this.hash},get origin(){var t=this.host;return t?this.protocal+"//"+t:""},get pathname(){var t=this.filename,e=this.dirname;return t?e+("/"===e[e.length-1]?"":"/")+t:e},port:"",protocal:"",search:"",toString:function(){return this.href},username:""}),r}(function(t){return"string"!=typeof t&&(t=null==t?"":t.toString()),r(t.trim())},function(t,r){var s=r.match(e);if(!s)throw"Invalid URL: "+r;var o=[],c=i(s,1),u=i(s,2),a=i(s,3),l=i(s,4),h=i(s,5),p=i(s,6);switch(t.protocal=c,t.hostname=a,t.username=u,t.port=l,t.filename=p,t.ext=i(s,7),t.search=i(s,8),t.hash=i(s,9),c){case"http:":case"https:":if(!t.hostname)return!1;break;case"":break;default:var f;switch(r=decodeURI(r),!0){case t.search.length>0:f=r.indexOf("?");break;case t.hash.length>0:f=r.indexOf("#");break;default:f=r.length}if(t.hostname=t.port="","data:"===c)return t.dirname=r.substring(c.length,f),t.filename=t.ext="",!0;h=r.substring(c.length,f-p.length),t.search=decodeURI(t.search),t.hash=decodeURI(t.hash)}return h.split(n).forEach(function(t){switch(t){case".":break;case"..":o.splice(o.length-1);break;case"":break;default:o.push(t)}}),p||"/"!==h[h.length-1]||o.push(""),t.dirname="/"+o.join("/"),c.length>0}),t.static(this)}(Rexjs,/^(?:([^:\/?#.]+:)(?:\/+(?:([^\/?#]*)@)?([\w\d\-\u0100-\uffff.%]*)(?::([0-9]+))?)?)?(?:([^?#]+?)([^\/]+?(\.[^.?#\/]+))?)?(?:(\?[^#]*))?(?:(#.*))?$/,/\/|\\/g,encodeURI,function(t,e){return t[e]||""}),new function(Rexjs,URL,Module,global){(function(){this.IteratorIndex=function(){function t(t){this.max=t}return t=new Rexjs(t),t.props({current:0,increase:function(t){var e=this.current+t,n=this.max;this.current=e>n?n:e},max:0}),t}(),this.IteratorResult=function(){function t(t,e){this.value=t,this.done=e}return t=new Rexjs(t),t.props({value:void 0,done:!1}),t}(),this.Iterator=function(t,e){function n(e){if(null!=e){var n=e.length;if("number"==typeof n||"number"==typeof(n=e.size))return this.index=new t(n),void(this.iterable=e)}throw"TypeError: uniterable object "+e}return n=new Rexjs(n),n.props({close:function(t){return this.index.increase(1/0),new e(t,this.closed)},get closed(){var t=this.index;return t.current>=t.max},index:null,iterable:null,get next(){var t=this.result;return this.index.increase(1),t},get result(){return new e(this.iterable[this.index.current],this.closed)}}),n}(this.IteratorIndex,this.IteratorResult),this.FunctionIterator=function(t,e,n,r){function i(e,n,i){t.call(this,e),this.boundThis=n,this.boundArguments=r(i),this.observers=[],this.index.max=1/0}return i=new Rexjs(i,t),i.props({boundThis:null,boundArguments:null,close:function(t){return this.index.increase(NaN),new e(t,this.closed)},get closed(){return n(this.index.current)},exception:"",get next(){return this.result},observe:function(t){this.observers.push(t)},observers:null,get result(){try{return new e(this.closed?void 0:this.iterable.apply(this.boundThis,this.boundArguments),this.closed)}catch(e){var t=this.observers;if(0===t.length)throw e;return this.exception=e,this.index.current=this.unobserve(),this.result}},unobserve:function(){return this.observers.pop()}}),i}(this.Iterator,this.IteratorResult,isNaN,Rexjs.toArray),this.Generator=function(t){function e(e){this.iterator=e instanceof t?e:new t(e)}return e=new Rexjs(e),e.props({iterator:null,next:function(){return this.iterator.next},return:function(t){return this.iterator.close(t)},throw:function(t){throw t}}),e}(this.Iterator)}).call(this,1/0),function(t,e,n,r){r=function(e){return e?t:function(e){switch(!0){case e instanceof Rexjs:break;case n.call(e,"$Rexjs_prototype"):return e.$Rexjs_prototype}return t(e)}}(!(!Object.setPrototypeOf&&!e(Object.prototype,"__proto__"))),this.ClassProperty=function(){function t(t,e,n){this.name=t,this.value=e,n&&(this.type=n)}return t=new Rexjs(t),t.props({name:"",static:!1,type:"value",value:null}),t}(),this.StaticProperty=function(t){function e(e,n,r){t.call(this,e,n,r)}return e=new Rexjs(e,t),e.props({static:!0}),e}(this.ClassProperty),this.Super=function(e){function n(){}return n=new Rexjs(n),n.static({callConstructor:function(e,n,r){return this.returnedThis(n,t(e).constructor.apply(n,r))},execMethod:function(t,e,n){return e.apply(t,n)},getProperty:function(t,n,r){var i=e(t,r);if(i)return i.hasOwnProperty("get")?i.get.call(n):i.value},returnedThis:function(t,e){return"object"==typeof e&&e||t},setProperty:function(t,n,r,i){var s=e(t,r);if(s&&s.hasOwnProperty("set")){var o=s.set;return o&&o.call(n,i),i}return n[r]=i,i}}),n}(function(i,s){for(var o=r(i);o;){if(n.call(o,s))return e(o,s);o=t(o)}return null}),this.Class=function(t,e){function n(){}return n=new Rexjs(n),n.static({create:function(t,n,r){var i=n[r].value;if("function"!=typeof i)throw"Class extends value "+i.toString()+" is not a constructor or null";for(var s=new Rexjs(i,t),o=s.prototype,c=0,u=n.length;c<u;c++){var a=n[c];if(c!==r){var l=a.type,h={enumerable:!1,configurable:!0};"value"===l?(h.writable=!0,h.value=a.value):h[l]=a.value,e(a.static?s:o,a.name,h)}}return s}}),n}(this.ClassProperty,Object.defineProperty)}.call(this,Object.getPrototypeOf,Object.getOwnPropertyDescriptor,Object.hasOwnProperty,null),function(){this.Function=function(t,e){function n(){}return n=new Rexjs(n),n.static({convert:function(n,r){if(1===arguments.length)return"function"==typeof n?n:e;var i=n[r];return"function"!=typeof i?e:t.call(i,n)}}),n}(Function.bind,function(){}),this.Object=function(){function t(){}return t=new Rexjs(t),t.static({getEnumerablePropertyNames:function(t){var e=[];for(var n in t)e.push(n);return e}}),t}(),this.ObjectDestructuringTarget=function(t,e){function n(t){this.destructed=[],this.origin=t}return n=new Rexjs(n),n.props({destructed:null,get:function(t){return this.destructed.push(t),this.origin[t]},origin:null,get rest(){var n={},r=this.origin;return t(r).forEach(function(t){this.indexOf(t)>-1||e(r,t).enumerable&&(n[t]=r[t])},this.destructed),n}}),n}(Object.getOwnPropertyNames,Object.getOwnPropertyDescriptor),this.SpreadItem=function(t,e){function n(t){this.value=t}return n=new Rexjs(n),n.static({assign:function(e,n){return t(n,function(t,n){e[n]=t}),e},combine:function(r){var i=[];return t(arguments,function(t){if(t instanceof n)return void e.apply(i,t.value);i.push(t)},null,!0),i},combineBy:function(t){return this.combine.apply(this,t)}}),n.props({value:null}),n}(Rexjs.forEach,Array.prototype.push),this.SwitchCondition=function(){function t(t){this.value=t}return t=new Rexjs(t),t.props({case:function(t){switch(!0){case this.matched:break;case this.value===t:this.matched=!0;break;default:return!1}return!0},default:function(){return!this.matched&&(this.matched=!0,!0)},matched:!1,value:null}),t}()}.call(this),function(){this.ModuleCompiler=function(){function t(){}return t=new Rexjs(t),t.props({compile:function(t){this.deps=[],this.result=t.origin},deps:null,exec:function(t){var e=this;t.load(function(){Module.export("default",e.result)})},result:null}),t}(),this.JavaScriptCompiler=function(t,e,n,r){function i(){t.call(this)}return i=new Rexjs(i,t),i.props({compile:function(t){var r=new e;r.parse(new n(t.name,t.origin)),this.result=r.build(),this.deps=r.deps},exec:function(t){r(this.result)}}),i}(this.ModuleCompiler,Rexjs.ECMAScriptParser,Rexjs.File,eval),this.JSONCompiler=function(t,e){function n(){t.call(this)}return n=new Rexjs(n,t),n.props({compile:function(t){this.result=e(t.origin),this.deps=[]}}),n}(this.ModuleCompiler,JSON.parse)}.call(this),function(t,e,n,r,i,s,o,c,u){this.Module=Module=function(a,l,h,p,f,d){function y(t,n,r){var i=c.parseName(t),s=i.href;if(l.hasOwnProperty(s)){var o=l[s];return"function"!=typeof n||this.ended||o.load(n),o}switch(this.exports=p(null),this.imports=[],this.listeners=[],this.name=i,this.status=e,this.targets=[],l[s]=this,typeof n){case"string":return void this.ready(n,r);case"function":return void this.load(n)}d(this,r)}return y=new Rexjs(y),y.static({STATUS_NONE:t,STATUS_LOADING:e,STATUS_COMPILING:n,STATUS_READY:r,STATUS_ENDED:i,STATUS_COMPLETED:s,STATUS_ERROR:o,get cache(){return l},defaultOf:function(t,e){return this.import(t,e).default},export:function(t,e,n){f((n||h[h.length-1]).exports,t,{get:function(){return e},configurable:!1,enumerable:!0})},exportAs:function(t,e,n){if(e){var r=this.import(e,n);for(var i in t)this.export(i,r[t[i]])}else for(var i in t)this.export(i,t[i])},exportFrom:function(t,e){var n=this.import(t,e);for(var r in n)"default"!==r&&this.export(r,n[r])},import:function(t,e){return l[c.parseName(t,e).href].exports},memberOf:function(t,e,n){return this.import(e,n)[t]},moduleOf:function(t,e){return this.import(t,e)},get stack(){return h}}),y.props({compiler:null,get completed(){return(this.status&s)===s},get ended(){return(this.status&i)===i},get error(){return(this.status&o)===o},exports:null,eval:function(){var t=0,e=0,n=this.imports;this.status;return(this.status&r)===r&&(!!this.completed||(n.forEach(function(e){t+=+e.completed}),(e=t/n.length)<1?(u(this,+e.toFixed(2)),!1):(this.compiler.exec(this),!0)))},imports:null,listen:function(t){if(this.ended)return void t.call(this,1);this.listeners.push(t)},listeners:null,load:function(t){this.completed||(h.push(this),t.call(global,Rexjs),h.pop(),this.status=s,u(this))},name:null,origin:"",ready:function(t,e){var i,s=this.name,o=this.imports;this.origin=t,this.status=n,this.compiler=i=new(c.compilers[s.ext]||a),i.compile(this),this.status=r,i.deps.forEach(function(t){var n=c.parseName(t,s.href).href,r=l.hasOwnProperty(n)?l[n]:new y(n,null,e);if(!(o.indexOf(r)>-1)){if(r.imports.indexOf(this)>-1)throw"Module has been imported by each other "+s.href+" "+r.name.href;o.push(r),r.targets.push(this)}},this),this.eval()},status:t,targets:null}),y}(this.ModuleCompiler,{},[],Object.create,Object.defineProperty,function(t,e){c.readFile(t.name,function(n){t.ready(n,e)},function(e){t.status=o,t.origin=e,console.error('加载模块 "'+t.name.href+'" 错误:'+e+"。"),u(t)},e)}),this.ModuleReady=function(t,e,n){function r(){this.compilers={".js":t,".json":e},c=this}return r=new Rexjs(r),r.static({get current(){return c}}),r.props({compilers:null,parseName:function(){n("parseName")},readFile:function(){n("readFile")}}),r}(this.JavaScriptCompiler,this.JSONCompiler,function(t){throw"应该在创建 ModuleReady 的子类时,重新定义该方法:"+t}),new this.ModuleReady}.call(this,parseInt(0,2),parseInt(10,2),parseInt(100,2),parseInt(1e3,2),parseInt(1e4,2),parseInt(111e3,2),parseInt(101e4,2),null,function(t,e){var n=t.listeners;"number"!=typeof e&&(e=1),t.completed&&(t.targets.forEach(function(t){t.eval()}),n=n.splice(0)),n.forEach(function(n){n.call(t,e)})}),Rexjs.static(this)}(Rexjs,Rexjs.URL,null,Function("return this")()),new function(t,e,n,r){(function(i){this.HTMLCompiler=function(n){function r(){i.call(this)}return r=new t(r,i),r.props({compile:function(t){var e=new URL(t.name.href);this.deps=[],this.result=t.origin.replace(n,e.origin+e.dirname+"/")},exec:function(t){var n=this;t.load(function(){e.export("compiler",n),e.export("default",n.result)})}}),r}(/to:\/\/|~\//gi),this.CSSSelectorMap=function(e,n,r,i,s,o){function c(t){r[t]=this}return c=new t(c),c.static({getSelectorMapByNS:function(t){return o.call(r,t)?r[t]:new c(t)}}),c.props({merge:function(t){var e=this;t.forEach(function(t){t!==e&&s(t).forEach(this,t)},function(t){o.call(e,t)||(e[t]=this[t])})},parse:function(t){var r=this;return t.replace(e,function(t){var e,s=t.substring(1);return e=s.replace(n,function(t){return t[1].toUpperCase()}),o.call(r,e)||(i++,r[e]=s+"-"+i.toString(16)),t[0]+r[e]})}}),c}(/(?:#|\.)[^#.[+~*>:,\s]+/g,/(?:-|_)\w/g,{},Math.round(2560+256*Math.random()),Object.getOwnPropertyNames,Object.prototype.hasOwnProperty),this.CSSCompiler=function(s,o,c,u,a,l,h){function p(t,e){i.call(this)}return p=new t(p,i),p.static({disableSelectorMap:function(){u=!1}}),p.props({compile:function(t){var e=t.name.href;this.deps=[],cssText=this.compileURLs(t.origin,e),u&&(this.selectorMap=new s(e),cssText=this.compileSelectors(h(cssText,n.implementation.createHTMLDocument("").head).sheet.cssRules)),this.result=cssText+"\n/*# sourceURL="+e+" */"},compileSelectors:function(t){var e="";return r(t,function(t){switch(t.type){case o.STYLE_RULE:return void(e+=a.call(this.selectorMap,t.selectorText)+"{"+t.style.cssText+"}");case o.MEDIA_RULE:e+="@media "+t.conditionText;break;case o.KEYFRAMES_RULE:e+="@keyframes "+t.name;break;case o.SUPPORTS_RULE:e+="@supports "+t.conditionText;break;case o.IMPORT_RULE:return void this.deps.push(t.href);case o.NAMESPACE_RULE:if("selector-map"===t.prefix)return void(this.selectorMap=s.getSelectorMapByNS(t.namespaceURI));default:return void(e+=t.cssText)}e+="{",e+=this.compileSelectors(t.cssRules),e+="}"},this,!0),e},compileURLs:function(t,e){return t.replace(c,function(t,n,r,i,s){return i?n+new URL(i,e).href+s:t})},exec:function(t){var r=this,i=this.selectorMap;l.call(i,t.imports.map(function(t){return t.compiler.selectorMap})),this.style=h(this.result,n.head),t.load(function(){e.export("compiler",r),e.export("default",i)})},selectorMap:null,style:null}),p}(this.CSSSelectorMap,CSSRule,new RegExp([/\/\*[\s\S]*?\*\//.source,/"(?:\\(?:[^\r]|\r\n?)|[^"\\\r\n\u2028\u2029]+)*"|'(?:\\(?:[^\r]|\r\n?)|[^'\\\r\n\u2028\u2029]+)*'/.source,/(\burl\s*\(\s*(['"]?))(.*?)(\2\s*\))/.source].join("|"),"g"),!0,this.CSSSelectorMap.prototype.parse,this.CSSSelectorMap.prototype.merge,function(t,e){var r=n.createElement("style");return r.type="text/css",r.textContent=t,e.appendChild(r),r})}).call(this,t.ModuleCompiler),function(i,s,o,c){this.BrowserReady=function(e,r,s,c,u){function a(){var t;i.call(this),t=this.compilers,t[".html"]=e,t[".css"]=r,n.addEventListener("DOMContentLoaded",u)}return a=new t(a,i),a.props({parseName:function(t,e){var n=new o(t,e?new o(e,c).href:c);return""===n.filename&&(n.ext=".js",n.filename="index.js"),n},readFile:function(t,e,n,r){var i=new s;i.addEventListener("load",function(){(200===this.status?e:n)(this.responseText)}),i.open("get",t.href,!r),i.send()}}),a}(this.HTMLCompiler,this.CSSCompiler,XMLHttpRequest,new o(c?c.getAttribute("href"):"./",location.href).href,function(){var t=0;r(n.querySelectorAll('script[type="text/rexjs"]'),function(n){if(n.hasAttribute("src"))return n.hasAttribute("data-sourcemaps")&&(s.sourceMaps=!0),void new e(n.src);new e("inline-script-"+t+++".js",n.textContent)},null,!0)})}.call(this,t.ModuleReady,t.ECMAScriptParser,t.URL,n.querySelector("base")),new this.BrowserReady,t.static(this)}(Rexjs,Rexjs.Module,document,Rexjs.forEach),new Rexjs.Module("/source/rexjs-template.js",function(t){"use strict";var e=new t.ObjectDestructuringTarget(new function(e,r,i,s,o,c,u,a,l,h,p){this.Reference=function(e,n){return t.Class.create(void 0,[new t.ClassProperty("owner",null),new t.ClassProperty("name",""),new t.ClassProperty("value",null),new t.ClassProperty("constructor",function(t,e,n){this.bind(t,e,n)}),new t.StaticProperty("add",function(t){e.push(t)}),new t.StaticProperty("is",function(t){return!e.every(n,t)}),new t.ClassProperty("bind",function(t,e,n){return(t!==this.owner||e!==this.name||n!==this.value)&&(this.owner=t,this.name=e,this.value=n,!0)})],3)}(("function"==typeof $&&$.fn&&$.fn.constructor?[$.fn.constructor]:[]).concat([Node,Function]),function(t){return!(this instanceof t)}),this.Data=function(e,n,r,i){return t.Class.create(void 0,[new t.StaticProperty("STATUS_NONE",n),new t.StaticProperty("STATUS_OVERRIDE",r),new t.ClassProperty("origin",null),new t.ClassProperty("refs",null),new t.ClassProperty("refIndex",-1),new t.ClassProperty("status",n),new t.ClassProperty("string",""),new t.ClassProperty("constructor",function(t){null!==t&&"object"==typeof t||(t={}),this.refs=[],this.origin=t}),new t.ClassProperty("compare",function(){var t,e,i=this.refs;return this.refIndex=0,this.status=n,t=this.parse(this.origin),e=this.refIndex,e!==i.length&&(i.splice(e),this.status|=r),this.string!==t&&(this.string=t,this.status|=r),(this.status&r)===r}),new t.ClassProperty("parse",function(n){var s="",o=i(n);s+="{";for(var c=0,u=o.length;c<u;c++){var a=o[c],l=n[a];switch(s+='"'+a+'":',typeof l){case"object":if(e.is(l))break;s+=this.parse(l),s+=",";continue;case"function":break;default:s+='"'+l+'",';continue}var h=new t.ObjectDestructuringTarget(this),p=h.get("refs"),f=h.get("refIndex");this.refIndex++,f<p.length?p[f].bind(n,a,l)&&(this.status|=r):(p.push(new e(n,a,l)),this.status|=r),s+='"",'}return s+="}"})],7)}(this.Reference,parseInt("0",2),parseInt("1",2),Object.keys),this.DOMAction=e=function(e,n,r){return t.Class.create(void 0,[new t.ClassProperty("childIndexes",null),new t.ClassProperty("clones",null),new t.ClassProperty("count",0),new t.ClassProperty("index",-1),new t.ClassProperty("indexOf",-1),new t.ClassProperty("indexBy",-1),new t.ClassProperty("model",null),new t.ClassProperty("constructor",function(t){this.childIndexes=[],this.clones=[],this.model=t}),new t.ClassProperty("applyAppendTo",function(t,e){var i=this.clones,s=t[e];if(this.count>=i.length){var o=this.model.cloneNode();n(o,t,s),i.push(o)}else r(this,t,s);s.indexBy=this.indexOf,this.count++}),new t.ClassProperty("applyAttr",function(t,e){var n=this.dom.attributes[t];n.value!==e&&(n.value=e)}),new t.ClassProperty("applyEvent",function(t,e){var n=this.dom;n[t]!==e&&(n[t]=e)}),new t.ClassProperty("applyReplace",function(t){var n=this.dom;n!==t&&(!(t instanceof e)&&t.length>0&&(t=t[0]),this.clones.splice(this.count-1,1,t),n.parentNode.replaceChild(t,n))}),new t.ClassProperty("applyText",function(t){var e=this.dom;e.textContent!==t&&(e.textContent=t)}),new t.ClassProperty("dom",function(){return this.clones[this.count-1]},"get"),new t.ClassProperty("finish",function(){var t=this.clones,e=this.count;switch(t.length){case 0:case e:break;default:t.splice(e).forEach(l)}this.count=0,this.indexBy=-1})],7)}(Node,function(e,n,r){return function(){var i=new t.ObjectDestructuringTarget(r),s=i.get("dom"),o=i.get("indexBy");if(o>-1){var c=n[r.childIndexes[o]].dom.nextSibling;if(c)return void s.insertBefore(e,c)}s.appendChild(e)}.apply(this[0],this[1])}.bind([this,arguments]),function(e,n,r){return function(){var i=new t.ObjectDestructuringTarget(e),s=i.get("indexOf"),o=i.get("count"),c=i.get("clones");if(e.index>1&&!n[1].dom.contains(c[o]))return void c.splice(o,1);if(0!==s)for(var u=r.indexBy;s>++u;){var a=new t.ObjectDestructuringTarget(n[r.childIndexes[u]]),h=a.get("clones"),p=a.get("count");h.length&&l(h.splice(p,1)[0])}}.apply(this[0],this[1])}.bind([this,arguments])),this.FragmentAction=function(n){var i;return i=t.Class.create(e,[new t.ClassProperty("constructor",function(){return t.Super.callConstructor(i.prototype,this,[c.createDocumentFragment()])}),new t.ClassProperty("dom",function(){return this.model},"get"),new t.ClassProperty("count",function(){return 0},"get"),new t.ClassProperty("finish",function(){}),new t.ClassProperty("rootElement",function(){var t;return n.call(this.dom.childNodes,function(e){return function(){return e.nodeType!==r||(t=e,!1)}.apply(this[0],this[1])}.bind([this,arguments])),t},"get")],0)}(Array.prototype.every),this.ActionList=function(e,n){return t.Class.create(void 0,[new t.ClassProperty("length",0),new t.ClassProperty("finishAll",function(){this.forEach(function(t){return function(){t.finish()}.apply(this[0],this[1])}.bind([this,arguments]))}),new t.ClassProperty("forEach",function(){return a.apply(this,arguments)}),new t.ClassProperty("max",function(){return this.length-1},"get"),new t.ClassProperty("push",function(t,n){var r=this[n],i=this.length;if(t.index=i,r){var s=r.childIndexes;t.indexOf=s.length,s.push(i)}return e.call(this,t)}),new t.ClassProperty("splice",function(){return n.apply(this,arguments)}),new t.ClassProperty("constructor",function(){})],6)}(Array.prototype.push,Array.prototype.splice),this.ActionCompiler=function(e,n,i,s,o,c,u,l,f,d,y,m){return t.Class.create(void 0,[new t.ClassProperty("actionList",null),new t.ClassProperty("selectorMap",null),new t.ClassProperty("constructor",function(t,r,i){var s=new e;switch(i&&(this.selectorMap=i),this.actionList=s,u.innerHTML=this.format(t),u.children.length){case 0:return void h("模板中需要一个根元素",u);case 1:if(f(u,t))break;return;default:return void h("模板不应该存在多种(多个、循环、判断等)情况的根元素",t)}s.push(new n,-1),this.compile(u,r),u.innerHTML=""}),new t.ClassProperty("compile",function(t,e){var n=this.actionList,i=n.max;a.call(t.childNodes,function(t){return function(){if(t.nodeType!==r)return e.push(d(t.textContent)),void m(n,e,t,i);this.compileElement(t,e,i)}.apply(this[0],this[1])}.bind([this,arguments]))}),new t.ClassProperty("compileElement",function(t,e,n){var r=t.tagName;if("SCRIPT"===r&&"rexjs/template"===t.getAttribute("type"))return void this.compileScript(t.childNodes[0],e,t.getAttribute("data-modifier"),n);this.selectorMap&&(t.id&&(t.id=this.compileSelector(t.id)),t.className&&(t.className=this.compileSelectors(t.classList||t.className.match(o)))),m(this.actionList,e,t,n),e.push(d("<"+r.toLowerCase()+">")),a.call(t.attributes,function(n){return function(){this.compileAttr(t,n,e)}.apply(this[0],this[1])}.bind([this,arguments])),this.compile(t,e)}),new t.ClassProperty("compileAttr",function(t,e,n){var r,s,o=[];y(e.value,function(t,e,n){return function(){return"="===t&&(s=n,r=e,o.push(p(n),'" + valueOf('+e+') + "'),!0)}.apply(this[0],this[1])}.bind([this,arguments]),function(c){return function(){var u=e.name,a=this.actionList.max;if(i.test(u)&&2===o.length&&0===s.trim().length&&0===c.trim().length)return n.push("actionList["+a+'].applyEvent("'+u+'", '+r+");"),void t.removeAttribute(u);o.push(p(c)),n.push("actionList["+a+'].applyAttr("'+e.name+'", "'+o.join("")+'");')}.apply(this[0],this[1])}.bind([this,arguments]))}),new t.ClassProperty("compileSelector",function(t){var e,n=this.selectorMap;return e=t.replace(c,function(t){return t[1].toUpperCase()}),l.call(n,e)?n[e]:t}),new t.ClassProperty("compileSelectors",function(t){var e="";if(t){var n=t.length;if(n>0){e=this.compileSelector(t[0]);for(var r=1;r<n;r++)e+=" "+this.compileSelector(t[r])}}return e}),new t.ClassProperty("compileScript",function(t,e,n,r){var i=this.actionList,s=t.textContent;if(e.push(d(s)),n)return m(i,e,t,r),":"===n?void e.push("actionList["+i.max+"].applyReplace("+s+");"):void e.push("actionList["+i.max+"].applyText(valueOf("+s+"));");e.push(s)}),new t.ClassProperty("format",function(t){return t.replace(s,function(t,e,n){return void 0===n?t:n.trim()?'<script type="rexjs/template" data-modifier="'+e+'"}>'+n+"<\/script>":""})})],2)}(this.ActionList,this.FragmentAction,/^on[A-z]+$/,new RegExp([/<!--[\s\S]*?-->/,/<\/?[A-z:_](?:"(?:\\"|[^"]+)*"|'(?:\\'|[^']+)*'|[^>]+?)*>/,/<!doctype\s+\w+\s*>/,i].map(function(t){return function(){return t.source}.apply(this[0],this[1])}.bind([this,arguments])).join("|"),"g"),/\S+/g,/(?:-|_)\w/g,c.body,Object.prototype.hasOwnProperty,function(t,e){return function(){var n=t.firstElementChild;switch(!1){case t.textContent.trim()===n.textContent.trim():return h("根元素外层不应该出现非注释形式的其他文本",e),!1;case"SCRIPT"===n.tagName:case"rexjs/template"===n.getAttribute("type"):return!0}return h("语法标签不允许出现在最外层",e),!1}.apply(this[0],this[1])}.bind([this,arguments]),function(t){return function(){return 0===t.length?"/**/":"/* "+t.split("*/").join("*\\/")+" */"}.apply(this[0],this[1])}.bind([this,arguments]),function(t,e,n,r){return function(){var s,o=-1;for(i.lastIndex=0,s=i.exec(t);s;){var c=s.index;e(s[1],s[2],t.substring(o,c))&&(o=c+s[0].length),s=i.exec(t)}if(-1===o)return void(r&&r(t));n(t.substring(o))}.apply(this[0],this[1])}.bind([this,arguments]),function(t,n,r,i){return function(){t.push(new e(r),i),n.push("actionList["+t.max+"].applyAppendTo(actionList, "+i+");")}.apply(this[0],this[1])}.bind([this,arguments])),this.RexjsTemplate=window.RexjsTemplate=function(e,r,i,s,o,c,u,a,l,h){return t.Class.create(void 0,[new t.ClassProperty("actionList",null),new t.ClassProperty("data",null),new t.ClassProperty("renderer",null),new t.ClassProperty("constructor",function(t,e,n){var i;this.actionList=t,this.renderer=e,this.data=new r(n),this.render(),i=t[0].rootElement,i.rexjsTemplate=this,i.setAttribute("rex-template","")}),new t.StaticProperty("addRef",function(t){e.add(t)}),new t.StaticProperty("compile",function(t,e,r){var o=[],c=new i(t,o,r),u=c.actionList;return o.push("actionList.finishAll();"),new n(u,new s("actionList","valueOf",o.join("\n")),e),u[0].rootElement}),new t.StaticProperty("refresh",function(t){return l(!0,t)}),new t.StaticProperty("watch",function(){if(!c){var t=o.now();c=!0,t-u>50&&(l(!1),u=t),a(function(){return function(){c&&(this.unwatch(),this.watch())}.apply(this[0],this[1])}.bind([this,arguments]))}}),new t.StaticProperty("watching",function(){return c},"get"),new t.StaticProperty("unwatch",function(){c=!1}),new t.ClassProperty("render",function(t){var e=this.data;(t||e.compare())&&this.renderer.call(e.origin,this.actionList,h)})],3)}(this.Reference,this.Data,this.ActionCompiler,Function,Date,!1,-1,window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return function(){u(t,50)}.apply(this[0],this[1])}.bind([this,arguments]),function(e,n){return function(){var r=0;return a.call(s.querySelectorAll("[rex-template]"),function(i){return function(){var s=i.rexjsTemplate,c=!1;if(n)c=s.data.origin===n;else{var u=new t.ObjectDestructuringTarget(i.getBoundingClientRect()),a=u.get("top"),l=u.get("left"),h=u.get("height"),p=u.get("width");(a>=0?a<o.availHeight:a+h>0)&&(c=l>=0?l<o.availWidth:l+p>0)}c&&(s.render(e),r++)}.apply(this[0],this[1])}.bind([this,arguments])),r}.apply(this[0],this[1])}.bind([this,arguments]),function(t){return function(){return null==t?"":t.toString()}.apply(this[0],this[1])}.bind([this,arguments]))}(null,Node.ELEMENT_NODE,/<%([:=]?)([\s\S]*?)%>/g,document,screen,document.implementation.createHTMLDocument(""),setTimeout,Array.prototype.forEach,function(t){return function(){var e=t.parentNode;e&&e.removeChild(t),t.textCOntent=""}.apply(this[0],this[1])}.bind([this,arguments]),function(t,e){return function(){var n=e.split("\n").slice(0,5).join("\n");throw t+":\n`"+n+"\n"+(n===e?"":"...")+"`"}.apply(this[0],this[1])}.bind([this,arguments]),function(t){return function(){return t.split('"').join('\\"').split("\n").join("\\n")}.apply(this[0],this[1])}.bind([this,arguments]))),n=e.get("RexjsTemplate");t.Module.export("RexjsTemplate",n)})}]);