-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.min.js
More file actions
1 lines (1 loc) · 9.04 KB
/
Copy pathbundle.min.js
File metadata and controls
1 lines (1 loc) · 9.04 KB
1
(()=>{var l,r,p,h,e,d;function v(e,n){var t,r={}.hasOwnProperty;for(t in n)r.call(n,t)&&(e[t]=n[t]);return e}function m(e,n){for(var t=-1,r=n.length>>>0;++t<r;)if(e===n[t])return 1}p=function(e,n){return d.__node&&"undefined"!=typeof fs&&null!==fs&&!/^https?:/.exec(e)?new Promise(function(t,r){return fs.readFile(e,function(e,n){return e?r(e):t(n.toString())})}):fetch(e,n).then(function(i){var e;return i&&i.ok?i.text():i?i.clone().text().then(function(e){var n,t=i.status||404,r=new Error(t+" "+e);r.name="lderror",r.id=t,r.message=e,t=r;try{(n=JSON.parse(e))&&"lderror"===n.name&&(v(t,n).json=n)}catch(e){0}return Promise.reject(t)}):Promise.reject(((e=new Error("404")).name="lderror",e.id=404,e))})},(h=function(e){var n,t,o,u,s,c,a,i,f=this;return this.lc=(e=null==e?{}:e).context||{},this.id=Math.random().toString(36).substring(2),e.iframe?this.iframe=e.iframe:(this.iframe=n=r.createElement("iframe"),(t=n.style).position="absolute",t.top=0,t.left=0,t.width=0,t.height=0,t.pointerEvents="none",t.opacity=0,n.setAttribute("title","rescope script loader"),n.setAttribute("name","pdb-proxin-"+this.id),r.body.appendChild(n)),o=Object.fromEntries(Reflect.ownKeys(this.iframe.contentWindow).map(function(e){return[e,!0]})),u={},s={},c={},a=new WeakMap,this._proxy=new Proxy(e.target||l,{get:function(n,t,r){var i;if(null!=f.lc[t])return f.lc[t];if(null!=u[t])return u[t];if(null!=s[t])return s[t];if(null!=c[t])return c[t];if("addEventListener"===t)return c[t]=function(e,n){return"message"!==e?(r.target||l).addEventListener(e,n):((r.target||l).addEventListener(e,e=function(e){return Object.defineProperty(e,"source",{value:f._proxy,writable:!1,configurable:!0}),n.apply(f._proxy,arguments)}),a.set(n,e))};if("removeEventListener"===t)return c[t]=function(e,n){return"message"!==e?(r.target||l).removeEventListener(e,n):(r.target||l).removeEventListener(e,a.get(n))||n};if("function"!=typeof n[t])return null!=o[t]?n[t]:void 0;try{i=Reflect.get(n,t,r)}catch(e){return i=n[t]}return u[t]=new Proxy(i.bind(n),{get:function(e,n,t){return Reflect.get(m(n,e)?e:i,n,t)}})},set:function(e,n,t){var r;return"_rspvarsetcb_"===n?i.on(t.k,t.f):(i.fire(n,t),"onmessage"===n?(r=function(n){return function(e){if(Object.defineProperty(e,"source",{value:f._proxy,writable:!1,configurable:!0}),n)return n.call(f._proxy,e)}},s[n]=t,queueMicrotask(function(){return e[n]=r(t)})):o[n]?e[n]=t:f.lc[n]=t),!0},defineProperty:function(e,n,t){return Object.defineProperty(f.lc,n,t),f._proxy}}),i={evthdr:{},on:function(e,t){var r=this;return(Array.isArray(e)?e:[e]).map(function(e){var n;return((n=r.evthdr)[e]||(n[e]=[])).push(t)})},fire:function(e){for(var n,t,r,i,o=[],u=[],s=1,c=arguments.length;s<c;++s)u.push(arguments[s]);for(n=u,s=0,r=(t=this.evthdr[e]||[]).length;s<r;++s)i=t[s],o.push(i.apply(this,n));return o}},this}).prototype=((e=Object.create(Object.prototype)).proxy=function(){return this._proxy},e.ctx=function(){return this.lc},e),(d=function(e){var n,t;return null==e&&(e={}),this.id=Math.random().toString(36).substring(2),this.iframe=n=r.createElement("iframe"),this._cache={},this.proxy=new h,this.registry(e.registry||"/assets/lib/"),(t=n.style).position="absolute",t.top=0,t.left=0,t.width=0,t.height=0,t.pointerEvents="none",t.opacity=0,n.setAttribute("title","rescope script loader"),n.setAttribute("name","pdb-rescope-"+this.id),r.body.appendChild(n),n.contentWindow.document.body.innerHTML=(e.preloads||[]).map(function(e){return'<script type="text/javascript" src="'+e+'"><\/script>'}).join(""),this}).env=function(e){e=[e,e.document];return l=e[0],r=e[1],e},d.prop={legacy:{webkitStorageInfo:!0}},d.id=function(e){var n=e.path||("js"===e.type?"index.min.js":"css"===e.type?"index.min.css":"index.html");return e.id||e.url||(e.ns?e.ns+":":"")+e.name+"@"+(e.version||"main")+":"+n},d._cache={},d._ver={map:{},list:{}},d.cache=function(e){var n,t,r,i,o,u,s,c,a,f,l;if((e="string"==typeof e?{url:e}:e).id||(e.id=d.id(e)),n=this._cache[e.id])return n;if(e.id&&!e.name?((o=e.id.split(":")).length<=2?(t=o[0],r=o[1],i=o[2]):(i=o[0],t=o[1],r=o[2]),u=(o=(o=/^(@?[^@]+)(?:@([^:]+))?$/.exec(t))||["",e.id,""])[1],s=o[2]):(i=(c=[e.ns,e.name,e.version||"",e.path||""])[0],u=c[1],s=c[2],r=c[3]),/^[0-9.]+$/.exec(s)){if((n=((c=this._ver.map)[u]||(c[u]={}))[s])&&(s=n),n=this._cache[d.id({ns:i,name:u,version:s,path:r})])return n;for(a=0,f=((c=this._ver.list)[u]||(c[u]=[])).length;a<f;++a)if(l=a,l=this._ver.list[u][l],semver.fit(l,s)&&(this._ver.map[u][s]=l,e.id=d.id({ns:i,name:u,version:l,path:r}),n=this._cache[e.id]))return n}return m(s,(c=this._ver.list)[u]||(c[u]=[]))||this._ver.list[u].push(s),this._cache[e.id]=e},d.prototype=((e=Object.create(Object.prototype)).peekScope=function(){return!1},e.init=function(){return Promise.resolve()},e._ref=function(e){var n,t;return"string"==typeof e&&(e={url:e}),"function"==typeof(n=this._reg.url||this._reg)&&((t=v({},e)).url=n(e),e=t),this._reg.fetch?this._reg.fetch(e):e.url},e.registry=function(e){return"string"==typeof e?("/"===e[e.length-1]&&(e=e.substring(0,e.length-1)),this._reg=(n=e,function(e){return n+"/"+e.name+"/"+(e.version||"main")+"/"+(e.path||"index.min.js")})):this._reg=e;var n},e.cache=function(e){var n;return(e="string"==typeof e?{url:e}:e).id||(e.id=d.id(e)),(n=this._cache[e.id])||(this._cache[e.id]=d.cache(e))},e.exports=function(e){var n,t,r=[],i=(e=null==e?{}:e).ctx||{},e="string"==typeof e.libs?[e.libs]:e.libs||[],o=(n=[{},this.iframe.contentWindow])[0],u=n[1];for(t in i)o[t]=u[t],u[t]=i[t];for(t in this._exports(e,0,i),o)r.push(u[t]=o[t]);return r},e._exports=function(e,n,t){var r,i,o,u,s,c,a=[];if(null==t&&(t={}),r=e[n=null==n?0:n]){if(i=(c=[{},(r=this.cache(r)).fprop,this.iframe.contentWindow])[0],o=c[1],u=c[2],o)for(s in o)i[s]=u[s],u[s]=o[s];else if(r.fprop=o={},r.prop={},r.propIniting=!0,r.gen)v(o,r.gen.apply(u,[u,u,u])),r.prop=Object.fromEntries((()=>{var e=[];for(s in o)e.push([s,null]);return e})());else{for(s in Object.fromEntries(Reflect.ownKeys(u).filter(function(e){return!d.prop.legacy[e]}).map(function(e){return[e,!0]})))i[s]=u[s];try{u.eval((r.code||"").replace('"use strict";',""))}catch(e){throw c=e,console.error("[@plotdb/rescope] Parse failed",{url:r.url,ns:r.ns,name:r.name,version:r.version,path:r.path}),console.error("[@plotdb/rescope] with this error:",c),c}for(s in Object.fromEntries(Reflect.ownKeys(u).filter(function(e){return!d.prop.legacy[e]}).map(function(e){return[e,!0]})))u[s]!==i[s]&&"NaN"!==s&&(o[s]=u[s],r.prop[s]=null)}for(s in o)t[s]=o[s];for(s in this._exports(e,n+1),o)a.push(u[s]=i[s]);return a}},e._wrap=function(e,n,t){var r,i,o,u,s;for(s in null==n&&(n={}),null==t&&(t={}),r=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,o="var window, global, globalThis, self, __ret = {}; __win = {};\nwindow = global = globalThis = self = window = scope;",u=function(e){return"window['_rspvarsetcb_'] = {k:'"+e+"',f:function(v){"+e+"=v}};"},i=(e=null==e?{}:e).prop||{})r.exec(s)&&(o+="var "+s+";"+u(s)),o+="__win['"+s+"'] = win['"+s+"']; win['"+s+"'] = undefined;";for(s in n)o+="window['"+s+"'] = ctx['"+s+"'];",r.exec(s)&&(o+="var "+s+" = window['"+s+"'];"+u(s));for(s in o+=e.code+";",i)r.exec(s)?o+="if(!("+s+")) { "+s+" = scope['"+s+"']; }\n__ret['"+s+"'] = "+s+" || window['"+s+"'] || win['"+s+"'] || this['"+s+"'];\nwin['"+s+"'] = __win['"+s+"'];":o+="__ret['"+s+"'] = window['"+s+"'] || win['"+s+"'] || this['"+s+"'];\nwin['"+s+"'] = __win['"+s+"'];";return o+="return __ret;",t.codeOnly?"function(scope, ctx, win){"+o+"}":new Function("scope","ctx","win",o)},e.load=function(e,r,i,o){var n,u,s,c,a,f=this;return null==r&&(r={}),null==i&&(i=!1),null==o&&(o=!1),n=(e=(Array.isArray(e)?e:[e]).map(function(e){return f.cache(e)})).px||(e.px=r&&r.p?r.p:new h),u=n.ctx(),s=n.proxy(),c=[e],(a=function(e){var n,t;return(n=c[e=null==e?0:e])?(t=n.map(function(n){var e;return!n.code&&!n.gen||i?(e=f._ref(n)).then?e.then(function(e){return n.code=e.content,f.cache((n.id=void 0,n.version=e.version,n.code=e.content,n))}):p(e,{method:"GET"}).then(function(e){return n.code=e}):Promise.resolve()}),Promise.all(t).then(function(){if(!o)return f.exports({libs:n,ctx:r.f}),n.map(function(e){return e.propIniting&&(e.gen||(e.gen=f._wrap(e,u)),e.prop=e.gen.apply(s,[s,u,l]),e.propIniting=!1),v(u,e.prop)})}).then(function(){return u}).then(function(){return a(e+1)})):Promise.resolve(u)})(0)},e.context=function(e,n,t){var r;return"function"!=typeof n&&(n=(r=[t,n])[0],t=r[1]),this.load(e,t).then(function(e){return n?n(e):e})},e),d.env("undefined"!=typeof self&&null!==self?self:globalThis),d.proxin=h,d.dualContext=function(){return{p:new h,f:{},ctx:function(){return this.p.ctx()}}},d.prototype.bundle=function(n){var t,e,r,i,o=this;for(r in null==n&&(n={}),n=(Array.isArray(n)?n:[n]).map(function(e){return o.cache(e)}),t={},n.filter(function(e){return e&&e.id}).map(function(e){return t[e.id]=e}),e=[],t)i=t[r],e.push(i);return n=e,this.load(n,null,!0,!0).then(function(){var e=n.filter(function(e){return e.code}).map(function(e){return JSON.stringify({url:e.url,id:e.id,ns:e.ns,name:e.name,version:e.version,path:e.path,code:e.code})});return Promise.resolve("["+e.join(",")+"].forEach(function(o){rescope.cache(o);})")})},"undefined"!=typeof module&&null!==module?module.exports=d:"undefined"!=typeof window&&null!==window&&(window.rescope=d)})();