UNPKG

@velcro/strategy-cdn

Version:

Velcro resolver strategy for resolving modules from a cdn such as Unpkg or JsDelivr

1 lines 68.2 kB
this.Velcro=this.Velcro||{},this.Velcro.StrategyCdn=function(e){"use strict";class t extends Error{constructor(){super(...arguments),this.name=this.constructor.name}}class r extends t{}class n extends t{constructor(e){super(`Entry was excluded by current configuration '${e.toString()}'`)}}class i extends t{constructor(e){super(`Unable to resolve '${e.toString()}'`)}}class s extends i{constructor(e,t){super(`The dependency '${e}' of '${t.toString()}' was not found`)}}function o(e,t){let r=!1;const n=e.map((e=>c(e)?(r=!0,a(e,t)):e));return r?Promise.all(n):e}async function a(e,t){try{const n=await e;return t.isCancellationRequested?Promise.reject(new r):n}catch(e){if(t.isCancellationRequested)return Promise.reject(new r);throw e}}function c(e){return e&&("function"==typeof e.then||"boolean"==typeof e.done&&"number"==typeof e.next&&"number"==typeof e.pre)}var h;!function(e){e.decode="object"==typeof global&&"function"==typeof global.Buffer?e=>global.Buffer.from(e,"base64").toString("utf-8"):"function"==typeof atob?e=>decodeURIComponent(escape(atob(e))):e=>{throw new Error("The environment has neither the Buffer nor btoa functions. Please consider polyfilling one of these apis.")},e.encode="object"==typeof global&&"function"==typeof global.Buffer?e=>global.Buffer.from(e).toString("base64"):"function"==typeof btoa?e=>btoa(unescape(encodeURIComponent(e))):e=>{throw new Error("The environment has neither the Buffer nor btoa functions. Please consider polyfilling one of these apis.")}}(h||(h={}));const l=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout((()=>{if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw e}),0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t=>{t(e)}))}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function u(e){var t;(t=e)instanceof Error&&t.name===f&&t.message===f||l.onUnexpectedError(e)}const f="Canceled";var d,p;function g(e){}function m(...e){return e.forEach(g),{dispose:()=>function(e){if(d.is(e)){for(let t of e)t&&t.dispose();return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}(e)}}!function(e){e.is=function(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]};const t=Object.freeze([]);e.empty=function(){return t},e.single=function*(e){yield e},e.from=function(e){return e||t},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){for(const r of e)if(t(r))return!0;return!1},e.filter=function*(e,t){for(const r of e)t(r)&&(yield r)},e.map=function*(e,t){for(const r of e)yield t(r)},e.concat=function*(...e){for(const t of e)for(const e of t)yield e},e.consume=function(t,r=Number.POSITIVE_INFINITY){const n=[];if(0===r)return[n,t];const i=t[Symbol.iterator]();for(let t=0;t<r;t++){const t=i.next();if(t.done)return[n,e.empty()];n.push(t.value)}return[n,{[Symbol.iterator]:()=>i}]}}(d||(d={}));class E{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){this._toDispose.forEach((e=>e.dispose())),this._toDispose.clear()}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?E.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}}E.DISABLE_DISPOSED_WARNING=!1;class v{constructor(){this._store=new E}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}v.None=Object.freeze({dispose(){}});class y{constructor(e){this.element=e,this.next=y.Undefined,this.prev=y.Undefined}}y.Undefined=new y(void 0);class C{constructor(){this._first=y.Undefined,this._last=y.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===y.Undefined}clear(){this._first=y.Undefined,this._last=y.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const r=new y(e);if(this._first===y.Undefined)this._first=r,this._last=r;else if(t){const e=this._last;this._last=r,r.prev=e,e.next=r}else{const e=this._first;this._first=r,r.next=e,e.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==y.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==y.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==y.Undefined&&e.next!==y.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===y.Undefined&&e.next===y.Undefined?(this._first=y.Undefined,this._last=y.Undefined):e.next===y.Undefined?(this._last=this._last.prev,this._last.next=y.Undefined):e.prev===y.Undefined&&(this._first=this._first.next,this._first.prev=y.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==y.Undefined;)yield e.element,e=e.next}toArray(){const e=[];for(let t=this._first;t!==y.Undefined;t=t.next)e.push(t.element);return e}}!function(e){function t(e){return(t,r=null,n)=>{let i,s=!1;return i=e((e=>{if(!s)return i?i.dispose():s=!0,t.call(r,e)}),null,n),s&&i.dispose(),i}}function r(e,t){return o(((r,n=null,i)=>e((e=>r.call(n,t(e))),null,i)))}function n(e,t){return o(((r,n=null,i)=>e((e=>{t(e),r.call(n,e)}),null,i)))}function i(e,t){return o(((r,n=null,i)=>e((e=>t(e)&&r.call(n,e)),null,i)))}function s(e,t,n){let i=n;return r(e,(e=>(i=t(i,e),i)))}function o(e){let t;const r=new $({onFirstListenerAdd(){t=e(r.fire,r)},onLastListenerRemove(){t.dispose()}});return r.event}function a(e,t,r=100,n=!1,i){let s,o=void 0,a=void 0,c=0;const h=new $({leakWarningThreshold:i,onFirstListenerAdd(){s=e((e=>{c++,o=t(o,e),n&&!a&&(h.fire(o),o=void 0),clearTimeout(a),a=setTimeout((()=>{const e=o;o=void 0,a=void 0,(!n||c>1)&&h.fire(e),c=0}),r)}))},onLastListenerRemove(){s.dispose()}});return h.event}function c(e){let t,r=!0;return i(e,(e=>{const n=r||e!==t;return r=!1,t=e,n}))}e.None=()=>v.None,e.once=t,e.map=r,e.forEach=n,e.filter=i,e.signal=function(e){return e},e.any=function(...e){return(t,r=null,n)=>m(...e.map((e=>e((e=>t.call(r,e)),null,n))))},e.reduce=s,e.snapshot=o,e.debounce=a,e.stopwatch=function(e){const n=(new Date).getTime();return r(t(e),(e=>(new Date).getTime()-n))},e.latch=c,e.buffer=function(e,t=!1,r=[]){let n=r.slice(),i=e((e=>{n?n.push(e):o.fire(e)}));const s=()=>{n&&n.forEach((e=>o.fire(e))),n=null},o=new $({onFirstListenerAdd(){i||(i=e((e=>o.fire(e))))},onFirstListenerDidAdd(){n&&(t?setTimeout(s):s())},onLastListenerRemove(){i&&i.dispose(),i=null}});return o.event};class h{constructor(e){this.event=e}map(e){return new h(r(this.event,e))}forEach(e){return new h(n(this.event,e))}filter(e){return new h(i(this.event,e))}reduce(e,t){return new h(s(this.event,e,t))}latch(){return new h(c(this.event))}debounce(e,t=100,r=!1,n){return new h(a(this.event,e,t,r,n))}on(e,t,r){return this.event(e,t,r)}once(e,r,n){return t(this.event)(e,r,n)}}e.chain=function(e){return new h(e)},e.fromNodeEventEmitter=function(e,t,r=(e=>e)){const n=(...e)=>i.fire(r(...e)),i=new $({onFirstListenerAdd:()=>e.on(t,n),onLastListenerRemove:()=>e.removeListener(t,n)});return i.event},e.fromDOMEventEmitter=function(e,t,r=(e=>e)){const n=(...e)=>i.fire(r(...e)),i=new $({onFirstListenerAdd:()=>e.addEventListener(t,n),onLastListenerRemove:()=>e.removeEventListener(t,n)});return i.event},e.fromPromise=function(e){const t=new $;let r=!1;return e.then(void 0,(()=>null)).then((()=>{r?t.fire(void 0):setTimeout((()=>t.fire(void 0)),0)})),r=!0,t.event},e.toPromise=function(e){return new Promise((r=>t(e)(r)))}}(p||(p={}));class ${constructor(e){this._disposed=!1,this._options=e,this._leakageMon=void 0}get event(){return this._event||(this._event=(e,t,r)=>{this._listeners||(this._listeners=new C);const n=this._listeners.isEmpty();n&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const i=this._listeners.push(t?[e,t]:e);let s,o;return n&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t),this._leakageMon&&(s=this._leakageMon.check(this._listeners.size)),o={dispose:()=>{if(s&&s(),o.dispose=$._noop,!this._disposed&&(i(),this._options&&this._options.onLastListenerRemove)){this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)}}},r instanceof E?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}fire(e){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new C);for(let t of this._listeners)this._deliveryQueue.push([t,e]);for(;this._deliveryQueue.size>0;){const[e,t]=this._deliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){u(e)}}}}dispose(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0}}$._noop=function(){};const w=Object.freeze((function(e,t){const r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}));var A;!function(e){e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||(t instanceof I||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested))},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:p.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:w})}(A||(A={}));class I{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?w:(this._emitter||(this._emitter=new $),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class R{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new I),this._token}cancel(){this._token?this._token instanceof I&&this._token.cancel():this._token=A.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof I&&this._token.dispose():this._token=A.None}}!function(){if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){Object.freeze({didTimeout:!0,timeRemaining:()=>15})}}();const b="object"==typeof self?self:"object"==typeof global?global:{},_=function(){if(b.setImmediate)return b.setImmediate.bind(b);if("function"==typeof b.postMessage&&!b.importScripts){let e=[];b.addEventListener("message",(t=>{if(t.data&&t.data.vscodeSetImmediateId)for(let r=0,n=e.length;r<n;r++){const n=e[r];if(n.id===t.data.vscodeSetImmediateId)return e.splice(r,1),void n.callback()}}));let t=0;return r=>{const n=++t;e.push({id:n,callback:r}),b.postMessage({vscodeSetImmediateId:n},"*")}}if("undefined"!=typeof process&&"function"==typeof process.nextTick)return process.nextTick.bind(process);const e=Promise.resolve();return t=>e.then(t)}(),k="undefined"==typeof process?{cwd:()=>"/",env:Object.create(null),get platform(){return"linux"},nextTick:e=>_(e)}:process,S=k.cwd,P=k.env,L=(k.platform,k.nextTick,46),O=47,N=92,T=58;class x extends Error{constructor(e,t,r){let n;"string"==typeof t&&0===t.indexOf("not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";const i=-1!==e.indexOf(".")?"property":"argument";let s=`The "${e}" ${i} ${n} of type ${t}`;s+=". Received type "+typeof r,super(s),this.code="ERR_INVALID_ARG_TYPE"}}function U(e,t){if("string"!=typeof e)throw new x(t,"string",e)}function F(e){return e===O||e===N}function j(e){return e===O}function D(e){return e>=65&&e<=90||e>=97&&e<=122}function M(e,t,r,n){let i="",s=0,o=-1,a=0,c=0;for(let h=0;h<=e.length;++h){if(h<e.length)c=e.charCodeAt(h);else{if(n(c))break;c=O}if(n(c)){if(o===h-1||1===a);else if(2===a){if(i.length<2||2!==s||i.charCodeAt(i.length-1)!==L||i.charCodeAt(i.length-2)!==L){if(i.length>2){const e=i.lastIndexOf(r);-1===e?(i="",s=0):(i=i.slice(0,e),s=i.length-1-i.lastIndexOf(r)),o=h,a=0;continue}if(0!==i.length){i="",s=0,o=h,a=0;continue}}t&&(i+=i.length>0?r+"..":"..",s=2)}else i.length>0?i+=`${r}${e.slice(o+1,h)}`:i=e.slice(o+1,h),s=h-o-1;o=h,a=0}else c===L&&-1!==a?++a:a=-1}return i}function G(e,t){if(null===t||"object"!=typeof t)throw new x("pathObject","Object",t);const r=t.dir||t.root,n=t.base||`${t.name||""}${t.ext||""}`;return r?r===t.root?`${r}${n}`:`${r}${e}${n}`:n}const V={resolve(...e){let t="",r="",n=!1;for(let i=e.length-1;i>=-1;i--){let s;if(i>=0){if(s=e[i],U(s,"path"),0===s.length)continue}else 0===t.length?s=S():(s=P["="+t]||S(),(void 0===s||s.slice(0,2).toLowerCase()!==t.toLowerCase()&&s.charCodeAt(2)===N)&&(s=t+"\\"));const o=s.length;let a=0,c="",h=!1;const l=s.charCodeAt(0);if(1===o)F(l)&&(a=1,h=!0);else if(F(l))if(h=!0,F(s.charCodeAt(1))){let e=2,t=e;for(;e<o&&!F(s.charCodeAt(e));)e++;if(e<o&&e!==t){const r=s.slice(t,e);for(t=e;e<o&&F(s.charCodeAt(e));)e++;if(e<o&&e!==t){for(t=e;e<o&&!F(s.charCodeAt(e));)e++;e!==o&&e===t||(c=`\\\\${r}\\${s.slice(t,e)}`,a=e)}}}else a=1;else D(l)&&s.charCodeAt(1)===T&&(c=s.slice(0,2),a=2,o>2&&F(s.charCodeAt(2))&&(h=!0,a=3));if(c.length>0)if(t.length>0){if(c.toLowerCase()!==t.toLowerCase())continue}else t=c;if(n){if(t.length>0)break}else if(r=`${s.slice(a)}\\${r}`,n=h,h&&t.length>0)break}return r=M(r,!n,"\\",F),n?`${t}\\${r}`:`${t}${r}`||"."},normalize(e){U(e,"path");const t=e.length;if(0===t)return".";let r,n=0,i=!1;const s=e.charCodeAt(0);if(1===t)return j(s)?"\\":e;if(F(s))if(i=!0,F(e.charCodeAt(1))){let i=2,s=i;for(;i<t&&!F(e.charCodeAt(i));)i++;if(i<t&&i!==s){const o=e.slice(s,i);for(s=i;i<t&&F(e.charCodeAt(i));)i++;if(i<t&&i!==s){for(s=i;i<t&&!F(e.charCodeAt(i));)i++;if(i===t)return`\\\\${o}\\${e.slice(s)}\\`;i!==s&&(r=`\\\\${o}\\${e.slice(s,i)}`,n=i)}}}else n=1;else D(s)&&e.charCodeAt(1)===T&&(r=e.slice(0,2),n=2,t>2&&F(e.charCodeAt(2))&&(i=!0,n=3));let o=n<t?M(e.slice(n),!i,"\\",F):"";return 0!==o.length||i||(o="."),o.length>0&&F(e.charCodeAt(t-1))&&(o+="\\"),void 0===r?i?"\\"+o:o:i?`${r}\\${o}`:`${r}${o}`},isAbsolute(e){U(e,"path");const t=e.length;if(0===t)return!1;const r=e.charCodeAt(0);return F(r)||t>2&&D(r)&&e.charCodeAt(1)===T&&F(e.charCodeAt(2))},join(...e){if(0===e.length)return".";let t,r;for(let n=0;n<e.length;++n){const i=e[n];U(i,"path"),i.length>0&&(void 0===t?t=r=i:t+="\\"+i)}if(void 0===t)return".";let n=!0,i=0;if("string"==typeof r&&F(r.charCodeAt(0))){++i;const e=r.length;e>1&&F(r.charCodeAt(1))&&(++i,e>2&&(F(r.charCodeAt(2))?++i:n=!1))}if(n){for(;i<t.length&&F(t.charCodeAt(i));)i++;i>=2&&(t="\\"+t.slice(i))}return V.normalize(t)},relative(e,t){if(U(e,"from"),U(t,"to"),e===t)return"";const r=V.resolve(e),n=V.resolve(t);if(r===n)return"";if((e=r.toLowerCase())===(t=n.toLowerCase()))return"";let i=0;for(;i<e.length&&e.charCodeAt(i)===N;)i++;let s=e.length;for(;s-1>i&&e.charCodeAt(s-1)===N;)s--;const o=s-i;let a=0;for(;a<t.length&&t.charCodeAt(a)===N;)a++;let c=t.length;for(;c-1>a&&t.charCodeAt(c-1)===N;)c--;const h=c-a,l=o<h?o:h;let u=-1,f=0;for(;f<l;f++){const r=e.charCodeAt(i+f);if(r!==t.charCodeAt(a+f))break;r===N&&(u=f)}if(f!==l){if(-1===u)return n}else{if(h>l){if(t.charCodeAt(a+f)===N)return n.slice(a+f+1);if(2===f)return n.slice(a+f)}o>l&&(e.charCodeAt(i+f)===N?u=f:2===f&&(u=3)),-1===u&&(u=0)}let d="";for(f=i+u+1;f<=s;++f)f!==s&&e.charCodeAt(f)!==N||(d+=0===d.length?"..":"\\..");return a+=u,d.length>0?`${d}${n.slice(a,c)}`:(n.charCodeAt(a)===N&&++a,n.slice(a,c))},toNamespacedPath(e){if("string"!=typeof e)return e;if(0===e.length)return"";const t=V.resolve(e);if(t.length<=2)return e;if(t.charCodeAt(0)===N){if(t.charCodeAt(1)===N){const e=t.charCodeAt(2);if(63!==e&&e!==L)return"\\\\?\\UNC\\"+t.slice(2)}}else if(D(t.charCodeAt(0))&&t.charCodeAt(1)===T&&t.charCodeAt(2)===N)return"\\\\?\\"+t;return e},dirname(e){U(e,"path");const t=e.length;if(0===t)return".";let r=-1,n=0;const i=e.charCodeAt(0);if(1===t)return F(i)?e:".";if(F(i)){if(r=n=1,F(e.charCodeAt(1))){let i=2,s=i;for(;i<t&&!F(e.charCodeAt(i));)i++;if(i<t&&i!==s){for(s=i;i<t&&F(e.charCodeAt(i));)i++;if(i<t&&i!==s){for(s=i;i<t&&!F(e.charCodeAt(i));)i++;if(i===t)return e;i!==s&&(r=n=i+1)}}}}else D(i)&&e.charCodeAt(1)===T&&(r=t>2&&F(e.charCodeAt(2))?3:2,n=r);let s=-1,o=!0;for(let r=t-1;r>=n;--r)if(F(e.charCodeAt(r))){if(!o){s=r;break}}else o=!1;if(-1===s){if(-1===r)return".";s=r}return e.slice(0,s)},basename(e,t){void 0!==t&&U(t,"ext"),U(e,"path");let r,n=0,i=-1,s=!0;if(e.length>=2&&D(e.charCodeAt(0))&&e.charCodeAt(1)===T&&(n=2),void 0!==t&&t.length>0&&t.length<=e.length){if(t===e)return"";let o=t.length-1,a=-1;for(r=e.length-1;r>=n;--r){const c=e.charCodeAt(r);if(F(c)){if(!s){n=r+1;break}}else-1===a&&(s=!1,a=r+1),o>=0&&(c===t.charCodeAt(o)?-1==--o&&(i=r):(o=-1,i=a))}return n===i?i=a:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=n;--r)if(F(e.charCodeAt(r))){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname(e){U(e,"path");let t=0,r=-1,n=0,i=-1,s=!0,o=0;e.length>=2&&e.charCodeAt(1)===T&&D(e.charCodeAt(0))&&(t=n=2);for(let a=e.length-1;a>=t;--a){const t=e.charCodeAt(a);if(F(t)){if(!s){n=a+1;break}}else-1===i&&(s=!1,i=a+1),t===L?-1===r?r=a:1!==o&&(o=1):-1!==r&&(o=-1)}return-1===r||-1===i||0===o||1===o&&r===i-1&&r===n+1?"":e.slice(r,i)},format:G.bind(null,"\\"),parse(e){U(e,"path");const t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;const r=e.length;let n=0,i=e.charCodeAt(0);if(1===r)return F(i)?(t.root=t.dir=e,t):(t.base=t.name=e,t);if(F(i)){if(n=1,F(e.charCodeAt(1))){let t=2,i=t;for(;t<r&&!F(e.charCodeAt(t));)t++;if(t<r&&t!==i){for(i=t;t<r&&F(e.charCodeAt(t));)t++;if(t<r&&t!==i){for(i=t;t<r&&!F(e.charCodeAt(t));)t++;t===r?n=t:t!==i&&(n=t+1)}}}}else if(D(i)&&e.charCodeAt(1)===T){if(r<=2)return t.root=t.dir=e,t;if(n=2,F(e.charCodeAt(2))){if(3===r)return t.root=t.dir=e,t;n=3}}n>0&&(t.root=e.slice(0,n));let s=-1,o=n,a=-1,c=!0,h=e.length-1,l=0;for(;h>=n;--h)if(i=e.charCodeAt(h),F(i)){if(!c){o=h+1;break}}else-1===a&&(c=!1,a=h+1),i===L?-1===s?s=h:1!==l&&(l=1):-1!==s&&(l=-1);return-1!==a&&(-1===s||0===l||1===l&&s===a-1&&s===o+1?t.base=t.name=e.slice(o,a):(t.name=e.slice(o,s),t.base=e.slice(o,a),t.ext=e.slice(s,a))),t.dir=o>0&&o!==n?e.slice(0,o-1):t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},q={resolve(...e){let t="",r=!1;for(let n=e.length-1;n>=-1&&!r;n--){const i=n>=0?e[n]:S();U(i,"path"),0!==i.length&&(t=`${i}/${t}`,r=i.charCodeAt(0)===O)}return t=M(t,!r,"/",j),r?"/"+t:t.length>0?t:"."},normalize(e){if(U(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===O,r=e.charCodeAt(e.length-1)===O;return 0===(e=M(e,!t,"/",j)).length?t?"/":r?"./":".":(r&&(e+="/"),t?"/"+e:e)},isAbsolute:e=>(U(e,"path"),e.length>0&&e.charCodeAt(0)===O),join(...e){if(0===e.length)return".";let t;for(let r=0;r<e.length;++r){const n=e[r];U(n,"path"),n.length>0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":q.normalize(t)},relative(e,t){if(U(e,"from"),U(t,"to"),e===t)return"";if((e=q.resolve(e))===(t=q.resolve(t)))return"";const r=e.length,n=r-1,i=t.length-1,s=n<i?n:i;let o=-1,a=0;for(;a<s;a++){const r=e.charCodeAt(1+a);if(r!==t.charCodeAt(1+a))break;r===O&&(o=a)}if(a===s)if(i>s){if(t.charCodeAt(1+a)===O)return t.slice(1+a+1);if(0===a)return t.slice(1+a)}else n>s&&(e.charCodeAt(1+a)===O?o=a:0===a&&(o=0));let c="";for(a=1+o+1;a<=r;++a)a!==r&&e.charCodeAt(a)!==O||(c+=0===c.length?"..":"/..");return`${c}${t.slice(1+o)}`},toNamespacedPath:e=>e,dirname(e){if(U(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===O;let r=-1,n=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===O){if(!n){r=t;break}}else n=!1;return-1===r?t?"/":".":t&&1===r?"//":e.slice(0,r)},basename(e,t){void 0!==t&&U(t,"ext"),U(e,"path");let r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t===e)return"";let o=t.length-1,a=-1;for(r=e.length-1;r>=0;--r){const c=e.charCodeAt(r);if(c===O){if(!s){n=r+1;break}}else-1===a&&(s=!1,a=r+1),o>=0&&(c===t.charCodeAt(o)?-1==--o&&(i=r):(o=-1,i=a))}return n===i?i=a:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===O){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname(e){U(e,"path");let t=-1,r=0,n=-1,i=!0,s=0;for(let o=e.length-1;o>=0;--o){const a=e.charCodeAt(o);if(a!==O)-1===n&&(i=!1,n=o+1),a===L?-1===t?t=o:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=o+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:G.bind(null,"/"),parse(e){U(e,"path");const t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;const r=e.charCodeAt(0)===O;let n;r?(t.root="/",n=1):n=0;let i=-1,s=0,o=-1,a=!0,c=e.length-1,h=0;for(;c>=n;--c){const t=e.charCodeAt(c);if(t!==O)-1===o&&(a=!1,o=c+1),t===L?-1===i?i=c:1!==h&&(h=1):-1!==i&&(h=-1);else if(!a){s=c+1;break}}if(-1!==o){const n=0===s&&r?1:s;-1===i||0===h||1===h&&i===o-1&&i===s+1?t.base=t.name=e.slice(n,o):(t.name=e.slice(n,i),t.base=e.slice(n,o),t.ext=e.slice(i,o))}return s>0?t.dir=e.slice(0,s-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};q.win32=V.win32=V,q.posix=V.posix=q;class J{constructor(){if("undefined"!=typeof TextDecoder)this.decoder=new TextDecoder;else if("function"!=typeof Buffer||"function"!=typeof Buffer.from)throw new Error("The environment supports neither the TextDecoder nor Buffer API. Please consider polyfilling one of these.")}decode(e){const t=this.decoder?this.decoder.decode(e):Buffer.from(e).toString("utf-8");return 65279===t.charCodeAt(0)?t.slice(1):t}}class z{constructor(){this._data=new Map}get size(){return this._data.size}add(e,t){let r=this._data.get(e);return r||(r=new Set,this._data.set(e,r)),r.add(t),this}clear(){this._data.clear()}delete(e,t){const r=this._data.get(e);if(r){const n=r.delete(t);return r.size||this._data.delete(e),n}return!1}deleteAll(e){return this._data.delete(e)}get(e){return this._data.get(e)}has(e){return this._data.has(e)}hasValue(e,t){const r=this._data.get(e);return!!r&&r.has(t)}*entries(){for(const[e,t]of this._data.entries())for(const r of t)yield[e,r]}*values(){for(const e of this._data.values())yield*e.values()}}function K(e){return!("object"!=typeof e||null===e||B(e,"name")||B(e,"version")||function(e){let t="";const r=e.browser;if(r&&"object"==typeof r)for(const e in r){if("string"!=typeof e){t=`The key ${e} of .browser must be a string`;break}if("string"!=typeof r[e]&&!1!==r[e]){t=`The value ${e} of .browser must be a string or false`;break}}return t}(e)||B(e,"main")||B(e,"module")||B(e,"jsnext:main")||B(e,"unpkg")||W(e,"dependencies")||W(e,"devDependencies")||W(e,"peerDependencies"))}function X(e,t){return"string"!=typeof e[t]}function B(e,t){return void 0!==e[t]&&"string"!=typeof e[t]}function W(e,t){return void 0!==e[t]&&"object"==typeof e[t]&&null!==e[t]&&!Object.keys(e[t]).every((r=>"string"==typeof r&&"string"==typeof e[t][r]))}function H(e,t,r){try{return Q(e.decode(t),r)}catch(e){throw new Error(`Error decoding manifest buffer for package ${r}: ${e.message}`)}}function Y(e,t,r){try{return function(e,t){const r=Q(e,t);if(!function(e){return K(e)&&!X(e,"name")&&!X(e,"version")}(r))throw new Error("Invalid manifest for the package "+t);return r}(e.decode(t),r)}catch(e){throw new Error(`Error decoding manifest buffer for package ${r}: ${e.message}`)}}function Q(e,t){let r;try{r=JSON.parse(e)}catch(e){throw new Error(`Error parsing manifest as json for package ${t}: ${e.message}`)}if(!K(r))throw new Error("Invalid manifest for the package "+t);return r}const Z=47;class ee extends Error{constructor(e,t,r){let n;"string"==typeof t&&0===t.indexOf("not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";const i=-1!==e.indexOf(".")?"property":"argument";let s=`The "${e}" ${i} ${n} of type ${t}`;s+=". Received type "+typeof r,super(s),this.code="ERR_INVALID_ARG_TYPE"}}function te(e,t){if("string"!=typeof e)throw new ee(t,"string",e)}function re(e){return e===Z}function ne(e,t,r,n){let i="",s=0,o=-1,a=0,c=0;for(let h=0;h<=e.length;++h){if(h<e.length)c=e.charCodeAt(h);else{if(n(c))break;c=Z}if(n(c)){if(o===h-1||1===a);else if(2===a){if(i.length<2||2!==s||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2)){if(i.length>2){const e=i.lastIndexOf(r);-1===e?(i="",s=0):(i=i.slice(0,e),s=i.length-1-i.lastIndexOf(r)),o=h,a=0;continue}if(0!==i.length){i="",s=0,o=h,a=0;continue}}t&&(i+=i.length>0?r+"..":"..",s=2)}else i.length>0?i+=`${r}${e.slice(o+1,h)}`:i=e.slice(o+1,h),s=h-o-1;o=h,a=0}else 46===c&&-1!==a?++a:a=-1}return i}const ie={resolve(...e){let t="",r=!1;for(let n=e.length-1;n>=-1&&!r;n--){const i=n>=0?e[n]:process.cwd();te(i,"path"),0!==i.length&&(t=`${i}/${t}`,r=i.charCodeAt(0)===Z)}return t=ne(t,!r,"/",re),r?"/"+t:t.length>0?t:"."},normalize(e){if(te(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===Z,r=e.charCodeAt(e.length-1)===Z;return 0===(e=ne(e,!t,"/",re)).length?t?"/":r?"./":".":(r&&(e+="/"),t?"/"+e:e)},isAbsolute:e=>(te(e,"path"),e.length>0&&e.charCodeAt(0)===Z),join(...e){if(0===e.length)return".";let t;for(let r=0;r<e.length;++r){const n=e[r];te(n,"path"),n.length>0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":ie.normalize(t)},relative(e,t){if(te(e,"from"),te(t,"to"),e===t)return"";if((e=ie.resolve(e))===(t=ie.resolve(t)))return"";const r=e.length,n=r-1,i=t.length-1,s=n<i?n:i;let o=-1,a=0;for(;a<s;a++){const r=e.charCodeAt(1+a);if(r!==t.charCodeAt(1+a))break;r===Z&&(o=a)}if(a===s)if(i>s){if(t.charCodeAt(1+a)===Z)return t.slice(1+a+1);if(0===a)return t.slice(1+a)}else n>s&&(e.charCodeAt(1+a)===Z?o=a:0===a&&(o=0));let c="";for(a=1+o+1;a<=r;++a)a!==r&&e.charCodeAt(a)!==Z||(c+=0===c.length?"..":"/..");return`${c}${t.slice(1+o)}`},toNamespacedPath:e=>e,dirname(e){if(te(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===Z;let r=-1,n=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===Z){if(!n){r=t;break}}else n=!1;return-1===r?t?"/":".":t&&1===r?"//":e.slice(0,r)},basename(e,t){void 0!==t&&te(t,"ext"),te(e,"path");let r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t===e)return"";let o=t.length-1,a=-1;for(r=e.length-1;r>=0;--r){const c=e.charCodeAt(r);if(c===Z){if(!s){n=r+1;break}}else-1===a&&(s=!1,a=r+1),o>=0&&(c===t.charCodeAt(o)?-1==--o&&(i=r):(o=-1,i=a))}return n===i?i=a:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===Z){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname(e){te(e,"path");let t=-1,r=0,n=-1,i=!0,s=0;for(let o=e.length-1;o>=0;--o){const a=e.charCodeAt(o);if(a!==Z)-1===n&&(i=!1,n=o+1),46===a?-1===t?t=o:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=o+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e,t){if(null===t||"object"!=typeof t)throw new ee("pathObject","Object",t);const r=t.dir||t.root,n=t.base||`${t.name||""}${t.ext||""}`;return r?r===t.root?`${r}${n}`:`${r}${e}${n}`:n}.bind(null,"/"),parse(e){te(e,"path");const t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;const r=e.charCodeAt(0)===Z;let n;r?(t.root="/",n=1):n=0;let i=-1,s=0,o=-1,a=!0,c=e.length-1,h=0;for(;c>=n;--c){const t=e.charCodeAt(c);if(t!==Z)-1===o&&(a=!1,o=c+1),46===t?-1===i?i=c:1!==h&&(h=1):-1!==i&&(h=-1);else if(!a){s=c+1;break}}if(-1!==o){const n=0===s&&r?1:s;-1===i||0===h||1===h&&i===o-1&&i===s+1?t.base=t.name=e.slice(n,o):(t.name=e.slice(n,i),t.base=e.slice(n,o),t.ext=e.slice(i,o))}return s>0?t.dir=e.slice(0,s-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null},se=ie.join,oe=ie.dirname,ae=ie.basename,ce=/^\w[\w\d+.-]*$/,he=/^\//,le=/^\/\//;const ue="",fe="/",de=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class pe{constructor(e,t,r,n,i,s=!1){"object"==typeof e?(this.scheme=e.scheme||ue,this.authority=e.authority||ue,this.path=e.path||ue,this.query=e.query||ue,this.fragment=e.fragment||ue):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||ue,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==fe&&(t=fe+t):t=fe}return t}(this.scheme,r||ue),this.query=n||ue,this.fragment=i||ue,function(e,t){if(!e.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!ce.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!he.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(le.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}(this,s))}static ensureTrailingSlash(e,t="/"){return e.with({path:e.path.replace(Re,t)})}static equals(e,t){return e.authority===t.authority&&e.fragment===t.fragment&&e.path===t.path&&e.query===t.query&&e.scheme===t.scheme}static getFirstPathSegmentAfterPrefix(e,t){const r=e.path,n=t.path,i="/"===n.charAt(n.length-1)?-1:0;for(let s=0;s<=r.length;s++)if(s<n.length){if(r.charAt(s)!==n.charAt(s))throw new Error(`The child entry ${e.toString()} does not have the pathname of ${t.toString()} as a prefix`)}else if(s===n.length+i){if("/"!==r.charAt(s))throw new Error(`The child entry ${e.toString()} does not have the pathname of ${t.toString()} as a prefix`)}else if("/"===r.charAt(s))return r.slice(n.length+1+i,s);return r.slice(n.length+1+i)}static isPrefixOf(e,t,r){return e.authority===t.authority&&e.fragment===t.fragment&&e.query===t.query&&e.scheme===t.scheme&&t.path.startsWith(e.path)&&(!r||t.path.length>e.path.length)}static isUri(e){return e instanceof pe||!!e&&("string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"function"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString)}get fsPath(){return Ce(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:r,path:n,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=ue),void 0===r?r=this.authority:null===r&&(r=ue),void 0===n?n=this.path:null===n&&(n=ue),void 0===i?i=this.query:null===i&&(i=ue),void 0===s?s=this.fragment:null===s&&(s=ue),t===this.scheme&&r===this.authority&&n===this.path&&i===this.query&&s===this.fragment?this:new me(t,r,n,i,s)}static parse(e,t=!1){const r=de.exec(e);return r?new me(r[2]||ue,Ie(r[4]||ue),Ie(r[5]||ue),Ie(r[7]||ue),Ie(r[9]||ue),t):new me(ue,ue,ue,ue,ue)}static file(e){let t=ue;if(e[0]===fe&&e[1]===fe){const r=e.indexOf(fe,2);-1===r?(t=e.substring(2),e=fe):(t=e.substring(2,r),e=e.substring(r)||fe)}return new me("file",t,e,ue,ue)}static from(e){return new me(e.scheme,e.authority,e.path,e.query,e.fragment)}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPaths on URI without path");const r=se(e.path,...t);return e.with({path:r})}toString(e=!0){return $e(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof pe)return e;{const t=new me(e);return t._formatted=e.external,t._fsPath=e._sep===ge?e.fsPath:null,t}}return e}}const ge=void 0;class me extends pe{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=Ce(this,!1)),this._fsPath}toString(e=!0){return e?(this._formatted||(this._formatted=$e(this,!0)),this._formatted):$e(this,!1)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=ge),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const Ee={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function ve(e,t){let r=void 0,n=-1;for(let i=0;i<e.length;i++){const s=e.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||45===s||46===s||95===s||126===s||t&&47===s)-1!==n&&(r+=encodeURIComponent(e.substring(n,i)),n=-1),void 0!==r&&(r+=e.charAt(i));else{void 0===r&&(r=e.substr(0,i));const t=Ee[s];void 0!==t?(-1!==n&&(r+=encodeURIComponent(e.substring(n,i)),n=-1),r+=t):-1===n&&(n=i)}}return-1!==n&&(r+=encodeURIComponent(e.substring(n))),void 0!==r?r:e}function ye(e){let t=void 0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);35===n||63===n?(void 0===t&&(t=e.substr(0,r)),t+=Ee[n]):void 0!==t&&(t+=e[r])}return void 0!==t?t:e}function Ce(e,t){let r;return r=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?t?e.path.substr(1):e.path[1].toLowerCase()+e.path.substr(2):e.path,r}function $e(e,t){const r=t?ye:ve;let n="",{scheme:i,authority:s,path:o,query:a,fragment:c}=e;if(i&&(n+=i,n+=":"),(s||"file"===i)&&(n+=fe,n+=fe),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.indexOf(":"),-1===e?n+=r(t,!1):(n+=r(t.substr(0,e),!1),n+=":",n+=r(t.substr(e+1),!1)),n+="@"}s=s.toLowerCase(),e=s.indexOf(":"),-1===e?n+=r(s,!1):(n+=r(s.substr(0,e),!1),n+=s.substr(e))}if(o){if(o.length>=3&&47===o.charCodeAt(0)&&58===o.charCodeAt(2)){const e=o.charCodeAt(1);e>=65&&e<=90&&(o=`/${String.fromCharCode(e+32)}:${o.substr(3)}`)}else if(o.length>=2&&58===o.charCodeAt(1)){const e=o.charCodeAt(0);e>=65&&e<=90&&(o=`${String.fromCharCode(e+32)}:${o.substr(2)}`)}n+=r(o,!0)}return a&&(n+="?",n+=r(a,!1)),c&&(n+="#",n+=t?c:ve(c,!1)),n}function we(e){try{return decodeURIComponent(e)}catch(t){return e.length>3?e.substr(0,3)+we(e.substr(3)):e}}const Ae=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Ie(e){return e.match(Ae)?e.replace(Ae,(e=>we(e))):e}const Re=/\/?$/,be=/^((@[^/]+\/[^/@]+|[^./@][^/@]*)(?:@([^/]+))?)(.*)?$/;function _e(e){const t=e.match(be);if(t){const[,e,r,n,i=""]=t;return{nameSpec:e,name:r,spec:n,path:i}}return null}const ke=Object.assign(Object.create(null),{string_decoder:_e("string_decoder@1.2.0"),punycode:_e("punycode@2.1.1")});for(const e of["assert","buffer","constants","crypto","events","fs","http","https","net","os","path","process","querystring","stream","tls","url","util","vm","zlib"])ke[e]=_e(`@velcro/node-libs@0.56.2/lib/${e}.js`);var Se;!function(e){let t;!function(e){e.File="file",e.Directory="directory"}(t=e.EntryKind||(e.EntryKind={}))}(Se||(Se={}));const Pe=Symbol("Context.cache");class Le{constructor(e,t){this.uri=e,this.visits=[],this.parent=t}child(e){return new Le(e,this)}push(e){this.visits.find((t=>t.type==e.type&&pe.equals(t.uri,e.uri)))||(this.visits.push(e),this.parent&&this.parent.push(e))}toArray(){return this.parent?this.parent.toArray():this.visits.slice()}}class Oe{constructor(e){this.mapResultWithVisits=e=>Object.assign(e,{visited:this.visits.toArray()}),this.cache=e.cache,this.cacheInvalidations=e.cacheInvalidations,this.debugMode=e.debug,this.decoder=e.decoder,this.path=e.path,this.resolver=e.resolver,this.settings=e.settings,this.strategy=e.strategy,this.tokenSource=new R(e.token),this.visits=e.visits}static create(e,t,r,n,i={}){return new Oe({cache:new Map,cacheInvalidations:new z,debug:!!i.debug,decoder:new J,path:[],resolver:e,settings:r,strategy:t,token:n,visits:new Le(pe.parse("velcro:/root"))})}get token(){return this.tokenSource.token}get visited(){return this.visits.toArray()}dispose(){this.tokenSource.dispose(!0)}forOperation(e,t,r={}){const n=function(e,t){return`${e}:${t.toString()}`}(e,t);if(this.path.includes(n)){const r=this.path.map((e=>{const{operationName:t,uri:r}=Ne(e);return`${t}(${r.toString()})`})).join(" -> ");throw this._wrapError(new Error(`Detected a recursive call to the operation '${e}' for '${t.toString()}' at path '${r}'`))}return new Oe({cache:this.cache,cacheInvalidations:this.cacheInvalidations,debug:this.debugMode,decoder:this.decoder,path:r.resetPath?[]:this.path.concat(n),resolver:this.resolver,settings:this.settings,strategy:this.strategy,token:this.tokenSource.token,visits:r.resetVisits?new Le(t):this.visits.child(t)})}getCanonicalUrl(e){const t=this.strategy.getCanonicalUrl,r=this.strategy,n="Strategy.getCanonicalUrl",i=e.toString();return this.runInChildContext(n,e,(s=>s.runWithCache(n,i,t,r,s,e)))}getResolveRoot(e){const t=this.strategy.getResolveRoot,r=this.strategy,n="Strategy.getResolveRoot",i=e.toString();return this.runInChildContext(n,e,(s=>s.runWithCache(n,i,t,r,s,e)))}getSettings(e){const t=this.strategy.getSettings,r=this.strategy,n="Strategy.getSettings",i=e.toString();return this.runInChildContext(n,e,(s=>s.runWithCache(n,i,t,r,s,e)))}getUrlForBareModule(e,t,r){const n=this.strategy.getUrlForBareModule;if(!n)return Promise.reject(new Error(`Unable to resolve bare module spec '${e}@${t}${r}' because no strategy was found that supports resolving bare modules`));const i=this.strategy,s="Strategy.getUrlForBareModule",o=`${e}@${t}${r}`;return this.runInChildContext(s,o,(a=>a.runWithCache(s,o,n,i,a,e,t,r)))}invalidate(e){const t=e.toString(),r=this.cacheInvalidations.get(t);let n=!1;if(r)for(const{cacheKey:e,operationCache:t}of r)n=t.delete(e)||n;return this.cacheInvalidations.deleteAll(t),n}listEntries(e){const t=this.strategy.listEntries,r=this.strategy,n="Strategy.listEntries",i=e.toString();return this.runInChildContext(n,e,(s=>s.runWithCache(n,i,t,r,s,e)))}readFileContent(e){const t=this.strategy.readFileContent,r=this.strategy,n="Strategy.readFileContent",i=e.toString();return this.recordVisit(e,Oe.VisitKind.File),this.runInChildContext(n,e,(s=>s.runWithCache(n,i,t,r,s,e)))}readParentPackageJson(e){return console.debug("readParentPackageJson(%s)",e.toString()),this.runWithCache("readParentPackageJson",e.toString(),je,null,this,e)}recordVisit(e,t=Oe.VisitKind.File){this.visits.push({type:t,uri:e})}resolve(e,t){const r=xe,n="resolve",i=`${t}|${e}`;return this.runInChildContext(n,i,(s=>s.runWithCache(n,i,r,null,s,t,e)))}resolveUri(e){const t=Te,r="resolveUri",n=e.toString();return this.runInChildContext(r,e,(i=>i.runWithCache(r,n,t,null,i,e)))}runInChildContext(e,t,r){return this.runInContext(e,t,{resetPath:!1,resetVisits:!1},r)}runInIsolatedContext(e,t,r){return this.runInContext(e,t,{resetPath:!0,resetVisits:!0},r)}runInContext(e,t,r,n){const i=this.forOperation(e,t,r);return i.debug("%s(%s)",e,t.toString()),n(i)}createStoreResultFn(e,t){return r=>{const n=this.mapResultWithVisits(r),i=n.visited;if(n[Pe]){const t=n[Pe];delete n[Pe];for(const[r,n]of t){e.set(r,n);for(const t of i)this.cacheInvalidations.add(t.uri.toString(),{cacheKey:r,operationCache:e})}}e.set(t,n);for(const r of i)this.cacheInvalidations.add(r.uri.toString(),{cacheKey:t,operationCache:e});return n}}runWithCache(e,t,r,n,...i){let s=this.cache.get(e);s||(s=new Map,this.cache.set(e,s));const o=s.get(t);if(o)return this.debug("%s(%s) [HIT]",e,t),o;const a=this.createStoreResultFn(s,t);this.debug("%s(%s) [MISS]",e,t);const h=r.apply(n,i);if(c(h)){const e=h.then(a,(e=>(s.delete(t),Promise.reject(e))));return s.set(t,e),e}return a(h)}_wrapError(e){return Object.assign(e,{path:this.path.map(Ne)})}debug(...e){this.debugMode&&("string"==typeof e[0]&&(e[0]=" ".repeat(this.path.length)+e[0]),console.warn(...e))}}function Ne(e){const t=e.split(":",2);if(2!==t.length)throw console.log("WTF",{node:e,parts:t}),new Error(`Invariant violation: Unexpected path node: '${e}'`);return{operationName:t[0],uri:t[1].includes(":")?pe.parse(t[1]):t[1]}}async function Te(e,t){const r=o([e.getCanonicalUrl(t),e.getResolveRoot(t),e.getSettings(t)],e.token),[n,i,s]=c(r)?await a(r,e.token):r,h=i.uri,l=pe.ensureTrailingSlash(h,"");if(!pe.isPrefixOf(l,n.uri))throw new Error(`Unable to resolve a module whose path ${n.uri.toString(!0)} is above the host's root ${h.toString()}`);const u=o([pe.equals(l,n.uri)||pe.equals(h,n.uri)?e.runInChildContext("resolveAsDirectory",n.uri,(e=>Ue(e,pe.ensureTrailingSlash(n.uri),i.uri,s.settings))):e.runInChildContext("resolveAsFile",n.uri,(e=>Fe(e,n.uri,i.uri,s.settings,null))),De(e,n.uri,h,{uriIsCanonicalized:!0})],e.token),[f,d]=c(u)?await u:u;let p=void 0;if(d.found&&"string"==typeof d.packageJson.name&&"string"==typeof d.packageJson.version)p={packageJson:d.packageJson,uri:d.uri};else if(d.found){let t=pe.joinPath(d.uri,"..");for(;pe.isPrefixOf(h,t,!0);){const r=De(e,t,h,{uriIsCanonicalized:!1}),n=c(r)?await a(r,e.token):r;if(!n.found)break;if(n.packageJson.name&&n.packageJson.version){p={packageJson:n.packageJson,uri:n.uri};break}t=pe.joinPath(n.uri,"..")}}return{...f,parentPackageJson:p}}async function xe(e,t,r){const i=_e(r);if(i)return e.runInChildContext("resolveBareModule",t,(e=>async function(e,t,r){let i=r.name,o=r.spec,h=r.path;if(!o){const n=e.getResolveRoot(t),i=c(n)?await a(n,e.token):n;let h=t;const l=10,u=[];for(;pe.isPrefixOf(i.uri,h,!0);){if(u.length>=l)throw new Error(`Consulted a maximum of ${l} locations while trying to resolve '${Me(r)}' from '${t.toString()}', via ${e.path.join(" -> ")}: ${u.map((e=>e.toString())).join(", ")}`);const n=h;u.push(n);const f=De(e,n,i.uri,{uriIsCanonicalized:!1}),d=c(f)?await a(f,e.token):f;if(!d.found)throw new s(r.nameSpec,t);if(e.recordVisit(d.uri,Oe.VisitKind.File),d.packageJson.name===r.name){const t=pe.ensureTrailingSlash(pe.joinPath(d.uri,"../"));return e.runInChildContext("resolveAsDirectory",t,(e=>Ue(e,t,i.uri,e.settings)))}if(o={...d.packageJson.devDependencies||{},...d.packageJson.peerDependencies||{},...d.packageJson.dependencies||{}}[r.name],o)break;if(h=pe.joinPath(d.uri,".."),pe.equals(h,n)||pe.equals(h,i.uri))break}}if(!o){const e=ke[r.name];e&&(i=e.name,o=e.spec,h=e.path)}if(!o)throw new s(r.nameSpec,t);const l=e.getUrlForBareModule(i,o,h),u=c(l)?await a(l,e.token):l;if(!u.found)throw new s(r.nameSpec,t);if(!u.uri)throw new n(r.nameSpec);const f=e.resolveUri(u.uri);return c(f)?await a(f,e.token):f}(e,t,i)));const o=pe.joinPath(pe.from({...t,path:oe(t.path)}),r);return e.runInChildContext("resolveUri",o,(e=>Te(e,o)))}async function Ue(e,t,r,n){e.recordVisit(t,Oe.VisitKind.Directory);const i=e.listEntries(t),s=c(i)?await a(i,e.token):i;let o="index";const h=pe.joinPath(t,"./package.json");e.recordVisit(h,Oe.VisitKind.File);const l=s.entries.find((e=>e.type===Se.EntryKind.File&&pe.equals(h,e.uri)));let u=null;if(l){const r=e.readFileContent(h),i=c(r)?await a(r,e.token):r;u=H(e.decoder,i.content,t.toString());for(const e of n.packageMain){const t=u[e];if("string"==typeof t){o=t;break}}}const f=pe.joinPath(t,o);return e.runInChildContext("resolveAsFile",t,(e=>Fe(e,f,r,n,u)))}async function Fe(e,t,r,n,s,o=!1){if(""===t.path||"/"===t.path)throw new TypeError("Unable to resolve the root as a file: "+t.toString());e.recordVisit(t,Oe.VisitKind.File);const h=new Map;if(null===s){const i=n.packageMain.includes("browser")&&!o?await a(e.runInChildContext("readParentPackageJsonInternal",t,(e=>De(e,t,r,{uriIsCanonicalized:!0}))),e.token):void 0;if(i&&i.found&&(e.recordVisit(i.uri,Oe.VisitKind.File),s=i.packageJson,i.packageJson.browser&&"object"==typeof i.packageJson.browser)){const o=i.packageJson.browser,a=pe.joinPath(i.uri,"..");for(const i in o){const c=pe.joinPath(a,i),l=o[i],u=!1!==l&&pe.joinPath(a,l);if(pe.equals(c,t))return!1===u?{found:!1,uri:null}:e.runInChildContext("resolveAsFile",u,(e=>Fe(e,u,r,n,s,!0)));h.set(c.toString(),u)}}}const l=pe.ensureTrailingSlash(pe.joinPath(t,"..")),u=ae(t.path),f=e.listEntries(l),d=c(f)?await a(f,e.token):f,p=new Map,g=new Map;for(const e of d.entries){if(pe.equals(e.uri,t)&&e.type==Se.EntryKind.File)return{found:!0,rootUri:r,uri:t};if(e.type===Se.EntryKind.Directory){const t=pe.getFirstPathSegmentAfterPrefix(e.uri,l);p.set(t,e)}else if(e.type===Se.EntryKind.File){const t=ae(e.uri.path);g.set(t,e)}}for(const i of n.extensions){const o=t.with({path:`${t.path}${i}`}),a=o.toString(),c=h.get(a);if(e.recordVisit(o,Oe.VisitKind.File),!1===c)return{found:!0,rootUri:r,uri:null};if(c)return e.runInChildContext("resolveAsFile",c,(e=>Fe(e,c,r,n,s,!0)));const l=g.get(`${u}${i}`);if(l){if(l.type!==Se.EntryKind.File)continue;return{found:!0,rootUri:r,uri:l.uri}}}const m=p.get(u);if(m){if(m.type!==Se.EntryKind.Directory)throw new Error(`Invariant violation ${m.type} is unexpected`);return e.runInChildContext("resolveAsDirectory",m.uri,(e=>Ue(e,pe.ensureTrailingSlash(m.uri),r,n)))}throw new i(t)}async function je(e,t){const r=o([e.getCanonicalUrl(t),e.getResolveRoot(t)],e.token),[n,i]=c(r)?await a(r,e.token):r,s=e.runInChildContext("readParentPackageJsonInternal",n.uri,(e=>De(e,n.uri,i.uri,{uriIsCanonicalized:!0}))),h=c(s)?await s:s;if(h.found&&h.visitedDirs){const e=h.visitedDirs;delete h.visitedDirs,h[Pe]=e.map((e=>[e.toString(),{...h,uri:e}]))}return h}async function De(e,t,n,i){if(!i.uriIsCanonicalized){const r=e.getCanonicalUrl(t);t=(c(r)?await a(r,e.token):r).uri}const s=pe.ensureTrailingSlash(n),o=pe.ensureTrailingSlash(pe.joinPath(t,"..")),h=[],l=async(e,t)=>{if(!pe.isPrefixOf(s,t))return{found:!1,packageJson:null,uri:null};e.recordVisit(t,Oe.VisitKind.Directory);const n=e.listEntries(t),i=c(n)?await a(n,e.token):n,o=pe.joinPath(t,"package.json"),u=i.entries.find((e=>e.type===Se.EntryKind.File&&pe.equals(e.uri,o)));if(e.recordVisit(o,Oe.VisitKind.File),u)try{const t=e.readFileContent(o),r=c(t)?await a(t,e.token):t;return{found:!0,packageJson:H(e.decoder,r.content,o.toString()),uri:o,visitedDirs:h}}catch(e){if(e instanceof r||e&&"CanceledError"===e.name)throw e}const f=pe.ensureTrailingSlash(pe.joinPath(t,".."));return pe.equals(t,f)||pe.isPrefixOf(t,f)?{found:!1,packageJson:null,uri:null}:(h.push(t),e.runInChildContext("readPackageJsonOrRecurse",f,(e=>l(e,f))))};return pe.equals(t,o)||pe.isPrefixOf(t,o)?{found:!1,packageJson:null,uri:null}:e.runInChildContext("readPackageJsonOrRecurse",o,(e=>l(e,o)))}function Me(e){return`${e.nameSpec}${e.path}`}!function(e){let t;!function(e){e.Directory="Directory",e.File="File"}(t=e.VisitKind||(e.VisitKind={}))}(Oe||(Oe={}));var Ge={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16};var Ve,qe,Je="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},ze=(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r}=Ge,n=(t=e.exports={}).re=[],i=t.src=[],s=t.t={};let o=0;const a=(e,t,r)=>{const a=o++;Je(a,t),s[e]=a,i[a]=t,n[a]=new RegExp(t,r?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION",`(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})`),a("MAINVERSIONLOOSE",`(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})`),a("PRERELEASEIDENTIFIER",`(?:${i[s.NUMERICIDENTIFIER]}|${i[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASEIDENTIFIERLOOSE",`(?:${i[s.NUMERICIDENTIFIERLOOSE]}|${i[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASE",`(?:-(${i[s.PRERELEASEIDENTIFIER]}(?:\\.${i[s.PRERELEASEIDENTIFIER]})*))`),a("PRERELEASELOOSE",`(?:-?(${i[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[s.PRERELEASEIDENTIFIERLOOSE]})*))`),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD",`(?:\\+(${i[s.BUILDIDENTIFIER]}(?:\\.${i[s.BUILDIDENTIFIER]})*))`),a("FULLPLAIN",`v?${i[s.MAINVERSION]}${i[s.PRERELEASE]}?${i[s.BUILD]}?`),a("FULL",`^${i[s.FULLPLAIN]}$`),a("LOOSEPLAIN",`[v=\\s]*${i[s.MAINVERSIONLOOSE]}${i[s.PRERELEASELOOSE]}?${i[s.BUILD]}?`),a("LOOSE",`^${i[s.LOOSEPLAIN]}$`),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE",i[s.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),a("XRANGEIDENTIFIER",i[s.NUMERICIDENTIFIER]+"|x|X|\\*"),a("XRANGEPLAIN",`[v=\\s]*(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:${i[s.PRERELEASE]})?${i[s.BUILD]}?)?)?`),a("XRANGEPLAINLOOSE",`[v=\\s]*(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:${i[s.PRERELEASELOOSE]})?${i[s.BUILD]}?)?)?`),a("XRANGE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAIN]}$`),a("XRANGELOOSE",`^${i[s.GTLT]}\\s*${i[s.XRANGEPLAINLOOSE]}$`),a("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),a("COERCERTL",i[s.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM",`(\\s*)${i[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",a("TILDE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAIN]}$`),a("TILDELOOSE",`^${i[s.LONETILDE]}${i[s.XRANGEPLAINLOOSE]}$`),a("LONECARET","(?:\\^)"),a("CARETTRIM",`(\\s*)${i[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",a("CARET",`^${i[s.LONECARET]}${i[s.XRANGEPLAIN]}$`),a("CARETLOOSE",`^${i[s.LONECARET]}${i[s.XRANGEPLAINLOOSE]}$`),a("COMPARATORLOOSE",`^${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]})$|^$`),a("COMPARATOR",`^${i[s.GTLT]}\\s*(${i[s.FULLPLAIN]})$|^$`),a("COMPARATORTRIM",`(\\s*)${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]}|${i[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE",`^\\s*(${i[s.XRANGEPLAIN]})\\s+-\\s+(${i[s.XRANGEPLAIN]})\\s*$`),a("HYPHENRANGELOOSE",`^\\s*(${i[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[s.XRANGEPLAINLOOSE]})\\s*$`),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}(qe={path:Ve,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&qe.path)}},qe.exports),qe.exports);const Ke=/^[0-9]+$/,Xe=(e,t)=>{const r=Ke.test(e),n=Ke.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1};var Be={compareIdentifiers:Xe,rcompareIdent