/* Finka.js v2.4.3 | Copyright 2023 (c) Bitbar Technologies and contributors | https://github.com/bitbar/finka-js/blob/master/LICENSE.md */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).finka=e()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){var r=t[0],u=t[1],s=t[2],f=t[3];r=n(r,u,s,f,e[0],7,-680876936),f=n(f,r,u,s,e[1],12,-389564586),s=n(s,f,r,u,e[2],17,606105819),u=n(u,s,f,r,e[3],22,-1044525330),r=n(r,u,s,f,e[4],7,-176418897),f=n(f,r,u,s,e[5],12,1200080426),s=n(s,f,r,u,e[6],17,-1473231341),u=n(u,s,f,r,e[7],22,-45705983),r=n(r,u,s,f,e[8],7,1770035416),f=n(f,r,u,s,e[9],12,-1958414417),s=n(s,f,r,u,e[10],17,-42063),u=n(u,s,f,r,e[11],22,-1990404162),r=n(r,u,s,f,e[12],7,1804603682),f=n(f,r,u,s,e[13],12,-40341101),s=n(s,f,r,u,e[14],17,-1502002290),r=o(r,u=n(u,s,f,r,e[15],22,1236535329),s,f,e[1],5,-165796510),f=o(f,r,u,s,e[6],9,-1069501632),s=o(s,f,r,u,e[11],14,643717713),u=o(u,s,f,r,e[0],20,-373897302),r=o(r,u,s,f,e[5],5,-701558691),f=o(f,r,u,s,e[10],9,38016083),s=o(s,f,r,u,e[15],14,-660478335),u=o(u,s,f,r,e[4],20,-405537848),r=o(r,u,s,f,e[9],5,568446438),f=o(f,r,u,s,e[14],9,-1019803690),s=o(s,f,r,u,e[3],14,-187363961),u=o(u,s,f,r,e[8],20,1163531501),r=o(r,u,s,f,e[13],5,-1444681467),f=o(f,r,u,s,e[2],9,-51403784),s=o(s,f,r,u,e[7],14,1735328473),r=i(r,u=o(u,s,f,r,e[12],20,-1926607734),s,f,e[5],4,-378558),f=i(f,r,u,s,e[8],11,-2022574463),s=i(s,f,r,u,e[11],16,1839030562),u=i(u,s,f,r,e[14],23,-35309556),r=i(r,u,s,f,e[1],4,-1530992060),f=i(f,r,u,s,e[4],11,1272893353),s=i(s,f,r,u,e[7],16,-155497632),u=i(u,s,f,r,e[10],23,-1094730640),r=i(r,u,s,f,e[13],4,681279174),f=i(f,r,u,s,e[0],11,-358537222),s=i(s,f,r,u,e[3],16,-722521979),u=i(u,s,f,r,e[6],23,76029189),r=i(r,u,s,f,e[9],4,-640364487),f=i(f,r,u,s,e[12],11,-421815835),s=i(s,f,r,u,e[15],16,530742520),r=a(r,u=i(u,s,f,r,e[2],23,-995338651),s,f,e[0],6,-198630844),f=a(f,r,u,s,e[7],10,1126891415),s=a(s,f,r,u,e[14],15,-1416354905),u=a(u,s,f,r,e[5],21,-57434055),r=a(r,u,s,f,e[12],6,1700485571),f=a(f,r,u,s,e[3],10,-1894986606),s=a(s,f,r,u,e[10],15,-1051523),u=a(u,s,f,r,e[1],21,-2054922799),r=a(r,u,s,f,e[8],6,1873313359),f=a(f,r,u,s,e[15],10,-30611744),s=a(s,f,r,u,e[6],15,-1560198380),u=a(u,s,f,r,e[13],21,1309151649),r=a(r,u,s,f,e[4],6,-145523070),f=a(f,r,u,s,e[11],10,-1120210379),s=a(s,f,r,u,e[2],15,718787259),u=a(u,s,f,r,e[9],21,-343485551),t[0]=c(r,t[0]),t[1]=c(u,t[1]),t[2]=c(s,t[2]),t[3]=c(f,t[3])}function r(t,e,r,n,o,i){return e=c(c(e,t),c(n,i)),c(e<>>32-o,r)}function n(t,e,n,o,i,a,u){return r(e&n|~e&o,t,e,i,a,u)}function o(t,e,n,o,i,a,u){return r(e&o|n&~o,t,e,i,a,u)}function i(t,e,n,o,i,a,u){return r(e^n^o,t,e,i,a,u)}function a(t,e,n,o,i,a,u){return r(n^(e|~o),t,e,i,a,u)}function u(t){var e,r=[];for(e=0;e<64;e+=4)r[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return r}var s="0123456789abcdef".split("");function f(t){for(var e="",r=0;r<4;r++)e+=s[t>>8*r+4&15]+s[t>>8*r&15];return e}var c=function(t,e){return t+e&4294967295},l=function(t){return function(t){for(var e=0;e>2]|=t.charCodeAt(r)<<(r%4<<3);if(i[r>>2]|=128<<(r%4<<3),r>55)for(e(o,i),r=0;r<16;r++)i[r]=0;return i[14]=8*n,e(o,i),o}(t))};var h={constant:{isNodeJs:t.process&&t.process.release&&"node"===t.process.release.name},static:{getLanguage:function(){return(t.isNodeJs?process.env.LANGUAGE||process.env.LANG:navigator.language||navigator.languages&&navigator.languages[0]).substr(0,2)},getCountry:function(){if(void 0!==t.userCountry)return t.userCountry;var e;if(t.isNodeJs)e=process.env.LANG;else if((e=navigator.language).length<3&&navigator.languages)for(var r=0;r2){e=navigator.languages[r];break}var n=e.match(/^[a-z]{2}[_-]([A-Z]{2})/);return null!==n&&(e=n[1]),e},isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},parseValue:function(e){if("string"!=typeof e)return e;if(t.isNumeric(e))return parseFloat(e);var r=e.toLowerCase();return"true"===r||"false"===r?"true"===r:e},md5:l}};var g={static:{sortArrayOfObjects:function(t,e,r){var n,o,i=r?-1:1;t.sort((function(t,r){return n=t[e],o=r[e],"string"==typeof n&&(n=n.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),n>o?1*i:n0},isInvalidOrEmpty:function(t){return!Array.isArray(t)||0===t.length}},method:{empty:function(){return this.length=0,this},absorb:function(t){return this.push.apply(this,t),this},diff:function(t){return this.filter((function(e){return t.indexOf(e)<0}))},clone:function(){return Object.clone(this)},lookFor:function(t){for(var e=0;e0;t--){var e=Math.floor(Math.rand()*(t+1)),r=this[t];this[t]=this[e],this[e]=r}return this}}};var p={static:{xor:function(t,e){return!t!=!e}}};function v(t){return v="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},v(t)}var d=["AF","CN","HU","JP","KP","KR","LT","MN","TW"],m=["BZ","FM","US"],y=36e5,b=24*y;var O={constant:{SECOND:1e3,MINUTE:6e4,HOUR:y,DAY:b,WEEK:7*b},getter:{TODAY:function(){return b*Math.floor(Date.now()/b)},YESTERDAY:function(){return Date.TODAY-b},TOMORROW:function(){return Date.TODAY+b},DAYAFTERTOMORROW:function(){return Date.TOMORROW+b}},static:{parseValue:function(t){var e=v(t);if("string"!==e){if("number"===e||t instanceof Date)return new Date(t);throw new TypeError("Unsupported value type")}switch(t.toLowerCase()){case"today":return new Date(Date.TODAY);case"yesterday":return new Date(Date.YESTERDAY);case"tomorrow":return new Date(Date.TOMORROW);case"dayaftertomorrow":return new Date(Date.DAYAFTERTOMORROW);case"now":return new Date;default:throw new Error("Unsupported string: "+t)}},daysFromNow:function(t){return Date.now()+Date.DAY*t},getLocalDateFormat:function(e){var r,n;return void 0===e&&(e=!0),r=t.getCountry()||"US",n=d.indexOf(r)>=0?"y-m-d":m.indexOf(r)>=0?"m/d/y":"d.m.y",e&&(n=(n=(n=n.replace("d","dd")).replace("m","mm")).replace("y","yyyy")),n},getTimezoneName:function(){return(new this).toString().match(/\(([^)]+)\)$/)[1]},getHms:function(t){var e={h:0,m:0,s:0,ms:0};return e.ms=Math.max(0,t%1e3),t-=e.ms,t/=1e3,e.s=Math.max(0,t%60),t-=e.s,t/=60,e.m=Math.max(0,t%60),t-=e.m,t/=60,e.h=Math.max(0,t),e},toHmsFormat:function(t,e){void 0===e&&(e="seconds");var r=Date.getHms(t),n=[];switch(e){case"hours":n.push(r.h+"h");break;case"minutes":r.h>0&&n.push(r.h+"h"),n.push(r.m+"m");break;case"seconds":r.h>0&&n.push(r.h+"h"),r.m>0&&n.push(r.m+"m"),n.push(r.s+"s");break;default:throw new TypeError("Unknown accuracy")}return n.join(" ")},toStopwatchFormat:function(t){var e=Date.getHms(t),r=e.m.pad(2)+":"+e.s.pad(2)+"."+Math.floor(e.ms/100);return e.h>0&&(r=e.h.pad(2)+":"+r),r},toTimerFormat:function(t){var e=Date.getHms(t),r=e.m.pad(2)+":"+e.s.pad(2);return e.h>0&&(r=e.h.pad(2)+":"+r),r}},method:{daysPassed:function(t){var e=v(t);if("undefined"===e?t=new Date:"number"!==e&&"string"!==e||(t=new Date(t)),!(t instanceof Date))throw new TypeError("toDate is not instance of Date");return Math.floor(Math.abs((this.getTime()-t.getTime())/Date.DAY))},toCustomDate:function(t){return t=(t=(t=t.replace("d",this.getDate().pad(2))).replace("m",(this.getMonth()+1).pad(2))).replace("y",this.getFullYear())},toUiTime:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?":".concat(this.getSeconds().pad(2)):"";return this.getHours().pad(2)+":"+this.getMinutes().pad(2)+t},toUiDate:function(){return this.toCustomDate(Date.getLocalDateFormat(!1))},toUiDateTime:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.toUiDate()+" "+this.toUiTime(t)},toInputTimeFormat:function(){return this.toUiTime(!1)},toInputDateFormat:function(){return this.toCustomDate("y-m-d")},addTime:function(t){return this.setTime(this.getTime()+t)}}};var D={static:{isJSONString:function(t){try{JSON.parse(t)}catch(t){return!1}return!0}}};var A=function(){var t=Array.prototype.slice.call(arguments),e=4294967087,r=4294944443,n=12345,o=12345,i=123,a=12345,u=12345,s=123;0===t.length&&(t=[+new Date]);for(var f,c=(f=4022871197,function(t){t=t.toString();for(var e=0;e>>0,f=(r*=f)>>>0,f+=4294967296*(r-=f)}return 2.3283064365386963e-10*(f>>>0)}),l=0;l=0&&!Number.isNegativeZero(t)},isFloat:function(t){return Number.isNumber(t)&&t%1!=0}},method:{pad:function(t){var e=this.toString(),r=e.indexOf("."),n=t;n-=r>-1?r:e.length;for(var o=0;o0},isInvalidOrEmpty:function(t){return"string"!=typeof t||0===t.length}},method:{capitaliseFirstLetter:function(t){var e=this.valueOf();return t&&(e=e.toLowerCase()),e.replace(/[a-z]/i,(function(t){return t.toUpperCase()}))},lowerFirstLetter:function(){return this.valueOf().replace(/[a-z]/i,(function(t){return t.toLowerCase()}))},noCase:function(){var t=this.valueOf();return/^[A-Z0-9_]+$/.test(t)?t.replace(/_/g," ").toLowerCase():t=(t=(t=(t=(t=(t=(t=t.replace(/[-_]/g," ")).replace(/[^a-z0-9 ]/gi,"")).lowerFirstLetter()).replace(/([A-Za-z])([0-9])/g,(function(t,e,r){return e+" "+r}))).replace(/[A-Z][a-z]/g,(function(t){return" "+t.toLowerCase()}))).replace(/([a-z0-9])([A-Z])/g,(function(t,e,r){return e+" "+r}))).trim().replace(/\s{2,}/g," ")},toCamelCase:function(){var t=this.valueOf();return t=(t=t.noCase()).replace(/ [a-z0-9]/gi,(function(t){return t[1].toUpperCase()}))},toPascalCase:function(){return this.toCamelCase().capitaliseFirstLetter()},toKebabCase:function(){var t=this.valueOf();return t=(t=t.noCase()).replace(/\s/g,"-")},toSnakeCase:function(t){var e=t||!1,r=this.valueOf();return r=(r=r.noCase()).replace(/\s/g,"_"),e?r.toUpperCase():r},toChecksum:function(){var t,e,r;for(t=this.valueOf(),r=305419896,e=0;ethis.length)&&-1!==this.indexOf(t,r)}}};function E(t){this.bytes=t,this.toReadableString=function(){return E.getReadableString(this.bytes)}}E.UNITS=["B","KB","MB","GB","TB","EB","ZB","YB"],E.B=1,E.KB=1024*E.B,E.MB=1024*E.KB,E.GB=1024*E.MB,E.TB=1024*E.GB,E.EB=1024*E.TB,E.getReadableString=function(t){var e,r=t;for(e=0;e