UNPKG

@devlander/utils

Version:

Comprehensive JavaScript and TypeScript utilities for seamless development. Includes object manipulation, data validation, and more.

1 lines 55.1 kB
"use strict";var t;function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function e(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=f(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function n(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function i(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?o(Object(e),!0).forEach((function(r){n(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):o(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function a(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],s=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;s=!1}else for(;!(s=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(t){f=!0,o=t}finally{try{if(!s&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,r)||f(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function f(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}exports.DeduplicateInputType=void 0,(t=exports.DeduplicateInputType||(exports.DeduplicateInputType={})).STRING="string",t.OBJECT="object",t.ARRAY="array",t.NUMBER="number",t.MATRIX="matrix";var c=["and","to",".","the",",","of","in","for","&","a","an","with","on","at","from","as","by","or","but","into","is","are","was","were","be","being","been","have","has","had","having","do","does","did","doing","will","would","should","can","could","may","might","must","ought","shall","should","there","their","they","them","these","those","this","that","then","than","thus","so","such","if","else","not","no","yes","i","you","he","she","it","we","me","him","her","us","my","your","his","its","our","mine","yours","hers","ours","theirs","who","whom","which","what","when","where","why","how","up","about","into","with","over","before","after","between","among","through","during","above","below","out","off","down","under","again","further","once","here","all","any","both","each","few","more","most","other","some","such","both","each"];function l(t,r){var e=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,n=void 0!==e&&e;if(null!=t)if("object"!==s(t)&&(t=[t]),Array.isArray(t))for(var o=0,i=t.length;o<i;o++)r.call(null,t[o],o,t);else for(var a=n?Object.getOwnPropertyNames(t):Object.keys(t),u=a.length,f=0;f<u;f++){var c=a[f];r.call(null,t[c],c,t)}}var p="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},h=[],g=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,y=!1;function v(){y=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)h[r]=t[r],g[t.charCodeAt(r)]=r;g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63}function m(t,r,e){for(var n,o,i=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(h[(o=n)>>18&63]+h[o>>12&63]+h[o>>6&63]+h[63&o]);return i.join("")}function b(t){var r;y||v();for(var e=t.length,n=e%3,o="",i=[],a=16383,u=0,s=e-n;u<s;u+=a)i.push(m(t,u,u+a>s?s:u+a));return 1===n?(r=t[e-1],o+=h[r>>2],o+=h[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=h[r>>10],o+=h[r>>4&63],o+=h[r<<2&63],o+="="),i.push(o),i.join("")}function w(t,r,e,n,o){var i,a,u=8*o-n-1,s=(1<<u)-1,f=s>>1,c=-7,l=e?o-1:0,p=e?-1:1,h=t[r+l];for(l+=p,i=h&(1<<-c)-1,h>>=-c,c+=u;c>0;i=256*i+t[r+l],l+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+t[r+l],l+=p,c-=8);if(0===i)i=1-f;else{if(i===s)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=f}return(h?-1:1)*a*Math.pow(2,i-n)}function x(t,r,e,n,o,i){var a,u,s,f=8*i-o-1,c=(1<<f)-1,l=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,g=n?1:-1,d=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=c):(a=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-a))<1&&(a--,s*=2),(r+=a+l>=1?p/s:p*Math.pow(2,1-l))*s>=2&&(a++,s/=2),a+l>=c?(u=0,a=c):a+l>=1?(u=(r*s-1)*Math.pow(2,o),a+=l):(u=r*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[e+h]=255&u,h+=g,u/=256,o-=8);for(a=a<<o|u,f+=o;f>0;t[e+h]=255&a,h+=g,a/=256,f-=8);t[e+h-g]|=128*d}var A={}.toString,E=Array.isArray||function(t){return"[object Array]"==A.call(t)};function S(){return R.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(t,r){if(S()<r)throw new RangeError("Invalid typed array length");return R.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=R.prototype:(null===t&&(t=new R(r)),t.length=r),t}function R(t,r,e){if(!(R.TYPED_ARRAY_SUPPORT||this instanceof R))return new R(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return j(this,t)}return P(this,t,r,e)}function P(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);R.TYPED_ARRAY_SUPPORT?(t=r).__proto__=R.prototype:t=I(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!R.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|C(r,e);t=O(t,n);var o=t.write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(N(r)){var e=0|B(r.length);return 0===(t=O(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?O(t,0):I(t,r);if("Buffer"===r.type&&E(r.data))return I(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function T(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function j(t,r){if(T(r),t=O(t,r<0?0:0|B(r)),!R.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function I(t,r){var e=r.length<0?0:0|B(r.length);t=O(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function B(t){if(t>=S())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|t}function N(t){return!(null==t||!t._isBuffer)}function C(t,r){if(N(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return at(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return ut(t).length;default:if(n)return at(t).length;r=(""+r).toLowerCase(),n=!0}}function M(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return H(this,r,e);case"utf8":case"utf-8":return J(this,r,e);case"ascii":return Z(this,r,e);case"latin1":case"binary":return K(this,r,e);case"base64":return $(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function U(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=R.from(r,n)),N(r))return 0===r.length?-1:L(t,r,e,n,o);if("number"==typeof r)return r&=255,R.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):L(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function L(t,r,e,n,o){var i,a=1,u=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a=2,u/=2,s/=2,e/=2}function f(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(o){var c=-1;for(i=e;i<u;i++)if(f(t,i)===f(r,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===s)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(e+s>u&&(e=u-s),i=e;i>=0;i--){for(var l=!0,p=0;p<s;p++)if(f(t,i+p)!==f(r,p)){l=!1;break}if(l)return i}return-1}function D(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function Y(t,r,e,n){return st(at(r,t.length-e),t,e,n)}function k(t,r,e,n){return st(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function F(t,r,e,n){return k(t,r,e,n)}function z(t,r,e,n){return st(ut(r),t,e,n)}function W(t,r,e,n){return st(function(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)n=(e=t.charCodeAt(a))>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function $(t,r,e){return 0===r&&e===t.length?b(t):b(t.slice(r,e))}function J(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,a,u,s,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=e)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&f)<<6|63&i)>127&&(c=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(s=(15&f)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(c=s)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var r=t.length;if(r<=V)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=V));return e}(n)}R.TYPED_ARRAY_SUPPORT=void 0===p.TYPED_ARRAY_SUPPORT||p.TYPED_ARRAY_SUPPORT,R.poolSize=8192,R._augment=function(t){return t.__proto__=R.prototype,t},R.from=function(t,r,e){return P(null,t,r,e)},R.TYPED_ARRAY_SUPPORT&&(R.prototype.__proto__=Uint8Array.prototype,R.__proto__=Uint8Array),R.alloc=function(t,r,e){return function(t,r,e,n){return T(r),r<=0?O(t,r):void 0!==e?"string"==typeof n?O(t,r).fill(e,n):O(t,r).fill(e):O(t,r)}(null,t,r,e)},R.allocUnsafe=function(t){return j(null,t)},R.allocUnsafeSlow=function(t){return j(null,t)},R.isBuffer=function(t){return null!=t&&(!!t._isBuffer||ft(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ft(t.slice(0,0))}(t))},R.compare=function(t,r){if(!N(t)||!N(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},R.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},R.concat=function(t,r){if(!E(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return R.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=R.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!N(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},R.byteLength=C,R.prototype._isBuffer=!0,R.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)_(this,r,r+1);return this},R.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)_(this,r,r+3),_(this,r+1,r+2);return this},R.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)_(this,r,r+7),_(this,r+1,r+6),_(this,r+2,r+5),_(this,r+3,r+4);return this},R.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?J(this,0,t):M.apply(this,arguments)},R.prototype.equals=function(t){if(!N(t))throw new TypeError("Argument must be a Buffer");return this===t||0===R.compare(this,t)},R.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},R.prototype.compare=function(t,r,e,n,o){if(!N(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(i,a),s=this.slice(n,o),f=t.slice(r,e),c=0;c<u;++c)if(s[c]!==f[c]){i=s[c],a=f[c];break}return i<a?-1:a<i?1:0},R.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},R.prototype.indexOf=function(t,r,e){return U(this,t,r,e,!0)},R.prototype.lastIndexOf=function(t,r,e){return U(this,t,r,e,!1)},R.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return D(this,t,r,e);case"utf8":case"utf-8":return Y(this,t,r,e);case"ascii":return k(this,t,r,e);case"latin1":case"binary":return F(this,t,r,e);case"base64":return z(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},R.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var V=4096;function Z(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function K(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function H(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=it(t[i]);return o}function G(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function X(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function q(t,r,e,n,o,i){if(!N(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function Q(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function tt(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function rt(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function et(t,r,e,n,o){return o||rt(t,0,e,4),x(t,r,e,n,23,4),e+4}function nt(t,r,e,n,o){return o||rt(t,0,e,8),x(t,r,e,n,52,8),e+8}R.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),R.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=R.prototype;else{var o=r-t;e=new R(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},R.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||X(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},R.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||X(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},R.prototype.readUInt8=function(t,r){return r||X(t,1,this.length),this[t]},R.prototype.readUInt16LE=function(t,r){return r||X(t,2,this.length),this[t]|this[t+1]<<8},R.prototype.readUInt16BE=function(t,r){return r||X(t,2,this.length),this[t]<<8|this[t+1]},R.prototype.readUInt32LE=function(t,r){return r||X(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},R.prototype.readUInt32BE=function(t,r){return r||X(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},R.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||X(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},R.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||X(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},R.prototype.readInt8=function(t,r){return r||X(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},R.prototype.readInt16LE=function(t,r){r||X(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},R.prototype.readInt16BE=function(t,r){r||X(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},R.prototype.readInt32LE=function(t,r){return r||X(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},R.prototype.readInt32BE=function(t,r){return r||X(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},R.prototype.readFloatLE=function(t,r){return r||X(t,4,this.length),w(this,t,!0,23,4)},R.prototype.readFloatBE=function(t,r){return r||X(t,4,this.length),w(this,t,!1,23,4)},R.prototype.readDoubleLE=function(t,r){return r||X(t,8,this.length),w(this,t,!0,52,8)},R.prototype.readDoubleBE=function(t,r){return r||X(t,8,this.length),w(this,t,!1,52,8)},R.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||q(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},R.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||q(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},R.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,1,255,0),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},R.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Q(this,t,r,!0),r+2},R.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Q(this,t,r,!1),r+2},R.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):tt(this,t,r,!0),r+4},R.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):tt(this,t,r,!1),r+4},R.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);q(this,t,r,e,o-1,-o)}var i=0,a=1,u=0;for(this[r]=255&t;++i<e&&(a*=256);)t<0&&0===u&&0!==this[r+i-1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},R.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);q(this,t,r,e,o-1,-o)}var i=e-1,a=1,u=0;for(this[r+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},R.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,1,127,-128),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},R.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Q(this,t,r,!0),r+2},R.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Q(this,t,r,!1),r+2},R.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,2147483647,-2147483648),R.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):tt(this,t,r,!0),r+4},R.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||q(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),R.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):tt(this,t,r,!1),r+4},R.prototype.writeFloatLE=function(t,r,e){return et(this,t,r,!0,e)},R.prototype.writeFloatBE=function(t,r,e){return et(this,t,r,!1,e)},R.prototype.writeDoubleLE=function(t,r,e){return nt(this,t,r,!0,e)},R.prototype.writeDoubleBE=function(t,r,e){return nt(this,t,r,!1,e)},R.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!R.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},R.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!R.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var a=N(t)?t:at(new R(t,n).toString()),u=a.length;for(i=0;i<e-r;++i)this[i+r]=a[i%u]}return this};var ot=/[^+\/0-9A-Za-z-_]/g;function it(t){return t<16?"0"+t.toString(16):t.toString(16)}function at(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((e=t.charCodeAt(a))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function ut(t){return function(t){var r,e,n,o,i,a;y||v();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[u-2]?2:"="===t[u-1]?1:0,a=new d(3*u/4-i),n=i>0?u-4:u;var s=0;for(r=0,e=0;r<n;r+=4,e+=3)o=g[t.charCodeAt(r)]<<18|g[t.charCodeAt(r+1)]<<12|g[t.charCodeAt(r+2)]<<6|g[t.charCodeAt(r+3)],a[s++]=o>>16&255,a[s++]=o>>8&255,a[s++]=255&o;return 2===i?(o=g[t.charCodeAt(r)]<<2|g[t.charCodeAt(r+1)]>>4,a[s++]=255&o):1===i&&(o=g[t.charCodeAt(r)]<<10|g[t.charCodeAt(r+1)]<<4|g[t.charCodeAt(r+2)]>>2,a[s++]=o>>8&255,a[s++]=255&o),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(ot,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function st(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function ft(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var ct=Object.prototype.toString;var lt=function(t,r){var e={},n=function(t){t.forEach((function(t){e[t]=!0}))};return Array.isArray(t)?n(t):"string"==typeof t&&void 0!==r&&n(String(t).split(r)),Object.keys(e).forEach((function(t){t||delete e[t]})),e};var pt,ht=function(t,r){for(var e,n=[];null!==(e=t.exec(r));)n.push(e);return n};exports.AbbreviateNumberSuffix=void 0,(pt=exports.AbbreviateNumberSuffix||(exports.AbbreviateNumberSuffix={})).NONE="",pt.K="K",pt.M="M",pt.B="B",pt.T="T",pt.P="P",pt.E="E";var gt,dt,yt;exports.SingleItemLabelPrefix=void 0,(gt=exports.SingleItemLabelPrefix||(exports.SingleItemLabelPrefix={})).Only="Only",gt.Exclusive="Exclusive to",gt.Solely="Solely in",exports.MultipleItemsLabelPrefix=void 0,(dt=exports.MultipleItemsLabelPrefix||(exports.MultipleItemsLabelPrefix={})).IncludedIn="Included in",dt.FoundWithin="Found in",dt.PresentIn="Present in",exports.ListConjunction=void 0,(yt=exports.ListConjunction||(exports.ListConjunction={})).And="and",yt.AsWellAs="as well as",yt.AlongWith="along with";var vt,mt;exports.RangeOrAmountEnum=void 0,(vt=exports.RangeOrAmountEnum||(exports.RangeOrAmountEnum={})).None=" ",vt.Range="Range",vt.Amount="Amount",exports.PercentagePrefixEnum=void 0,(mt=exports.PercentagePrefixEnum||(exports.PercentagePrefixEnum={})).Empty=" ",mt.UpTo="up to",mt.About="about",mt.Around="around",mt.Approximately="approximately";var bt=function(t){return null==t||"object"===s(t)&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length},wt=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"message";if(!bt(r)&&Object.prototype.hasOwnProperty.call(r,e)){var n=r[e];if(n&&Array.isArray(n))return n.find((function(r){return r.includes(String(t))}))||null}return null};function xt(t,r){return r.hasOwnProperty(t)?r[t]:null}var At;exports.ProtocolPrefixEnum=void 0,(At=exports.ProtocolPrefixEnum||(exports.ProtocolPrefixEnum={})).HTTPS="https://",At.HTTP="http://",At.NONE="";var Et=["visa","mastercard","amex","discover","jcb","dinersclub"];var St=function(t){try{var r="string"==typeof t?t:JSON.stringify(t);return JSON.parse(r)}catch(t){return!1}},Ot=function(t){var r=St(t);if(!r)throw new Error("Invalid JSON string.");if("boolean"!=typeof r)return function t(r){for(var e in r){if("string"==typeof r[e]&&r[e].includes("\n"))return!0;if("object"===s(r[e])&&null!==r[e]&&t(r[e]))return!0}return!1}(r);throw new Error("Invalid input: input must be a JSON string or an object.")};var Rt={blue:"",green:"",red:"",yellow:"",magenta:"",bgBlue:"",bgGreen:"",bgRed:"",reset:""},Pt=function(t,r,e){var n=Rt[t]||Rt.reset;void 0!==e?console.log("".concat(n,"%s").concat(Rt.reset),r,e):console.log("".concat(n,"%s").concat(Rt.reset),r)},Tt=function(t){Pt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bgBlue",t)},jt=function(){console.log("\n==============================================\n")},It=function(t,r){var n,o=e(Object.getOwnPropertyNames(t));try{for(o.s();!(n=o.n()).done;){var i=n.value,a=Object.getOwnPropertyDescriptor(t,i);if(a){var u=r(a,i);!1!==u&&Object.defineProperty(t,i,u||a)}}}catch(t){o.e(t)}finally{o.f()}},Bt=["align-items","align-self","align-content","aspect-ratio","backface-visibility","border-bottom-width","border-end-width","border-left-width","border-right-width","border-start-width","border-top-width","border-width","bottom","color","display","elevation","flex","flex-basis","flex-direction","flex-grow","flex-shrink","flex-wrap","font-family","font-size","font-style","font-weight","height","justify-content","left","letter-spacing","line-height","margin","margin-bottom","margin-end","margin-horizontal","margin-left","margin-right","margin-start","margin-top","margin-vertical","max-height","max-width","min-height","min-width","opacity","overflow","padding","padding-bottom","padding-end","padding-horizontal","padding-left","padding-right","padding-start","padding-top","padding-vertical","position","right","text-align","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-shadow-color","text-shadow-offset","text-shadow-radius","text-transform","top","width","z-index"];var Nt;exports.AspectRatioEnum=void 0,(Nt=exports.AspectRatioEnum||(exports.AspectRatioEnum={}))["4:3"]="4:3",Nt["16:9"]="16:9",Nt["1:1"]="1:1",Nt["3:2"]="3:2",Nt["8:5"]="8:5";function Ct(t,r){"number"==typeof r&&(r=r.toString());for(var e=r.toLowerCase(),n=Object.keys(t),o=n.length;o-- >0;){var i=n[o];if(e===i.toString().toLowerCase())return i}return null}var Mt=function(t){return"[object Object]"===Object.prototype.toString.call(t)};function _t(t,r,e,n){var o=i({},e),a=Ct(e,r)||r;Mt(e[a])&&Mt(t)?e[a]=n(o,r,t):Mt(t)?e[a]=n({},r,t):Array.isArray(t)?e[a]=t.slice():e[a]=t}function Ut(t,r){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return t.apply(r,n)}}var Lt,Dt=(Lt=Object.create(null),function(t){var r=toString.call(t);return Lt[r]||(Lt[r]=r.slice(8,-1).toLowerCase())}),Yt=function(t){return t=t.toLowerCase(),function(r){return Dt(r)===t}};function kt(t){return Yt("function")(t)}var Ft=function(t){return t.replace(/\n/g,"")},zt=function(t){return t.replace(/\s+/g,"")};var Wt,$t=(Wt=Object.prototype.hasOwnProperty,function(t,r){return Wt.call(t,r)}),Jt=Yt("undefined"),Vt=function(t){return t=t.toLowerCase(),function(r){return Dt(r)===t}};var Zt=Vt("ArrayBuffer"),Kt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ht=Vt("Date");var Gt=Vt("File"),Xt=function(t){var r=Yt("object"),e=Yt("array");return null!==t&&(r(t)||e(t))},qt=Yt("number");exports.abbreviateNumber=function(t,r){var e=[exports.AbbreviateNumberSuffix.NONE,exports.AbbreviateNumberSuffix.K,exports.AbbreviateNumberSuffix.M,exports.AbbreviateNumberSuffix.B,exports.AbbreviateNumberSuffix.T,exports.AbbreviateNumberSuffix.P,exports.AbbreviateNumberSuffix.E];if(void 0===t)return"";var n="string"==typeof t?parseFloat(t):t;if(isNaN(n))return"Invalid input";var o=Math.log10(Math.abs(n))/3|0;if(0===o)return n.toString();var i=e[o],a=n/Math.pow(10,3*o);if(null!=r&&r.rounding)switch(r.rounding){case"up":a=Math.ceil(10*a)/10;break;case"down":a=Math.floor(10*a)/10}return"lower"===(null==r?void 0:r.case)?i=i.toLowerCase():"upper"===(null==r?void 0:r.case)&&(i=i.toUpperCase()),a.toFixed(1)+i},exports.arrayToObject=function(t){for(var r={},e=0;e<t.length;e++)r[e.toString()]=t[e];return r},exports.assignValue=_t,exports.binaryToHex=function(t){if(!/^[01]+$/.test(t))throw new Error("Invalid binary input");return(t.length%4==0?t:"0".repeat(4-t.length%4)+t).match(/.{1,4}/g).map((function(t){return parseInt(t,2).toString(16)})).join("")},exports.bind=Ut,exports.calculatePercentage=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("number"!=typeof t||"number"!=typeof r||0===r)throw new Error("Both inputs must be numbers and 'whole' cannot be zero.");var n=t/r*100;return e?Math.trunc(n):n},exports.capitalize=function(t){return"string"!=typeof t||0===t.length?t:t.charAt(0).toUpperCase()+t.slice(1)},exports.chunkArray=function(t,r){if(!Array.isArray(t)||"number"!=typeof r||r<=0)return[];for(var e=[],n=0;n<t.length;n+=r)e.push(t.slice(n,n+r));return e},exports.clamp=function(t,r,e){if("number"!=typeof t||isNaN(t))return r;if("number"!=typeof r||"number"!=typeof e||isNaN(r)||isNaN(e))return t;if(r>e){var n=[e,r];r=n[0],e=n[1]}return Math.min(Math.max(t,r),e)},exports.composeLabelFromItems=function(t){var r=t.items,e=t.labelKey,n=t.singleItemPrefix,o=void 0===n?exports.SingleItemLabelPrefix.Only:n,i=t.multipleItemsPrefix,a=void 0===i?exports.MultipleItemsLabelPrefix.FoundWithin:i,u=t.conjunctionWord,s=void 0===u?exports.ListConjunction.And:u;if(!r||0===r.length)return"";var f=exports.SingleItemLabelPrefix[o]||o,c=exports.MultipleItemsLabelPrefix[a]||a,l=exports.ListConjunction[s]||s;if(1===r.length)return"".concat(f," ").concat(r[0][e],":");var p=r.map((function(t,n){var o=n===r.length-1,i=t[e];return o?"".concat(l," ").concat(i):i})).join(", ");return"".concat(c," ").concat(p,":")},exports.convertBlobToBase64NativeAsync=function(t){return new Promise((function(r,e){if("undefined"==typeof Blob||!(t instanceof Blob))return e(new Error("The provided value is not a valid Blob."));var n=new FileReader;n.readAsArrayBuffer(t),n.onloadend=function(){var e=n.result,o="data:".concat(t.type,";base64,").concat(R.from(e).toString("base64"));r(o)},n.onerror=function(){e(new Error("Error occurred while reading the Blob."))}}))},exports.convertBlobToBase64WebAsync=function(t){return new Promise((function(r,e){if("undefined"==typeof Blob||!(t instanceof Blob))return e(new Error("The provided value is not a valid Blob."));if("undefined"==typeof FileReader)return e(new Error("FileReader is not available in this environment."));var n=new FileReader;n.readAsDataURL(t),n.onloadend=function(){r(n.result)},n.onerror=function(){e(new Error("Error occurred while reading the Blob."))}}))},exports.convertVideoTimeStampToSeconds=function(t){var r=t.split(":");if(3!==r.length)throw new Error('Invalid timestamp format. Expected format: "HH:MM:SS"');var e=parseInt(r[0],10),n=parseInt(r[1],10),o=parseInt(r[2],10);if(isNaN(e)||isNaN(n)||isNaN(o))throw new Error('Invalid timestamp format. Expected format: "HH:MM:SS"');if(e<0||n<0||o<0)throw new Error("Invalid timestamp. Negative values are not allowed.");return 3600*e+60*n+o},exports.createTransitionalMessage=function(t,r,e){return function(n){var o=n.option,i=n.description,a="[".concat(r," v").concat(t,"] Transitional option '").concat(o,"' ").concat(i);return e?e.replace("{baseMessage}",a):a}},exports.dashToCamelCase=function(t){return t.replace(/^-+/,"").replace(/-+$/,"").toLowerCase().replace(/-([a-z])/g,(function(t,r){return r.toUpperCase()}))},exports.debounce=function(t,r){var e=null;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},exports.decodeBase64ToString=function(t){if("undefined"!=typeof Buffer)return Buffer.from(t,"base64").toString("utf8");if("undefined"!=typeof atob)try{return decodeURIComponent(Array.prototype.map.call(atob(t),(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join(""))}catch(r){return atob(t)}throw new Error("No base64 decoder available in this environment.")},exports.deduplicate=function(t,r){if(!r)if("string"==typeof t)r=exports.DeduplicateInputType.STRING;else if(Array.isArray(t))r=t.length>0&&t.every(Array.isArray)?exports.DeduplicateInputType.MATRIX:exports.DeduplicateInputType.ARRAY;else if("number"==typeof t)r=exports.DeduplicateInputType.NUMBER;else{if("object"!==s(t)||null===t)throw new Error("Unsupported input type: ".concat(s(t)));r=exports.DeduplicateInputType.OBJECT}return function(){switch(r){case exports.DeduplicateInputType.STRING:case"STRING":case"string":if("string"==typeof t)return t.split("").filter((function(t,r,e){return e.indexOf(t)===r})).join("");break;case exports.DeduplicateInputType.ARRAY:case"ARRAY":case"array":if(Array.isArray(t))return t.filter((function(t,r,e){return e.indexOf(t)===r}));break;case exports.DeduplicateInputType.OBJECT:case"OBJECT":case"object":if("object"===s(t)&&!Array.isArray(t)){var e=new Set,n=Object.entries(t).filter((function(t){var r=a(t,2)[1];return!e.has(r)&&(e.add(r),!0)}));return Object.fromEntries(n)}break;case exports.DeduplicateInputType.NUMBER:case"NUMBER":case"number":if("number"==typeof t){var o=t.toString().split("").filter((function(t,r,e){return e.indexOf(t)===r})).join("");return parseInt(o,10)}break;case exports.DeduplicateInputType.MATRIX:case"MATRIX":case"matrix":if(Array.isArray(t)&&t.every(Array.isArray))return t.map((function(t){return Array.from(new Set(t))}))}throw new Error("Unsupported type or input format for: ".concat(r))}()},exports.deepClone=function t(r){if(null===r||"object"!==s(r))return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r))return r.map((function(r){return t(r)}));if("object"===s(r)){var e={};for(var n in r)r.hasOwnProperty(n)&&(e[n]=t(r[n]));return e}return r},exports.defaultStopWords=c,exports.encodeStringToBase64=function(t){if("undefined"!=typeof Buffer)return Buffer.from(t,"utf8").toString("base64");if("undefined"!=typeof btoa)try{return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(function(t,r){return String.fromCharCode(parseInt(r,16))})))}catch(r){return btoa(t)}throw new Error("No base64 encoder available in this environment.")},exports.endsWith=function(t,r,e){(void 0===e||e>t.length)&&(e=t.length),e-=r.length;var n=t.indexOf(r,e);return-1!==n&&n===e},exports.ensureValidStyle=function(t){return t.replace(/([a-z-]+)\s+([^;:]+)(;|$)/gi,(function(t,r,e,n){return"".concat(r,": ").concat(e).concat(";"===n?";":"")})).replace(/([^;])\s*$/gm,"$1;")},exports.extend=function(t,r,e){return l(r,(function(r,n){e&&kt(r)?t[n]=Ut(r,e):t[n]=r}),{allOwnKeys:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),t},exports.extractKeysAndValues=function(t){return{keys:Object.keys(t),values:Object.values(t)}},exports.filterAndSuggestItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["name"],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"_id",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:c,u=[];if(!t.trim()||!r.length)return u;var s=t.toLowerCase().split(" ").filter((function(t){return t&&!a.includes(t)}));if(0===s.length)return u;var f,l=new Set(Array.isArray(n)?n.map(String):[String(n)]),p=e(r);try{var h=function(){var t=f.value,r=String(t[i]);if(l.has(r))return 1;o.some((function(r){var e=t[r];if(!e||"string"!=typeof e)return!1;var n=e.toLowerCase().split(" ").filter((function(t){return!a.includes(t)}));return s.every((function(t){return n.includes(t)}))}))&&u.push(t)};for(p.s();!(f=p.n()).done;)h()}catch(t){p.e(t)}finally{p.f()}return u},exports.findKey=Ct,exports.flattenArray=function(t){return Array.isArray(t)?t.reduce((function(t,r){return Array.isArray(r)?t.concat(r):t.concat([r])}),[]):[]},exports.forEach=l,exports.forEachEntry=function(t,r){if(!t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Object is not iterable");for(var e,n=t[Symbol.iterator]();!(e=n.next()).done;){var o=a(e.value,2),i=o[0],u=o[1];r.call(t,i,u)}},exports.formatNumberWithCommas=function(t){return"number"!=typeof t||isNaN(t)?"0":t.toLocaleString("en-US")},exports.formatRangeOrPercentage=function(t){var r=t.details,e=void 0===r?"":r,n=t.formatAsRangeOrAmount,o=void 0===n?exports.RangeOrAmountEnum.None:n,i=t.percentagePrefix,a=void 0===i?exports.PercentagePrefixEnum.Empty:i,u=t.percentageSuffix,s=void 0===u?"":u,f=t.percent,c=void 0===f?0:f,l=t.minPercent,p=void 0===l?0:l,h=t.maxPercent,g=void 0===h?0:h,d=function(t,r,e){return""!==t.trim()||""!==r.trim()||e===exports.RangeOrAmountEnum.Range||e===exports.RangeOrAmountEnum.Amount}(a,s,o),y=o===exports.RangeOrAmountEnum.Amount?"".concat(c,"%"):o===exports.RangeOrAmountEnum.Range?"".concat(p," - ").concat(g).concat(s.includes("%")?"":"%"):"",v="";return o===exports.RangeOrAmountEnum.Range?v="".concat(d?"(":"").concat(a.trim()?"".concat(a," "):"").concat(y).concat(s.trim()?s:"").concat(d?")":""," ").concat(e.trim()):o===exports.RangeOrAmountEnum.Amount?v="(".concat(a.trim()?"".concat(a," "):"").concat(c,"%").concat(s.trim()?" ".concat(s):"",") ").concat(e.trim()):o===exports.RangeOrAmountEnum.None&&(v=e.trim()),v},exports.freezeMethods=function(t){It(t,(function(r,e){return(!kt(t)||!["arguments","caller","callee"].includes(e))&&(kt(t[e])?(r.enumerable=!1,"writable"in r?r.writable=!1:r.set||(r.set=function(){throw new Error("Cannot rewrite read-only method '".concat(e,"'"))}),r):void 0)}))},exports.generateAllowedOrigins=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.values(exports.ProtocolPrefixEnum),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{includeWww:!0,validateDomains:!0},n=new Set;return t.forEach((function(t){var o=function(t){return t.replace(/^(https?:\/\/)?(www\.)?/,"").toLowerCase()}(t);!e.validateDomains||function(t){return!(!t||""===t.trim())&&(t.startsWith("localhost")?/^localhost(:\d+)?$/.test(t):/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.[a-zA-Z]{2,}$/.test(t))}(o)?(r.forEach((function(t){if(!Object.values(exports.ProtocolPrefixEnum).includes(t))throw new Error("Invalid prefix: ".concat(t));n.add("".concat(t).concat(o)),e.includeWww&&!o.startsWith("localhost")&&n.add("".concat(t,"www.").concat(o))})),n.add(o),e.includeWww&&!o.startsWith("localhost")&&n.add("www.".concat(o))):console.warn("Skipping invalid domain: ".concat(t))})),Array.from(n)},exports.generateStripeCard=function(){var t=Et[Math.floor(Math.random()*Et.length)],r=Math.floor(9e15*Math.random())+1e15,e="amex"===t?4:3,n=Math.floor(Math.random()*Math.pow(10,e)).toString().padStart(e,"0"),o=(new Date).getFullYear(),i=Math.floor(12*Math.random())+1,a=o+Math.floor(10*Math.random())+1;return{brand:t,number:r.toString(),cvv:n,expirationDate:"".concat(i.toString().padStart(2,"0"),"/").concat(a)}},exports.getAspectRatio=function(t){var r,e=t.width,n=t.orientation,o=void 0===n?"landscape":n,i=t.aspectRatio||exports.AspectRatioEnum["16:9"],u=(null===(r=exports.AspectRatioEnum[i])||void 0===r?void 0:r.split(":").map(Number))||[16,9];switch(i){case"4:3":u=[4,3];break;case"16:9":default:u=[16,9];break;case"1:1":u=[1,1];break;case"3:2":u=[3,2];break;case"8:5":u=[8,5]}var s,f=a(u,2),c=f[0],l=f[1];return s="landscape"===o?e/(c/l):e*(l/c),{width:e,height:Math.round(s)}},exports.getAverage=function(t){if(!Array.isArray(t)||0===t.length)throw new Error("Input must be a non-empty array of numbers.");if(!t.every((function(t){return"number"==typeof t&&!isNaN(t)})))throw new Error("All elements in the array must be valid numbers.");return t.reduce((function(t,r){return t+r}),0)/t.length},exports.getFirstWordCapitalized=function(t){try{var r=t.trim().split(" ");if(0===r.length||""===r[0])return"";if(r&&r.length>1&&r[0]){var e=r[0];return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}return""}catch(t){throw new Error(String(t))}},exports.getMessageByField=function(t,r){var n=function(t){if(!bt(r)&&xt(t,r)){var e=xt(t,r);if("string"==typeof e)return e}else if(!bt(r)){var n=wt(t,r);if(n)return n}};if("string"==typeof t)return n(t)||void 0;if(Array.isArray(t)){var o,i=e(t);try{for(i.s();!(o=i.n()).done;){var a=n(o.value);if(a)return a}}catch(t){i.e(t)}finally{i.f()}}else;},exports.getMessageFromObject=wt,exports.getRandomValFromArray=function(t,r){var e;return 0===t.length?r:null!==(e=t[Math.floor(Math.random()*t.length)])&&void 0!==e?e:r},exports.getRange=function(t,r){return r<0?[]:Array.apply(0,Array(r)).map((function(r,e){return e+t}))},exports.getUniqueObjects=function(t,r){return t.map((function(t){return t[r]})).filter((function(t,r,e){return e.indexOf(t)===r})).map((function(r,e){return t[e]}))},exports.getValueFromObject=xt,exports.hasItemByLetterAndFilter=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"name",n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;return r.some((function(r){if(1!==t.length)throw new Error("Letter must be a single character.");var i=r[e]||null;if(!i)return!1;var a=function(t){return!o||[o,o.toLowerCase()].every((function(r){return t.includes(r)}))}(i),u=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return void 0===e&&(e=0),[r,r.toLowerCase()].some((function(r){return r.charAt(e)===t}))}(i,n);return!(!a||!u)}))},exports.hasOwnProp=$t,exports.isArrayBuffer=Zt,exports.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Zt(t.buffer)},exports.isBoolean=function(t){return!0===t||!1===t},exports.isBuffer=function(t){return null!==t&&!Jt(t)&&null!==t.constructor&&!Jt(t.constructor)&&kt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},exports.isContextDefined=function(t){return!Jt(t)&&t!==Kt},exports.isDate=Ht,exports.isDeepEqual=function t(r,e){if(r===e)return!0;if("object"!==s(r)||null===r||"object"!==s(e)||null===e)return!1;var n=Object.keys(r),o=Object.keys(e);if(n.length!==o.length)return!1;for(var i=0,a=n;i<a.length;i++){var u=a[i];if(!o.includes(u)||!t(r[u],e[u]))return!1}return!0},exports.isEmpty=bt,exports.isFile=Gt,exports.isFormData=function(t){var r;return!!t&&("function"==typeof FormData&&t instanceof FormData||Xt(t)&&Object.prototype.hasOwnProperty.call(t,"append")&&kt(t.append)&&("formdata"===(r=Dt(t))||"object"===r&&kt(t.toString)&&"[object FormData]"===t.toString()))},exports.isFunction=kt,exports.isGlobalDefined=Kt,exports.isJson=St,exports.isNumber=qt,exports.isNumeric=function(t){return"string"==typeof t?""!==t.trim()&&t.trim()===t&&(!isNaN(Number(t))&&isFinite(Number(t))):"number"==typeof t?!isNaN(t)&&isFinite(t):qt(t)},exports.isObject=Xt,exports.isPlainObject=Mt,exports.isRegExp=function(t){return Vt("RegExp")(t)},exports.isString=function(t){return Yt("string")(t)},exports.isUndefined=Jt,exports.isValidBase64=function(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))return!1;var r=t.length%4;if(1===r)return!1;if(0===r||2===r||3===r)return!0;var e=t.slice(-r);return!!/^=*$/.test(e)},exports.isValidBinary=function(t){return/^[01]+$/.test(t)},exports.isValidBlob=function(t){return"undefined"!=typeof Blob&&t instanceof Blob&&"[object Blob]"===ct.call(t)},exports.isValidStyle=function(t,r){var n=[].concat(u(Bt),u(r||[])),o=new Set(n.map((function(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()})));if(!(t=t.trim()))return!1;var i=t.split(";").filter((function(t){return t.trim()}));if(t&&!t.endsWith(";"))return!1;var s,f=e(i);try{for(f.s();!(s=f.n()).done;){var c=s.value.split(":").map((function(t){return t.trim()}));if(2!==c.length)return!1;var l=a(c,2),p=l[0],h=l[1];if(!o.has(p)||!h)return!1}}catch(t){f.e(t)}finally{f.f()}return!0},exports.jsonContainsNewLine=Ot,exports.kebabCase=function(t){return"string"!=typeof t?"":t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").toLowerCase().replace(/^-+|-+$/g,"")},exports.kindOf=Dt,exports.kindOfTest=Vt,exports.log=Pt,exports.logCondition=function(t,r){Pt(r?"green":"red",t)},exports.logEnd=function(t,r){jt();var e=r?" (".concat(r,")"):"";Pt("blue","==== END: ".concat(t).concat(e," ====")),jt()},exports.logError=function(t,r){var e="string"==typeof r?r:JSON.stringify(r,null,2);Tt("Error in ".concat(t,": ").concat(e),"red")},exports.logFunction=function(t,r,e){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bgBlue",o="object"===s(r)?JSON.stringify(r,null,2):String(r),i="Function: ".concat(t," ").concat(e?"- ".concat(e):""," | Variables: ").concat(o);Pt(n,i)},exports.logMessage=Tt,exports.logSeparator=jt,exports.logStart=function(t,r){jt();var e=r?" (".concat(r,")"):"";Pt("blue","==== START: ".concat(t).concat(e," ====")),jt()},exports.matchAll=ht,exports.merge=function t(){for(var r={},e=function(e,n){_t(e,n,r,t)},n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];for(var a=0,u=o;a<u.length;a++){var s=u[a];s&&l(s,e)}return r},exports.mergeObjects=function t(r,e){var n=i({},r);return Object.keys(e).forEach((function(r){var o=e[r],i=n[r];Array.isArray(o)&&Array.isArray(i)?n[r]=[].concat(u(i),u(o)):"object"!==s(o)||null===o||Array.isArray(o)||"object"!==s(i)||Array.isArray(i)?n[r]=o:n[r]=t(i,o)})),n},exports.parseHeaders=function(t)