@lizardbyte/shared-web 2025.1014.124946 → 2026.219.33142

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # shared-web
2
2
 
3
3
  [![GitHub stars](https://img.shields.io/github/stars/lizardbyte/shared-web.svg?logo=github&style=for-the-badge)](https://github.com/LizardByte/shared-web)
4
- [![GitHub Workflow Status (CI)](https://img.shields.io/github/actions/workflow/status/lizardbyte/shared-web/ci.yml.svg?branch=master&label=CI%20build&logo=github&style=for-the-badge)](https://github.com/LizardByte/shared-web/actions/workflows/CI.yml?query=branch%3Amaster)
4
+ [![GitHub Workflow Status (CI)](https://img.shields.io/github/actions/workflow/status/lizardbyte/shared-web/_ci-node.yml.svg?branch=master&label=CI%20build&logo=github&style=for-the-badge)](https://github.com/LizardByte/shared-web/actions/workflows/CI.yml?query=branch%3Amaster)
5
5
  [![Codecov](https://img.shields.io/codecov/c/gh/LizardByte/shared-web?token=gWHqqpMAuO&style=for-the-badge&logo=codecov&label=codecov)](https://codecov.io/gh/LizardByte/shared-web)
6
6
  [![NPM Monthly Downloads](https://img.shields.io/npm/dm/%40lizardbyte%2Fshared-web?style=for-the-badge&logo=npm&label=npm%20downloads/m)](https://www.npmjs.com/package/@lizardbyte/shared-web)
7
7
  [![NPM Version](https://img.shields.io/npm/v/%40lizardbyte%2Fshared-web?style=for-the-badge&logo=npm&label=npm%20version)](https://www.npmjs.com/package/@lizardbyte/shared-web)
@@ -16,7 +16,7 @@ Common web assets for use in LizardByte projects.
16
16
 
17
17
  1. Add the dependency to your package.json file:
18
18
  ```bash
19
- npm install @lizardbyte/shared-web
19
+ npm install @lizardbyte/shared-web --ignore-scripts
20
20
  ```
21
21
 
22
22
  ### Install via GitHub Package Registry
@@ -26,7 +26,7 @@ Common web assets for use in LizardByte projects.
26
26
  //npm.pkg.github.com/:_authToken=TOKEN
27
27
  @lizardbyte:registry=https://npm.pkg.github.com
28
28
  ```
29
-
29
+
30
30
  Replace `TOKEN` with a valid GitHub token with read access to the package registry.
31
31
 
32
32
  See
@@ -35,5 +35,5 @@ Common web assets for use in LizardByte projects.
35
35
 
36
36
  2. Add the dependency to your package.json file:
37
37
  ```bash
38
- npm install @lizardbyte/shared-web
38
+ npm install @lizardbyte/shared-web --ignore-scripts
39
39
  ```
package/dist/crowdin.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var e={714:(e,t,o)=>{var n=o(836);function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"LizardByte",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;["LizardByte","LizardByte-docs"].includes(e)?["sphinx",null].includes(t)?n("https://proxy-translator.app.crowdin.net/assets/proxy-translator.js",function(){var o={LizardByte:{baseUrl:"https://app.lizardbyte.dev",valuesParams:"U2FsdGVkX193b3LJT2/HWNIVSb3D61klmnbJ+dvGjoY2XSu35S3gL3FRLBfiXVk4nRsFlfzaC0R7JrklvnS7Xqz5im/VrO+sGzo3LbebxNIMp8LZe28udpnJcA2I2u8B",filePath:"/app.lizardbyte.dev.json",distribution:"0913bb75b61f0b26247ffa91bw4"},"LizardByte-docs":{baseUrl:"https://docs.lizardbyte.dev",valuesParams:"U2FsdGVkX19eQczbrFgaLYbrEBP8is5CVpC2YSnXxH/sRjWqaBtQOsLZJbSRMepcn3D2sofzZxALb2pvT3MLmM+WG5EpWSF7CzzYsAOJ+k/FpMUJ1PZ1FQmmlKCIWyD7",filePath:"/docs.lizardbyte.dev.json",distribution:"fb3b3d5c18de9bc717d96b91bw4"}},n={bg:{code:"bg",name:"Bulgarian",twoLettersCode:"bg"},de:{code:"de",name:"German",twoLettersCode:"de"},en:{code:"en",name:"English",twoLettersCode:"en"},"en-GB":{code:"en-GB",name:"English, United Kingdom",twoLettersCode:"en"},"en-US":{code:"en-US",name:"English, United States",twoLettersCode:"en"},"es-ES":{code:"es-ES",name:"Spanish",twoLettersCode:"es"},fr:{code:"fr",name:"French",twoLettersCode:"fr"},it:{code:"it",name:"Italian",twoLettersCode:"it"},ja:{code:"ja",name:"Japanese",twoLettersCode:"ja"},ko:{code:"ko",name:"Korean",twoLettersCode:"ko"},pl:{code:"pl",name:"Polish",twoLettersCode:"pl"},"pt-BR":{code:"pt-BR",name:"Portuguese, Brazilian",twoLettersCode:"pt"},"pt-PT":{code:"pt-PT",name:"Portuguese",twoLettersCode:"pt"},ru:{code:"ru",name:"Russian",twoLettersCode:"ru"},"sv-SE":{code:"sv-SE",name:"Swedish",twoLettersCode:"sv"},tr:{code:"tr",name:"Turkish",twoLettersCode:"tr"},uk:{code:"uk",name:"Ukrainian",twoLettersCode:"uk"},"zh-CN":{code:"zh-CN",name:"Chinese Simplified",twoLettersCode:"zh"},"zh-TW":{code:"zh-TW",name:"Chinese Traditional",twoLettersCode:"zh"}};if(n=Object.fromEntries(Object.entries(n).sort(function(e,t){return e[1].name.localeCompare(t[1].name)})),window.proxyTranslator.init({baseUrl:o[e].baseUrl,appUrl:"https://proxy-translator.app.crowdin.net",valuesParams:o[e].valuesParams,distributionBaseUrl:"https://distributions.crowdin.net",filePath:o[e].filePath,distribution:o[e].distribution,distributionSeparateFiles:void 0,languagesData:n,defaultLanguage:"en",defaultLanguageTitle:"English",languageDetectType:"default",poweredBy:!1,position:"bottom-left",submenuPosition:"top-left"}),null!==t){var r=document.getElementById("crowdin-language-picker"),a=document.getElementsByClassName("cr-picker-button")[0];"sphinx"===t&&(r.classList.remove("cr-position-bottom-left"),r.style.width=a.offsetWidth+10+"px",r.style.position="relative",r.style.left="10px",r.style.bottom="10px",document.getElementsByClassName("sidebar-sticky")[0].appendChild(r))}}):console.error('Invalid UI. Must be "sphinx", or null'):console.error('Invalid project. Must be "LizardByte" or "LizardByte-docs"')}"undefined"!=typeof window&&(window.initCrowdIn=r),e.exports=r},836:e=>{function t(e,t){var o=document.createElement("script");o.src=e,o.async=!0,o.onload=function(){t&&t(null,o)},o.onerror=function(){t&&t(new Error("Failed to load script: ".concat(e)))},document.head.appendChild(o)}"undefined"!=typeof window&&(window.loadScript=t),e.exports=t}},t={};!function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}(714)})();
1
+ (()=>{var e={714(e,t,i){var n=i(836);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"LizardByte",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;["LizardByte","LizardByte-docs"].includes(e)?["sphinx",null].includes(t)?n("https://website-translator.app.crowdin.net/assets/proxy-translator.js",function(){var i={bg:"Български (Bulgarian)",cs:"Čeština (Czech)",de:"Deutsch (German)",en:"English","en-GB":"English, United Kingdom","en-US":"English, United States","es-ES":"Español (Spanish)",fr:"Français (French)",hu:"Magyar (Hungarian)",it:"Italiano (Italian)",ja:"日本語 (Japanese)",ko:"한국어 (Korean)",pl:"Polski (Polish)","pt-BR":"Português, Brasileiro (Portuguese, Brazilian)","pt-PT":"Português (Portuguese)",ru:"Русский (Russian)","sv-SE":"svenska (Swedish)",tr:"Türkçe (Turkish)",uk:"Українська (Ukranian)",vi:"Tiếng Việt (Vietnamese)","zh-CN":"简体中文 (Chinese Simplified)","zh-TW":"繁體中文 (Chinese Traditional)"};i=Object.fromEntries(Object.entries(i).sort(function(e,t){return e[1].localeCompare(t[1])}));var n=globalThis.location.origin;if(globalThis.proxyTranslator.init({baseUrl:n,distribution:{LizardByte:{baseUrl:"https://app.lizardbyte.dev",distribution:"458f881791aebba1d4dde491bw4"},"LizardByte-docs":{baseUrl:"https://docs.lizardbyte.dev",distribution:"d6c830ba4b41106fefe5d391bw4"}}[e].distribution,defaultLanguage:"en",languageTitles:i,showDefaultLanguageInUrl:!1,languageRoutingMethod:"query",position:"bottom-left",submenuPosition:"top-left",poweredBy:!1}),null!==t){var o=document.getElementById("crowdin-language-picker"),r=document.getElementsByClassName("cr-picker-button")[0];"sphinx"===t&&(o.classList.remove("cr-position-bottom-left"),o.style.width=r.offsetWidth+10+"px",o.style.position="relative",o.style.left="10px",o.style.bottom="10px",document.getElementsByClassName("sidebar-sticky")[0].appendChild(o))}}):console.error('Invalid UI. Must be "sphinx", or null'):console.error('Invalid project. Must be "LizardByte" or "LizardByte-docs"')}"undefined"!=typeof globalThis&&void 0!==globalThis.window&&(globalThis.initCrowdIn=o),e.exports=o},836(e){function t(e,t){var i=document.createElement("script");i.src=e,i.async=!0,i.onload=function(){t&&t(null,i)},i.onerror=function(){t&&t(new Error("Failed to load script: ".concat(e)))},document.head.appendChild(i)}"undefined"!=typeof window&&(window.loadScript=t),e.exports=t}},t={};!function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}(714)})();
2
2
  //# sourceMappingURL=crowdin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"crowdin.js","mappings":"2BAAA,IAAMA,EAAaC,EAAQ,KAO3B,SAASC,IAAqD,IAAzCC,EAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,aAAcG,EAAQH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,KAE/C,CAAC,aAAc,mBAAmBI,SAASL,GAI3C,CAAC,SAAU,MAAMK,SAASD,GAK/BP,EAAW,sEAAuE,WAE9E,IAAMS,EAAkB,CACpB,WAAc,CACVC,QAAS,6BACTC,aAAc,mIACdC,SAAU,2BACVC,aAAc,+BAElB,kBAAmB,CACfH,QAAS,8BACTC,aAAc,mIACdC,SAAU,4BACVC,aAAc,gCAIlBC,EAAgB,CAChB,GAAK,CAAC,KAAO,KAAK,KAAO,YAAY,eAAiB,MACtD,GAAK,CAAC,KAAO,KAAK,KAAO,SAAS,eAAiB,MACnD,GAAK,CAAC,KAAO,KAAK,KAAO,UAAU,eAAiB,MACpD,QAAQ,CAAC,KAAO,QAAQ,KAAO,0BAA0B,eAAiB,MAC1E,QAAQ,CAAC,KAAO,QAAQ,KAAO,yBAAyB,eAAiB,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G,uBAAuB,oBAAoB,GAElD,WAAbhC,IACA4B,EAAUK,UAAUC,OAAO,2BAC3BN,EAAUO,MAAMC,MAAQL,EAAOM,YAAc,GAAK,KAClDT,EAAUO,MAAMT,SAAW,WAC3BE,EAAUO,MAAMG,KAAO,OACvBV,EAAUO,MAAMI,OAAS,OAGTV,SAASG,uBAAuB,kBAAkB,GAG1DQ,YAAYZ,GAhBxB,CAkBJ,GApFIa,QAAQC,MAAM,yCAJdD,QAAQC,MAAM,6DAyFtB,CAGsB,oBAAX1B,SACPA,OAAOrB,YAAcA,GAGzBgD,EAAOC,QAAUjD,C,UCrGjB,SAASF,EAAWoD,EAAKC,GACrB,IAAMC,EAASlB,SAASmB,cAAc,UACtCD,EAAOE,IAAMJ,EACbE,EAAOG,OAAQ,EAEfH,EAAOI,OAAS,WACRL,GAAUA,EAAS,KAAMC,EACjC,EAEAA,EAAOK,QAAU,WACTN,GAAUA,EAAS,IAAIO,MAAM,0BAADC,OAA2BT,IAC/D,EAEAhB,SAAS0B,KAAKf,YAAYO,EAC9B,CAGsB,oBAAX/B,SACPA,OAAOvB,WAAaA,GAGxBkD,EAAOC,QAAUnD,C,GCzBb+D,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB3D,IAAjB4D,EACH,OAAOA,EAAaf,QAGrB,IAAID,EAASa,EAAyBE,GAAY,CAGjDd,QAAS,CAAC,GAOX,OAHAgB,EAAoBF,GAAUf,EAAQA,EAAOC,QAASa,GAG/Cd,EAAOC,OACf,CCnB0Ba,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/crowdin.js","webpack://@lizardbyte/shared-web/./src/js/load-script.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["const loadScript = require('./load-script');\n\n/**\n * Initializes Crowdin translation widget based on project and UI platform.\n * @param {string} project - Project name ('LizardByte' or 'LizardByte-docs').\n * @param {string|null} platform - UI platform ('sphinx', or null).\n */\nfunction initCrowdIn(project = 'LizardByte', platform = null) {\n // Input validation\n if (!['LizardByte', 'LizardByte-docs'].includes(project)) {\n console.error('Invalid project. Must be \"LizardByte\" or \"LizardByte-docs\"');\n return;\n }\n if (!['sphinx', null].includes(platform)) {\n console.error('Invalid UI. Must be \"sphinx\", or null');\n return;\n }\n\n loadScript('https://proxy-translator.app.crowdin.net/assets/proxy-translator.js', function() {\n // Configure base settings based on project\n const projectSettings = {\n 'LizardByte': {\n baseUrl: \"https://app.lizardbyte.dev\",\n valuesParams: \"U2FsdGVkX193b3LJT2/HWNIVSb3D61klmnbJ+dvGjoY2XSu35S3gL3FRLBfiXVk4nRsFlfzaC0R7JrklvnS7Xqz5im/VrO+sGzo3LbebxNIMp8LZe28udpnJcA2I2u8B\",\n filePath: \"/app.lizardbyte.dev.json\",\n distribution: \"0913bb75b61f0b26247ffa91bw4\",\n },\n 'LizardByte-docs': {\n baseUrl: \"https://docs.lizardbyte.dev\",\n valuesParams: \"U2FsdGVkX19eQczbrFgaLYbrEBP8is5CVpC2YSnXxH/sRjWqaBtQOsLZJbSRMepcn3D2sofzZxALb2pvT3MLmM+WG5EpWSF7CzzYsAOJ+k/FpMUJ1PZ1FQmmlKCIWyD7\",\n filePath: \"/docs.lizardbyte.dev.json\",\n distribution: \"fb3b3d5c18de9bc717d96b91bw4\",\n }\n };\n\n let languagesData = {\n \"bg\":{\"code\":\"bg\",\"name\":\"Bulgarian\",\"twoLettersCode\":\"bg\"},\n \"de\":{\"code\":\"de\",\"name\":\"German\",\"twoLettersCode\":\"de\"},\n \"en\":{\"code\":\"en\",\"name\":\"English\",\"twoLettersCode\":\"en\"},\n \"en-GB\":{\"code\":\"en-GB\",\"name\":\"English, United Kingdom\",\"twoLettersCode\":\"en\"},\n \"en-US\":{\"code\":\"en-US\",\"name\":\"English, United States\",\"twoLettersCode\":\"en\"},\n \"es-ES\":{\"code\":\"es-ES\",\"name\":\"Spanish\",\"twoLettersCode\":\"es\"},\n \"fr\":{\"code\":\"fr\",\"name\":\"French\",\"twoLettersCode\":\"fr\"},\n \"it\":{\"code\":\"it\",\"name\":\"Italian\",\"twoLettersCode\":\"it\"},\n \"ja\":{\"code\":\"ja\",\"name\":\"Japanese\",\"twoLettersCode\":\"ja\"},\n \"ko\":{\"code\":\"ko\",\"name\":\"Korean\",\"twoLettersCode\":\"ko\"},\n \"pl\":{\"code\":\"pl\",\"name\":\"Polish\",\"twoLettersCode\":\"pl\"},\n \"pt-BR\":{\"code\":\"pt-BR\",\"name\":\"Portuguese, Brazilian\",\"twoLettersCode\":\"pt\"},\n \"pt-PT\":{\"code\":\"pt-PT\",\"name\":\"Portuguese\",\"twoLettersCode\":\"pt\"},\n \"ru\":{\"code\":\"ru\",\"name\":\"Russian\",\"twoLettersCode\":\"ru\"},\n \"sv-SE\":{\"code\":\"sv-SE\",\"name\":\"Swedish\",\"twoLettersCode\":\"sv\"},\n \"tr\":{\"code\":\"tr\",\"name\":\"Turkish\",\"twoLettersCode\":\"tr\"},\n \"uk\":{\"code\":\"uk\",\"name\":\"Ukrainian\",\"twoLettersCode\":\"uk\"},\n \"zh-CN\":{\"code\":\"zh-CN\",\"name\":\"Chinese Simplified\",\"twoLettersCode\":\"zh\"},\n \"zh-TW\":{\"code\":\"zh-TW\",\"name\":\"Chinese Traditional\",\"twoLettersCode\":\"zh\"},\n };\n // sort languages by name\n languagesData = Object.fromEntries(Object.entries(languagesData).sort((a, b) => a[1].name.localeCompare(b[1].name)));\n\n // Initialize Crowdin translator\n window.proxyTranslator.init({\n baseUrl: projectSettings[project].baseUrl,\n appUrl: \"https://proxy-translator.app.crowdin.net\",\n valuesParams: projectSettings[project].valuesParams,\n distributionBaseUrl: \"https://distributions.crowdin.net\",\n filePath: projectSettings[project].filePath,\n distribution: projectSettings[project].distribution,\n distributionSeparateFiles: undefined,\n languagesData: languagesData,\n defaultLanguage: \"en\",\n defaultLanguageTitle: \"English\",\n languageDetectType: \"default\",\n poweredBy: false,\n position: \"bottom-left\",\n submenuPosition: \"top-left\",\n });\n\n // Apply styling based on UI framework\n if (platform === null) {\n return;\n }\n\n const container = document.getElementById('crowdin-language-picker');\n const button = document.getElementsByClassName('cr-picker-button')[0];\n\n if (platform === 'sphinx') {\n container.classList.remove('cr-position-bottom-left')\n container.style.width = button.offsetWidth + 10 + 'px';\n container.style.position = 'relative';\n container.style.left = '10px';\n container.style.bottom = '10px';\n\n // get rst versions\n const sidebar = document.getElementsByClassName('sidebar-sticky')[0];\n\n // move button to related pages\n sidebar.appendChild(container);\n }\n });\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.initCrowdIn = initCrowdIn;\n}\n\nmodule.exports = initCrowdIn;\n","/**\n * Load a script asynchronously, and add it to the DOM. Optionally, call a callback when the script has loaded.\n * @param {string} url The URL of the script to load.\n * @param {Function} callback An optional callback to call when the script has loaded.\n */\nfunction loadScript(url, callback) {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n\n script.onload = () => {\n if (callback) callback(null, script);\n };\n\n script.onerror = () => {\n if (callback) callback(new Error(`Failed to load script: ${url}`));\n };\n\n document.head.appendChild(script);\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.loadScript = loadScript;\n}\n\nmodule.exports = loadScript;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(714);\n"],"names":["loadScript","require","initCrowdIn","project","arguments","length","undefined","platform","includes","projectSettings","baseUrl","valuesParams","filePath","distribution","languagesData","Object","fromEntries","entries","sort","a","b","name","localeCompare","window","proxyTranslator","init","appUrl","distributionBaseUrl","distributionSeparateFiles","defaultLanguage","defaultLanguageTitle","languageDetectType","poweredBy","position","submenuPosition","container","document","getElementById","button","getElementsByClassName","classList","remove","style","width","offsetWidth","left","bottom","appendChild","console","error","module","exports","url","callback","script","createElement","src","async","onload","onerror","Error","concat","head","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"crowdin.js","mappings":"wBAAA,IAAMA,EAAaC,EAAQ,KAO3B,SAASC,IAAqD,IAAzCC,EAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,aAAcG,EAAQH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,KAE/C,CAAC,aAAc,mBAAmBI,SAASL,GAI3C,CAAC,SAAU,MAAMK,SAASD,GAK/BP,EAAW,wEAAyE,WAEhF,IAWIS,EAAiB,CACjB,GAAM,wBACN,GAAM,kBACN,GAAM,mBACN,GAAM,UACN,QAAS,0BACT,QAAS,yBACT,QAAS,oBACT,GAAM,oBACN,GAAM,qBACN,GAAM,qBACN,GAAM,iBACN,GAAM,eACN,GAAM,kBACN,QAAS,gDACT,QAAS,yBACT,GAAM,oBACN,QAAS,oBACT,GAAM,mBACN,GAAM,wBACN,GAAM,0BACN,QAAS,4BACT,QAAS,8BAGbA,EAAiBC,OAAOC,YAAYD,OAAOE,QAAQH,GAAgBI,KAAK,SAACC,EAAGC,GAAC,OAAKD,EAAE,GAAGE,cAAcD,EAAE,GAAG,IAG1G,IAAIE,EAAiBC,WAAWC,SAASC,OAgBzC,GAbAF,WAAWG,gBAAgBC,KAAK,CAC5BC,QAASN,EACTO,aA5CoB,CACpB,WAAc,CACVD,QAAS,6BACTC,aAA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,OACf,CCnB0Ba,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/crowdin.js","webpack://@lizardbyte/shared-web/./src/js/load-script.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["const loadScript = require('./load-script');\n\n/**\n * Initializes Crowdin translation widget based on project and UI platform.\n * @param {string} project - Project name ('LizardByte' or 'LizardByte-docs').\n * @param {string|null} platform - UI platform ('sphinx', or null).\n */\nfunction initCrowdIn(project = 'LizardByte', platform = null) {\n // Input validation\n if (!['LizardByte', 'LizardByte-docs'].includes(project)) {\n console.error('Invalid project. Must be \"LizardByte\" or \"LizardByte-docs\"');\n return;\n }\n if (!['sphinx', null].includes(platform)) {\n console.error('Invalid UI. Must be \"sphinx\", or null');\n return;\n }\n\n loadScript('https://website-translator.app.crowdin.net/assets/proxy-translator.js', function() {\n // Configure base settings based on project\n const projectSettings = {\n 'LizardByte': {\n baseUrl: \"https://app.lizardbyte.dev\",\n distribution: \"458f881791aebba1d4dde491bw4\",\n },\n 'LizardByte-docs': {\n baseUrl: \"https://docs.lizardbyte.dev\",\n distribution: \"d6c830ba4b41106fefe5d391bw4\",\n }\n };\n\n let languageTitles = {\n \"bg\": \"Български (Bulgarian)\",\n \"cs\": \"Čeština (Czech)\",\n \"de\": \"Deutsch (German)\",\n \"en\": \"English\",\n \"en-GB\": \"English, United Kingdom\",\n \"en-US\": \"English, United States\",\n \"es-ES\": \"Español (Spanish)\",\n \"fr\": \"Français (French)\",\n \"hu\": \"Magyar (Hungarian)\",\n \"it\": \"Italiano (Italian)\",\n \"ja\": \"日本語 (Japanese)\",\n \"ko\": \"한국어 (Korean)\",\n \"pl\": \"Polski (Polish)\",\n \"pt-BR\": \"Português, Brasileiro (Portuguese, Brazilian)\",\n \"pt-PT\": \"Português (Portuguese)\",\n \"ru\": \"Русский (Russian)\",\n \"sv-SE\": \"svenska (Swedish)\",\n \"tr\": \"Türkçe (Turkish)\",\n \"uk\": \"Українська (Ukranian)\",\n \"vi\": \"Tiếng Việt (Vietnamese)\",\n \"zh-CN\": \"简体中文 (Chinese Simplified)\",\n \"zh-TW\": \"繁體中文 (Chinese Traditional)\",\n };\n // sort languages by name\n languageTitles = Object.fromEntries(Object.entries(languageTitles).sort((a, b) => a[1].localeCompare(b[1])));\n\n // use this to allow translations to work on PR preview builds\n let currentBaseUrl = globalThis.location.origin;\n\n // Initialize Crowdin translator\n globalThis.proxyTranslator.init({\n baseUrl: currentBaseUrl,\n distribution: projectSettings[project].distribution,\n defaultLanguage: \"en\",\n languageTitles: languageTitles,\n showDefaultLanguageInUrl: false,\n languageRoutingMethod: \"query\",\n position: \"bottom-left\",\n submenuPosition: \"top-left\",\n poweredBy: false,\n });\n\n // Apply styling based on UI framework\n if (platform === null) {\n return;\n }\n\n const container = document.getElementById('crowdin-language-picker');\n const button = document.getElementsByClassName('cr-picker-button')[0];\n\n if (platform === 'sphinx') {\n container.classList.remove('cr-position-bottom-left')\n container.style.width = button.offsetWidth + 10 + 'px';\n container.style.position = 'relative';\n container.style.left = '10px';\n container.style.bottom = '10px';\n\n // get rst versions\n const sidebar = document.getElementsByClassName('sidebar-sticky')[0];\n\n // move button to related pages\n sidebar.appendChild(container);\n }\n });\n}\n\n// Expose to the global scope\nif (typeof globalThis !== 'undefined' && globalThis.window !== undefined) {\n globalThis.initCrowdIn = initCrowdIn;\n}\n\nmodule.exports = initCrowdIn;\n","/**\n * Load a script asynchronously, and add it to the DOM. Optionally, call a callback when the script has loaded.\n * @param {string} url The URL of the script to load.\n * @param {Function} callback An optional callback to call when the script has loaded.\n */\nfunction loadScript(url, callback) {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n\n script.onload = () => {\n if (callback) callback(null, script);\n };\n\n script.onerror = () => {\n if (callback) callback(new Error(`Failed to load script: ${url}`));\n };\n\n document.head.appendChild(script);\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.loadScript = loadScript;\n}\n\nmodule.exports = loadScript;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(714);\n"],"names":["loadScript","require","initCrowdIn","project","arguments","length","undefined","platform","includes","languageTitles","Object","fromEntries","entries","sort","a","b","localeCompare","currentBaseUrl","globalThis","location","origin","proxyTranslator","init","baseUrl","distribution","defaultLanguage","showDefaultLanguageInUrl","languageRoutingMethod","position","submenuPosition","poweredBy","container","document","getElementById","button","getElementsByClassName","classList","remove","style","width","offsetWidth","left","bottom","appendChild","console","error","window","module","exports","url","callback","script","createElement","src","async","onload","onerror","Error","concat","head","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (()=>{var e={415:e=>{function r(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e>=1e6?(e/1e6).toFixed(r)+"M":e>=1e3?(e/1e3).toFixed(r)+"k":e.toString()}"undefined"!=typeof window&&(window.formatNumber=r),e.exports=r}},r={};!function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return e[o](i,i.exports,t),i.exports}(415)})();
1
+ (()=>{var e={415(e){function r(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e>=1e6?(e/1e6).toFixed(r)+"M":e>=1e3?(e/1e3).toFixed(r)+"k":e.toString()}"undefined"!=typeof window&&(window.formatNumber=r),e.exports=r}},r={};!function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return e[o](i,i.exports,t),i.exports}(415)})();
2
2
  //# sourceMappingURL=format-number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-number.js","mappings":"qBAMA,SAASA,EAAaC,GAAwB,IAAnBC,EAAaC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,EACvC,OAAIF,GAAO,KACCA,EAAM,KAASK,QAAQJ,GAAiB,IACzCD,GAAO,KACNA,EAAM,KAAMK,QAAQJ,GAAiB,IAEtCD,EAAIM,UAEnB,CAGsB,oBAAXC,SACPA,OAAOR,aAAeA,GAG1BS,EAAOC,QAAUV,C,GCpBbW,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBR,IAAjBS,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAK,EAAoBF,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/format-number.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Format a number to a human-readable string.\n * @param {number} num The number to format.\n * @param {number} decimalPlaces The number of decimal places to include in the formatted string.\n * @returns {string} The formatted number as a string with suffix (k, M, etc.).\n */\nfunction formatNumber(num, decimalPlaces = 1) {\n if (num >= 1000000) {\n return (num / 1000000).toFixed(decimalPlaces) + 'M';\n } else if (num >= 1000) {\n return (num / 1000).toFixed(decimalPlaces) + 'k';\n } else {\n return num.toString()\n }\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.formatNumber = formatNumber;\n}\n\nmodule.exports = formatNumber;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(415);\n"],"names":["formatNumber","num","decimalPlaces","arguments","length","undefined","toFixed","toString","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"format-number.js","mappings":"oBAMA,SAASA,EAAaC,GAAwB,IAAnBC,EAAaC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,EACvC,OAAIF,GAAO,KACCA,EAAM,KAASK,QAAQJ,GAAiB,IACzCD,GAAO,KACNA,EAAM,KAAMK,QAAQJ,GAAiB,IAEtCD,EAAIM,UAEnB,CAGsB,oBAAXC,SACPA,OAAOR,aAAeA,GAG1BS,EAAOC,QAAUV,C,GCpBbW,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBR,IAAjBS,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAK,EAAoBF,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/format-number.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Format a number to a human-readable string.\n * @param {number} num The number to format.\n * @param {number} decimalPlaces The number of decimal places to include in the formatted string.\n * @returns {string} The formatted number as a string with suffix (k, M, etc.).\n */\nfunction formatNumber(num, decimalPlaces = 1) {\n if (num >= 1000000) {\n return (num / 1000000).toFixed(decimalPlaces) + 'M';\n } else if (num >= 1000) {\n return (num / 1000).toFixed(decimalPlaces) + 'k';\n } else {\n return num.toString()\n }\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.formatNumber = formatNumber;\n}\n\nmodule.exports = formatNumber;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(415);\n"],"names":["formatNumber","num","decimalPlaces","arguments","length","undefined","toFixed","toString","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (()=>{var t={83:t=>{function n(t,n){if(0===t.length)return n.length;if(0===n.length)return t.length;var e,r,h=[];for(e=0;e<=n.length;e++)h[e]=[e];for(r=0;r<=t.length;r++)h[0][r]=r;for(e=1;e<=n.length;e++)for(r=1;r<=t.length;r++)n.charAt(e-1)===t.charAt(r-1)?h[e][r]=h[e-1][r-1]:h[e][r]=Math.min(h[e-1][r-1]+1,Math.min(h[e][r-1]+1,h[e-1][r]+1));return 100*(1-h[n.length][t.length]/Math.max(t.length,n.length))}"undefined"!=typeof window&&(window.levenshteinDistance=n),t.exports=n}},n={};!function e(r){var h=n[r];if(void 0!==h)return h.exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}(83)})();
1
+ (()=>{var t={83(t){function n(t,n){if(0===t.length)return n.length;if(0===n.length)return t.length;var e,r,h=[];for(e=0;e<=n.length;e++)h[e]=[e];for(r=0;r<=t.length;r++)h[0][r]=r;for(e=1;e<=n.length;e++)for(r=1;r<=t.length;r++)n.charAt(e-1)===t.charAt(r-1)?h[e][r]=h[e-1][r-1]:h[e][r]=Math.min(h[e-1][r-1]+1,Math.min(h[e][r-1]+1,h[e-1][r]+1));return 100*(1-h[n.length][t.length]/Math.max(t.length,n.length))}"undefined"!=typeof window&&(window.levenshteinDistance=n),t.exports=n}},n={};!function e(r){var h=n[r];if(void 0!==h)return h.exports;var o=n[r]={exports:{}};return t[r](o,o.exports,e),o.exports}(83)})();
2
2
  //# sourceMappingURL=levenshtein-distance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"levenshtein-distance.js","mappings":"oBAMA,SAASA,EAAoBC,EAAGC,GAC5B,GAAiB,IAAbD,EAAEE,OAAc,OAAOD,EAAEC,OAC7B,GAAiB,IAAbD,EAAEC,OAAc,OAAOF,EAAEE,OAE7B,IAGIC,EAMAC,EATAC,EAAS,GAIb,IAAKF,EAAI,EAAGA,GAAKF,EAAEC,OAAQC,IACvBE,EAAOF,GAAK,CAACA,GAKjB,IAAKC,EAAI,EAAGA,GAAKJ,EAAEE,OAAQE,IACvBC,EAAO,GAAGD,GAAKA,EAInB,IAAKD,EAAI,EAAGA,GAAKF,EAAEC,OAAQC,IACvB,IAAKC,EAAI,EAAGA,GAAKJ,EAAEE,OAAQE,IACnBH,EAAEK,OAAOH,EAAI,KAAOH,EAAEM,OAAOF,EAAI,GACjCC,EAAOF,GAAGC,GAAKC,EAAOF,EAAI,GAAGC,EAAI,GAEjCC,EAAOF,GAAGC,GAAKG,KAAKC,IAAIH,EAAOF,EAAI,GAAGC,EAAI,GAAK,EAC3CG,KAAKC,IAAIH,EAAOF,GAAGC,EAAI,GAAK,EACxBC,EAAOF,EAAI,GAAGC,GAAK,IAMvC,OAA2E,KAAnE,EAAKC,EAAOJ,EAAEC,QAAQF,EAAEE,QAAUK,KAAKE,IAAIT,EAAEE,OAAQD,EAAEC,QACnE,CAGsB,oBAAXQ,SACPA,OAAOX,oBAAsBA,GAGjCY,EAAOC,QAAUb,C,GC7Cbc,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,G","sources":["webpack://@lizardbyte/shared-web/./src/js/levenshtein-distance.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Calculate the levenshtein distance between two strings.\n * @param {string} a - The first string to compare.\n * @param {string} b - The second string to compare.\n * @returns {number|*} - The percentage of the levenshtein distance.\n */\nfunction levenshteinDistance(a, b) {\n if (a.length === 0) return b.length;\n if (b.length === 0) return a.length;\n\n let matrix = [];\n\n // increment along the first column of each row\n let i;\n for (i = 0; i <= b.length; i++) {\n matrix[i] = [i];\n }\n\n // increment each column in the first row\n let j;\n for (j = 0; j <= a.length; j++) {\n matrix[0][j] = j;\n }\n\n // Fill in the rest of the matrix\n for (i = 1; i <= b.length; i++) {\n for (j = 1; j <= a.length; j++) {\n if (b.charAt(i - 1) === a.charAt(j - 1)) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution\n Math.min(matrix[i][j - 1] + 1, // insertion\n matrix[i - 1][j] + 1)); // deletion\n }\n }\n }\n\n // return the percentage of the levenshtein distance\n return (1 - (matrix[b.length][a.length] / Math.max(a.length, b.length))) * 100\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.levenshteinDistance = levenshteinDistance;\n}\n\nmodule.exports = levenshteinDistance;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(83);\n"],"names":["levenshteinDistance","a","b","length","i","j","matrix","charAt","Math","min","max","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"levenshtein-distance.js","mappings":"mBAMA,SAASA,EAAoBC,EAAGC,GAC5B,GAAiB,IAAbD,EAAEE,OAAc,OAAOD,EAAEC,OAC7B,GAAiB,IAAbD,EAAEC,OAAc,OAAOF,EAAEE,OAE7B,IAGIC,EAMAC,EATAC,EAAS,GAIb,IAAKF,EAAI,EAAGA,GAAKF,EAAEC,OAAQC,IACvBE,EAAOF,GAAK,CAACA,GAKjB,IAAKC,EAAI,EAAGA,GAAKJ,EAAEE,OAAQE,IACvBC,EAAO,GAAGD,GAAKA,EAInB,IAAKD,EAAI,EAAGA,GAAKF,EAAEC,OAAQC,IACvB,IAAKC,EAAI,EAAGA,GAAKJ,EAAEE,OAAQE,IACnBH,EAAEK,OAAOH,EAAI,KAAOH,EAAEM,OAAOF,EAAI,GACjCC,EAAOF,GAAGC,GAAKC,EAAOF,EAAI,GAAGC,EAAI,GAEjCC,EAAOF,GAAGC,GAAKG,KAAKC,IAAIH,EAAOF,EAAI,GAAGC,EAAI,GAAK,EAC3CG,KAAKC,IAAIH,EAAOF,GAAGC,EAAI,GAAK,EACxBC,EAAOF,EAAI,GAAGC,GAAK,IAMvC,OAA2E,KAAnE,EAAKC,EAAOJ,EAAEC,QAAQF,EAAEE,QAAUK,KAAKE,IAAIT,EAAEE,OAAQD,EAAEC,QACnE,CAGsB,oBAAXQ,SACPA,OAAOX,oBAAsBA,GAGjCY,EAAOC,QAAUb,C,GC7Cbc,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,G","sources":["webpack://@lizardbyte/shared-web/./src/js/levenshtein-distance.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Calculate the levenshtein distance between two strings.\n * @param {string} a - The first string to compare.\n * @param {string} b - The second string to compare.\n * @returns {number|*} - The percentage of the levenshtein distance.\n */\nfunction levenshteinDistance(a, b) {\n if (a.length === 0) return b.length;\n if (b.length === 0) return a.length;\n\n let matrix = [];\n\n // increment along the first column of each row\n let i;\n for (i = 0; i <= b.length; i++) {\n matrix[i] = [i];\n }\n\n // increment each column in the first row\n let j;\n for (j = 0; j <= a.length; j++) {\n matrix[0][j] = j;\n }\n\n // Fill in the rest of the matrix\n for (i = 1; i <= b.length; i++) {\n for (j = 1; j <= a.length; j++) {\n if (b.charAt(i - 1) === a.charAt(j - 1)) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution\n Math.min(matrix[i][j - 1] + 1, // insertion\n matrix[i - 1][j] + 1)); // deletion\n }\n }\n }\n\n // return the percentage of the levenshtein distance\n return (1 - (matrix[b.length][a.length] / Math.max(a.length, b.length))) * 100\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.levenshteinDistance = levenshteinDistance;\n}\n\nmodule.exports = levenshteinDistance;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(83);\n"],"names":["levenshteinDistance","a","b","length","i","j","matrix","charAt","Math","min","max","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (()=>{var n={836:n=>{function o(n,o){var r=document.createElement("script");r.src=n,r.async=!0,r.onload=function(){o&&o(null,r)},r.onerror=function(){o&&o(new Error("Failed to load script: ".concat(n)))},document.head.appendChild(r)}"undefined"!=typeof window&&(window.loadScript=o),n.exports=o}},o={};!function r(e){var t=o[e];if(void 0!==t)return t.exports;var c=o[e]={exports:{}};return n[e](c,c.exports,r),c.exports}(836)})();
1
+ (()=>{var n={836(n){function o(n,o){var r=document.createElement("script");r.src=n,r.async=!0,r.onload=function(){o&&o(null,r)},r.onerror=function(){o&&o(new Error("Failed to load script: ".concat(n)))},document.head.appendChild(r)}"undefined"!=typeof window&&(window.loadScript=o),n.exports=o}},o={};!function r(e){var t=o[e];if(void 0!==t)return t.exports;var c=o[e]={exports:{}};return n[e](c,c.exports,r),c.exports}(836)})();
2
2
  //# sourceMappingURL=load-script.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-script.js","mappings":"qBAKA,SAASA,EAAWC,EAAKC,GACrB,IAAMC,EAASC,SAASC,cAAc,UACtCF,EAAOG,IAAML,EACbE,EAAOI,OAAQ,EAEfJ,EAAOK,OAAS,WACRN,GAAUA,EAAS,KAAMC,EACjC,EAEAA,EAAOM,QAAU,WACTP,GAAUA,EAAS,IAAIQ,MAAM,0BAADC,OAA2BV,IAC/D,EAEAG,SAASQ,KAAKC,YAAYV,EAC9B,CAGsB,oBAAXW,SACPA,OAAOd,WAAaA,GAGxBe,EAAOC,QAAUhB,C,GCzBbiB,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/load-script.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Load a script asynchronously, and add it to the DOM. Optionally, call a callback when the script has loaded.\n * @param {string} url The URL of the script to load.\n * @param {Function} callback An optional callback to call when the script has loaded.\n */\nfunction loadScript(url, callback) {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n\n script.onload = () => {\n if (callback) callback(null, script);\n };\n\n script.onerror = () => {\n if (callback) callback(new Error(`Failed to load script: ${url}`));\n };\n\n document.head.appendChild(script);\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.loadScript = loadScript;\n}\n\nmodule.exports = loadScript;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(836);\n"],"names":["loadScript","url","callback","script","document","createElement","src","async","onload","onerror","Error","concat","head","appendChild","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"load-script.js","mappings":"oBAKA,SAASA,EAAWC,EAAKC,GACrB,IAAMC,EAASC,SAASC,cAAc,UACtCF,EAAOG,IAAML,EACbE,EAAOI,OAAQ,EAEfJ,EAAOK,OAAS,WACRN,GAAUA,EAAS,KAAMC,EACjC,EAEAA,EAAOM,QAAU,WACTP,GAAUA,EAAS,IAAIQ,MAAM,0BAADC,OAA2BV,IAC/D,EAEAG,SAASQ,KAAKC,YAAYV,EAC9B,CAGsB,oBAAXW,SACPA,OAAOd,WAAaA,GAGxBe,EAAOC,QAAUhB,C,GCzBbiB,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/load-script.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Load a script asynchronously, and add it to the DOM. Optionally, call a callback when the script has loaded.\n * @param {string} url The URL of the script to load.\n * @param {Function} callback An optional callback to call when the script has loaded.\n */\nfunction loadScript(url, callback) {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n\n script.onload = () => {\n if (callback) callback(null, script);\n };\n\n script.onerror = () => {\n if (callback) callback(new Error(`Failed to load script: ${url}`));\n };\n\n document.head.appendChild(script);\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.loadScript = loadScript;\n}\n\nmodule.exports = loadScript;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(836);\n"],"names":["loadScript","url","callback","script","document","createElement","src","async","onload","onerror","Error","concat","head","appendChild","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (()=>{var r={76:r=>{function n(r,n){return function(t,e){return t[r]>e[r]?-1:t[r]<e[r]||t[n]>e[n]?1:t[n]<e[n]?-1:0}}"undefined"!=typeof window&&(window.rankingSorter=n),r.exports=n}},n={};!function t(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,t),i.exports}(76)})();
1
+ (()=>{var r={76(r){function n(r,n){return function(t,e){return t[r]>e[r]?-1:t[r]<e[r]||t[n]>e[n]?1:t[n]<e[n]?-1:0}}"undefined"!=typeof window&&(window.rankingSorter=n),r.exports=n}},n={};!function t(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,t),i.exports}(76)})();
2
2
  //# sourceMappingURL=ranking-sorter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ranking-sorter.js","mappings":"oBAMA,SAASA,EAAcC,EAAUC,GAC7B,OAAO,SAASC,EAAGC,GACf,OAAID,EAAEF,GAAYG,EAAEH,IACR,EACDE,EAAEF,GAAYG,EAAEH,IAInBE,EAAED,GAAaE,EAAEF,GAHd,EAKIC,EAAED,GAAaE,EAAEF,IAChB,EAED,CAGnB,CACJ,CAGsB,oBAAXG,SACPA,OAAOL,cAAgBA,GAG3BM,EAAOC,QAAUP,C,GC7BbQ,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,G","sources":["webpack://@lizardbyte/shared-web/./src/js/ranking-sorter.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Sorts an array of objects by two keys in descending order.\n * @param {string} firstKey The primary key to sort by.\n * @param {string} secondKey The secondary key to sort by, in case the first key is equal.\n * @returns {Function} The sorting function that returns a number.\n */\nfunction rankingSorter(firstKey, secondKey) {\n return function(a, b) {\n if (a[firstKey] > b[firstKey]) {\n return -1;\n } else if (a[firstKey] < b[firstKey]) {\n return 1;\n }\n else {\n if (a[secondKey] > b[secondKey]) {\n return 1;\n } else if (a[secondKey] < b[secondKey]) {\n return -1;\n } else {\n return 0;\n }\n }\n }\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.rankingSorter = rankingSorter;\n}\n\nmodule.exports = rankingSorter;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(76);\n"],"names":["rankingSorter","firstKey","secondKey","a","b","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"ranking-sorter.js","mappings":"mBAMA,SAASA,EAAcC,EAAUC,GAC7B,OAAO,SAASC,EAAGC,GACf,OAAID,EAAEF,GAAYG,EAAEH,IACR,EACDE,EAAEF,GAAYG,EAAEH,IAInBE,EAAED,GAAaE,EAAEF,GAHd,EAKIC,EAAED,GAAaE,EAAEF,IAChB,EAED,CAGnB,CACJ,CAGsB,oBAAXG,SACPA,OAAOL,cAAgBA,GAG3BM,EAAOC,QAAUP,C,GC7BbQ,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,G","sources":["webpack://@lizardbyte/shared-web/./src/js/ranking-sorter.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Sorts an array of objects by two keys in descending order.\n * @param {string} firstKey The primary key to sort by.\n * @param {string} secondKey The secondary key to sort by, in case the first key is equal.\n * @returns {Function} The sorting function that returns a number.\n */\nfunction rankingSorter(firstKey, secondKey) {\n return function(a, b) {\n if (a[firstKey] > b[firstKey]) {\n return -1;\n } else if (a[firstKey] < b[firstKey]) {\n return 1;\n }\n else {\n if (a[secondKey] > b[secondKey]) {\n return 1;\n } else if (a[secondKey] < b[secondKey]) {\n return -1;\n } else {\n return 0;\n }\n }\n }\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.rankingSorter = rankingSorter;\n}\n\nmodule.exports = rankingSorter;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(76);\n"],"names":["rankingSorter","firstKey","secondKey","a","b","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
package/dist/sleep.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var e={399:e=>{function r(e){return new Promise(function(r){return setTimeout(r,e)})}"undefined"!=typeof window&&(window.sleep=r),e.exports=r}},r={};!function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}(399)})();
1
+ (()=>{var e={399(e){function r(e){return new Promise(function(r){return setTimeout(r,e)})}"undefined"!=typeof window&&(window.sleep=r),e.exports=r}},r={};!function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}(399)})();
2
2
  //# sourceMappingURL=sleep.js.map
package/dist/sleep.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.js","mappings":"qBAKA,SAASA,EAAMC,GACX,OAAO,IAAIC,QAAQ,SAAAC,GAAO,OAAIC,WAAWD,EAASF,EAAG,EACzD,CAGsB,oBAAXI,SACPA,OAAOL,MAAQA,GAGnBM,EAAOC,QAAUP,C,GCbbQ,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/sleep.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Sleep for a given amount of time.\n * @param {number} ms The time to sleep in milliseconds.\n * @returns {Promise<unknown>} A promise that resolves after the given time.\n */\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.sleep = sleep;\n}\n\nmodule.exports = sleep;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(399);\n"],"names":["sleep","ms","Promise","resolve","setTimeout","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"sleep.js","mappings":"oBAKA,SAASA,EAAMC,GACX,OAAO,IAAIC,QAAQ,SAAAC,GAAO,OAAIC,WAAWD,EAASF,EAAG,EACzD,CAGsB,oBAAXI,SACPA,OAAOL,MAAQA,GAGnBM,EAAOC,QAAUP,C,GCbbQ,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/sleep.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/**\n * Sleep for a given amount of time.\n * @param {number} ms The time to sleep in milliseconds.\n * @returns {Promise<unknown>} A promise that resolves after the given time.\n */\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.sleep = sleep;\n}\n\nmodule.exports = sleep;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(399);\n"],"names":["sleep","ms","Promise","resolve","setTimeout","window","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/LizardByte/shared-web.git"
6
6
  },
7
- "version": "2025.1014.124946",
7
+ "version": "2026.219.33142",
8
8
  "description": "Shared web assets for LizardByte projects",
9
9
  "license": "AGPL-3.0-only",
10
10
  "funding": "https://app.lizardbyte.dev",
@@ -20,37 +20,37 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@fortawesome/fontawesome-free": "7.0.1",
23
+ "@fortawesome/fontawesome-free": "7.2.0",
24
24
  "bootstrap": "5.3.8"
25
25
  },
26
26
  "devDependencies": {
27
- "@babel/core": "7.28.4",
28
- "@babel/preset-env": "7.28.3",
27
+ "@babel/core": "7.29.0",
28
+ "@babel/preset-env": "7.29.0",
29
29
  "@codecov/webpack-plugin": "1.9.1",
30
- "@eslint/js": "9.36.0",
30
+ "@eslint/js": "10.0.1",
31
31
  "@jest/globals": "30.2.0",
32
32
  "babel-loader": "10.0.0",
33
33
  "clean-jsdoc-theme": "4.3.0",
34
- "cross-env": "10.0.0",
35
- "css-loader": "7.1.2",
36
- "eslint": "9.36.0",
37
- "eslint-plugin-jest": "29.0.1",
38
- "globals": "16.4.0",
34
+ "cross-env": "10.1.0",
35
+ "css-loader": "7.1.4",
36
+ "eslint": "10.0.0",
37
+ "eslint-plugin-jest": "29.15.0",
38
+ "globals": "17.3.0",
39
39
  "jest": "30.2.0",
40
40
  "jest-environment-jsdom": "30.2.0",
41
41
  "jest-junit": "16.0.0",
42
- "jsdoc": "4.0.4",
43
- "mini-css-extract-plugin": "2.9.4",
42
+ "jsdoc": "4.0.5",
43
+ "mini-css-extract-plugin": "2.10.0",
44
44
  "node-fetch": "3.3.2",
45
45
  "npm-run-all": "4.1.5",
46
46
  "postcss": "8.5.6",
47
- "postcss-loader": "8.2.0",
48
- "postcss-preset-env": "10.4.0",
49
- "sass": "1.93.2",
50
- "sass-loader": "16.0.5",
51
- "webpack": "5.101.3",
47
+ "postcss-loader": "8.2.1",
48
+ "postcss-preset-env": "11.1.3",
49
+ "sass": "1.97.3",
50
+ "sass-loader": "16.0.7",
51
+ "webpack": "5.105.2",
52
52
  "webpack-cli": "6.0.1",
53
- "webpack-dev-server": "5.2.2"
53
+ "webpack-dev-server": "5.2.3"
54
54
  },
55
55
  "jest": {
56
56
  "collectCoverageFrom": [
package/src/js/crowdin.js CHANGED
@@ -16,63 +16,60 @@ function initCrowdIn(project = 'LizardByte', platform = null) {
16
16
  return;
17
17
  }
18
18
 
19
- loadScript('https://proxy-translator.app.crowdin.net/assets/proxy-translator.js', function() {
19
+ loadScript('https://website-translator.app.crowdin.net/assets/proxy-translator.js', function() {
20
20
  // Configure base settings based on project
21
21
  const projectSettings = {
22
22
  'LizardByte': {
23
23
  baseUrl: "https://app.lizardbyte.dev",
24
- valuesParams: "U2FsdGVkX193b3LJT2/HWNIVSb3D61klmnbJ+dvGjoY2XSu35S3gL3FRLBfiXVk4nRsFlfzaC0R7JrklvnS7Xqz5im/VrO+sGzo3LbebxNIMp8LZe28udpnJcA2I2u8B",
25
- filePath: "/app.lizardbyte.dev.json",
26
- distribution: "0913bb75b61f0b26247ffa91bw4",
24
+ distribution: "458f881791aebba1d4dde491bw4",
27
25
  },
28
26
  'LizardByte-docs': {
29
27
  baseUrl: "https://docs.lizardbyte.dev",
30
- valuesParams: "U2FsdGVkX19eQczbrFgaLYbrEBP8is5CVpC2YSnXxH/sRjWqaBtQOsLZJbSRMepcn3D2sofzZxALb2pvT3MLmM+WG5EpWSF7CzzYsAOJ+k/FpMUJ1PZ1FQmmlKCIWyD7",
31
- filePath: "/docs.lizardbyte.dev.json",
32
- distribution: "fb3b3d5c18de9bc717d96b91bw4",
28
+ distribution: "d6c830ba4b41106fefe5d391bw4",
33
29
  }
34
30
  };
35
31
 
36
- let languagesData = {
37
- "bg":{"code":"bg","name":"Bulgarian","twoLettersCode":"bg"},
38
- "de":{"code":"de","name":"German","twoLettersCode":"de"},
39
- "en":{"code":"en","name":"English","twoLettersCode":"en"},
40
- "en-GB":{"code":"en-GB","name":"English, United Kingdom","twoLettersCode":"en"},
41
- "en-US":{"code":"en-US","name":"English, United States","twoLettersCode":"en"},
42
- "es-ES":{"code":"es-ES","name":"Spanish","twoLettersCode":"es"},
43
- "fr":{"code":"fr","name":"French","twoLettersCode":"fr"},
44
- "it":{"code":"it","name":"Italian","twoLettersCode":"it"},
45
- "ja":{"code":"ja","name":"Japanese","twoLettersCode":"ja"},
46
- "ko":{"code":"ko","name":"Korean","twoLettersCode":"ko"},
47
- "pl":{"code":"pl","name":"Polish","twoLettersCode":"pl"},
48
- "pt-BR":{"code":"pt-BR","name":"Portuguese, Brazilian","twoLettersCode":"pt"},
49
- "pt-PT":{"code":"pt-PT","name":"Portuguese","twoLettersCode":"pt"},
50
- "ru":{"code":"ru","name":"Russian","twoLettersCode":"ru"},
51
- "sv-SE":{"code":"sv-SE","name":"Swedish","twoLettersCode":"sv"},
52
- "tr":{"code":"tr","name":"Turkish","twoLettersCode":"tr"},
53
- "uk":{"code":"uk","name":"Ukrainian","twoLettersCode":"uk"},
54
- "zh-CN":{"code":"zh-CN","name":"Chinese Simplified","twoLettersCode":"zh"},
55
- "zh-TW":{"code":"zh-TW","name":"Chinese Traditional","twoLettersCode":"zh"},
32
+ let languageTitles = {
33
+ "bg": "Български (Bulgarian)",
34
+ "cs": "Čeština (Czech)",
35
+ "de": "Deutsch (German)",
36
+ "en": "English",
37
+ "en-GB": "English, United Kingdom",
38
+ "en-US": "English, United States",
39
+ "es-ES": "Español (Spanish)",
40
+ "fr": "Français (French)",
41
+ "hu": "Magyar (Hungarian)",
42
+ "it": "Italiano (Italian)",
43
+ "ja": "日本語 (Japanese)",
44
+ "ko": "한국어 (Korean)",
45
+ "pl": "Polski (Polish)",
46
+ "pt-BR": "Português, Brasileiro (Portuguese, Brazilian)",
47
+ "pt-PT": "Português (Portuguese)",
48
+ "ru": "Русский (Russian)",
49
+ "sv-SE": "svenska (Swedish)",
50
+ "tr": "Türkçe (Turkish)",
51
+ "uk": "Українська (Ukranian)",
52
+ "vi": "Tiếng Việt (Vietnamese)",
53
+ "zh-CN": "简体中文 (Chinese Simplified)",
54
+ "zh-TW": "繁體中文 (Chinese Traditional)",
56
55
  };
57
56
  // sort languages by name
58
- languagesData = Object.fromEntries(Object.entries(languagesData).sort((a, b) => a[1].name.localeCompare(b[1].name)));
57
+ languageTitles = Object.fromEntries(Object.entries(languageTitles).sort((a, b) => a[1].localeCompare(b[1])));
58
+
59
+ // use this to allow translations to work on PR preview builds
60
+ let currentBaseUrl = globalThis.location.origin;
59
61
 
60
62
  // Initialize Crowdin translator
61
- window.proxyTranslator.init({
62
- baseUrl: projectSettings[project].baseUrl,
63
- appUrl: "https://proxy-translator.app.crowdin.net",
64
- valuesParams: projectSettings[project].valuesParams,
65
- distributionBaseUrl: "https://distributions.crowdin.net",
66
- filePath: projectSettings[project].filePath,
63
+ globalThis.proxyTranslator.init({
64
+ baseUrl: currentBaseUrl,
67
65
  distribution: projectSettings[project].distribution,
68
- distributionSeparateFiles: undefined,
69
- languagesData: languagesData,
70
66
  defaultLanguage: "en",
71
- defaultLanguageTitle: "English",
72
- languageDetectType: "default",
73
- poweredBy: false,
67
+ languageTitles: languageTitles,
68
+ showDefaultLanguageInUrl: false,
69
+ languageRoutingMethod: "query",
74
70
  position: "bottom-left",
75
71
  submenuPosition: "top-left",
72
+ poweredBy: false,
76
73
  });
77
74
 
78
75
  // Apply styling based on UI framework
@@ -100,8 +97,8 @@ function initCrowdIn(project = 'LizardByte', platform = null) {
100
97
  }
101
98
 
102
99
  // Expose to the global scope
103
- if (typeof window !== 'undefined') {
104
- window.initCrowdIn = initCrowdIn;
100
+ if (typeof globalThis !== 'undefined' && globalThis.window !== undefined) {
101
+ globalThis.initCrowdIn = initCrowdIn;
105
102
  }
106
103
 
107
104
  module.exports = initCrowdIn;
@@ -67,8 +67,8 @@ describe('initCrowdIn', () => {
67
67
 
68
68
  expect(window.proxyTranslator.init).toHaveBeenCalledWith(
69
69
  expect.objectContaining({
70
- baseUrl: "https://app.lizardbyte.dev",
71
- distribution: "0913bb75b61f0b26247ffa91bw4",
70
+ baseUrl: "http://localhost",
71
+ distribution: "458f881791aebba1d4dde491bw4",
72
72
  defaultLanguage: "en"
73
73
  })
74
74
  );
@@ -82,8 +82,8 @@ describe('initCrowdIn', () => {
82
82
 
83
83
  expect(window.proxyTranslator.init).toHaveBeenCalledWith(
84
84
  expect.objectContaining({
85
- baseUrl: "https://docs.lizardbyte.dev",
86
- distribution: "fb3b3d5c18de9bc717d96b91bw4",
85
+ baseUrl: "http://localhost",
86
+ distribution: "d6c830ba4b41106fefe5d391bw4",
87
87
  defaultLanguage: "en"
88
88
  })
89
89
  );
package/dist/discord.js DELETED
@@ -1,3 +0,0 @@
1
- /*! For license information please see discord.js.LICENSE.txt */
2
- (()=>{var t={300:(t,n,e)=>{var r=e(836),o=e(748).fetchRandomQuote;function i(t,n){var e=t.quote_safe||t.quote;n.notify(e)}function a(){r("https://cdn.jsdelivr.net/npm/@widgetbot/crate@3",function(){var t=new Crate({server:"804382334370578482",channel:"804383092822900797",defer:!1}),n=document.createElement("style");n.innerHTML="\n widgetbot-crate {\n position: fixed !important;\n }\n ",document.head.appendChild(n),o().then(function(n){setTimeout(function(){t&&i(n,t)},42e4)})})}"undefined"!=typeof window&&(window.initDiscord=a),t.exports={initDiscord:a,randomQuote:i}},748:t=>{function n(){var t,r,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function c(n,o,i,a){var c=o&&o.prototype instanceof f?o:f,p=Object.create(c.prototype);return e(p,"_invoke",function(n,e,o){var i,a,c,f=0,p=o||[],s=!1,d={p:0,n:0,v:t,a:l,f:l.bind(t,4),d:function(n,e){return i=n,a=0,c=t,d.n=e,u}};function l(n,e){for(a=n,c=e,r=0;!s&&f&&!o&&r<p.length;r++){var o,i=p[r],l=d.p,v=i[2];n>3?(o=v===e)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=l&&((o=n<2&&l<i[1])?(a=0,d.v=e,d.n=i[1]):l<v&&(o=n<3||i[0]>e||e>v)&&(i[4]=n,i[5]=e,d.n=v,a=0))}if(o||n>1)return u;throw s=!0,e}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&l(p,v),a=p,c=v;(r=a<2?t:c)||!s;){i||(a?a<3?(a>1&&(d.n=-1),l(a,c)):d.n=c:d.v=c);try{if(f=2,i){if(a||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,a<2&&(a=0)}else 1===a&&(r=i.return)&&r.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((r=(s=d.n<0)?c:n.call(e,d))!==u)break}catch(n){i=t,a=1,c=n}finally{f=1}}return{value:r,done:s}}}(n,i,a),!0),p}var u={};function f(){}function p(){}function s(){}r=Object.getPrototypeOf;var d=[][i]?r(r([][i]())):(e(r={},i,function(){return this}),r),l=s.prototype=f.prototype=Object.create(d);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,e(t,a,"GeneratorFunction")),t.prototype=Object.create(l),t}return p.prototype=s,e(l,"constructor",s),e(s,"constructor",p),p.displayName="GeneratorFunction",e(s,a,"GeneratorFunction"),e(l),e(l,a,"Generator"),e(l,i,function(){return this}),e(l,"toString",function(){return"[object Generator]"}),(n=function(){return{w:c,m:v}})()}function e(t,n,r,o){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}e=function(t,n,r,o){function a(n,r){e(t,n,function(t){return this._invoke(n,r,t)})}n?i?i(t,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):t[n]=r:(a("next",0),a("throw",1),a("return",2))},e(t,n,r,o)}function r(t,n,e,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?n(u):Promise.resolve(u).then(r,o)}var o=null;function i(){var t;return t=n().m(function t(){var e;return n().w(function(t){for(;;)switch(t.n){case 0:if(o){t.n=3;break}return t.n=1,fetch("https://app.lizardbyte.dev/uno/random-quotes/games.json");case 1:return e=t.v,t.n=2,e.json();case 2:o=t.v;case 3:return t.a(2,o[Math.floor(Math.random()*o.length)])}},t)}),i=function(){var n=this,e=arguments;return new Promise(function(o,i){var a=t.apply(n,e);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)})},i.apply(this,arguments)}t.exports={fetchRandomQuote:function(){return i.apply(this,arguments)},resetQuoteCache:function(){o=null}}},836:t=>{function n(t,n){var e=document.createElement("script");e.src=t,e.async=!0,e.onload=function(){n&&n(null,e)},e.onerror=function(){n&&n(new Error("Failed to load script: ".concat(t)))},document.head.appendChild(e)}"undefined"!=typeof window&&(window.loadScript=n),t.exports=n}},n={};!function e(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return t[r](i,i.exports,e),i.exports}(300)})();
3
- //# sourceMappingURL=discord.js.map
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
@@ -1 +0,0 @@
1
- {"version":3,"file":"discord.js","mappings":";2BAI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AU,CACbtB,iBApBJ,WAI+B,OAAAuE,EAAAU,MAAC,KAADD,UAAA,EAiB3BI,gBANJ,WACId,EAAa,IACjB,E,UCdA,SAASxE,EAAWuF,EAAKC,GACrB,IAAMC,EAAS1E,SAASC,cAAc,UACtCyE,EAAOC,IAAMH,EACbE,EAAOE,OAAQ,EAEfF,EAAOG,OAAS,WACRJ,GAAUA,EAAS,KAAMC,EACjC,EAEAA,EAAOI,QAAU,WACTL,GAAUA,EAAS,IAAIM,MAAM,0BAADC,OAA2BR,IAC/D,EAEAxE,SAASG,KAAKC,YAAYsE,EAC9B,CAGsB,oBAAXnE,SACPA,OAAOtB,WAAaA,GAGxBuB,EAAOC,QAAUxB,C,GCzBbgG,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAa3E,QAGrB,IAAID,EAASyE,EAAyBE,GAAY,CAGjD1E,QAAS,CAAC,GAOX,OAHA6E,EAAoBH,GAAU3E,EAAQA,EAAOC,QAASyE,GAG/C1E,EAAOC,OACf,CCnB0ByE,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/discord.js","webpack://@lizardbyte/shared-web/./src/js/random-quote.js","webpack://@lizardbyte/shared-web/./src/js/load-script.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["/* global Crate */\n// Crate is not defined... can we use npm version?\n// https://github.com/widgetbot-io/crate/issues/26\n\nconst loadScript = require('./load-script');\nconst { fetchRandomQuote } = require('./random-quote');\n\n/**\n * Notify the user with a random quote.\n * @param {Object} quote - The quote object.\n * @param {Crate} crate - The Crate object.\n */\nfunction randomQuote(quote, crate) {\n let the_quote = quote['quote_safe'] || quote['quote'];\n crate.notify(the_quote);\n}\n\n/**\n * Initialize the Discord widget.\n */\nfunction initDiscord() {\n loadScript('https://cdn.jsdelivr.net/npm/@widgetbot/crate@3', function() {\n let widgetbot = new Crate({\n server: '804382334370578482',\n channel: '804383092822900797',\n defer: false,\n });\n\n // Apply CSS position change directly in JavaScript\n const style = document.createElement('style');\n style.innerHTML = `\n widgetbot-crate {\n position: fixed !important;\n }\n `;\n document.head.appendChild(style);\n\n // get random video game quotes and notify the user on Widgetbot after 7 minutes\n fetchRandomQuote().then(quote => {\n setTimeout(() => {\n if (widgetbot) {\n randomQuote(quote, widgetbot);\n }\n }, 7 * 60 * 1000);\n });\n });\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.initDiscord = initDiscord;\n}\n\nmodule.exports = {\n initDiscord,\n randomQuote,\n};\n","let quoteCache = null;\n\n/**\n * Fetch a random quote from our API.\n * @returns {Promise<*>} A promise that resolves with a random quote\n */\nasync function fetchRandomQuote() {\n if (!quoteCache) {\n const response = await fetch('https://app.lizardbyte.dev/uno/random-quotes/games.json');\n quoteCache = await response.json();\n }\n return quoteCache[Math.floor(Math.random() * quoteCache.length)];\n}\n\n/**\n * Reset the quote cache.\n */\nfunction resetQuoteCache() {\n quoteCache = null;\n}\n\nmodule.exports = {\n fetchRandomQuote,\n resetQuoteCache,\n};\n","/**\n * Load a script asynchronously, and add it to the DOM. Optionally, call a callback when the script has loaded.\n * @param {string} url The URL of the script to load.\n * @param {Function} callback An optional callback to call when the script has loaded.\n */\nfunction loadScript(url, callback) {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n\n script.onload = () => {\n if (callback) callback(null, script);\n };\n\n script.onerror = () => {\n if (callback) callback(new Error(`Failed to load script: ${url}`));\n };\n\n document.head.appendChild(script);\n}\n\n// Expose to the global scope\nif (typeof window !== 'undefined') {\n window.loadScript = loadScript;\n}\n\nmodule.exports = loadScript;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(300);\n"],"names":["loadScript","require","fetchRandomQuote","randomQuote","quote","crate","the_quote","notify","initDiscord","widgetbot","Crate","server","channel","defer","style","document","createElement","innerHTML","head","appendChild","then","setTimeout","window","module","exports","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","quoteCache","_fetchRandomQuote","_callee","response","_context","fetch","json","Math","floor","random","arguments","apply","_next","_throw","resetQuoteCache","url","callback","script","src","async","onload","onerror","Error","concat","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
@@ -1,3 +0,0 @@
1
- /*! For license information please see random-quote.js.LICENSE.txt */
2
- (()=>{var t={748:t=>{function r(){var t,e,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.toStringTag||"@@toStringTag";function a(r,o,i,u){var a=o&&o.prototype instanceof f?o:f,p=Object.create(a.prototype);return n(p,"_invoke",function(r,n,o){var i,u,a,f=0,p=o||[],s=!1,l={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(r,n){return i=r,u=0,a=t,l.n=n,c}};function v(r,n){for(u=r,a=n,e=0;!s&&f&&!o&&e<p.length;e++){var o,i=p[e],v=l.p,h=i[2];r>3?(o=h===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=r<2&&v<i[1])?(u=0,l.v=n,l.n=i[1]):v<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,l.n=h,u=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,h){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&v(p,h),u=p,a=h;(e=u<2?t:a)||!s;){i||(u?u<3?(u>1&&(l.n=-1),v(u,a)):l.n=a:l.v=a);try{if(f=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=l.n<0)?a:r.call(n,l))!==c)break}catch(r){i=t,u=1,a=r}finally{f=1}}return{value:e,done:s}}}(r,i,u),!0),p}var c={};function f(){}function p(){}function s(){}e=Object.getPrototypeOf;var l=[][i]?e(e([][i]())):(n(e={},i,function(){return this}),e),v=s.prototype=f.prototype=Object.create(l);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,n(t,u,"GeneratorFunction")),t.prototype=Object.create(v),t}return p.prototype=s,n(v,"constructor",s),n(s,"constructor",p),p.displayName="GeneratorFunction",n(s,u,"GeneratorFunction"),n(v),n(v,u,"Generator"),n(v,i,function(){return this}),n(v,"toString",function(){return"[object Generator]"}),(r=function(){return{w:a,m:h}})()}function n(t,r,e,o){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}n=function(t,r,e,o){function u(r,e){n(t,r,function(t){return this._invoke(r,e,t)})}r?i?i(t,r,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[r]=e:(u("next",0),u("throw",1),u("return",2))},n(t,r,e,o)}function e(t,r,n,e,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?r(c):Promise.resolve(c).then(e,o)}var o=null;function i(){var t;return t=r().m(function t(){var n;return r().w(function(t){for(;;)switch(t.n){case 0:if(o){t.n=3;break}return t.n=1,fetch("https://app.lizardbyte.dev/uno/random-quotes/games.json");case 1:return n=t.v,t.n=2,n.json();case 2:o=t.v;case 3:return t.a(2,o[Math.floor(Math.random()*o.length)])}},t)}),i=function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function a(t){e(u,o,i,a,c,"next",t)}function c(t){e(u,o,i,a,c,"throw",t)}a(void 0)})},i.apply(this,arguments)}t.exports={fetchRandomQuote:function(){return i.apply(this,arguments)},resetQuoteCache:function(){o=null}}}},r={};!function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}(748)})();
3
- //# sourceMappingURL=random-quote.js.map
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-quote.js","mappings":";kCACA,IAAAA,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,EAAAC,EAAAX,GAAA,GAAAY,GAAA,EAAAC,EAAA,CAAAF,EAAA,EAAAb,EAAA,EAAAgB,EAAApB,EAAAqB,EAAAC,EAAAN,EAAAM,EAAAC,KAAAvB,EAAA,GAAAsB,EAAA,SAAArB,EAAAC,GAAA,OAAAM,EAAAP,EAAAQ,EAAA,EAAAG,EAAAZ,EAAAmB,EAAAf,EAAAF,EAAAmB,CAAA,YAAAC,EAAApB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sD,EAAAC,EAAA,QAAAzD,EAAA,CAAAwD,OAAA,MAWCX,EAAAU,MAAA,KAAAD,UAAA,CASDI,EAAOC,QAAU,CACbC,iBApBJ,WAI+B,OAAAf,EAAAU,MAAC,KAADD,UAAA,EAiB3BO,gBANJ,WACIjB,EAAa,IACjB,E,GClBIkB,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASI,EAAyBE,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUN,EAAQA,EAAOC,QAASI,GAG/CL,EAAOC,OACf,CCnB0BI,CAAoB,I","sources":["webpack://@lizardbyte/shared-web/./src/js/random-quote.js","webpack://@lizardbyte/shared-web/webpack/bootstrap","webpack://@lizardbyte/shared-web/webpack/startup"],"sourcesContent":["let quoteCache = null;\n\n/**\n * Fetch a random quote from our API.\n * @returns {Promise<*>} A promise that resolves with a random quote\n */\nasync function fetchRandomQuote() {\n if (!quoteCache) {\n const response = await fetch('https://app.lizardbyte.dev/uno/random-quotes/games.json');\n quoteCache = await response.json();\n }\n return quoteCache[Math.floor(Math.random() * quoteCache.length)];\n}\n\n/**\n * Reset the quote cache.\n */\nfunction resetQuoteCache() {\n quoteCache = null;\n}\n\nmodule.exports = {\n fetchRandomQuote,\n resetQuoteCache,\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(748);\n"],"names":["e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","then","quoteCache","_fetchRandomQuote","_callee","response","_context","fetch","json","Math","floor","random","arguments","apply","_next","_throw","module","exports","fetchRandomQuote","resetQuoteCache","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
package/src/js/discord.js DELETED
@@ -1,57 +0,0 @@
1
- /* global Crate */
2
- // Crate is not defined... can we use npm version?
3
- // https://github.com/widgetbot-io/crate/issues/26
4
-
5
- const loadScript = require('./load-script');
6
- const { fetchRandomQuote } = require('./random-quote');
7
-
8
- /**
9
- * Notify the user with a random quote.
10
- * @param {Object} quote - The quote object.
11
- * @param {Crate} crate - The Crate object.
12
- */
13
- function randomQuote(quote, crate) {
14
- let the_quote = quote['quote_safe'] || quote['quote'];
15
- crate.notify(the_quote);
16
- }
17
-
18
- /**
19
- * Initialize the Discord widget.
20
- */
21
- function initDiscord() {
22
- loadScript('https://cdn.jsdelivr.net/npm/@widgetbot/crate@3', function() {
23
- let widgetbot = new Crate({
24
- server: '804382334370578482',
25
- channel: '804383092822900797',
26
- defer: false,
27
- });
28
-
29
- // Apply CSS position change directly in JavaScript
30
- const style = document.createElement('style');
31
- style.innerHTML = `
32
- widgetbot-crate {
33
- position: fixed !important;
34
- }
35
- `;
36
- document.head.appendChild(style);
37
-
38
- // get random video game quotes and notify the user on Widgetbot after 7 minutes
39
- fetchRandomQuote().then(quote => {
40
- setTimeout(() => {
41
- if (widgetbot) {
42
- randomQuote(quote, widgetbot);
43
- }
44
- }, 7 * 60 * 1000);
45
- });
46
- });
47
- }
48
-
49
- // Expose to the global scope
50
- if (typeof window !== 'undefined') {
51
- window.initDiscord = initDiscord;
52
- }
53
-
54
- module.exports = {
55
- initDiscord,
56
- randomQuote,
57
- };
@@ -1,25 +0,0 @@
1
- let quoteCache = null;
2
-
3
- /**
4
- * Fetch a random quote from our API.
5
- * @returns {Promise<*>} A promise that resolves with a random quote
6
- */
7
- async function fetchRandomQuote() {
8
- if (!quoteCache) {
9
- const response = await fetch('https://app.lizardbyte.dev/uno/random-quotes/games.json');
10
- quoteCache = await response.json();
11
- }
12
- return quoteCache[Math.floor(Math.random() * quoteCache.length)];
13
- }
14
-
15
- /**
16
- * Reset the quote cache.
17
- */
18
- function resetQuoteCache() {
19
- quoteCache = null;
20
- }
21
-
22
- module.exports = {
23
- fetchRandomQuote,
24
- resetQuoteCache,
25
- };
@@ -1,56 +0,0 @@
1
- import {
2
- describe,
3
- expect,
4
- it,
5
- jest,
6
- } from '@jest/globals';
7
-
8
- const { initDiscord, randomQuote } = require('../src/js/discord');
9
- const loadScript = require('../src/js/load-script');
10
- const { fetchRandomQuote } = require('../src/js/random-quote');
11
-
12
- jest.mock('../src/js/load-script');
13
- jest.mock('../src/js/random-quote');
14
-
15
- describe('initDiscord', () => {
16
- it('should load the script and get a random quote', () => {
17
- jest.useFakeTimers();
18
- const mockCrate = {
19
- notify: jest.fn()
20
- };
21
- global.Crate = jest.fn(() => mockCrate);
22
-
23
- loadScript.mockImplementation((url, callback) => {
24
- callback();
25
- });
26
-
27
- fetchRandomQuote.mockResolvedValue({
28
- quote: 'Test quote',
29
- quote_safe: 'Test quote safe'
30
- });
31
-
32
- initDiscord();
33
-
34
- expect(global.Crate).toHaveBeenCalledWith({
35
- server: '804382334370578482',
36
- channel: '804383092822900797',
37
- defer: false,
38
- });
39
-
40
- // advance timers
41
- jest.advanceTimersByTime(7 * 60 * 1000);
42
-
43
- expect(fetchRandomQuote).toHaveBeenCalled();
44
- });
45
- });
46
-
47
- describe('randomQuote', () => {
48
- it('should notify the user with the quote', () => {
49
- const mockCrate = {
50
- notify: jest.fn()
51
- };
52
-
53
- randomQuote({quote_safe: 'Test quote'}, mockCrate);
54
- expect(mockCrate.notify).toHaveBeenCalledWith('Test quote');
55
- });
56
- });
@@ -1,77 +0,0 @@
1
- import {
2
- afterEach,
3
- beforeEach,
4
- describe,
5
- expect,
6
- it,
7
- jest,
8
- } from '@jest/globals';
9
-
10
- const { fetchRandomQuote, resetQuoteCache } = require('../src/js/random-quote');
11
-
12
- describe('fetchRandomQuote', () => {
13
- let originalFetch;
14
-
15
- beforeEach(() => {
16
- // Save the original fetch function
17
- originalFetch = globalThis.fetch;
18
- // Clear the quote cache before each test
19
- jest.resetModules();
20
- // Reset the quotesCache
21
- resetQuoteCache();
22
- });
23
-
24
- afterEach(() => {
25
- // Restore the original fetch function
26
- globalThis.fetch = originalFetch;
27
- });
28
-
29
- it('should fetch and return a random quote', async () => {
30
- const mockQuotes = [
31
- { quote: 'Quote 1' },
32
- { quote: 'Quote 2' },
33
- { quote: 'Quote 3' }
34
- ];
35
-
36
- globalThis.fetch = jest.fn(() =>
37
- Promise.resolve({
38
- json: () => Promise.resolve(mockQuotes)
39
- })
40
- );
41
-
42
- const quote = await fetchRandomQuote();
43
- expect(mockQuotes).toContainEqual(quote);
44
- expect(globalThis.fetch).toHaveBeenCalledTimes(1);
45
- });
46
-
47
- it('should return a cached quote if already fetched', async () => {
48
- const mockQuotes = [
49
- { quote: 'Quote 1' },
50
- { quote: 'Quote 2' },
51
- { quote: 'Quote 3' }
52
- ];
53
-
54
- globalThis.fetch = jest.fn(() =>
55
- Promise.resolve({
56
- json: () => Promise.resolve(mockQuotes)
57
- })
58
- );
59
-
60
- // First call to populate the cache
61
- await fetchRandomQuote();
62
- // Second call should use the cache
63
- const quote = await fetchRandomQuote();
64
-
65
- expect(mockQuotes).toContainEqual(quote);
66
- expect(globalThis.fetch).toHaveBeenCalledTimes(1);
67
- });
68
-
69
- it('should handle fetch errors gracefully', async () => {
70
- globalThis.fetch = jest.fn(() =>
71
- Promise.reject(new Error('Failed to fetch'))
72
- );
73
-
74
- await expect(fetchRandomQuote()).rejects.toThrow('Failed to fetch');
75
- expect(globalThis.fetch).toHaveBeenCalledTimes(1);
76
- });
77
- });