includejs
Advanced tools
Comparing version 0.10.28 to 0.10.29
{ | ||
"name": "includejs", | ||
"version": "0.10.28", | ||
"version": "0.10.29", | ||
"homepage": "https://github.com/atmajs/IncludeJS", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
function __eval(e,n){"use strict";n&&n.route.params;return eval.call(window,e)}!function(e,n){"use strict";var t,r;return"undefined"==typeof exports||e!==exports&&null!=e||(t=r=global),null==t&&(t="undefined"==typeof window?global:window),null==r&&(r=e||t),"undefined"!=typeof include&&"function"==typeof include.js?(r.include=include,void(r.includeLib=include.Lib||t.includeLib)):void n(t,r,t.document)}(this,function(global,exports,document){"use strict";function fn_proxy(e,n){return function(){e.apply(n,arguments)}}function fn_doNothing(e){"function"==typeof e&&e()}function arr_invoke(e,n,t){if(null!=e&&e instanceof Array!=!1)for(var r=0,o=e.length;o>r;r++)"function"==typeof e[r]&&(null==n?e[r].call(t):e[r].apply(t,n))}function arr_ensure(e,n){if(!n)return e;for(var t,r=n.split("."),o=r.length-1,i=0;o>i;i++)t=r[i],e=e[t]||(e[t]={});return t=r[o],e[t]||(e[t]=[])}var isWeb=!("undefined"==typeof location||!location.protocol||!/^https?:/.test(location.protocol)),reg_subFolder=/([^\/]+\/)?\.\.\//,reg_hasProtocol=/^(file|https?):/i,handler={},hasOwnProp={}.hasOwnProperty,emptyResponse={load:{}},__array_slice=Array.prototype.slice,XMLHttpRequest=global.XMLHttpRequest,isBrowser=!0,isNode=!1,isBrowser=!1,isNode=!0,Helper={reportError:function(e){console.error("IncludeJS Error:",e,e.message,e.url),"function"==typeof handler.onerror&&handler.onerror(e)}},XHR=function(e,n){var t=new XMLHttpRequest;t.onreadystatechange=function(){4===t.readyState&&n&&n(e,t.responseText)};var r="object"==typeof e?e.url:e,o=cfg.sync!==!0;isBrowser&&cfg.version&&(r=(-1===r.indexOf("?")?"?":"&")+"v="+cfg.version),"/"===r[0]&&cfg.lockedToFolder===!0&&(r=r.substring(1)),t.open("GET",r,o),t.send()},XHR_LOAD=function(e,n){var t=new XMLHttpRequest;t.onreadystatechange=function(){return 4===t.readyState?200!==t.status?void n(t.status):void n(null,t.responseText):void 0},t.open("GET",e,cfg.sync!==!0),t.send()},obj_inherit,obj_getProperty,obj_setProperty;!function(){obj_inherit=function(e){"function"==typeof e&&(e=e.prototype);for(var n,t,r=1,o=arguments.length;o>r;r++){n="function"==typeof arguments[r]?arguments[r].prototype:arguments[r];for(t in n)e[t]=n[t]}return e},obj_getProperty=function(e,n){for(var t=n.split("."),r=t.length,o=0;r>o;o++){if(null==e)return null;e=e[t[o]]}return e},obj_setProperty=function(e,n,t){for(var r,o=n.split("."),i=o.length-1,s=-1;++s<i;)r=o[s],null==e[r]&&(e[r]={}),e=e[r];e[o[s]]=t}}();var path_getDir,path_getFile,path_getExtension,path_resolveCurrent,path_normalize,path_win32Normalize,path_resolveUrl,path_combine,path_isRelative;!function(){function e(e){for(;-1!==e.indexOf("../");)e=e.replace(reg_subFolder,"");return e.replace(/\/\.\//g,"/")}path_getDir=function(e){return e.substring(0,e.lastIndexOf("/")+1)},path_getFile=function(e){return e=e.replace("file://","").replace(/\\/g,"/").replace(/\?[^\n]+$/,""),/^\/\w+:\/[^\/]/i.test(e)?e.substring(1):e},path_getExtension=function(e){var n=e.indexOf("?");return-1===n?e.substring(e.lastIndexOf(".")+1):e.substring(e.lastIndexOf(".",n)+1,n)},path_resolveCurrent=function(){if(null==document)return"undefined"==typeof module?"":path_win32Normalize(module.parent.filename);var e=document.getElementsByTagName("script"),n=e[e.length-1],t=n&&n.getAttribute("src")||"";if("/"===t[0])return t;var r=window.location.pathname.replace(/\/[^\/]+\.\w+$/,"");return"/"!==r[r.length-1]&&(r+="/"),r+t},path_normalize=function(e){return e.replace(/\\/g,"/").replace(/([^:\/])\/{2,}/g,"$1/")},path_win32Normalize=function(e){return e=path_normalize(e),"file:"===e.substring(0,5)?e:"file:///"+e},path_resolveUrl=function(n,t){return reg_hasProtocol.test(n)?e(n):("./"===n.substring(0,2)&&(n=n.substring(2)),"/"===n[0]&&null!=t&&null!=t.base&&(n=path_combine(t.base,n),reg_hasProtocol.test(n))?e(n):"/"===n[0]&&cfg.path&&0!==n.indexOf(cfg.path)&&(n=path_combine(cfg.path,n),reg_hasProtocol.test(n))?e(n):("/"!==n[0]&&null!=t&&null!=t.location&&(n=path_combine(t.location,n)),"/"!==n[0]&®_hasProtocol.test(n)===!1&&(n="/"+n),e(n)))},path_isRelative=function(e){var n=e.charCodeAt(0);switch(n){case 47:return!1;case 102:case 104:return reg_hasProtocol.test(e)===!1}return!0},path_combine=function(){for(var e,n="",t=arguments.length,r=-1;++r<t;)e=arguments[r],e&&(e=path_normalize(e),""!==n?("/"!==n[n.length-1]&&(n+="/"),"/"===e[0]&&(e=e.substring(1)),n+=e):n=e);return n}}();var tree_resolveUsage;!function(){function e(n,t,r){if(null==t){console.warn("<include> Usage Not Found:",n),console.warn("- Ensure to have it included before with the correct alias"),console.warn("- Initiator Stacktrace:");for(var o=[],i=r;null!=i;)o.push(i.url),i=i.parent;return console.warn(o.join("\n")),null}for(var s,u,a=t.includes,l=-1,c=a.length;++l<c;)if(s=a[l],u=s.route.alias||Routes.parseAlias(s.route),u===n)return s.resource;return e(n,t.parent,r)}tree_resolveUsage=function(n,t,r){for(var o,i,s,u,a,l=[],c=t.length,f=-1;++f<c;){if(s=i=t[f],u=i.indexOf("."),-1!==u&&(s=i.substring(0,u),i=i.substring(u+1)),a=e(s,n.parent,n),null==a)return null;if(4!==a.state)return n.state=3,a.on(4,r,a,"push"),null;o=a.exports,s!==i&&(o=obj_getProperty(o,i)),"object"==typeof o&&null==o&&console.warn("<include:use> Used resource has no exports",s,n.url),l[f]=o}return l}}();var res_groupByType;!function(){function e(e){var n=r.exec(e);return null==n?"js":n[1]}function n(e){return o[e]||"load"}function t(e,n,t){var r=e[n];null==r&&(r=e[n]=[]),r.push(t)}res_groupByType=function(r){for(var o={},i=r.length,s=-1;++s<i;){var u=r[s],a=e(u),l=n(a);t(o,l,u)}return o};var r=/\.([\w]+)($|\?|:)/,o={js:"js",es6:"js",css:"css",less:"css",sass:"css",json:"ajax",mask:"mask"}}();var cfg,Config;!function(){function e(e,t,r){switch(t){case"loader":for(var o in r)CustomLoader.register(o,r[o]);return;case"modules":return void(r===!0&&n());case"commonjs":return void(r===!0&&CommonJS.enable());case"amd":return void(r===!0&&Amd.enable());case"map":return void PathResolver.configMap(r);case"extentionDefault":return void PathResolver.configExt({def:r});case"extentionTypes":return void PathResolver.configExt({types:r})}t in e==!1&&console.warn("Not supported config",t),e[t]=r}function n(){return"undefined"==typeof Object.defineProperty?void console.warn("Browser do not support Object.defineProperty"):(Object.defineProperty(global,"module",{get:function(){return global.include}}),void Object.defineProperty(global,"exports",{get:function(){var e=global.include;return e.exports||(e.exports={})},set:function(e){global.include.exports=e}}))}Config=function(){},Config.prototype={path:null,loader:null,version:null,lockedToFolder:!1,sync:!1,eval:null==document,call:function(n,t,r){if(null==t)return this;var o=typeof t;if("string"===o&&null==r)return this[t];if("string"===o&&null!=r)return e(this,t,r),n;if("object"===o&&null==r)for(var i in t)e(this,i,t[i]);return n}},cfg=new Config}();var bin,Bin;!function(){Bin={add:function(e,n,t){bin[e][n]=t,bin.all[n]=t},get:function(e,n){if(null!=n){var t=bin[e][n];return t||bin.all[n]}}},bin={js:{},css:{},load:{},ajax:{},embed:{},mask:{},all:{}}}();var Routes,RoutesLib;!function(){function e(){var e={},n=/([^\\\/]+)\.\w+$/;return{register:function(n,t,r){if("string"==typeof t&&path_isRelative(t)){var o=r||include,i=o.location||path_getDir(o.url||path_resolveCurrent());path_isRelative(i)&&(i="/"+i),t=i+t}e[n]=t instanceof Array?t:t.split(/[\{\}]/g)},resolve:function(n,t){var r,o,i,s,u,a,l,c,f=t.indexOf("?"),d=t.indexOf("::");if(-1!==d&&(r=t.substring(d+2),t=t.substring(0,d)),-1!==f){for(c=t.substring(f+1).split("&"),i={},u=0,l=c.length;l>u;u++)a=c[u].split("="),i[a[0]]=a[1];t=t.substring(0,f)}if(t=t.split("/"),s=e[n],null==s)return{path:t.join("/"),params:i,alias:r};for(o=s[0],u=1;u<s.length;u++)if(u%2===0)o+=s[u];else{var h=s[u]<<0;if(h>t.length-1&&(h=t.length-1),o+=t[h],u===s.length-2)for(h++;h<t.length;h++)o+="/"+t[h]}return{path:o,params:i,alias:r}},each:function(e,n,t,r,o){if(null!=n)if("lazy"!==e||null!=o)if(n instanceof Array)for(var i=0;i<n.length;i++)this.each(e,n[i],t,r,o);else if("object"!=typeof n){if("string"==typeof n){var s=this.resolve(r,n);return r&&(r+="."+n),void t(r,s,o)}console.error("Include Package is invalid",arguments)}else for(var u in n)this.each(e,n[u],t,u,o);else for(var u in n)this.each(e,n[u],t,null,u)},getRoutes:function(){return e},parseAlias:function(e){var t=e.path,r=n.exec(t);return r&&r[1]}}}RoutesLib=e,Routes=e()}();var Events=function(e){function n(){Events.ready=fn_doNothing,null!=t&&(arr_invoke(t),t=null)}if(null==e)return{ready:fn_doNothing,load:fn_doNothing};var t=[];return"onreadystatechange"in e?e.onreadystatechange=function(){/complete|interactive/g.test(e.readyState)!==!1&&n()}:e.addEventListener?e.addEventListener("DOMContentLoaded",n):window.onload=n,{ready:function(e){t.unshift(e)}}}(document),ScriptStack=function(){function e(e,n){cfg.version&&(e+=(-1===e.indexOf("?")?"?":"&")+"v="+cfg.version),"/"===e[0]&&cfg.lockedToFolder===!0&&(e=e.substring(1));var t=document.createElement("script");t.type="text/javascript",t.src=e,"onreadystatechange"in t?t.onreadystatechange=function(){("complete"===this.readyState||"loaded"===this.readyState)&&n()}:t.onload=t.onerror=n,null==s&&(s=document.getElementsByTagName("head")[0]),s.appendChild(t)}function n(){function t(e){e&&"error"===e.type&&console.log("Script Loaded Error",r.url);for(var t=0,o=l.length;o>t;t++)if(l[t]===r){l.splice(t,1);break}return t===o?void console.error("Loaded Resource not found in stack",r):(2.5!==r.state&&r.readystatechanged(3),u=null,void n())}if(!a){if(0===l.length)return void i();if(null==u){var r=u=l[0];if(1!==r.state)return r.state=1,global.include=r,global.iparams=r.route.params,r.source?(__eval(r.source,r),void t()):void e(r.url,t)}}}function t(){if(!a){if(0===l.length)return void i();if(null==u){var e=l[0];e.state<2||(u=e,u.state=1,global.include=e,__eval(e.source,e),o(e),2.5!==e.state&&e.readystatechanged(3),u=null,t())}}}function r(){if(!a){if(0===l.length)return void i();var e=l.shift();e.state<2||(u=e,u.state=3,global.include=e,__eval(e.source,e),e.readystatechanged(3),u=null,r())}}function o(e){for(var n=l.length,t=-1;++t<n;)if(l[t]===e)return void l.splice(t,1)}function i(){for(var e=-1,n=c.length;++e<n;)c[e]();c.length=0}var s,u,a,l=[],c=[];return{load:function(e,o,i){return this.add(e,o),!cfg.eval||i?void n():e.source?(e.state=2,void t()):void XHR(e,function(e,n){return n||(console.error("Not Loaded:",e.url),console.error("- Initiator:",e.parent&&e.parent.url||"<root resource>")),e.source=n,e.state=2,cfg.sync?void r():void t()})},add:function(e,n){if(1===e.priority)return l.unshift(e);if(null==n)return l.push(e);for(var t=l.length,r=-1;++r<t;)if(l[r]===n)return l.splice(r,0,e);l.push(e)},moveToParent:function(e,n){var t,r=l.length,o=-1,i=-1;for(t=0;r>t;t++)if(l[t]===e){i=t;break}if(-1!==i){for(t=0;r>t;t++)if(l[t]===n){o=t;break}-1!==o&&(o>i||(l.splice(i,1),l.splice(o,0,e)))}},pause:function(){a=!0},resume:function(){a=!1,null==u&&this.touch()},touch:function(){var e=cfg.eval?t:n;e()},complete:function(e){return a!==!0&&0===l.length?void e():void c.push(e)}}}(),IncludeDeferred=function(){this.callbacks=[],this.state=-1};IncludeDeferred.prototype={on:function(e,n,t,r){return this===t&&-1===this.state?(n(this),this):(null==r&&(r=this.state<3||this===t?"unshift":"push"),e<=this.state?n(this):this.callbacks[r]({state:e,callback:n}),this)},readystatechanged:function(e){var n,t,r,o;if(e>this.state&&(this.state=e),3===this.state){var i=this.includes;if(null!=i&&i.length)for(n=0;n<i.length;n++)if(4!==i[n].resource.state)return;this.state=4}if(n=0,t=this.callbacks.length,0!==t){for("js"===this.type&&4===this.state&&(o=global.include,global.include=this);t>n&&(r=this.callbacks[n],null==r||r.state>this.state||(this.callbacks.splice(n,1),t--,n--,r.callback(this),!(this.state<4)));n++);null!=o&&"js"===o.type&&(global.include=o)}},ready:function(e){var n=this;return this.on(4,function(){Events.ready(function(){n.resolve(e)})},this)},done:function(e){var n=this;return this.on(4,function(){n.resolve(e)},this)},resolve:function(e){var n=this.includes,t=null==n?0:n.length;if(t>0&&null==this.response){this.response={};for(var r,o,i,s=0;t>s;s++)if(i=n[s],r=i.resource,o=i.route,"undefined"!=typeof r.exports){var u=r.type;switch(u){case"js":case"load":case"ajax":case"mask":var a=o.alias||Routes.parseAlias(o),l="js"===u?this.response:this.response[u]||(this.response[u]={});if(null!=a){l[a]=r.exports;break}console.warn("<includejs> Alias is undefined",r)}}}var c=this.response||emptyResponse,f=this;return null==this._use&&null!=this._usage&&(this._use=tree_resolveUsage(this,this._usage,function(){f.state=4,f.resolve(e),f.readystatechanged(4)}),this.state<4)?void 0:this._use?void e.apply(null,[c].concat(this._use)):void e(c)}};var Include,IncludeLib={};!function(IncludeDeferred){function incl_getResource(e,n){var t=e;if(path_isRelative(e)===!0&&(t="/"+t),null!=n)return bin[n][t];for(var r in bin)if(bin[r].hasOwnProperty(t))return bin[r][t];return null}function embedPlugin(source){eval(source)}function includePackage(e,n,t){var r=1===t.length?t[0]:__array_slice.call(t);return e instanceof Resource?e.include(n,r):new Resource("js").include(n,r)}function createIncluder(e){return function(){return includePackage(this,e,arguments)}}function doNothing(){return this}function stub_freeze(e){e.js=e.css=e.load=e.ajax=e.embed=e.lazy=e.inject=e.mask=doNothing}function stub_release(e){for(var n=["js","css","load","ajax","embed","lazy","mask"],t=n.length;-1!==--t;)e[n[t]]=createIncluder(n[t]);e.inject=e.js}Include=function(){IncludeDeferred.call(this)},stub_release(Include.prototype),obj_inherit(Include,IncludeDeferred,{_use:null,_usage:null,isBrowser:isBrowser,isNode:isNode,setCurrent:function(e){var n=e.url,t=this.getResourceById(n,"js");if(null==t){"/"===n[0]&&this.base&&(n=this.base+n.substring(1));var t=new Resource("js",{path:n},e.namespace,null,null,n)}t.state<3&&console.error("<include> Resource should be loaded",e),t.state=3,global.include=t},cfg:function(e,n){return cfg.call(this,e,n)},routes:function(e){if(null==e)return Routes.getRoutes();if(2===arguments.length)return Routes.register(e,arguments[1],this),this;for(var n in e)Routes.register(n,e[n],this);return this},promise:function(e){for(var n=e.split("."),t=global;n.length;){var r=n.shift();t=t[r]||(t[r]={})}return t},register:function(e){function n(e){return null==a?e:("/"===e.url[0]&&(e.url=a+e.url.substring(1)),"/"===e.parent[0]&&(e.parent=a+e.parent.substring(1)),e.id=e.url,e)}function t(e,n){e.exports=n,e.readystatechanged(4)}var r,o,i,s,u,a=this.base;for(r in e)for(i=e[r],s=i.length,u=-1;++u<s;){o=n(i[u]);var l=o.id,c=o.url,f=o.namespace,d=o.parent&&incl_getResource(o.parent,"js"),h=new Resource,p=o.state;if(l||c){switch(c&&("/"===c[0]&&(c=c.substring(1)),h.location=path_getDir(c)),h.state=null==p?"js"===r?3:4:p,h.namespace=f,h.type=r,h.url=c||l,h.parent=d,h.base=d&&d.base||a,r){case"load":case"lazy":var v=document.querySelector("#includejs-"+l.replace(/\W/g,""));if(null==v){console.error('"%s" Data was not embedded into html',l);break}h.exports=v.innerHTML,CustomLoader.exists(h)&&(h.state=3,CustomLoader.load(h,t))}(bin[r]||(bin[r]={}))[l]=h}}},instance:function(e,n){var t;return null==e?(t=new Include,t.state=4,t):(t=new Resource("js"),t.state=4,t.url=path_resolveUrl(e,n),t.location=path_getDir(t.url),t.parent=n,t)},getResource:function(e,n){return this.base&&"/"===e[0]&&(e=this.base+e.substring(1)),incl_getResource(e,n)},getResourceById:function(e,n){var t=bin[n],r=t[e];return null!=r?r:this.base&&"/"===e[0]&&(r=t[path_combine(this.base,e)],null!=r)?r:this.base&&this.location&&(r=t[path_combine(this.base,this.location,e)],null!=r)?r:this.location&&(r=t[path_combine(this.location,e)],null!=r)?r:null},getResources:function(){return bin},plugin:function(e,n){var t=[],r=0,o=0,i=0,s=function(e,t){o++,embedPlugin(t),o===r-1&&n&&(n(),n=null)};for(Routes.each("",e,function(e,n){t.push("/"===n.path[0]?n.path.substring(1):n.path)}),r=t.length;r>i;i++)XHR(t[i],s);return this},client:function(){return cfg.server===!0&&stub_freeze(this),this},server:function(){return cfg.server!==!0&&stub_freeze(this),this},use:function(){return null==this.parent?(console.error("<include.use> Parent resource is undefined"),this):(this._usage=arguments,this)},pauseStack:fn_proxy(ScriptStack.pause,ScriptStack),resumeStack:fn_proxy(ScriptStack.resume,ScriptStack),allDone:function(e){ScriptStack.complete(function(){function n(){--r<1&&e()}var t=include.getPending(),r=t.length;if(0===r)return void e();for(var o=-1,i=r;++o<i;)t[o].on(4,n,null,"push")})},getPending:function(e){var n,t,r,o=[];for(t in bin)if(null==e||e===t)for(r in bin[t])n=bin[t][r],n.state<4&&o.push(n);return o},Lib:IncludeLib})}(IncludeDeferred);var CustomLoader=function(){function e(e){return"string"==typeof e?!1:"function"==typeof e.ready||"function"==typeof e.process}function n(n){var t=path_getExtension(n),r=cfg.loader[t];if(e(r))return r;var o,i=r;if("object"==typeof i)for(var s in i){o=s,i=i[s];break}return cfg.loader[t]=new Resource("js",Routes.resolve(o,i),o,null,null,null,1)}function t(e,n){return function(t){e(n,t)}}function r(e,n,r,o){if(null==r.process)return void o(n,e);var i=t(o,n),s=r.process(e,n,i);"undefined"!=typeof s&&o(n,s)}function o(e,n,t){function o(e,o){r(o,e,n,t)}return"string"==typeof e.exports?void r(e.exports,e,n,t):n.load?n.load(e,o):void XHR(e,o)}var i={process:function(e,n){try{return JSON.parse(e)}catch(t){return console.error(t,e),null}}};return cfg.loader={json:i},{load:function(e,t){var r=n(e.url);return r.process?void o(e,r,t):void r.on(4,function(){o(e,r.exports,t)},null,"push")},exists:function(e){if(!e.url)return!1;var n=path_getExtension(e.url);return cfg.loader.hasOwnProperty(n)},register:function(e,n){if("string"==typeof n){var t=include;null==t.location&&(t={location:path_getDir(path_resolveCurrent())}),n=path_resolveUrl(n,t)}cfg.loader[e]=n}}}(),LazyModule={create:function(e,n){for(var t=e.split("."),r=global,o=t[t.length-1];t.length>1;){var i=t.shift();r=r[i]||(r[i]={})}t=null,Object.defineProperty(r,o,{get:function(){delete r[o];try{var t=__eval(n,global.include);null==t||t instanceof Resource||(r[o]=t)}catch(i){i.xpath=e,Helper.reportError(i)}finally{return n=null,e=null,r[o]}}})}},Resource;!function(e,n,t,r){function o(e){var n=e.type,o=e.parent,s=e.url;if(null==document&&"css"===n)return e.state=4,e;if(r.exists(e)===!1)switch(n){case"js":case"embed":t.load(e,o,"embed"===n);break;case"ajax":case"load":case"lazy":case"mask":XHR(e,i);break;case"css":e.state=4;var u=document.createElement("link");u.href=s,u.rel="stylesheet",u.type="text/css",document.getElementsByTagName("head")[0].appendChild(u)}else"js"!==n&&"embed"!==n||t.add(e,e.parent),r.load(e,i);return e}function i(e,n){switch(n||console.warn("Resource can`t be loaded",e.url),e.type){case"js":case"embed":return e.source=n,e.state=2,void t.touch();case"load":case"ajax":e.exports=n;break;case"lazy":LazyModule.create(e.xpath,n);break;case"css":var r=document.createElement("style");r.type="text/css",r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r);break;case"mask":if(n){var o=global.mask;return null==o&&(o=global.require("mask")),void o.Module.registerModule(n,{path:e.url}).done(function(n){e.exports=n.exports,e.readystatechanged(4)}).fail(function(n){console.error(n),e.readystatechanged(4)})}}e.readystatechanged(4)}function s(e,n,t){if(null==e)return null;null==t&&(t=[]);for(var r,o=e.length,i=-1;++i<o;)r=e[i].resource,n===r.type&&t.push(r),null!=r.includes&&s(r.includes,n,t);return t}Resource=function(n,r,i,s,u,a,l){e.call(this);var c=r&&r.path;null!=c&&(c=PathResolver.resolveBasic(c,n,u)),null==a&&c&&(a=c);var f=Bin.get(n,a);if(f)return f.state<4&&"js"===n&&t.moveToParent(f,u),f;if(this.id=a,this.url=c,this.type=n,this.xpath=s,this.route=r,this.parent=u,this.priority=l,this.namespace=i,this.base=u&&u.base,this.childLoaded=fn_proxy(this.childLoaded,this),null==c)return this.state=3,this.location=path_getDir(path_resolveCurrent()),this;if(this.state=0,this.location=path_getDir(c),Bin.add(n,a,this),PathResolver.isNpm(this.url)===!1)return o(this),this;var d=this;return PathResolver.resolveNpm(this.url,this.type,this.parent,function(e,n){return e?void d.readystatechanged(4):(d.url=n,void o(d))}),this},Resource.prototype=obj_inherit(Resource,e,{state:null,location:null,includes:null,response:null,url:null,base:null,type:null,xpath:null,route:null,parent:null,priority:null,namespace:null,setBase:function(e){return this.base=e,this},childLoaded:function(e){var n=this,t=n.includes;if(t&&t.length){if(n.state<3)return;for(var r=0;r<t.length;r++)if(4!==t[r].resource.state)return}n.readystatechanged(4)},create:function(e,n,t,r,o){var i;return this.state=this.state>=3?3:2,this.response=null,null==this.includes&&(this.includes=[]),i=new Resource(e,n,t,r,this,o),this.includes.push({resource:i,route:n}),i},include:function(e,t){var r,o=this,i=[];n.each(e,t,function(n,t,s){null!=o.route&&o.route.path===t.path||(r=o.create(e,t,n,s),i.push(r))});for(var s=-1,u=i.length;++s<u;)i[s].on(4,this.childLoaded);return this},require:function(e){this.exports={},this.includes=[];var n=res_groupByType(e);for(var t in n)this.include(t,n[t]);return this},pause:function(){this.state=2.5;var e=this;return function(n){1===arguments.length&&(e.exports=n),e.readystatechanged(3)}},getNestedOfType:function(e){return s(this.includes,e)}})}(Include,Routes,ScriptStack,CustomLoader);var __nativeRequire,__includeRequire;if(global.require){var name=global.require.name;"amd"!==name&&"commonjs"!==name&&(__nativeRequire=global.require)}var CommonJS;!function(){function e(){global.require=CommonJS.require}function n(){if("undefined"==typeof module){if("undefined"==typeof Object.defineProperty)return void console.warn("Browser do not support Object.defineProperty");Object.defineProperty(global,"module",{get:function(){return global.include},configurable:!0}),Object.defineProperty(global,"exports",{get:function(){var e=global.include;return e.exports||(e.exports={})},set:function(e){global.include.exports=e},configurable:!0})}}CommonJS={exports:null,require:function(e){if(46!==e.charCodeAt(0)&&null!=__nativeRequire)return __nativeRequire(e);var n=cfg.sync,t=cfg.eval,r=include,o=null;return cfg.sync=!0,cfg.eval=!0,include.js(e+"::Module").done(function(e){o=e.Module}),include=r,cfg.sync=n,cfg.eval=t,o},enable:function(){"function"!=typeof __nativeRequire&&(n(),e())}}}();var Amd;!function(){function e(n,t){for(var r in t){var o=t[r];null!=o&&("load"!==r&&"ajax"!==r?n[+r]=o:e(n,o))}}Amd={enable:function(){n()}};var n;!function(){function t(e,n){var t=-1,o=e.length;e:for(;++t<o;){var i=e[t][0];if(i.length===n.length){for(var s=-1,u=i.length;++s<u;){var a=i[s];if(a(n[s])===!1)continue e}return e[t][1]}}return console.warn("Define function arguments are invalid",n),r}function r(){}function o(n,t,r,o){if(null!=t&&(bin.js[t]=n),null==r)return void(n.exports=i(o));var u=s(r,n),a=u.array,l=u.linked;return 0===l.length?void(n.exports=i(o,a)):void n.require(u.linked).done(function(t){e(a,t),n.exports=i(o,a)})}function i(e,n){return"function"==typeof e?e.apply(null,n||[]):e}function s(e,n){for(var t=new Array(e.length),r=[],o=e.length,i=-1;++i<o;){var s=f[e[i]];null!=s?t[i]=s(n):r.push(e[i]+"::"+i)}return{array:t,linked:r}}function u(e){return"string"==typeof e}function a(e){return!0}function l(e){return e instanceof Array}n=function(){var e=global.define=function(e,n,r){for(var o=arguments.length,i=new Array(o);--o>-1;)i[o]=arguments[o];var s=t(c,i),u=global.include;s(u,e,n,r)};__includeRequire=global.require=function(){return isNode&&__nativeRequire&&1===arguments.length?__nativeRequire.apply(null,arguments):e.apply(null,arguments)},"undefined"!=typeof require&&(require=__includeRequire)};var c=[[[a],function(e,n){o(e,null,null,n)}],[[u,a],function(e,n,t){o(e,n,null,t)}],[[u,l,a],function(e,n,t,r){o(e,n,t,r)}],[[l,a],function(e,n,t){o(e,null,n,t)}]],f={module:function(e){return e},exports:function(e){return e.exports},require:function(e){return CommonJS.require}}}()}();var PathResolver;!function(){function e(e){return s[e]||e}function n(e){return/\.[\w]{1,8}($|\?)/.test(e)}function t(e){return/^([\w\-]+)(\/[\w\-_]+)*$/.test(e)}function r(e,t,r){function o(){var e=a+"/node_modules/"+i+"/",n=e+"package.json";XHR_LOAD(n,function(n,t){var i;if(t)try{i=JSON.parse(t)}catch(n){}if(null!=n||null==i){var l=a.replace(/[^\/]+$/,"");return l===a?void r("Not found"):void o()}return s?void r(null,e+s):i.main?void r(null,path_combine(e,i.main)):void r(null,e+"index."+u.js)})}var i=/^([\w\-]+)/.exec(t)[0],s=t.substring(i.length+1);s&&n(s)===!1&&(s+="."+u.js);var a=e.replace(/[^\/]+\.[\w]{1,8}$/,"");o()}function o(e,t){if(n(e))return e;var r=u[t];return null==r?(console.warn("Extension is not defined for "+t),e):e+"."+r}function i(e){var n=/\.([\w]{1,8})($|\?)/.exec(e);if(null===n)return u.js;var t=n[1],r=a[t];if(null==r)throw Error("Unknown type for extension: "+t);return r}PathResolver={configMap:function(e){for(var n in e)s[n]=e},configExt:function(e){var n=e.def,t=e.types;for(var r in n)u[r]=n[r];for(var r in t)a[r]=t[r]},resolveBasic:function(n,r,i){if("js"===r&&t(n))return n;var s=path_resolveUrl(e(n),i);return o(s,r)},isNpm:t,getType:i,resolveNpm:function(o,i,s,a){var l=e(o);if(l.indexOf(".")>-1)return void a(null,l);if("js"===i&&t(l)){var c=s&&s.location||path_resolveCurrent();return void r(c,l,a)}n(l)===!1&&(l+="."+u[i]),a(null,l)}};var s={},u={js:"js",css:"css",mask:"mask"},a={js:"js",es6:"js",ts:"js",css:"css",less:"css",scss:"css",mask:"mask",json:"load",yml:"load"}}(),IncludeLib.Routes=RoutesLib,IncludeLib.Resource=Resource,IncludeLib.ScriptStack=ScriptStack,IncludeLib.PathResolver=PathResolver,IncludeLib.Config=Config,IncludeLib.registerLoader=CustomLoader.register,exports.include=new Include,exports.includeLib=IncludeLib}); | ||
function __eval(e,n){"use strict";n&&n.route.params;return eval.call(window,e)}!function(e,n){"use strict";var t,r;return"undefined"==typeof exports||e!==exports&&null!=e||(t=r=global),null==t&&(t="undefined"==typeof window?global:window),null==r&&(r=e||t),"undefined"!=typeof include&&"function"==typeof include.js?(r.include=include,void(r.includeLib=include.Lib||t.includeLib)):void n(t,r,t.document)}(this,function(global,exports,document){"use strict";function fn_proxy(e,n){return function(){e.apply(n,arguments)}}function fn_doNothing(e){"function"==typeof e&&e()}function arr_invoke(e,n,t){if(null!=e&&e instanceof Array!=!1)for(var r=0,o=e.length;r<o;r++)"function"==typeof e[r]&&(null==n?e[r].call(t):e[r].apply(t,n))}function arr_ensure(e,n){if(!n)return e;for(var t,r=n.split("."),o=r.length-1,i=0;i<o;i++)t=r[i],e=e[t]||(e[t]={});return t=r[o],e[t]||(e[t]=[])}var isWeb=!("undefined"==typeof location||!location.protocol||!/^https?:/.test(location.protocol)),reg_subFolder=/([^\/]+\/)?\.\.\//,reg_hasProtocol=/^(file|https?):/i,handler={},hasOwnProp={}.hasOwnProperty,emptyResponse={load:{}},__array_slice=Array.prototype.slice,XMLHttpRequest=global.XMLHttpRequest,isBrowser=!0,isNode=!1,isBrowser=!1,isNode=!0,Helper={reportError:function(e){console.error("IncludeJS Error:",e,e.message,e.url),"function"==typeof handler.onerror&&handler.onerror(e)}},XHR=function(e,n){var t=new XMLHttpRequest;t.onreadystatechange=function(){4===t.readyState&&n&&n(e,t.responseText)};var r="object"==typeof e?e.url:e,o=cfg.sync!==!0;isBrowser&&cfg.version&&(r=(r.indexOf("?")===-1?"?":"&")+"v="+cfg.version),"/"===r[0]&&cfg.lockedToFolder===!0&&(r=r.substring(1)),t.open("GET",r,o),t.send()},XHR_LOAD=function(e,n){var t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState)return 200!==t.status?void n(t.status):void n(null,t.responseText)},t.open("GET",e,cfg.sync!==!0),t.send()},obj_inherit,obj_getProperty,obj_setProperty;!function(){obj_inherit=function(e){"function"==typeof e&&(e=e.prototype);for(var n,t,r=1,o=arguments.length;r<o;r++){n="function"==typeof arguments[r]?arguments[r].prototype:arguments[r];for(t in n)e[t]=n[t]}return e},obj_getProperty=function(e,n){for(var t=n.split("."),r=t.length,o=0;o<r;o++){if(null==e)return null;e=e[t[o]]}return e},obj_setProperty=function(e,n,t){for(var r,o=n.split("."),i=o.length-1,s=-1;++s<i;)r=o[s],null==e[r]&&(e[r]={}),e=e[r];e[o[s]]=t}}();var path_getDir,path_getFile,path_getExtension,path_resolveCurrent,path_normalize,path_win32Normalize,path_resolveUrl,path_combine,path_isRelative;!function(){function e(e){for(;e.indexOf("../")!==-1;)e=e.replace(reg_subFolder,"");return e.replace(/\/\.\//g,"/")}path_getDir=function(e){return e.substring(0,e.lastIndexOf("/")+1)},path_getFile=function(e){return e=e.replace("file://","").replace(/\\/g,"/").replace(/\?[^\n]+$/,""),/^\/\w+:\/[^\/]/i.test(e)?e.substring(1):e},path_getExtension=function(e){var n=e.indexOf("?");return n===-1?e.substring(e.lastIndexOf(".")+1):e.substring(e.lastIndexOf(".",n)+1,n)},path_resolveCurrent=function(){if(null==document)return"undefined"==typeof module?"":path_win32Normalize(module.parent.filename);var e=document.getElementsByTagName("script"),n=e[e.length-1],t=n&&n.getAttribute("src")||"";if("/"===t[0])return t;var r=window.location.pathname.replace(/\/[^\/]+\.\w+$/,"");return"/"!==r[r.length-1]&&(r+="/"),r+t},path_normalize=function(e){return e.replace(/\\/g,"/").replace(/([^:\/])\/{2,}/g,"$1/")},path_win32Normalize=function(e){return e=path_normalize(e),"file:"===e.substring(0,5)?e:"file:///"+e},path_resolveUrl=function(n,t){return reg_hasProtocol.test(n)?e(n):("./"===n.substring(0,2)&&(n=n.substring(2)),"/"===n[0]&&null!=t&&null!=t.base&&(n=path_combine(t.base,n),reg_hasProtocol.test(n))?e(n):"/"===n[0]&&cfg.path&&0!==n.indexOf(cfg.path)&&(n=path_combine(cfg.path,n),reg_hasProtocol.test(n))?e(n):("/"!==n[0]&&null!=t&&null!=t.location&&(n=path_combine(t.location,n)),"/"!==n[0]&®_hasProtocol.test(n)===!1&&(n="/"+n),e(n)))},path_isRelative=function(e){var n=e.charCodeAt(0);switch(n){case 47:return!1;case 102:case 104:return reg_hasProtocol.test(e)===!1}return!0},path_combine=function(){for(var e,n="",t=arguments.length,r=-1;++r<t;)e=arguments[r],e&&(e=path_normalize(e),""!==n?("/"!==n[n.length-1]&&(n+="/"),"/"===e[0]&&(e=e.substring(1)),n+=e):n=e);return n}}();var tree_resolveUsage;!function(){function e(n,t,r){if(null==t){console.warn("<include> Usage Not Found:",n),console.warn("- Ensure to have it included before with the correct alias"),console.warn("- Initiator Stacktrace:");for(var o=[],i=r;null!=i;)o.push(i.url),i=i.parent;return console.warn(o.join("\n")),null}for(var s,u,a=t.includes,l=-1,c=a.length;++l<c;)if(s=a[l],u=s.route.alias||Routes.parseAlias(s.route),u===n)return s.resource;return e(n,t.parent,r)}tree_resolveUsage=function(n,t,r){for(var o,i,s,u,a,l=[],c=t.length,f=-1;++f<c;){if(s=i=t[f],u=i.indexOf("."),u!==-1&&(s=i.substring(0,u),i=i.substring(u+1)),a=e(s,n.parent,n),null==a)return null;if(4!==a.state)return n.state=3,a.on(4,r,a,"push"),null;o=a.exports,s!==i&&(o=obj_getProperty(o,i)),"object"==typeof o&&null==o&&console.warn("<include:use> Used resource has no exports",s,n.url),l[f]=o}return l}}();var res_groupByType;!function(){function e(e){var n=r.exec(e);return null==n?"js":n[1]}function n(e){return o[e]||"load"}function t(e,n,t){var r=e[n];null==r&&(r=e[n]=[]),r.push(t)}res_groupByType=function(r){for(var o={},i=r.length,s=-1;++s<i;){var u=r[s],a=e(u),l=n(a);t(o,l,u)}return o};var r=/\.([\w]+)($|\?|:)/,o={js:"js",es6:"js",css:"css",less:"css",sass:"css",json:"ajax",mask:"mask"}}();var cfg,Config;!function(){function e(e,t,r){switch(t){case"loader":for(var o in r)CustomLoader.register(o,r[o]);return;case"modules":return void(r===!0&&n());case"commonjs":return void(r===!0&&CommonJS.enable());case"amd":return void(r===!0&&Amd.enable());case"map":return void PathResolver.configMap(r);case"extentionDefault":return void PathResolver.configExt({def:r});case"extentionTypes":return void PathResolver.configExt({types:r})}t in e==!1&&console.warn("Not supported config",t),e[t]=r}function n(){return"undefined"==typeof Object.defineProperty?void console.warn("Browser do not support Object.defineProperty"):(Object.defineProperty(global,"module",{get:function(){return global.include}}),void Object.defineProperty(global,"exports",{get:function(){var e=global.include;return e.exports||(e.exports={})},set:function(e){global.include.exports=e}}))}Config=function(){},Config.prototype={path:null,loader:null,version:null,lockedToFolder:!1,sync:!1,eval:null==document,call:function(n,t,r){if(null==t)return this;var o=typeof t;if("string"===o&&null==r)return this[t];if("string"===o&&null!=r)return e(this,t,r),n;if("object"===o&&null==r)for(var i in t)e(this,i,t[i]);return n}},cfg=new Config}();var bin,Bin;!function(){Bin={add:function(e,n,t){bin[e][n]=t,bin.all[n]=t},get:function(e,n){if(null!=n){var t=bin[e][n];return t||bin.all[n]}}},bin={js:{},css:{},load:{},ajax:{},embed:{},mask:{},all:{}}}();var Routes,RoutesLib;!function(){function e(){var e={},n=/([^\\\/]+)\.\w+$/;return{register:function(n,t,r){if("string"==typeof t&&path_isRelative(t)){var o=r||include,i=o.location||path_getDir(o.url||path_resolveCurrent());path_isRelative(i)&&(i="/"+i),t=i+t}e[n]=t instanceof Array?t:t.split(/[\{\}]/g)},resolve:function(n,t){var r,o,i,s,u,a,l,c,f=t.indexOf("?"),d=t.indexOf("::");if(d!==-1&&(r=t.substring(d+2),t=t.substring(0,d)),f!==-1){for(c=t.substring(f+1).split("&"),i={},u=0,l=c.length;u<l;u++)a=c[u].split("="),i[a[0]]=a[1];t=t.substring(0,f)}if(t=t.split("/"),s=e[n],null==s)return{path:t.join("/"),params:i,alias:r};for(o=s[0],u=1;u<s.length;u++)if(u%2===0)o+=s[u];else{var h=s[u]<<0;if(h>t.length-1&&(h=t.length-1),o+=t[h],u===s.length-2)for(h++;h<t.length;h++)o+="/"+t[h]}return{path:o,params:i,alias:r}},each:function(e,n,t,r,o){if(null!=n)if("lazy"!==e||null!=o)if(n instanceof Array)for(var i=0;i<n.length;i++)this.each(e,n[i],t,r,o);else if("object"!=typeof n){if("string"==typeof n){var s=this.resolve(r,n);return r&&(r+="."+n),void t(r,s,o)}console.error("Include Package is invalid",arguments)}else for(var u in n)this.each(e,n[u],t,u,o);else for(var u in n)this.each(e,n[u],t,null,u)},getRoutes:function(){return e},parseAlias:function(e){var t=e.path,r=n.exec(t);return r&&r[1]}}}RoutesLib=e,Routes=e()}();var Events=function(e){function n(){Events.ready=fn_doNothing,null!=t&&(arr_invoke(t),t=null)}if(null==e)return{ready:fn_doNothing,load:fn_doNothing};var t=[];return"onreadystatechange"in e?e.onreadystatechange=function(){/complete|interactive/g.test(e.readyState)!==!1&&n()}:e.addEventListener?e.addEventListener("DOMContentLoaded",n):window.onload=n,{ready:function(e){t.unshift(e)}}}(document),ScriptStack=function(){function e(e,n){cfg.version&&(e+=(e.indexOf("?")===-1?"?":"&")+"v="+cfg.version),"/"===e[0]&&cfg.lockedToFolder===!0&&(e=e.substring(1));var t=document.createElement("script");t.type="text/javascript",t.src=e,"onreadystatechange"in t?t.onreadystatechange=function(){("complete"===this.readyState||"loaded"===this.readyState)&&n()}:t.onload=t.onerror=n,null==s&&(s=document.getElementsByTagName("head")[0]),s.appendChild(t)}function n(){function t(e){e&&"error"===e.type&&console.log("Script Loaded Error",r.url);for(var t=0,o=l.length;t<o;t++)if(l[t]===r){l.splice(t,1);break}return t===o?void console.error("Loaded Resource not found in stack",r):(2.5!==r.state&&r.readystatechanged(3),u=null,void n())}if(!a){if(0===l.length)return void i();if(null==u){var r=u=l[0];if(1!==r.state)return r.state=1,global.include=r,global.iparams=r.route.params,r.source?(__eval(r.source,r),void t()):void e(r.url,t)}}}function t(){if(!a){if(0===l.length)return void i();if(null==u){var e=l[0];e.state<2||(u=e,u.state=1,global.include=e,__eval(e.source,e),o(e),2.5!==e.state&&e.readystatechanged(3),u=null,t())}}}function r(){if(!a){if(0===l.length)return void i();var e=l.shift();e.state<2||(u=e,u.state=3,global.include=e,__eval(e.source,e),e.readystatechanged(3),u=null,r())}}function o(e){for(var n=l.length,t=-1;++t<n;)if(l[t]===e)return void l.splice(t,1)}function i(){for(var e=-1,n=c.length;++e<n;)c[e]();c.length=0}var s,u,a,l=[],c=[];return{load:function(e,o,i){return this.add(e,o),!cfg.eval||i?void n():e.source?(e.state=2,void t()):void XHR(e,function(e,n){return n||(console.error("Not Loaded:",e.url),console.error("- Initiator:",e.parent&&e.parent.url||"<root resource>")),e.source=n,e.state=2,cfg.sync?void r():void t()})},add:function(e,n){if(1===e.priority)return l.unshift(e);if(null==n)return l.push(e);for(var t=l.length,r=-1;++r<t;)if(l[r]===n)return l.splice(r,0,e);l.push(e)},moveToParent:function(e,n){var t,r=l.length,o=-1,i=-1;for(t=0;t<r;t++)if(l[t]===e){i=t;break}if(i!==-1){for(t=0;t<r;t++)if(l[t]===n){o=t;break}o!==-1&&(i<o||(l.splice(i,1),l.splice(o,0,e)))}},pause:function(){a=!0},resume:function(){a=!1,null==u&&this.touch()},touch:function(){var e=cfg.eval?t:n;e()},complete:function(e){return a!==!0&&0===l.length?void e():void c.push(e)}}}(),IncludeDeferred=function(){this.callbacks=[],this.state=-1};IncludeDeferred.prototype={on:function(e,n,t,r){return this===t&&this.state===-1?(n(this),this):(null==r&&(r=this.state<3||this===t?"unshift":"push"),e<=this.state?n(this):this.callbacks[r]({state:e,callback:n}),this)},readystatechanged:function(e){var n,t,r,o;if(e>this.state&&(this.state=e),3===this.state){var i=this.includes;if(null!=i&&i.length)for(n=0;n<i.length;n++)if(4!==i[n].resource.state)return;this.state=4}if(n=0,t=this.callbacks.length,0!==t){for("js"===this.type&&4===this.state&&(o=global.include,global.include=this);n<t&&(r=this.callbacks[n],null==r||r.state>this.state||(this.callbacks.splice(n,1),t--,n--,r.callback(this),!(this.state<4)));n++);null!=o&&"js"===o.type&&(global.include=o)}},ready:function(e){var n=this;return this.on(4,function(){Events.ready(function(){n.resolve(e)})},this)},done:function(e){var n=this;return this.on(4,function(){n.resolve(e)},this)},resolve:function(e){var n=this.includes,t=null==n?0:n.length;if(t>0&&null==this.response){this.response={};for(var r,o,i,s=0;s<t;s++)if(i=n[s],r=i.resource,o=i.route,"undefined"!=typeof r.exports){var u=r.type;switch(u){case"js":case"load":case"ajax":case"mask":var a=o.alias||Routes.parseAlias(o),l="js"===u?this.response:this.response[u]||(this.response[u]={});if(null!=a){l[a]=r.exports;break}console.warn("<includejs> Alias is undefined",r)}}}var c=this.response||emptyResponse,f=this;if(!(null==this._use&&null!=this._usage&&(this._use=tree_resolveUsage(this,this._usage,function(){f.state=4,f.resolve(e),f.readystatechanged(4)}),this.state<4)))return this._use?void e.apply(null,[c].concat(this._use)):void e(c)}};var Include,IncludeLib={};!function(IncludeDeferred){function incl_getResource(e,n){var t=e;if(path_isRelative(e)===!0&&(t="/"+t),null!=n)return bin[n][t];for(var r in bin)if(bin[r].hasOwnProperty(t))return bin[r][t];return null}function embedPlugin(source){eval(source)}function includePackage(e,n,t){var r=1===t.length?t[0]:__array_slice.call(t);return e instanceof Resource?e.include(n,r):new Resource("js").include(n,r)}function createIncluder(e){return function(){return includePackage(this,e,arguments)}}function doNothing(){return this}function stub_freeze(e){e.js=e.css=e.load=e.ajax=e.embed=e.lazy=e.inject=e.mask=doNothing}function stub_release(e){for(var n=["js","css","load","ajax","embed","lazy","mask"],t=n.length;--t!==-1;)e[n[t]]=createIncluder(n[t]);e.inject=e.js}Include=function(){IncludeDeferred.call(this)},stub_release(Include.prototype),obj_inherit(Include,IncludeDeferred,{_use:null,_usage:null,isBrowser:isBrowser,isNode:isNode,setCurrent:function(e){var n=e.url,t=this.getResourceById(n,"js");if(null==t){"/"===n[0]&&this.base&&(n=this.base+n.substring(1));var t=new Resource("js",{path:n},e.namespace,null,null,n)}t.state<3&&console.error("<include> Resource should be loaded",e),t.state=3,global.include=t},cfg:function(e,n){return cfg.call(this,e,n)},routes:function(e){if(null==e)return Routes.getRoutes();if(2===arguments.length)return Routes.register(e,arguments[1],this),this;for(var n in e)Routes.register(n,e[n],this);return this},promise:function(e){for(var n=e.split("."),t=global;n.length;){var r=n.shift();t=t[r]||(t[r]={})}return t},register:function(e){function n(e){return null==a?e:("/"===e.url[0]&&(e.url=a+e.url.substring(1)),"/"===e.parent[0]&&(e.parent=a+e.parent.substring(1)),e.id=e.url,e)}function t(e,n){e.exports=n,e.readystatechanged(4)}var r,o,i,s,u,a=this.base;for(r in e)for(i=e[r],s=i.length,u=-1;++u<s;){o=n(i[u]);var l=o.id,c=o.url,f=o.namespace,d=o.parent&&incl_getResource(o.parent,"js"),h=new Resource,p=o.state;if(l||c){switch(c&&("/"===c[0]&&(c=c.substring(1)),h.location=path_getDir(c)),h.state=null==p?"js"===r?3:4:p,h.namespace=f,h.type=r,h.url=c||l,h.parent=d,h.base=d&&d.base||a,r){case"load":case"lazy":var g=document.querySelector("#includejs-"+l.replace(/\W/g,""));if(null==g){console.error('"%s" Data was not embedded into html',l);break}h.exports=g.innerHTML,CustomLoader.exists(h)&&(h.state=3,CustomLoader.load(h,t))}(bin[r]||(bin[r]={}))[l]=h}}},instance:function(e,n){var t;return null==e?(t=new Include,t.state=4,t):(t=new Resource("js"),t.state=4,t.url=path_resolveUrl(e,n),t.location=path_getDir(t.url),t.parent=n,t)},getResource:function(e,n){return this.base&&"/"===e[0]&&(e=this.base+e.substring(1)),incl_getResource(e,n)},getResourceById:function(e,n){var t=bin[n],r=t[e];return null!=r?r:this.base&&"/"===e[0]&&(r=t[path_combine(this.base,e)],null!=r)?r:this.base&&this.location&&(r=t[path_combine(this.base,this.location,e)],null!=r)?r:this.location&&(r=t[path_combine(this.location,e)],null!=r)?r:null},getResources:function(){return bin},plugin:function(e,n){var t=[],r=0,o=0,i=0,s=function(e,t){o++,embedPlugin(t),o===r-1&&n&&(n(),n=null)};for(Routes.each("",e,function(e,n){t.push("/"===n.path[0]?n.path.substring(1):n.path)}),r=t.length;i<r;i++)XHR(t[i],s);return this},client:function(){return cfg.server===!0&&stub_freeze(this),this},server:function(){return cfg.server!==!0&&stub_freeze(this),this},use:function(){return null==this.parent?(console.error("<include.use> Parent resource is undefined"),this):(this._usage=arguments,this)},pauseStack:fn_proxy(ScriptStack.pause,ScriptStack),resumeStack:fn_proxy(ScriptStack.resume,ScriptStack),allDone:function(e){ScriptStack.complete(function(){function n(){--r<1&&e()}var t=include.getPending(),r=t.length;if(0===r)return void e();for(var o=-1,i=r;++o<i;)t[o].on(4,n,null,"push")})},getPending:function(e){var n,t,r,o=[];for(t in bin)if(null==e||e===t)for(r in bin[t])n=bin[t][r],n.state<4&&o.push(n);return o},Lib:IncludeLib})}(IncludeDeferred);var CustomLoader=function(){function e(e){return"string"!=typeof e&&("function"==typeof e.ready||"function"==typeof e.process)}function n(n){var t=path_getExtension(n),r=cfg.loader[t];if(e(r))return r;var o,i=r;if("object"==typeof i)for(var s in i){o=s,i=i[s];break}return cfg.loader[t]=new Resource("js",Routes.resolve(o,i),o,null,null,null,1)}function t(e,n){return function(t){e(n,t)}}function r(e,n,r,o){if(null==r.process)return void o(n,e);var i=t(o,n),s=r.process(e,n,i);"undefined"!=typeof s&&o(n,s)}function o(e,n,t){function o(e,o){r(o,e,n,t)}return"string"==typeof e.exports?void r(e.exports,e,n,t):n.load?n.load(e,o):void XHR(e,o)}var i={process:function(e,n){try{return JSON.parse(e)}catch(n){return console.error(n,e),null}}};return cfg.loader={json:i},{load:function(e,t){var r=n(e.url);return r.process?void o(e,r,t):void r.on(4,function(){o(e,r.exports,t)},null,"push")},exists:function(e){if(!e.url)return!1;var n=path_getExtension(e.url);return cfg.loader.hasOwnProperty(n)},register:function(e,n){if("string"==typeof n){var t=include;null==t.location&&(t={location:path_getDir(path_resolveCurrent())}),n=path_resolveUrl(n,t)}cfg.loader[e]=n}}}(),LazyModule={create:function(e,n){for(var t=e.split("."),r=global,o=t[t.length-1];t.length>1;){var i=t.shift();r=r[i]||(r[i]={})}t=null,Object.defineProperty(r,o,{get:function(){delete r[o];try{var t=__eval(n,global.include);null==t||t instanceof Resource||(r[o]=t)}catch(n){n.xpath=e,Helper.reportError(n)}finally{return n=null,e=null,r[o]}}})}},Resource;!function(e,n,t,r){function o(e){var n=e.type,o=e.parent,s=e.url;if(null==document&&"css"===n)return e.state=4,e;if(r.exists(e)===!1)switch(n){case"js":case"embed":t.load(e,o,"embed"===n);break;case"ajax":case"load":case"lazy":case"mask":XHR(e,i);break;case"css":e.state=4;var u=document.createElement("link");u.href=s,u.rel="stylesheet",u.type="text/css",document.getElementsByTagName("head")[0].appendChild(u)}else"js"!==n&&"embed"!==n||t.add(e,e.parent),r.load(e,i);return e}function i(e,n){switch(n||console.warn("Resource can`t be loaded",e.url),e.type){case"js":case"embed":return e.source=n,e.state=2,void t.touch();case"load":case"ajax":e.exports=n;break;case"lazy":LazyModule.create(e.xpath,n);break;case"css":var r=document.createElement("style");r.type="text/css",r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r);break;case"mask":if(n){var o=global.mask;return null==o&&(o=global.require("mask")),void o.Module.registerModule(n,{path:e.url}).done(function(n){e.exports=n.exports,e.readystatechanged(4)}).fail(function(n){console.error(n),e.readystatechanged(4)})}}e.readystatechanged(4)}function s(e,n,t){if(null==e)return null;null==t&&(t=[]);for(var r,o=e.length,i=-1;++i<o;)r=e[i].resource,n===r.type&&t.push(r),null!=r.includes&&s(r.includes,n,t);return t}Resource=function(n,r,i,s,u,a,l){e.call(this);var c=r&&r.path;null!=c&&(c=PathResolver.resolveBasic(c,n,u)),null==a&&c&&(a=c);var f=Bin.get(n,a);if(f)return f.state<4&&"js"===n&&t.moveToParent(f,u),f;if(this.id=a,this.url=c,this.type=n,this.xpath=s,this.route=r,this.parent=u,this.priority=l,this.namespace=i,this.base=u&&u.base,this.childLoaded=fn_proxy(this.childLoaded,this),null==c)return this.state=3,this.location=path_getDir(path_resolveCurrent()),this;if(this.state=0,this.location=path_getDir(c),Bin.add(n,a,this),PathResolver.isNpm(this.url)===!1)return o(this),this;var d=this;return PathResolver.resolveNpm(this.url,this.type,this.parent,function(e,n){return e?void d.readystatechanged(4):(d.url=n,void o(d))}),this},Resource.prototype=obj_inherit(Resource,e,{state:null,location:null,includes:null,response:null,url:null,base:null,type:null,xpath:null,route:null,parent:null,priority:null,namespace:null,setBase:function(e){return this.base=e,this},childLoaded:function(e){var n=this,t=n.includes;if(t&&t.length){if(n.state<3)return;for(var r=0;r<t.length;r++)if(4!==t[r].resource.state)return}n.readystatechanged(4)},create:function(e,n,t,r,o){var i;return this.state=this.state>=3?3:2,this.response=null,null==this.includes&&(this.includes=[]),i=new Resource(e,n,t,r,this,o),this.includes.push({resource:i,route:n}),i},include:function(e,t){var r,o=this,i=[];n.each(e,t,function(n,t,s){null!=o.route&&o.route.path===t.path||(r=o.create(e,t,n,s),i.push(r))});for(var s=-1,u=i.length;++s<u;)i[s].on(4,this.childLoaded);return this},require:function(e){this.exports={},this.includes=[];var n=res_groupByType(e);for(var t in n)this.include(t,n[t]);return this},pause:function(){this.state=2.5;var e=this;return function(n){1===arguments.length&&(e.exports=n),e.readystatechanged(3)}},getNestedOfType:function(e){return s(this.includes,e)}})}(Include,Routes,ScriptStack,CustomLoader);var __nativeRequire,__includeRequire;if(global.require){var name=global.require.name;"amd"!==name&&"commonjs"!==name&&(__nativeRequire=global.require)}var CommonJS;!function(){function e(){global.require=CommonJS.require}function n(){if("undefined"==typeof module){if("undefined"==typeof Object.defineProperty)return void console.warn("Browser do not support Object.defineProperty");Object.defineProperty(global,"module",{get:function(){return global.include},configurable:!0}),Object.defineProperty(global,"exports",{get:function(){var e=global.include;return e.exports||(e.exports={})},set:function(e){global.include.exports=e},configurable:!0})}}CommonJS={exports:null,require:function(e){if(46!==e.charCodeAt(0)&&null!=__nativeRequire)return __nativeRequire(e);var n=cfg.sync,t=cfg.eval,r=include,o=null;return cfg.sync=!0,cfg.eval=!0,include.js(e+"::Module").done(function(e){o=e.Module}),include=r,cfg.sync=n,cfg.eval=t,o},enable:function(){"function"!=typeof __nativeRequire&&(n(),e())}}}();var Amd;!function(){function e(n,t){for(var r in t){var o=t[r];null!=o&&("load"!==r&&"ajax"!==r?n[+r]=o:e(n,o))}}Amd={enable:function(){n()}};var n;!function(){function t(e,n){var t=-1,o=e.length;e:for(;++t<o;){var i=e[t][0];if(i.length===n.length){for(var s=-1,u=i.length;++s<u;){var a=i[s];if(a(n[s])===!1)continue e}return e[t][1]}}return console.warn("Define function arguments are invalid",n),r}function r(){}function o(n,t,r,o){if(null!=t&&(bin.js[t]=n),null==r)return void(n.exports=i(o));var u=s(r,n),a=u.array,l=u.linked;return 0===l.length?void(n.exports=i(o,a)):void n.require(u.linked).done(function(t){e(a,t),n.exports=i(o,a)})}function i(e,n){return"function"==typeof e?e.apply(null,n||[]):e}function s(e,n){for(var t=new Array(e.length),r=[],o=e.length,i=-1;++i<o;){var s=f[e[i]];null!=s?t[i]=s(n):r.push(e[i]+"::"+i)}return{array:t,linked:r}}function u(e){return"string"==typeof e}function a(e){return!0}function l(e){return e instanceof Array}n=function(){var e=global.define=function(e,n,r){for(var o=arguments.length,i=new Array(o);--o>-1;)i[o]=arguments[o];var s=t(c,i),u=global.include;s(u,e,n,r)};__includeRequire=global.require=function(){return isNode&&__nativeRequire&&1===arguments.length?__nativeRequire.apply(null,arguments):e.apply(null,arguments)},"undefined"!=typeof require&&(require=__includeRequire)};var c=[[[a],function(e,n){o(e,null,null,n)}],[[u,a],function(e,n,t){o(e,n,null,t)}],[[u,l,a],function(e,n,t,r){o(e,n,t,r)}],[[l,a],function(e,n,t){o(e,null,n,t)}]],f={module:function(e){return e},exports:function(e){return e.exports},require:function(e){return CommonJS.require}}}()}();var PathResolver;!function(){function e(e){return s[e]||e}function n(e){return/\.[\w]{1,8}($|\?)/.test(e)}function t(e){return/^([\w\-]+)(\/[\w\-_]+)*$/.test(e)}function r(e,t,r){function o(){var e=a+"/node_modules/"+i+"/",n=e+"package.json";XHR_LOAD(n,function(n,t){var i;if(t)try{i=JSON.parse(t)}catch(e){}if(null!=n||null==i){var l=a.replace(/[^\/]+$/,"");return l===a?void r("Not found"):void o()}return s?void r(null,e+s):i.main?void r(null,path_combine(e,i.main)):void r(null,e+"index."+u.js)})}var i=/^([\w\-]+)/.exec(t)[0],s=t.substring(i.length+1);s&&n(s)===!1&&(s+="."+u.js);var a=e.replace(/[^\/]+\.[\w]{1,8}$/,"");o()}function o(e,t){if(n(e))return e;var r=u[t];return null==r?(console.warn("Extension is not defined for "+t),e):e+"."+r}function i(e){var n=/\.([\w]{1,8})($|\?)/.exec(e);if(null===n)return u.js;var t=n[1],r=a[t];if(null==r)throw Error("Unknown type for extension: "+t);return r}PathResolver={configMap:function(e){for(var n in e)s[n]=e},configExt:function(e){var n=e.def,t=e.types;for(var r in n)u[r]=n[r];for(var r in t)a[r]=t[r]},resolveBasic:function(n,r,i){if("js"===r&&t(n))return n;var s=path_resolveUrl(e(n),i);return o(s,r)},isNpm:t,getType:i,resolveNpm:function(o,i,s,a){var l=e(o);if(l.indexOf(".")>-1)return void a(null,l);if("js"===i&&t(l)){var c=s&&s.location||path_resolveCurrent();return void r(c,l,a)}n(l)===!1&&(l+="."+u[i]),a(null,l)}};var s={},u={js:"js",css:"css",mask:"mask"},a={js:"js",es6:"js",ts:"js",css:"css",less:"css",scss:"css",mask:"mask",json:"load",yml:"load"}}(),IncludeLib.Routes=RoutesLib,IncludeLib.Resource=Resource,IncludeLib.ScriptStack=ScriptStack,IncludeLib.PathResolver=PathResolver,IncludeLib.Config=Config,IncludeLib.registerLoader=CustomLoader.register,exports.include=new Include,exports.includeLib=IncludeLib}); | ||
//# sourceMappingURL=include.min.js.map |
{ | ||
"name": "includejs", | ||
"description": "Resource Loader", | ||
"version": "0.10.28", | ||
"version": "0.10.29", | ||
"homepage": "http://atmajs.com/include", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
1
68
334072
9830