@localazy/cdn-client 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LocalazyCDN={},t.axios)}(this,(function(t,e){"use strict";var r=Object.defineProperty,n=(t,e,n)=>(((t,e,n)=>{e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class a{constructor(t){n(this,"context"),this.context=t}async fetchLocale(t){const e={reference:t};if(this.context.cache.has(t))return new Promise((r=>{r({data:this.context.cache.get(t),config:e})}));const r=/\.(json|json5)$/.test(t.metafileFile.file)?"json":"text";return this.context.client.get(t.metafileLocale.uri,{...e,responseType:r})}async fetchMetafile(t){return this.context.client.get(this.context.metafile.params.jsonPath,t)}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var s="object"==typeof i&&i&&i.Object===Object&&i,c=s,u="object"==typeof self&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),f=l.Symbol,h=f,p=Object.prototype,v=p.hasOwnProperty,d=p.toString,b=h?h.toStringTag:void 0;var y=function(t){var e=v.call(t,b),r=t[b];try{t[b]=void 0;var n=!0}catch(t){}var a=d.call(t);return n&&(e?t[b]=r:delete t[b]),a},g=Object.prototype.toString;var m=y,j=function(t){return g.call(t)},w=f?f.toStringTag:void 0;var _=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?m(t):j(t)};var x=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},O=_,F=x;var A=function(t){if(!F(t))return!1;var e=O(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const L=o(A);var M,S=l["__core-js_shared__"],R=(M=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"";var E=function(t){return!!R&&R in t},I=Function.prototype.toString;var U=function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""},P=A,q=E,z=x,$=U,C=/^\[object .+?Constructor\]$/,T=Function.prototype,B=Object.prototype,k=T.toString,D=B.hasOwnProperty,N=RegExp("^"+k.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(t){return!(!z(t)||q(t))&&(P(t)?N:C).test($(t))},W=function(t,e){return null==t?void 0:t[e]};var G=function(t,e){var r=W(t,e);return V(r)?r:void 0},H=G(Object,"create"),J=H;var K=function(){this.__data__=J?J(null):{},this.size=0};var Q=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},X=H,Y=Object.prototype.hasOwnProperty;var Z=function(t){var e=this.__data__;if(X){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Y.call(e,t)?e[t]:void 0},tt=H,et=Object.prototype.hasOwnProperty;var rt=H;var nt=K,at=Q,it=Z,ot=function(t){var e=this.__data__;return tt?void 0!==e[t]:et.call(e,t)},st=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=rt&&void 0===e?"__lodash_hash_undefined__":e,this};function ct(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ct.prototype.clear=nt,ct.prototype.delete=at,ct.prototype.get=it,ct.prototype.has=ot,ct.prototype.set=st;var ut=ct;var lt=function(){this.__data__=[],this.size=0};var ft=function(t,e){return t===e||t!=t&&e!=e},ht=ft;var pt=function(t,e){for(var r=t.length;r--;)if(ht(t[r][0],e))return r;return-1},vt=pt,dt=Array.prototype.splice;var bt=pt;var yt=pt;var gt=pt;var mt=lt,jt=function(t){var e=this.__data__,r=vt(e,t);return!(r<0)&&(r==e.length-1?e.pop():dt.call(e,r,1),--this.size,!0)},wt=function(t){var e=this.__data__,r=bt(e,t);return r<0?void 0:e[r][1]},_t=function(t){return yt(this.__data__,t)>-1},xt=function(t,e){var r=this.__data__,n=gt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ot.prototype.clear=mt,Ot.prototype.delete=jt,Ot.prototype.get=wt,Ot.prototype.has=_t,Ot.prototype.set=xt;var Ft=Ot,At=G(l,"Map"),Lt=ut,Mt=Ft,St=At;var Rt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Et=function(t,e){var r=t.__data__;return Rt(e)?r["string"==typeof e?"string":"hash"]:r.map},It=Et;var Ut=Et;var Pt=Et;var qt=Et;var zt=function(){this.size=0,this.__data__={hash:new Lt,map:new(St||Mt),string:new Lt}},$t=function(t){var e=It(this,t).delete(t);return this.size-=e?1:0,e},Ct=function(t){return Ut(this,t).get(t)},Tt=function(t){return Pt(this,t).has(t)},Bt=function(t,e){var r=qt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function kt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}kt.prototype.clear=zt,kt.prototype.delete=$t,kt.prototype.get=Ct,kt.prototype.has=Tt,kt.prototype.set=Bt;var Dt=kt;var Nt=Dt,Vt=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Wt=function(t){return this.__data__.has(t)};function Gt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Nt;++e<r;)this.add(t[e])}Gt.prototype.add=Gt.prototype.push=Vt,Gt.prototype.has=Wt;var Ht=Gt;var Jt=function(t,e,r,n){for(var a=t.length,i=r+(n?1:-1);n?i--:++i<a;)if(e(t[i],i,t))return i;return-1};var Kt=Jt,Qt=function(t){return t!=t},Xt=function(t,e,r){for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1};var Yt=function(t,e,r){return e==e?Xt(t,e,r):Kt(t,Qt,r)};var Zt=function(t,e){return!!(null==t?0:t.length)&&Yt(t,e,0)>-1};var te=function(t,e,r){for(var n=-1,a=null==t?0:t.length;++n<a;)if(r(e,t[n]))return!0;return!1};var ee=function(t,e){return t.has(e)},re=G(l,"Set");var ne=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ae=re,ie=function(){},oe=ae&&1/ne(new ae([,-0]))[1]==1/0?function(t){return new ae(t)}:ie,se=Ht,ce=Zt,ue=te,le=ee,fe=oe,he=ne;var pe=function(t,e,r){var n=-1,a=ce,i=t.length,o=!0,s=[],c=s;if(r)o=!1,a=ue;else if(i>=200){var u=e?null:fe(t);if(u)return he(u);o=!1,a=le,c=new se}else c=e?[]:s;t:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||0!==l?l:0,o&&f==f){for(var h=c.length;h--;)if(c[h]===f)continue t;e&&c.push(f),s.push(l)}else a(c,f,r)||(c!==s&&c.push(f),s.push(l))}return s},ve=pe;const de=o((function(t){return t&&t.length?ve(t):[]}));class be{constructor(){n(this,"map"),this.map=new Map}get(t){return this.map.get(t)}has(t){return this.map.has(t)}set(t,e){this.map.set(t,e)}flush(){this.map=new Map}}class ye{constructor(t){n(this,"context"),n(this,"cacheAdapter"),this.context=t,this.cacheAdapter=new be}setIfMissed(t){const{metafileFile:e,metafileLocale:r,data:n}=t,a=this.keyFromMetafile({metafileFile:e,metafileLocale:r});this.cacheAdapter.has(a)||this.cacheAdapter.set(a,n)}has(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.has(e)}get(t){const e=this.keyFromMetafile(t);return this.cacheAdapter.get(e)}flush(){this.cacheAdapter.flush()}keyFromMetafile(t){const{metafileFile:e,metafileLocale:r}=t,n=[...de(e.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,e.id,e.file,e.path,e.library,e.module,e.buildType,n,r.locale,r.timestamp.toString()].filter((t=>""!==t)).join("-")}}var ge=Array.isArray;const me=o(ge);var je=function(t){return null!=t&&"object"==typeof t},we=_,_e=ge,xe=je;const Oe=o((function(t){return"string"==typeof t||!_e(t)&&xe(t)&&"[object String]"==we(t)}));class Fe{constructor(t){n(this,"context"),this.context=t}}class Ae extends Fe{constructor(){super(...arguments),n(this,"flush",(()=>{this.context.cache.flush()}))}}var Le=Ft;var Me=Ft,Se=At,Re=Dt;var Ee=Ft,Ie=function(){this.__data__=new Le,this.size=0},Ue=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Pe=function(t){return this.__data__.get(t)},qe=function(t){return this.__data__.has(t)},ze=function(t,e){var r=this.__data__;if(r instanceof Me){var n=r.__data__;if(!Se||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Re(n)}return r.set(t,e),this.size=r.size,this};function $e(t){var e=this.__data__=new Ee(t);this.size=e.size}$e.prototype.clear=Ie,$e.prototype.delete=Ue,$e.prototype.get=Pe,$e.prototype.has=qe,$e.prototype.set=ze;var Ce=$e;var Te=Ht,Be=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},ke=ee;var De=function(t,e,r,n,a,i){var o=1&r,s=t.length,c=e.length;if(s!=c&&!(o&&c>s))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var f=-1,h=!0,p=2&r?new Te:void 0;for(i.set(t,e),i.set(e,t);++f<s;){var v=t[f],d=e[f];if(n)var b=o?n(d,v,f,e,t,i):n(v,d,f,t,e,i);if(void 0!==b){if(b)continue;h=!1;break}if(p){if(!Be(e,(function(t,e){if(!ke(p,e)&&(v===t||a(v,t,r,n,i)))return p.push(e)}))){h=!1;break}}else if(v!==d&&!a(v,d,r,n,i)){h=!1;break}}return i.delete(t),i.delete(e),h},Ne=l.Uint8Array;var Ve=Ne,We=ft,Ge=De,He=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r},Je=ne,Ke=f?f.prototype:void 0,Qe=Ke?Ke.valueOf:void 0;var Xe=function(t,e,r,n,a,i,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Ve(t),new Ve(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return We(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=He;case"[object Set]":var c=1&n;if(s||(s=Je),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;n|=2,o.set(t,e);var l=Ge(s(t),s(e),n,a,i,o);return o.delete(t),l;case"[object Symbol]":if(Qe)return Qe.call(t)==Qe.call(e)}return!1};var Ye=function(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t},Ze=Ye,tr=ge;var er=function(t,e,r){var n=e(t);return tr(t)?n:Ze(n,r(t))};var rr=function(t,e){for(var r=-1,n=null==t?0:t.length,a=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[a++]=o)}return i};var nr=function(){return[]},ar=rr,ir=nr,or=Object.prototype.propertyIsEnumerable,sr=Object.getOwnPropertySymbols,cr=sr?function(t){return null==t?[]:(t=Object(t),ar(sr(t),(function(e){return or.call(t,e)})))}:ir;var ur=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},lr=_,fr=je;var hr,pr,vr,dr,br,yr,gr,mr,jr=function(t){return fr(t)&&"[object Arguments]"==lr(t)},wr=je,_r=Object.prototype,xr=_r.hasOwnProperty,Or=_r.propertyIsEnumerable,Fr=jr(function(){return arguments}())?jr:function(t){return wr(t)&&xr.call(t,"callee")&&!Or.call(t,"callee")},Ar=Fr,Lr={exports:{}};hr=Lr,vr=l,dr=function(){return!1},br=(pr=Lr.exports)&&!pr.nodeType&&pr,yr=br&&hr&&!hr.nodeType&&hr,gr=yr&&yr.exports===br?vr.Buffer:void 0,mr=(gr?gr.isBuffer:void 0)||dr,hr.exports=mr;var Mr=Lr.exports,Sr=/^(?:0|[1-9]\d*)$/;var Rr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Sr.test(t))&&t>-1&&t%1==0&&t<e};var Er=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Ir=_,Ur=Er,Pr=je,qr={};qr["[object Float32Array]"]=qr["[object Float64Array]"]=qr["[object Int8Array]"]=qr["[object Int16Array]"]=qr["[object Int32Array]"]=qr["[object Uint8Array]"]=qr["[object Uint8ClampedArray]"]=qr["[object Uint16Array]"]=qr["[object Uint32Array]"]=!0,qr["[object Arguments]"]=qr["[object Array]"]=qr["[object ArrayBuffer]"]=qr["[object Boolean]"]=qr["[object DataView]"]=qr["[object Date]"]=qr["[object Error]"]=qr["[object Function]"]=qr["[object Map]"]=qr["[object Number]"]=qr["[object Object]"]=qr["[object RegExp]"]=qr["[object Set]"]=qr["[object String]"]=qr["[object WeakMap]"]=!1;var zr=function(t){return Pr(t)&&Ur(t.length)&&!!qr[Ir(t)]};var $r=function(t){return function(e){return t(e)}},Cr={exports:{}};!function(t,e){var r=s,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,i=a&&a.exports===n&&r.process,o=function(){try{var t=a&&a.require&&a.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o}(Cr,Cr.exports);var Tr=Cr.exports,Br=zr,kr=$r,Dr=Tr&&Tr.isTypedArray,Nr=Dr?kr(Dr):Br,Vr=ur,Wr=Ar,Gr=ge,Hr=Mr,Jr=Rr,Kr=Nr,Qr=Object.prototype.hasOwnProperty;var Xr=function(t,e){var r=Gr(t),n=!r&&Wr(t),a=!r&&!n&&Hr(t),i=!r&&!n&&!a&&Kr(t),o=r||n||a||i,s=o?Vr(t.length,String):[],c=s.length;for(var u in t)!e&&!Qr.call(t,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Jr(u,c))||s.push(u);return s},Yr=Object.prototype;var Zr=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Yr)};var tn=function(t,e){return function(r){return t(e(r))}},en=tn(Object.keys,Object),rn=Zr,nn=en,an=Object.prototype.hasOwnProperty;var on=A,sn=Er;var cn=function(t){return null!=t&&sn(t.length)&&!on(t)},un=Xr,ln=function(t){if(!rn(t))return nn(t);var e=[];for(var r in Object(t))an.call(t,r)&&"constructor"!=r&&e.push(r);return e},fn=cn;var hn=function(t){return fn(t)?un(t):ln(t)},pn=er,vn=cr,dn=hn;var bn=function(t){return pn(t,dn,vn)},yn=bn,gn=Object.prototype.hasOwnProperty;var mn=function(t,e,r,n,a,i){var o=1&r,s=yn(t),c=s.length;if(c!=yn(e).length&&!o)return!1;for(var u=c;u--;){var l=s[u];if(!(o?l in e:gn.call(e,l)))return!1}var f=i.get(t),h=i.get(e);if(f&&h)return f==e&&h==t;var p=!0;i.set(t,e),i.set(e,t);for(var v=o;++u<c;){var d=t[l=s[u]],b=e[l];if(n)var y=o?n(b,d,l,e,t,i):n(d,b,l,t,e,i);if(!(void 0===y?d===b||a(d,b,r,n,i):y)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var g=t.constructor,m=e.constructor;g==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(p=!1)}return i.delete(t),i.delete(e),p},jn=G(l,"DataView"),wn=At,_n=G(l,"Promise"),xn=re,On=G(l,"WeakMap"),Fn=_,An=U,Ln="[object Map]",Mn="[object Promise]",Sn="[object Set]",Rn="[object WeakMap]",En="[object DataView]",In=An(jn),Un=An(wn),Pn=An(_n),qn=An(xn),zn=An(On),$n=Fn;(jn&&$n(new jn(new ArrayBuffer(1)))!=En||wn&&$n(new wn)!=Ln||_n&&$n(_n.resolve())!=Mn||xn&&$n(new xn)!=Sn||On&&$n(new On)!=Rn)&&($n=function(t){var e=Fn(t),r="[object Object]"==e?t.constructor:void 0,n=r?An(r):"";if(n)switch(n){case In:return En;case Un:return Ln;case Pn:return Mn;case qn:return Sn;case zn:return Rn}return e});var Cn=$n,Tn=Ce,Bn=De,kn=Xe,Dn=mn,Nn=Cn,Vn=ge,Wn=Mr,Gn=Nr,Hn="[object Arguments]",Jn="[object Array]",Kn="[object Object]",Qn=Object.prototype.hasOwnProperty;var Xn=function(t,e,r,n,a,i){var o=Vn(t),s=Vn(e),c=o?Jn:Nn(t),u=s?Jn:Nn(e),l=(c=c==Hn?Kn:c)==Kn,f=(u=u==Hn?Kn:u)==Kn,h=c==u;if(h&&Wn(t)){if(!Wn(e))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new Tn),o||Gn(t)?Bn(t,e,r,n,a,i):kn(t,e,c,r,n,a,i);if(!(1&r)){var p=l&&Qn.call(t,"__wrapped__"),v=f&&Qn.call(e,"__wrapped__");if(p||v){var d=p?t.value():t,b=v?e.value():e;return i||(i=new Tn),a(d,b,r,n,i)}}return!!h&&(i||(i=new Tn),Dn(t,e,r,n,a,i))},Yn=je;var Zn=function t(e,r,n,a,i){return e===r||(null==e||null==r||!Yn(e)&&!Yn(r)?e!=e&&r!=r:Xn(e,r,n,a,t,i))},ta=Ce,ea=Zn;var ra=x;var na=function(t){return t==t&&!ra(t)},aa=na,ia=hn;var oa=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}},sa=function(t,e,r,n){var a=r.length,i=a,o=!n;if(null==t)return!i;for(t=Object(t);a--;){var s=r[a];if(o&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<i;){var c=(s=r[a])[0],u=t[c],l=s[1];if(o&&s[2]){if(void 0===u&&!(c in t))return!1}else{var f=new ta;if(n)var h=n(u,l,c,t,e,f);if(!(void 0===h?ea(l,u,3,n,f):h))return!1}}return!0},ca=function(t){for(var e=ia(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,aa(a)]}return e},ua=oa;var la=function(t){var e=ca(t);return 1==e.length&&e[0][2]?ua(e[0][0],e[0][1]):function(r){return r===t||sa(r,t,e)}},fa=_,ha=je;var pa=function(t){return"symbol"==typeof t||ha(t)&&"[object Symbol]"==fa(t)},va=ge,da=pa,ba=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ya=/^\w*$/;var ga=function(t,e){if(va(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!da(t))||(ya.test(t)||!ba.test(t)||null!=e&&t in Object(e))},ma=Dt;function ja(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(ja.Cache||ma),r}ja.Cache=ma;var wa=ja;var _a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xa=/\\(\\)?/g,Oa=function(t){var e=wa(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(_a,(function(t,r,n,a){e.push(n?a.replace(xa,"$1"):r||t)})),e}));var Fa=function(t,e){for(var r=-1,n=null==t?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a},Aa=ge,La=pa,Ma=f?f.prototype:void 0,Sa=Ma?Ma.toString:void 0;var Ra=function t(e){if("string"==typeof e)return e;if(Aa(e))return Fa(e,t)+"";if(La(e))return Sa?Sa.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r},Ea=Ra;var Ia=ge,Ua=ga,Pa=Oa,qa=function(t){return null==t?"":Ea(t)};var za=function(t,e){return Ia(t)?t:Ua(t,e)?[t]:Pa(qa(t))},$a=pa;var Ca=function(t){if("string"==typeof t||$a(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e},Ta=za,Ba=Ca;var ka=function(t,e){for(var r=0,n=(e=Ta(e,t)).length;null!=t&&r<n;)t=t[Ba(e[r++])];return r&&r==n?t:void 0},Da=ka;var Na=za,Va=Ar,Wa=ge,Ga=Rr,Ha=Er,Ja=Ca;var Ka=function(t,e){return null!=t&&e in Object(t)},Qa=function(t,e,r){for(var n=-1,a=(e=Na(e,t)).length,i=!1;++n<a;){var o=Ja(e[n]);if(!(i=null!=t&&r(t,o)))break;t=t[o]}return i||++n!=a?i:!!(a=null==t?0:t.length)&&Ha(a)&&Ga(o,a)&&(Wa(t)||Va(t))};var Xa=Zn,Ya=function(t,e,r){var n=null==t?void 0:Da(t,e);return void 0===n?r:n},Za=function(t,e){return null!=t&&Qa(t,e,Ka)},ti=ga,ei=na,ri=oa,ni=Ca;var ai=ka;var ii=function(t){return function(e){return null==e?void 0:e[t]}},oi=function(t){return function(e){return ai(e,t)}},si=ga,ci=Ca;var ui=la,li=function(t,e){return ti(t)&&ei(e)?ri(ni(t),e):function(r){var n=Ya(r,t);return void 0===n&&n===e?Za(r,t):Xa(e,n,3)}},fi=function(t){return t},hi=ge,pi=function(t){return si(t)?ii(ci(t)):oi(t)};var vi=function(t){return"function"==typeof t?t:null==t?fi:"object"==typeof t?hi(t)?li(t[0],t[1]):ui(t):pi(t)},di=vi,bi=pe;const yi=o((function(t,e){return t&&t.length?bi(t,di(e)):[]}));class gi{constructor(t,e){n(this,"language"),n(this,"region"),n(this,"script"),n(this,"isRtl"),n(this,"name"),n(this,"localizedName"),n(this,"uri"),n(this,"timestamp"),n(this,"baseLocale"),this.language=t.language,this.region=t.region,this.script=t.script,this.isRtl=t.isRtl,this.name=t.name,this.localizedName=t.localizedName,this.uri=t.uri,this.timestamp=t.timestamp,this.baseLocale=e}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class mi{constructor(t){n(this,"id"),n(this,"file"),n(this,"path"),n(this,"library"),n(this,"module"),n(this,"buildType"),n(this,"timestamp"),n(this,"productFlavors"),n(this,"locales"),n(this,"baseUrl"),this.id=t.id,this.file=t.file,this.path=t.path,this.library=t.library,this.module=t.module,this.buildType=t.buildType,this.timestamp=t.timestamp,this.productFlavors=t.productFlavors,this.locales=t.locales,this.baseUrl=t.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((t=>({locale:t.locale,isBaseLocale:t.isBaseLocale,uri:`${this.baseUrl}${t.uri}`})))}}}class ji{constructor(t,e){n(this,"projectUrl"),n(this,"baseLocale"),n(this,"locales"),n(this,"timestamp"),n(this,"files"),n(this,"filesMap"),this.projectUrl=t.projectUrl,this.timestamp=t.timestamp,this.files=ji.filesFactory(t.files,t.baseLocale,e),this.filesMap=ji.filesMapFactory(this.files),this.locales=ji.localesFactory(this.files),this.baseLocale=this.locales.find((t=>t.isBaseLocale))}static createEmpty(t){return new ji({projectUrl:"",baseLocale:"",timestamp:0,files:{}},t)}static filesFactory(t,e,r){return Object.keys(t).reduce(((n,a)=>{const i=t[a].locales.map((t=>new gi(t,e)));return n.push(new mi({...t[a],id:a,locales:i,baseUrl:r.baseUrl})),n}),[])}static filesMapFactory(t){return t.reduce(((t,e)=>(t[e.id]=e,t)),{})}static localesFactory(t){const e=t.reduce(((t,e)=>(t.push(...e.locales.map((t=>t.toCdnLocale()))),t)),[]);return yi(e,(t=>t.locale))}}class wi{constructor(t){n(this,"options"),this.options=wi.parseMetafileUrl(t)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(t){let e;try{e=new URL(t)}catch(t){throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const r=e.pathname.match(/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/);if(null===r||4!==r.length)throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const n=r[1],a=r[2];return{url:t,baseUrl:e.origin,cdnId:n,jsonPath:`/${n}/${a}.v2.json`}}}class _i{constructor(t){n(this,"params"),n(this,"parsedData"),n(this,"data"),this.params=new wi(t.metafile),this.parsedData=null,this.data=ji.createEmpty(this.params)}setMetafile(t){this.parsedData=t,this.data=new ji(t,this.params)}}class xi{constructor(t){n(this,"context"),this.context=t}createCdnResponse(t){const{responses:e,hasSingleFileResponse:r,hasSingleLocaleResponse:n}=t;return 0===e.length?{}:(this.cacheResponses(e),r&&n?e[0].data:xi.transformResponsesToOutput(t))}cacheResponses(t){t.forEach((t=>{const{metafileFile:e,metafileLocale:r}=xi.extractReference(t);e&&r&&this.context.cache.setIfMissed({metafileFile:e,metafileLocale:r,data:t.data})}))}static transformResponsesToOutput(t){const{responses:e,hasSingleFileResponse:r}=t;return e.reduce(((t,e)=>{const{metafileFile:n,metafileLocale:a}=xi.extractReference(e);return n&&a&&(r?t[a.locale]=e.data:(t[n.id]||(t[n.id]={}),t[n.id][a.locale]=e.data)),t}),{})}static extractReference(t){var e,r;const n=null==(e=t.config.reference)?void 0:e.metafileFile,a=null==(r=t.config.reference)?void 0:r.metafileLocale,{data:i}=t;return{metafileFile:n,metafileLocale:a,data:i}}}class Oi{constructor(t){n(this,"metafile"),n(this,"cdn"),n(this,"client"),n(this,"api"),n(this,"cache"),n(this,"responseFactory"),this.metafile=t.metafileContext,this.cdn=t.cdn,this.client=t.client,this.api=new a(this),this.cache=new ye(this),this.responseFactory=new xi(this)}}var Fi=function(t){return function(e,r,n){for(var a=-1,i=Object(e),o=n(e),s=o.length;s--;){var c=o[t?s:++a];if(!1===r(i[c],c,i))break}return e}}(),Ai=hn;var Li=cn;var Mi=function(t,e){return function(r,n){if(null==r)return r;if(!Li(r))return t(r,n);for(var a=r.length,i=e?a:-1,o=Object(r);(e?i--:++i<a)&&!1!==n(o[i],i,o););return r}}((function(t,e){return t&&Fi(t,e,Ai)}));var Si=rr,Ri=function(t,e){var r=[];return Mi(t,(function(t,n,a){e(t,n,a)&&r.push(t)})),r},Ei=vi,Ii=ge;const Ui=o((function(t,e){return(Ii(t)?Si:Ri)(t,Ei(e))}));var Pi=vi,qi=cn,zi=hn;var $i=function(t){return function(e,r,n){var a=Object(e);if(!qi(e)){var i=Pi(r);e=zi(e),r=function(t){return i(a[t],t,a)}}var o=t(e,r,n);return o>-1?a[i?e[o]:o]:void 0}},Ci=/\s/;var Ti=function(t){for(var e=t.length;e--&&Ci.test(t.charAt(e)););return e},Bi=/^\s+/;var ki=function(t){return t?t.slice(0,Ti(t)+1).replace(Bi,""):t},Di=x,Ni=pa,Vi=/^[-+]0x[0-9a-f]+$/i,Wi=/^0b[01]+$/i,Gi=/^0o[0-7]+$/i,Hi=parseInt;var Ji=function(t){if("number"==typeof t)return t;if(Ni(t))return NaN;if(Di(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Di(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=ki(t);var r=Wi.test(t);return r||Gi.test(t)?Hi(t.slice(2),r?2:8):Vi.test(t)?NaN:+t},Ki=1/0;var Qi=function(t){return t?(t=Ji(t))===Ki||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var Xi=Jt,Yi=vi,Zi=function(t){var e=Qi(t),r=e%1;return e==e?r?e-r:e:0},to=Math.max;const eo=o($i((function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var a=null==r?0:Zi(r);return a<0&&(a=to(n+a,0)),Xi(t,Yi(e),a)})));var ro=tn(Object.getPrototypeOf,Object),no=_,ao=ro,io=je,oo=Function.prototype,so=Object.prototype,co=oo.toString,uo=so.hasOwnProperty,lo=co.call(Object);const fo=o((function(t){if(!io(t)||"[object Object]"!=no(t))return!1;var e=ao(t);if(null===e)return!0;var r=uo.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&co.call(r)==lo}));var ho=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},po=G,vo=function(){try{var t=po(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var bo=function(t,e,r){"__proto__"==e&&vo?vo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},yo=bo,go=ft,mo=Object.prototype.hasOwnProperty;var jo=function(t,e,r){var n=t[e];mo.call(t,e)&&go(n,r)&&(void 0!==r||e in t)||yo(t,e,r)},wo=jo,_o=bo;var xo=function(t,e,r,n){var a=!r;r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],c=n?n(r[s],t[s],s,r,t):void 0;void 0===c&&(c=t[s]),a?_o(r,s,c):wo(r,s,c)}return r},Oo=xo,Fo=hn;var Ao=function(t,e){return t&&Oo(e,Fo(e),t)};var Lo=x,Mo=Zr,So=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},Ro=Object.prototype.hasOwnProperty;var Eo=Xr,Io=function(t){if(!Lo(t))return So(t);var e=Mo(t),r=[];for(var n in t)("constructor"!=n||!e&&Ro.call(t,n))&&r.push(n);return r},Uo=cn;var Po=function(t){return Uo(t)?Eo(t,!0):Io(t)},qo=xo,zo=Po;var $o=function(t,e){return t&&qo(e,zo(e),t)},Co={exports:{}};!function(t,e){var r=l,n=e&&!e.nodeType&&e,a=n&&t&&!t.nodeType&&t,i=a&&a.exports===n?r.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=o?o(r):new t.constructor(r);return t.copy(n),n}}(Co,Co.exports);var To=Co.exports;var Bo=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},ko=xo,Do=cr;var No=function(t,e){return ko(t,Do(t),e)},Vo=Ye,Wo=ro,Go=cr,Ho=nr,Jo=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Vo(e,Go(t)),t=Wo(t);return e}:Ho,Ko=xo,Qo=Jo;var Xo=function(t,e){return Ko(t,Qo(t),e)},Yo=er,Zo=Jo,ts=Po;var es=function(t){return Yo(t,ts,Zo)},rs=Object.prototype.hasOwnProperty;var ns=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&rs.call(t,"index")&&(r.index=t.index,r.input=t.input),r},as=Ne;var is=function(t){var e=new t.constructor(t.byteLength);return new as(e).set(new as(t)),e},os=is;var ss=function(t,e){var r=e?os(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},cs=/\w*$/;var us=function(t){var e=new t.constructor(t.source,cs.exec(t));return e.lastIndex=t.lastIndex,e},ls=f?f.prototype:void 0,fs=ls?ls.valueOf:void 0;var hs=is;var ps=is,vs=ss,ds=us,bs=function(t){return fs?Object(fs.call(t)):{}},ys=function(t,e){var r=e?hs(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var gs=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return ps(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return vs(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ys(t,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return ds(t);case"[object Symbol]":return bs(t)}},ms=x,js=Object.create,ws=function(){function t(){}return function(e){if(!ms(e))return{};if(js)return js(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),_s=ro,xs=Zr;var Os=function(t){return"function"!=typeof t.constructor||xs(t)?{}:ws(_s(t))},Fs=Cn,As=je;var Ls=function(t){return As(t)&&"[object Map]"==Fs(t)},Ms=$r,Ss=Tr&&Tr.isMap,Rs=Ss?Ms(Ss):Ls,Es=Cn,Is=je;var Us=function(t){return Is(t)&&"[object Set]"==Es(t)},Ps=$r,qs=Tr&&Tr.isSet,zs=qs?Ps(qs):Us,$s=Ce,Cs=ho,Ts=jo,Bs=Ao,ks=$o,Ds=To,Ns=Bo,Vs=No,Ws=Xo,Gs=bn,Hs=es,Js=Cn,Ks=ns,Qs=gs,Xs=Os,Ys=ge,Zs=Mr,tc=Rs,ec=x,rc=zs,nc=hn,ac=Po,ic="[object Arguments]",oc="[object Function]",sc="[object Object]",cc={};cc[ic]=cc["[object Array]"]=cc["[object ArrayBuffer]"]=cc["[object DataView]"]=cc["[object Boolean]"]=cc["[object Date]"]=cc["[object Float32Array]"]=cc["[object Float64Array]"]=cc["[object Int8Array]"]=cc["[object Int16Array]"]=cc["[object Int32Array]"]=cc["[object Map]"]=cc["[object Number]"]=cc[sc]=cc["[object RegExp]"]=cc["[object Set]"]=cc["[object String]"]=cc["[object Symbol]"]=cc["[object Uint8Array]"]=cc["[object Uint8ClampedArray]"]=cc["[object Uint16Array]"]=cc["[object Uint32Array]"]=!0,cc["[object Error]"]=cc[oc]=cc["[object WeakMap]"]=!1;var uc=function t(e,r,n,a,i,o){var s,c=1&r,u=2&r,l=4&r;if(n&&(s=i?n(e,a,i,o):n(e)),void 0!==s)return s;if(!ec(e))return e;var f=Ys(e);if(f){if(s=Ks(e),!c)return Ns(e,s)}else{var h=Js(e),p=h==oc||"[object GeneratorFunction]"==h;if(Zs(e))return Ds(e,c);if(h==sc||h==ic||p&&!i){if(s=u||p?{}:Xs(e),!c)return u?Ws(e,ks(s,e)):Vs(e,Bs(s,e))}else{if(!cc[h])return i?e:{};s=Qs(e,h,c)}}o||(o=new $s);var v=o.get(e);if(v)return v;o.set(e,s),rc(e)?e.forEach((function(a){s.add(t(a,r,n,a,e,o))})):tc(e)&&e.forEach((function(a,i){s.set(i,t(a,r,n,i,e,o))}));var d=f?void 0:(l?u?Hs:Gs:u?ac:nc)(e);return Cs(d||e,(function(a,i){d&&(a=e[i=a]),Ts(s,i,t(a,r,n,i,e,o))})),s},lc=uc,fc=la;const hc=o((function(t){return fc(lc(t,1))})),pc=class t extends Fe{constructor(){super(...arguments),n(this,"list",(()=>t.transformFiles(this.context.metafile.data.files))),n(this,"filter",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!L(e)&&!fo(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return L(e)?r.filter(e):Ui(r,hc(e))})),n(this,"find",(e=>{if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!L(e)&&!fo(e))throw new Error('Invalid param: "options" must be function or object.');const r=t.transformFiles(this.context.metafile.data.files);return L(e)?r.find(e):eo(r,hc(e))})),n(this,"first",(()=>{if(0===this.context.metafile.data.files.length)throw new Error("File is missing in downloaded metafile.");return t.transformFiles(this.context.metafile.data.files)[0]}))}};n(pc,"transformFiles",(t=>t.map((t=>t.toCdnFile()))));let vc=pc;class dc extends Fe{constructor(t){super(t),n(this,"files"),n(this,"locales",(t=>{const{excludeBaseLocale:e}=t||{},{locales:r}=this.context.metafile.data;return e?r.filter((t=>!t.isBaseLocale)):r})),n(this,"refresh",(async t=>{const e=await this.context.api.fetchMetafile(t);this.context.metafile.setMetafile(e.data)})),n(this,"switch",(async(t,e)=>{this.context.metafile.params=new wi(t.metafile),await this.refresh(e)})),this.files=new vc(t)}get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}}const bc=o((function(t){return void 0===t}));class yc{constructor(t){n(this,"data"),n(this,"context"),this.context=t.context,this.data=t.data||{}}}class gc{constructor(t){n(this,"files"),n(this,"localesMap"),n(this,"hasSingleFileResponse"),n(this,"hasSingleLocaleResponse"),n(this,"context"),this.files=[],this.localesMap=new yc({context:t}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=t}async execute(){return this.context.responseFactory.createCdnResponse({responses:await Promise.all(this.getPromises()),localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((t,e)=>(this.localesMap.data[e.id]&&t.push(...this.localesMap.data[e.id].map((t=>this.context.api.fetchLocale({metafileFile:e,metafileLocale:t})))),t)),[])}}class mc{constructor(t){n(this,"context"),n(this,"request"),this.context=t,this.request=new gc(this.context)}addFiles(t){if(!(fo(t)||Oe(t)||bc(t)||me(t)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(me(t)&&t.forEach((t=>{if(!fo(t)&&!Oe(t))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),Oe(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t));if(!(e instanceof mi))throw new Error(`File not found: "${t}".`);this.request.files=[e]}else if(bc(t))this.request.files=[...this.context.metafile.data.files];else if(me(t))this.request.files=t.map((t=>{let e;if(Oe(t)){const r=this.context.metafile.data.files.find((e=>e.id===t));if(bc(r))throw new Error(`File not found: "${t}".`);e=r}else{const r=this.context.metafile.data.files.find((e=>e.id===t.id));if(bc(r))throw new Error(`File not found: "${t.id}".`);e=r}return e}));else if(fo(t)){this.request.hasSingleFileResponse=!0;const e=this.context.metafile.data.files.find((e=>e.id===t.id));if(bc(e))throw new Error(`File not found: "${t.id}".`);this.request.files=[e]}return this}addLocales(t,e){if(!(Oe(t)||bc(t)||me(t)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return me(t)&&t.forEach((t=>{if(!Oe(t))throw new Error('Invalid param: array "request.locales" must contain strings.')})),Oe(t)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>e.locale===t)),e)),this.request.localesMap)):bc(t)?this.request.files.reduce(((t,r)=>(t.data[r.id]=e?r.locales.filter((t=>!t.isBaseLocale)):r.locales,t)),this.request.localesMap):me(t)&&this.request.files.reduce(((e,r)=>(e.data[r.id]=r.locales.filter((e=>t.includes(e.locale))),e)),this.request.localesMap),this}getCdnRequest(){const t=this.request;return this.request=new gc(this.context),t}}class jc{constructor(t,e){n(this,"client"),this.client=jc.clientFactory(t,e)}static clientFactory(t,r){const n={baseURL:t,...r};return e.create(n)}get(t,e){return this.client.get(t,e)}}class wc{constructor(t,e){n(this,"metafile"),n(this,"cache"),n(this,"context"),n(this,"fetch",(async t=>{const{files:e,locales:r,excludeBaseLocale:n}=t||{};return new mc(this.context).addFiles(e).addLocales(r,n).getCdnRequest().execute()}));const r=new _i(t),a=new jc(r.params.baseUrl,e);this.context=new Oi({metafileContext:r,cdn:this,client:a}),this.metafile=new dc(this.context),this.cache=new Ae(this.context)}static async create(t,e){if(!t)throw new Error('Invalid param: missing required "options" parameter.');if(!Oe(t.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const r=new wc(t,e);return await r.metafile.refresh(e),r}}t.Api=a,t.AxiosHttpAdapter=jc,t.CdnBase=Fe,t.CdnCache=Ae,t.CdnClient=wc,t.CdnMetafile=dc,t.CdnMetafileFiles=vc,t.Context=Oi,t.LocalesCache=ye,t.LocalesMap=yc,t.MemoryCacheAdapter=be,t.MetafileContext=_i,t.MetafileData=ji,t.MetafileFile=mi,t.MetafileLocale=gi,t.MetafileParams=wi,t.Request=gc,t.RequestBuilder=mc,t.ResponseFactory=xi,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
2
+ //# sourceMappingURL=localazy-cdn.umd.min.cjs.map