1 line
6.0 KiB
JavaScript

"use strict";exports.id=37,exports.ids=[37],exports.modules={40037:(a,b,c)=>{c.r(b),c.d(b,{default:()=>u});let d=a=>"object"==typeof a&&null!==a,e=a=>d(a)&&!(a instanceof RegExp)&&!(a instanceof Error)&&!(a instanceof Date),f=Symbol("mapObjectSkip"),g=(a,b,c,d=new WeakMap)=>{if(c={deep:!1,target:{},...c},d.has(a))return d.get(a);d.set(a,c.target);let{target:h}=c;delete c.target;let i=a=>a.map(a=>e(a)?g(a,b,c,d):a);if(Array.isArray(a))return i(a);for(let[j,k]of Object.entries(a)){let l=b(j,k,a);if(l===f)continue;let[m,n,{shouldRecurse:o=!0}={}]=l;"__proto__"!==m&&(c.deep&&o&&e(n)&&(n=Array.isArray(n)?i(n):g(n,b,c,d)),h[m]=n)}return h};function h(a,b,c){if(!d(a))throw TypeError(`Expected an object, got \`${a}\` (${typeof a})`);return g(a,b,c)}let i=/[\p{Lu}]/u,j=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,l=/([\p{Alpha}\p{N}_]|$)/u,m=/[_.\- ]+/,n=RegExp("^"+m.source),o=RegExp(m.source+l.source,"gu"),p=RegExp("\\d+"+l.source,"gu");class q extends Map{constructor(a={}){if(super(),!(a.maxSize&&a.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if("number"==typeof a.maxAge&&0===a.maxAge)throw TypeError("`maxAge` must be a number greater than 0");this.maxSize=a.maxSize,this.maxAge=a.maxAge||1/0,this.onEviction=a.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(a){if("function"==typeof this.onEviction)for(let[b,c]of a)this.onEviction(b,c.value)}_deleteIfExpired(a,b){return!!("number"==typeof b.expiry&&b.expiry<=Date.now())&&("function"==typeof this.onEviction&&this.onEviction(a,b.value),this.delete(a))}_getOrDeleteIfExpired(a,b){if(!1===this._deleteIfExpired(a,b))return b.value}_getItemValue(a,b){return b.expiry?this._getOrDeleteIfExpired(a,b):b.value}_peek(a,b){let c=b.get(a);return this._getItemValue(a,c)}_set(a,b){this.cache.set(a,b),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(a,b){this.oldCache.delete(a),this._set(a,b)}*_entriesAscending(){for(let a of this.oldCache){let[b,c]=a;this.cache.has(b)||!1===this._deleteIfExpired(b,c)&&(yield a)}for(let a of this.cache){let[b,c]=a;!1===this._deleteIfExpired(b,c)&&(yield a)}}get(a){if(this.cache.has(a)){let b=this.cache.get(a);return this._getItemValue(a,b)}if(this.oldCache.has(a)){let b=this.oldCache.get(a);if(!1===this._deleteIfExpired(a,b))return this._moveToRecent(a,b),b.value}}set(a,b,{maxAge:c=this.maxAge}={}){let d="number"==typeof c&&c!==1/0?Date.now()+c:void 0;return this.cache.has(a)?this.cache.set(a,{value:b,expiry:d}):this._set(a,{value:b,expiry:d}),this}has(a){return this.cache.has(a)?!this._deleteIfExpired(a,this.cache.get(a)):!!this.oldCache.has(a)&&!this._deleteIfExpired(a,this.oldCache.get(a))}peek(a){return this.cache.has(a)?this._peek(a,this.cache):this.oldCache.has(a)?this._peek(a,this.oldCache):void 0}delete(a){let b=this.cache.delete(a);return b&&this._size--,this.oldCache.delete(a)||b}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(a){if(!(a&&a>0))throw TypeError("`maxSize` must be a number greater than 0");let b=[...this._entriesAscending()],c=b.length-a;c<0?(this.cache=new Map(b),this.oldCache=new Map,this._size=b.length):(c>0&&this._emitEvictions(b.slice(0,c)),this.oldCache=new Map(b.slice(c)),this.cache=new Map,this._size=0),this.maxSize=a}*keys(){for(let[a]of this)yield a}*values(){for(let[,a]of this)yield a}*[Symbol.iterator](){for(let a of this.cache){let[b,c]=a;!1===this._deleteIfExpired(b,c)&&(yield[b,c.value])}for(let a of this.oldCache){let[b,c]=a;this.cache.has(b)||!1===this._deleteIfExpired(b,c)&&(yield[b,c.value])}}*entriesDescending(){let a=[...this.cache];for(let b=a.length-1;b>=0;--b){let[c,d]=a[b];!1===this._deleteIfExpired(c,d)&&(yield[c,d.value])}a=[...this.oldCache];for(let b=a.length-1;b>=0;--b){let[c,d]=a[b];this.cache.has(c)||!1===this._deleteIfExpired(c,d)&&(yield[c,d.value])}}*entriesAscending(){for(let[a,b]of this._entriesAscending())yield[a,b.value]}get size(){if(!this._size)return this.oldCache.size;let a=0;for(let b of this.oldCache.keys())!this.cache.has(b)&&a++;return Math.min(this._size+a,this.maxSize)}entries(){return this.entriesAscending()}forEach(a,b=this){for(let[c,d]of this.entriesAscending())a.call(b,d,c,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}let r=new q({maxSize:1e5}),s=a=>"object"==typeof a&&null!==a&&!(a instanceof RegExp)&&!(a instanceof Error)&&!(a instanceof Date),t=(a,b={})=>{if(!s(a))return a;let{exclude:c,pascalCase:d=!1,stopPaths:e,deep:f=!1,preserveConsecutiveUppercase:g=!1}=b,l=new Set(e),q=a=>(b,e)=>{if(f&&s(e)){let c=void 0===a?b:`${a}.${b}`;l.has(c)||(e=h(e,q(c)))}if(!(c&&((a,b)=>a.some(a=>"string"==typeof a?a===b:(a.lastIndex=0,a.test(b))))(c,b))){let a=d?`${b}_`:b;if(r.has(a))b=r.get(a);else{let c=function(a,b){var c,d;if(!("string"==typeof a||Array.isArray(a)))throw TypeError("Expected the input to be `string | string[]`");if(b={pascalCase:!1,preserveConsecutiveUppercase:!1,...b},0===(a=Array.isArray(a)?a.map(a=>a.trim()).filter(a=>a.length).join("-"):a.trim()).length)return"";let e=!1===b.locale?a=>a.toLowerCase():a=>a.toLocaleLowerCase(b.locale),f=!1===b.locale?a=>a.toUpperCase():a=>a.toLocaleUpperCase(b.locale);return 1===a.length?m.test(a)?"":b.pascalCase?f(a):e(a):(a!==e(a)&&(a=((a,b,c,d)=>{let e=!1,f=!1,g=!1,h=!1;for(let k=0;k<a.length;k++){let l=a[k];h=!(k>2)||"-"===a[k-3],e&&i.test(l)?(a=a.slice(0,k)+"-"+a.slice(k),e=!1,g=f,f=!0,k++):f&&g&&j.test(l)&&(!h||d)?(a=a.slice(0,k-1)+"-"+a.slice(k-1),g=f,f=!1,e=!0):(e=b(l)===l&&c(l)!==l,g=f,f=c(l)===l&&b(l)!==l)}return a})(a,e,f,b.preserveConsecutiveUppercase)),a=a.replace(n,""),a=b.preserveConsecutiveUppercase?(c=a,k.lastIndex=0,c.replaceAll(k,a=>e(a))):e(a),b.pascalCase&&(a=f(a.charAt(0))+a.slice(1)),d=a,o.lastIndex=0,p.lastIndex=0,d.replaceAll(p,(a,b,c)=>["_","-"].includes(d.charAt(c+a.length))?a:f(a)).replaceAll(o,(a,b)=>f(b)))}(b,{pascalCase:d,locale:!1,preserveConsecutiveUppercase:g});b.length<100&&r.set(a,c),b=c}}return[b,e]};return h(a,q(void 0))};function u(a,b){return Array.isArray(a)?Object.keys(a).map(c=>t(a[c],b)):t(a,b)}}};