@scrabble-solver/scrabble-solver 2.8.2 → 2.8.3

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.
Files changed (86) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +5 -5
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_8dgz12 +1 -1
  5. package/.next/cache/next-server.js.nft.json +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/.next/next-server.js.nft.json +1 -1
  11. package/.next/prerender-manifest.json +1 -1
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/413.js +391 -673
  14. package/.next/server/chunks/515.js +414 -500
  15. package/.next/server/chunks/907.js +397 -679
  16. package/.next/server/middleware-build-manifest.js +1 -1
  17. package/.next/server/pages/404.html +1 -1
  18. package/.next/server/pages/404.js.nft.json +1 -1
  19. package/.next/server/pages/500.html +2 -2
  20. package/.next/server/pages/_app.js +7 -10
  21. package/.next/server/pages/_app.js.nft.json +1 -1
  22. package/.next/server/pages/_document.js +0 -3
  23. package/.next/server/pages/_error.js.nft.json +1 -1
  24. package/.next/server/pages/api/dictionary/[locale]/[word].js +114 -171
  25. package/.next/server/pages/api/solve.js +428 -1164
  26. package/.next/server/pages/index.html +1 -1
  27. package/.next/server/pages/index.js +2 -2
  28. package/.next/server/pages/index.js.nft.json +1 -1
  29. package/.next/server/pages/index.json +1 -1
  30. package/.next/static/OhUvTNKwyrrzmNwKBnpUU/_buildManifest.js +1 -0
  31. package/.next/static/{nXSSCVI5pGlS_NxEidxkS → OhUvTNKwyrrzmNwKBnpUU}/_ssgManifest.js +0 -0
  32. package/.next/static/chunks/{195-fcadef5c6eed8338.js → 195-4b75c9c697b7b455.js} +1 -1
  33. package/.next/static/chunks/pages/_app-72522bfb306a8aef.js +1 -0
  34. package/.next/trace +42 -42
  35. package/package.json +9 -9
  36. package/src/components/Board/Board.tsx +1 -1
  37. package/src/components/Board/BoardPure.tsx +1 -1
  38. package/src/components/Board/components/Cell/Button.tsx +1 -1
  39. package/src/components/Board/components/Cell/Cell.tsx +1 -1
  40. package/src/components/Board/components/Cell/CellPure.tsx +1 -1
  41. package/src/components/Button/Button.tsx +1 -1
  42. package/src/components/Checkbox/Checkbox.tsx +1 -1
  43. package/src/components/Dictionary/Dictionary.tsx +1 -1
  44. package/src/components/DictionaryInput/DictionaryInput.tsx +1 -1
  45. package/src/components/EmptyState/EmptyState.tsx +1 -1
  46. package/src/components/Key/Key.tsx +1 -1
  47. package/src/components/KeyMap/KeyMap.tsx +1 -1
  48. package/src/components/KeyMap/components/Mapping/Mapping.tsx +1 -1
  49. package/src/components/Loading/Loading.tsx +1 -1
  50. package/src/components/Logo/Logo.tsx +1 -1
  51. package/src/components/NavButtons/NavButtons.tsx +1 -1
  52. package/src/components/NotFound/NotFound.tsx +1 -1
  53. package/src/components/PlainTiles/PlainTiles.tsx +1 -1
  54. package/src/components/PlainTiles/Tile.tsx +1 -1
  55. package/src/components/Rack/Rack.tsx +1 -1
  56. package/src/components/Rack/RackTile.tsx +1 -1
  57. package/src/components/Radio/Radio.tsx +1 -1
  58. package/src/components/RemainingTiles/Character.tsx +1 -1
  59. package/src/components/RemainingTiles/RemainingTiles.tsx +1 -1
  60. package/src/components/Results/Cell.tsx +1 -1
  61. package/src/components/Results/HeaderButton.tsx +1 -1
  62. package/src/components/Results/Result.tsx +1 -1
  63. package/src/components/Results/Results.tsx +1 -1
  64. package/src/components/Results/SolveButton.tsx +1 -1
  65. package/src/components/ResultsInput/ResultsInput.tsx +1 -1
  66. package/src/components/Screen/Screen.tsx +1 -1
  67. package/src/components/Settings/Settings.tsx +1 -1
  68. package/src/components/Settings/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -1
  69. package/src/components/Settings/components/ConfigSetting/ConfigSetting.tsx +1 -1
  70. package/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
  71. package/src/components/Sidebar/Sidebar.tsx +1 -1
  72. package/src/components/Sidebar/components/Section/Section.tsx +1 -1
  73. package/src/components/Splash/Splash.tsx +1 -1
  74. package/src/components/SquareButton/Link.tsx +1 -1
  75. package/src/components/SquareButton/SquareButton.tsx +1 -1
  76. package/src/components/Tile/Tile.tsx +1 -1
  77. package/src/components/Tile/TilePure.tsx +1 -1
  78. package/src/components/Tooltip/useTooltip.tsx +1 -1
  79. package/src/components/Well/Well.tsx +1 -1
  80. package/src/hooks/usePortal.tsx +19 -9
  81. package/src/lib/memoize.ts +1 -1
  82. package/src/pages/_app.tsx +1 -1
  83. package/src/pages/_document.tsx +1 -1
  84. package/src/pages/index.tsx +1 -1
  85. package/.next/static/chunks/pages/_app-f4030148d742bcd2.js +0 -1
  86. package/.next/static/nXSSCVI5pGlS_NxEidxkS/_buildManifest.js +0 -1
@@ -164,23 +164,22 @@ const parseRequest = (request)=>{
164
164
  var __importDefault = (this && this.__importDefault) || function (mod) {
165
165
  return (mod && mod.__esModule) ? mod : { "default": mod };
166
166
  };
167
- var _a;
168
167
  Object.defineProperty(exports, "__esModule", ({ value: true }));
169
- var types_1 = __webpack_require__(46452);
170
- var crawlEnglish_1 = __importDefault(__webpack_require__(90357));
171
- var crawlFrench_1 = __importDefault(__webpack_require__(93174));
172
- var crawlGerman_1 = __importDefault(__webpack_require__(69047));
173
- var crawlPolish_1 = __importDefault(__webpack_require__(18698));
174
- var crawlSpanish_1 = __importDefault(__webpack_require__(82360));
175
- var crawlPerLocale = (_a = {},
176
- _a[types_1.Locale.DE_DE] = crawlGerman_1.default,
177
- _a[types_1.Locale.EN_GB] = crawlEnglish_1.default,
178
- _a[types_1.Locale.EN_US] = crawlEnglish_1.default,
179
- _a[types_1.Locale.ES_ES] = crawlSpanish_1.default,
180
- _a[types_1.Locale.FR_FR] = crawlFrench_1.default,
181
- _a[types_1.Locale.PL_PL] = crawlPolish_1.default,
182
- _a);
183
- var crawl = function (locale, word) {
168
+ const types_1 = __webpack_require__(46452);
169
+ const crawlEnglish_1 = __importDefault(__webpack_require__(90357));
170
+ const crawlFrench_1 = __importDefault(__webpack_require__(93174));
171
+ const crawlGerman_1 = __importDefault(__webpack_require__(69047));
172
+ const crawlPolish_1 = __importDefault(__webpack_require__(18698));
173
+ const crawlSpanish_1 = __importDefault(__webpack_require__(82360));
174
+ const crawlPerLocale = {
175
+ [types_1.Locale.DE_DE]: crawlGerman_1.default,
176
+ [types_1.Locale.EN_GB]: crawlEnglish_1.default,
177
+ [types_1.Locale.EN_US]: crawlEnglish_1.default,
178
+ [types_1.Locale.ES_ES]: crawlSpanish_1.default,
179
+ [types_1.Locale.FR_FR]: crawlFrench_1.default,
180
+ [types_1.Locale.PL_PL]: crawlPolish_1.default,
181
+ };
182
+ const crawl = (locale, word) => {
184
183
  return crawlPerLocale[locale](word);
185
184
  };
186
185
  exports["default"] = crawl;
@@ -193,12 +192,12 @@ exports["default"] = crawl;
193
192
 
194
193
 
195
194
  Object.defineProperty(exports, "__esModule", ({ value: true }));
196
- var lib_1 = __webpack_require__(3805);
197
- var crawlEnglish = function (word) {
195
+ const lib_1 = __webpack_require__(3805);
196
+ const crawlEnglish = (word) => {
198
197
  return (0, lib_1.request)({
199
198
  protocol: 'https',
200
199
  hostname: 'www.merriam-webster.com',
201
- path: "/dictionary/".concat(encodeURIComponent(word)),
200
+ path: `/dictionary/${encodeURIComponent(word)}`,
202
201
  });
203
202
  };
204
203
  exports["default"] = crawlEnglish;
@@ -211,12 +210,12 @@ exports["default"] = crawlEnglish;
211
210
 
212
211
 
213
212
  Object.defineProperty(exports, "__esModule", ({ value: true }));
214
- var lib_1 = __webpack_require__(3805);
215
- var crawlFrench = function (word) {
213
+ const lib_1 = __webpack_require__(3805);
214
+ const crawlFrench = (word) => {
216
215
  return (0, lib_1.request)({
217
216
  protocol: 'https',
218
217
  hostname: 'www.cnrtl.fr',
219
- path: "/definition/".concat(encodeURIComponent(word)),
218
+ path: `/definition/${encodeURIComponent(word)}`,
220
219
  });
221
220
  };
222
221
  exports["default"] = crawlFrench;
@@ -229,12 +228,12 @@ exports["default"] = crawlFrench;
229
228
 
230
229
 
231
230
  Object.defineProperty(exports, "__esModule", ({ value: true }));
232
- var lib_1 = __webpack_require__(3805);
233
- var crawlGerman = function (word) {
231
+ const lib_1 = __webpack_require__(3805);
232
+ const crawlGerman = (word) => {
234
233
  return (0, lib_1.request)({
235
234
  protocol: 'https',
236
235
  hostname: 'www.dwds.de',
237
- path: "?q=".concat(encodeURIComponent(word), "&from=wb"),
236
+ path: `?q=${encodeURIComponent(word)}&from=wb`,
238
237
  });
239
238
  };
240
239
  exports["default"] = crawlGerman;
@@ -247,12 +246,12 @@ exports["default"] = crawlGerman;
247
246
 
248
247
 
249
248
  Object.defineProperty(exports, "__esModule", ({ value: true }));
250
- var lib_1 = __webpack_require__(3805);
251
- var crawlPolish = function (word) {
249
+ const lib_1 = __webpack_require__(3805);
250
+ const crawlPolish = (word) => {
252
251
  return (0, lib_1.request)({
253
252
  protocol: 'https',
254
253
  hostname: 'sjp.pl',
255
- path: "/".concat(encodeURIComponent(word)),
254
+ path: `/${encodeURIComponent(word)}`,
256
255
  });
257
256
  };
258
257
  exports["default"] = crawlPolish;
@@ -265,12 +264,12 @@ exports["default"] = crawlPolish;
265
264
 
266
265
 
267
266
  Object.defineProperty(exports, "__esModule", ({ value: true }));
268
- var lib_1 = __webpack_require__(3805);
269
- var crawlSpanish = function (word) {
267
+ const lib_1 = __webpack_require__(3805);
268
+ const crawlSpanish = (word) => {
270
269
  return (0, lib_1.request)({
271
270
  protocol: 'https',
272
271
  hostname: 'www.diccionarios.com',
273
- path: "/diccionario/espanol/".concat(encodeURIComponent(word)),
272
+ path: `/diccionario/espanol/${encodeURIComponent(word)}`,
274
273
  });
275
274
  };
276
275
  exports["default"] = crawlSpanish;
@@ -304,62 +303,19 @@ Object.defineProperty(exports, "crawlGerman", ({ enumerable: true, get: function
304
303
  /***/ }),
305
304
 
306
305
  /***/ 41568:
307
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
306
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
308
307
 
309
308
 
310
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
311
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
312
- return new (P || (P = Promise))(function (resolve, reject) {
313
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
314
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
315
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
316
- step((generator = generator.apply(thisArg, _arguments || [])).next());
317
- });
318
- };
319
- var __generator = (this && this.__generator) || function (thisArg, body) {
320
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
321
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
322
- function verb(n) { return function (v) { return step([n, v]); }; }
323
- function step(op) {
324
- if (f) throw new TypeError("Generator is already executing.");
325
- while (_) try {
326
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
327
- if (y = 0, t) op = [op[0] & 2, t.value];
328
- switch (op[0]) {
329
- case 0: case 1: t = op; break;
330
- case 4: _.label++; return { value: op[1], done: false };
331
- case 5: _.label++; y = op[1]; op = [0]; continue;
332
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
333
- default:
334
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
335
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
336
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
337
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
338
- if (t[2]) _.ops.pop();
339
- _.trys.pop(); continue;
340
- }
341
- op = body.call(thisArg, _);
342
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
343
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
344
- }
345
- };
346
309
  Object.defineProperty(exports, "__esModule", ({ value: true }));
347
- var types_1 = __webpack_require__(46452);
348
- var crawl_1 = __webpack_require__(66344);
349
- var parse_1 = __webpack_require__(74630);
350
- var getWordDefinition = function (locale, word) { return __awaiter(void 0, void 0, void 0, function () {
351
- var html, _a, definitions, isAllowed, wordDefinition;
352
- return __generator(this, function (_b) {
353
- switch (_b.label) {
354
- case 0: return [4 /*yield*/, (0, crawl_1.crawl)(locale, word)];
355
- case 1:
356
- html = _b.sent();
357
- _a = (0, parse_1.parse)(locale, html), definitions = _a.definitions, isAllowed = _a.isAllowed;
358
- wordDefinition = new types_1.WordDefinition({ definitions: definitions, isAllowed: isAllowed, word: word });
359
- return [2 /*return*/, wordDefinition];
360
- }
361
- });
362
- }); };
310
+ const types_1 = __webpack_require__(46452);
311
+ const crawl_1 = __webpack_require__(66344);
312
+ const parse_1 = __webpack_require__(74630);
313
+ const getWordDefinition = async (locale, word) => {
314
+ const html = await (0, crawl_1.crawl)(locale, word);
315
+ const { definitions, isAllowed } = (0, parse_1.parse)(locale, html);
316
+ const wordDefinition = new types_1.WordDefinition({ definitions, isAllowed, word });
317
+ return wordDefinition;
318
+ };
363
319
  exports["default"] = getWordDefinition;
364
320
 
365
321
 
@@ -424,25 +380,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
424
380
  return (mod && mod.__esModule) ? mod : { "default": mod };
425
381
  };
426
382
  Object.defineProperty(exports, "__esModule", ({ value: true }));
427
- var striptags_1 = __importDefault(__webpack_require__(37983));
428
- var EMPHASIS_TAGS = ['a', 'b', 'em', 'internalXref'];
429
- var normalizeHtmlTags = function (definition) { return (0, striptags_1.default)((0, striptags_1.default)(definition, EMPHASIS_TAGS), undefined, '"'); };
430
- var normalizeLineBreaks = function (definition) { return definition.replace(/[\r\n]/g, ''); };
431
- var normalizeQuotes = function (definition) { return definition.replace(/\."/g, '".'); };
383
+ const striptags_1 = __importDefault(__webpack_require__(37983));
384
+ const EMPHASIS_TAGS = ['a', 'b', 'em', 'internalXref'];
385
+ const normalizeHtmlTags = (definition) => (0, striptags_1.default)((0, striptags_1.default)(definition, EMPHASIS_TAGS), undefined, '"');
386
+ const normalizeLineBreaks = (definition) => definition.replace(/[\r\n]/g, '');
387
+ const normalizeQuotes = (definition) => definition.replace(/\."/g, '".');
432
388
  /**
433
389
  * `(1.2) definition` -> `definition`
434
390
  */
435
- var normalizeMarkers = function (definition) { return definition.replace(/^\(\d+\.\d+\)\s+/g, ''); };
436
- var normalizeTrailingSymbols = function (definition) { return definition.trim().replace(/:$/, ''); };
437
- var normalizeLeadingSymbols = function (definition) { return definition.trim().replace(/^:/, ''); };
438
- var normalizeNonWords = function (definition) { return (/\w/.test(definition) ? definition : ''); };
439
- var normalizeCommas = function (definition) {
391
+ const normalizeMarkers = (definition) => definition.replace(/^\(\d+\.\d+\)\s+/g, '');
392
+ const normalizeTrailingSymbols = (definition) => definition.trim().replace(/:$/, '');
393
+ const normalizeLeadingSymbols = (definition) => definition.trim().replace(/^:/, '');
394
+ const normalizeNonWords = (definition) => (/\w/.test(definition) ? definition : '');
395
+ const normalizeCommas = (definition) => {
440
396
  return definition
441
397
  .replace(/\s+,\s+/g, ', ')
442
398
  .replace(/^,/, '')
443
399
  .replace(/,$/, '');
444
400
  };
445
- var normalizers = [
401
+ const normalizers = [
446
402
  normalizeHtmlTags,
447
403
  normalizeMarkers,
448
404
  normalizeQuotes,
@@ -451,11 +407,11 @@ var normalizers = [
451
407
  normalizeLeadingSymbols,
452
408
  normalizeNonWords,
453
409
  normalizeCommas,
454
- function (definition) { return definition.trim(); },
410
+ (definition) => definition.trim(),
455
411
  ];
456
- var normalizeDefinition = function (definition) {
457
- var normalized = normalizers.reduce(function (result, normalize) { return normalize(result); }, definition);
458
- var hasChanged = normalized !== definition;
412
+ const normalizeDefinition = (definition) => {
413
+ const normalized = normalizers.reduce((result, normalize) => normalize(result), definition);
414
+ const hasChanged = normalized !== definition;
459
415
  return hasChanged ? normalizeDefinition(normalized) : normalized;
460
416
  };
461
417
  exports["default"] = normalizeDefinition;
@@ -464,34 +420,22 @@ exports["default"] = normalizeDefinition;
464
420
  /***/ }),
465
421
 
466
422
  /***/ 36:
467
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
423
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
468
424
 
469
425
 
470
- var __rest = (this && this.__rest) || function (s, e) {
471
- var t = {};
472
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
473
- t[p] = s[p];
474
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
475
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
476
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
477
- t[p[i]] = s[p[i]];
478
- }
479
- return t;
480
- };
481
426
  Object.defineProperty(exports, "__esModule", ({ value: true }));
482
- var follow_redirects_1 = __webpack_require__(46966);
483
- var request = function (_a) {
484
- var protocol = _a.protocol, options = __rest(_a, ["protocol"]);
485
- var agent = protocol === 'https' ? follow_redirects_1.https : follow_redirects_1.http;
486
- return new Promise(function (resolve, reject) {
427
+ const follow_redirects_1 = __webpack_require__(46966);
428
+ const request = ({ protocol, ...options }) => {
429
+ const agent = protocol === 'https' ? follow_redirects_1.https : follow_redirects_1.http;
430
+ return new Promise((resolve, reject) => {
487
431
  return agent
488
- .get(options, function (response) {
489
- var data = '';
432
+ .get(options, (response) => {
433
+ let data = '';
490
434
  response.setEncoding('utf8');
491
- response.on('data', function (chunk) {
435
+ response.on('data', (chunk) => {
492
436
  data += chunk;
493
437
  });
494
- response.on('end', function () {
438
+ response.on('end', () => {
495
439
  try {
496
440
  resolve(data);
497
441
  }
@@ -513,7 +457,7 @@ exports["default"] = request;
513
457
 
514
458
 
515
459
  Object.defineProperty(exports, "__esModule", ({ value: true }));
516
- var unique = function (array) { return Array.from(new Set(array)); };
460
+ const unique = (array) => Array.from(new Set(array));
517
461
  exports["default"] = unique;
518
462
 
519
463
 
@@ -551,28 +495,27 @@ Object.defineProperty(exports, "parseSpanish", ({ enumerable: true, get: functio
551
495
  var __importDefault = (this && this.__importDefault) || function (mod) {
552
496
  return (mod && mod.__esModule) ? mod : { "default": mod };
553
497
  };
554
- var _a;
555
498
  Object.defineProperty(exports, "__esModule", ({ value: true }));
556
- var types_1 = __webpack_require__(46452);
557
- var lib_1 = __webpack_require__(3805);
558
- var parseEnglish_1 = __importDefault(__webpack_require__(26519));
559
- var parseFrench_1 = __importDefault(__webpack_require__(51120));
560
- var parseGerman_1 = __importDefault(__webpack_require__(29075));
561
- var parsePolish_1 = __importDefault(__webpack_require__(92198));
562
- var parseSpanish_1 = __importDefault(__webpack_require__(22292));
563
- var parsePerLocale = (_a = {},
564
- _a[types_1.Locale.DE_DE] = parseGerman_1.default,
565
- _a[types_1.Locale.EN_GB] = parseEnglish_1.default,
566
- _a[types_1.Locale.EN_US] = parseEnglish_1.default,
567
- _a[types_1.Locale.ES_ES] = parseSpanish_1.default,
568
- _a[types_1.Locale.FR_FR] = parseFrench_1.default,
569
- _a[types_1.Locale.PL_PL] = parsePolish_1.default,
570
- _a);
571
- var parse = function (locale, html) {
572
- var _a = parsePerLocale[locale](html), definitions = _a.definitions, isAllowed = _a.isAllowed;
499
+ const types_1 = __webpack_require__(46452);
500
+ const lib_1 = __webpack_require__(3805);
501
+ const parseEnglish_1 = __importDefault(__webpack_require__(26519));
502
+ const parseFrench_1 = __importDefault(__webpack_require__(51120));
503
+ const parseGerman_1 = __importDefault(__webpack_require__(29075));
504
+ const parsePolish_1 = __importDefault(__webpack_require__(92198));
505
+ const parseSpanish_1 = __importDefault(__webpack_require__(22292));
506
+ const parsePerLocale = {
507
+ [types_1.Locale.DE_DE]: parseGerman_1.default,
508
+ [types_1.Locale.EN_GB]: parseEnglish_1.default,
509
+ [types_1.Locale.EN_US]: parseEnglish_1.default,
510
+ [types_1.Locale.ES_ES]: parseSpanish_1.default,
511
+ [types_1.Locale.FR_FR]: parseFrench_1.default,
512
+ [types_1.Locale.PL_PL]: parsePolish_1.default,
513
+ };
514
+ const parse = (locale, html) => {
515
+ const { definitions, isAllowed } = parsePerLocale[locale](html);
573
516
  return {
574
517
  definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)),
575
- isAllowed: isAllowed,
518
+ isAllowed,
576
519
  };
577
520
  };
578
521
  exports["default"] = parse;
@@ -588,15 +531,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
588
531
  return (mod && mod.__esModule) ? mod : { "default": mod };
589
532
  };
590
533
  Object.defineProperty(exports, "__esModule", ({ value: true }));
591
- var cheerio_1 = __importDefault(__webpack_require__(85131));
592
- var parseEnglish = function (html) {
593
- var $ = cheerio_1.default.load(html);
534
+ const cheerio_1 = __importDefault(__webpack_require__(85131));
535
+ const parseEnglish = (html) => {
536
+ const $ = cheerio_1.default.load(html);
594
537
  $('strong.mw_t_bc').replaceWith(', ');
595
538
  $('.text-lowercase').remove();
596
539
  $('[id^=dictionary-entry]').find('.dtText > *:not(a)').remove();
597
- var $definitions = $('[id^=dictionary-entry]').find('.dtText, .cxl-ref');
540
+ const $definitions = $('[id^=dictionary-entry]').find('.dtText, .cxl-ref');
598
541
  return {
599
- definitions: Array.from($definitions).map(function (definition) { return $(definition).text(); }),
542
+ definitions: Array.from($definitions).map((definition) => $(definition).text()),
600
543
  isAllowed: $definitions.length > 0,
601
544
  };
602
545
  };
@@ -613,12 +556,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
613
556
  return (mod && mod.__esModule) ? mod : { "default": mod };
614
557
  };
615
558
  Object.defineProperty(exports, "__esModule", ({ value: true }));
616
- var cheerio_1 = __importDefault(__webpack_require__(85131));
617
- var parseFrench = function (html) {
618
- var $ = cheerio_1.default.load(html);
619
- var $definitions = $('.tlf_cdefinition');
559
+ const cheerio_1 = __importDefault(__webpack_require__(85131));
560
+ const parseFrench = (html) => {
561
+ const $ = cheerio_1.default.load(html);
562
+ const $definitions = $('.tlf_cdefinition');
620
563
  return {
621
- definitions: Array.from($definitions).map(function (definition) { return $(definition).text(); }),
564
+ definitions: Array.from($definitions).map((definition) => $(definition).text()),
622
565
  isAllowed: $('#vitemselected span').length > 0,
623
566
  };
624
567
  };
@@ -635,11 +578,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
635
578
  return (mod && mod.__esModule) ? mod : { "default": mod };
636
579
  };
637
580
  Object.defineProperty(exports, "__esModule", ({ value: true }));
638
- var cheerio_1 = __importDefault(__webpack_require__(85131));
639
- var parseGerman = function (html) {
640
- var $ = cheerio_1.default.load(html);
641
- var $meaningOverview = $('.bedeutungsuebersicht');
642
- var $definitions;
581
+ const cheerio_1 = __importDefault(__webpack_require__(85131));
582
+ const parseGerman = (html) => {
583
+ const $ = cheerio_1.default.load(html);
584
+ const $meaningOverview = $('.bedeutungsuebersicht');
585
+ let $definitions;
643
586
  if ($meaningOverview.length > 0) {
644
587
  $definitions = $('.bedeutungsuebersicht > ol > li > a');
645
588
  }
@@ -647,7 +590,7 @@ var parseGerman = function (html) {
647
590
  $definitions = $('.dwdswb-lesart .dwdswb-definition');
648
591
  }
649
592
  return {
650
- definitions: Array.from($definitions).map(function (definition) { return $(definition).text().replace('/\n/', ''); }),
593
+ definitions: Array.from($definitions).map((definition) => $(definition).text().replace('/\n/', '')),
651
594
  isAllowed: $definitions.length > 0,
652
595
  };
653
596
  };
@@ -664,12 +607,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
664
607
  return (mod && mod.__esModule) ? mod : { "default": mod };
665
608
  };
666
609
  Object.defineProperty(exports, "__esModule", ({ value: true }));
667
- var cheerio_1 = __importDefault(__webpack_require__(85131));
668
- var parsePolish = function (html) {
669
- var $ = cheerio_1.default.load(html);
670
- var $header = $($('h1')[0]);
671
- var $isAllowed = $header.next();
672
- var $definitions = $header.next().next().next().next();
610
+ const cheerio_1 = __importDefault(__webpack_require__(85131));
611
+ const parsePolish = (html) => {
612
+ const $ = cheerio_1.default.load(html);
613
+ const $header = $($('h1')[0]);
614
+ const $isAllowed = $header.next();
615
+ const $definitions = $header.next().next().next().next();
673
616
  return {
674
617
  definitions: $definitions.text().trim().split(/\d+\./),
675
618
  isAllowed: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
@@ -688,9 +631,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
688
631
  return (mod && mod.__esModule) ? mod : { "default": mod };
689
632
  };
690
633
  Object.defineProperty(exports, "__esModule", ({ value: true }));
691
- var cheerio_1 = __importDefault(__webpack_require__(85131));
692
- var parseSpanish = function (html) {
693
- var $ = cheerio_1.default.load(html);
634
+ const cheerio_1 = __importDefault(__webpack_require__(85131));
635
+ const parseSpanish = (html) => {
636
+ const $ = cheerio_1.default.load(html);
694
637
  $('.verdBold14 + .gris11 + .gris13').remove();
695
638
  $('br + .gris13').remove();
696
639
  $('.grisItalic13 + .gris13').remove();
@@ -698,19 +641,19 @@ var parseSpanish = function (html) {
698
641
  $('font.gris11').remove();
699
642
  $('font[class^="grisBold"]').remove();
700
643
  $('font[class^="grisItalic"]').remove();
701
- Array.from($('.gris13')).forEach(function (element) {
702
- var children = $(element).find('.gris13');
644
+ Array.from($('.gris13')).forEach((element) => {
645
+ const children = $(element).find('.gris13');
703
646
  if (children && children.length > 0) {
704
647
  children.remove();
705
648
  }
706
649
  });
707
- var definitions = Array.from($('.dcom-search-result .gris13'));
650
+ const definitions = Array.from($('.dcom-search-result .gris13'));
708
651
  return {
709
652
  definitions: definitions
710
- .map(function (definition) { return $(definition).text().trim(); })
653
+ .map((definition) => $(definition).text().trim())
711
654
  .filter(Boolean)
712
- .map(function (definition) { return definition.replace(/\s+\.$/g, ''); })
713
- .map(function (definition) { return (definition.endsWith('.') ? definition : "".concat(definition, ".")); }),
655
+ .map((definition) => definition.replace(/\s+\.$/g, ''))
656
+ .map((definition) => (definition.endsWith('.') ? definition : `${definition}.`)),
714
657
  isAllowed: definitions.length > 0,
715
658
  };
716
659
  };