1 line
3.7 KiB
JavaScript
1 line
3.7 KiB
JavaScript
!function(){const e="undefined"!=typeof self?self:global;let n;if("undefined"!=typeof location){const e=(n=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(n=n.slice(0,e+1))}const t=/\\/g,r="undefined"!=typeof Symbol,i=r&&Symbol.toStringTag,o=r?Symbol():"@";function c(){this[o]={}}const l=c.prototype;let u;l.import=function(e,n){const t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){const n=function e(n,t,r){let c=n[o][t];if(c)return c;const l=[],u=Object.create(null);i&&Object.defineProperty(u,i,{value:"Module"});let f=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw new Error("Module "+t+" did not instantiate");const r=e[1](function(e,n){c.h=!0;let t=!1;if("object"!=typeof e)e in u&&u[e]===n||(u[e]=n,t=!0);else for(let n in e){let r=e[n];n in u&&u[n]===r||(u[n]=r,t=!0)}if(t)for(let e=0;e<l.length;e++)l[e](u);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return c.e=r.execute||function(){},[e[0],r.setters||[]]});const s=f.then(function(r){return Promise.all(r[0].map(function(i,o){const c=r[1][o];return Promise.resolve(n.resolve(i,t)).then(function(r){const i=e(n,r,t);return Promise.resolve(i.I).then(function(){return c&&(i.i.push(c),!i.h&&i.I||c(i.n)),i})})})).then(function(e){c.d=e})});return s.catch(function(){}),c=n[o][t]={id:t,i:l,n:u,I:f,L:s,h:!1,d:void 0,e:void 0,eE:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.eE)throw t.eE;return t.E?t.E:void 0}let i;return t.d.forEach(function(t){{const o=e(n,t,r);o&&(i=i||[]).push(o)}}),i?t.E=Promise.all(i).then(o):o();function o(){try{let e=t.e.call(f);if(e)return e.then(function(){t.C=t.n,t.E=null}),e.catch(function(){}),t.E=t.E||e;t.C=t.n}catch(e){throw t.eE=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},l.createContext=function(e){return{url:e}},l.register=function(e,n){u=[e,n]},l.getRegister=function(){const e=u;return u=void 0,e};const f=Object.freeze(Object.create(null));let s;e.System=new c,"undefined"!=typeof window&&window.addEventListener("error",function(e){s=e.error});const d=l.register;l.register=function(e,n){s=void 0,d.call(this,e,n)},l.instantiate=function(e,n){const t=this;return new Promise(function(r,i){const o=document.createElement("script");o.charset="utf-8",o.async=!0,o.addEventListener("error",function(){i(new Error("Error loading "+e+(n?" from "+n:"")))}),o.addEventListener("load",function(){if(document.head.removeChild(o),s)return i(s);r(t.getRegister())}),o.src=e,document.head.appendChild(o)})},l.resolve=function(e,r){const i=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(t,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const t=n.slice(0,n.indexOf(":")+1);let r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+1),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;const i=r.slice(0,r.lastIndexOf("/")+1)+e,o=[];let c=-1;for(let e=0;e<i.length;e++)-1!==c?"/"===i[e]&&(o.push(i.slice(c,e+1)),c=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:c=e:(o.pop(),e+=2):c=e;return-1!==c&&o.push(i.slice(c)),n.slice(0,n.length-r.length)+o.join("")}}(e,r||n);if(!i){if(-1!==e.indexOf(":"))return e;throw new Error('Cannot resolve "'+e+(r?'" from '+r:'"'))}return i}}(); |