@scrabble-solver/scrabble-solver 2.8.9 → 2.8.11

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 (74) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +11 -11
  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 +189 -43
  14. package/.next/server/chunks/429.js +2 -13
  15. package/.next/server/chunks/515.js +469 -254
  16. package/.next/server/chunks/911.js +25 -3
  17. package/.next/server/middleware-build-manifest.js +1 -1
  18. package/.next/server/pages/404.html +2 -2
  19. package/.next/server/pages/404.js.nft.json +1 -1
  20. package/.next/server/pages/500.html +2 -2
  21. package/.next/server/pages/_app.js.nft.json +1 -1
  22. package/.next/server/pages/api/solve.js +77 -20
  23. package/.next/server/pages/index.html +3 -3
  24. package/.next/server/pages/index.js +1 -1
  25. package/.next/server/pages/index.js.nft.json +1 -1
  26. package/.next/server/pages/index.json +1 -1
  27. package/.next/static/VJkrGviICslA_8zNVJ-g-/_buildManifest.js +1 -0
  28. package/.next/static/{yCxjzzYpw5JjJE53PO_s6 → VJkrGviICslA_8zNVJ-g-}/_ssgManifest.js +0 -0
  29. package/.next/static/chunks/317-8e8909dd2f587b64.js +1 -0
  30. package/.next/static/chunks/546-447e243fc9de2c59.js +1 -0
  31. package/.next/static/chunks/pages/{404-90c624da3c83fd17.js → 404-7082923654d5996f.js} +1 -1
  32. package/.next/static/chunks/pages/_app-57c77cad0f197d93.js +1 -0
  33. package/.next/static/chunks/pages/index-d3360e075ca3c222.js +1 -0
  34. package/.next/static/css/9ac903004135f4b1.css +1 -0
  35. package/.next/trace +42 -42
  36. package/package.json +12 -12
  37. package/src/components/Badge/Badge.module.scss +1 -1
  38. package/src/components/Board/Board.tsx +4 -2
  39. package/src/components/Board/BoardPure.tsx +25 -5
  40. package/src/components/Board/components/Cell/CellPure.tsx +33 -31
  41. package/src/components/Board/hooks/useGrid.ts +217 -91
  42. package/src/components/Dictionary/Dictionary.tsx +8 -1
  43. package/src/components/Rack/Rack.tsx +51 -11
  44. package/src/components/Rack/RackTile.tsx +33 -16
  45. package/src/components/Results/Results.tsx +19 -3
  46. package/src/components/Sidebar/Sidebar.tsx +20 -1
  47. package/src/components/SquareButton/Link.tsx +1 -1
  48. package/src/components/Tile/Tile.module.scss +4 -0
  49. package/src/components/Tile/Tile.tsx +13 -4
  50. package/src/components/Tile/TilePure.tsx +3 -4
  51. package/src/lib/extractCharacters.ts +26 -0
  52. package/src/lib/extractInputValue.ts +17 -0
  53. package/src/lib/index.ts +2 -0
  54. package/src/lib/isCtrl.ts +1 -1
  55. package/src/lib/memoize.ts +15 -1
  56. package/src/pages/api/solve.ts +1 -1
  57. package/src/sdk/fetchJson.ts +36 -0
  58. package/src/sdk/findWordDefinitions.ts +4 -3
  59. package/src/sdk/solve.ts +8 -7
  60. package/src/sdk/verify.ts +5 -6
  61. package/src/state/sagas.ts +9 -3
  62. package/src/state/selectors.ts +9 -1
  63. package/src/state/slices/dictionaryInitialState.ts +10 -2
  64. package/src/state/slices/dictionarySlice.ts +10 -16
  65. package/src/state/slices/rackSlice.ts +7 -5
  66. package/src/state/slices/solveInitialState.ts +14 -2
  67. package/src/state/slices/solveSlice.ts +7 -4
  68. package/src/types/index.ts +2 -0
  69. package/.next/static/chunks/317-a33dd38e9b9a17ed.js +0 -1
  70. package/.next/static/chunks/758-f333b1dcdb941547.js +0 -1
  71. package/.next/static/chunks/pages/_app-f8f360878e1c2aff.js +0 -1
  72. package/.next/static/chunks/pages/index-ecea697d3e5d8a6f.js +0 -1
  73. package/.next/static/css/64dc2ce1811912f1.css +0 -1
  74. package/.next/static/yCxjzzYpw5JjJE53PO_s6/_buildManifest.js +0 -1
@@ -861,7 +861,7 @@ exports.VOWELS = ['a', 'ą', 'ä', 'e', 'ę', 'i', 'o', 'ó', 'ö', 'u', 'ü', '
861
861
 
862
862
  /***/ }),
863
863
 
864
- /***/ 92237:
864
+ /***/ 75558:
865
865
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
866
866
 
867
867
 
@@ -873,6 +873,8 @@ __webpack_require__.d(__webpack_exports__, {
873
873
  "np": () => (/* reexport */ lib_createKeyboardNavigation),
874
874
  "Ml": () => (/* reexport */ lib_createNullMovingComparator),
875
875
  "Nj": () => (/* reexport */ lib_detectLocale),
876
+ "nK": () => (/* reexport */ lib_extractCharacters),
877
+ "WM": () => (/* reexport */ lib_extractInputValue),
876
878
  "Jp": () => (/* reexport */ lib_findCell),
877
879
  "Dz": () => (/* reexport */ lib_getCellSize),
878
880
  "ZM": () => (/* reexport */ lib_getRemainingTiles),
@@ -973,6 +975,43 @@ const detectLocale = ()=>{
973
975
  };
974
976
  /* harmony default export */ const lib_detectLocale = (detectLocale);
975
977
 
978
+ // EXTERNAL MODULE: ../constants/build/index.js
979
+ var constants_build = __webpack_require__(7618);
980
+ ;// CONCATENATED MODULE: ./src/lib/extractCharacters.ts
981
+
982
+ const extractCharacters = (config, value)=>{
983
+ let index = 0;
984
+ const characters = [];
985
+ while(index < value.length){
986
+ const character = value[index];
987
+ const nextCharacter = value[index + 1];
988
+ const twoCharacterTileCandidate = `${character}${nextCharacter}`;
989
+ if (config.twoCharacterTiles.includes(twoCharacterTileCandidate)) {
990
+ characters.push(twoCharacterTileCandidate);
991
+ ++index;
992
+ } else if (config.hasCharacter(character) || character === constants_build.BLANK) {
993
+ characters.push(character);
994
+ }
995
+ ++index;
996
+ }
997
+ return characters;
998
+ };
999
+ /* harmony default export */ const lib_extractCharacters = (extractCharacters);
1000
+
1001
+ ;// CONCATENATED MODULE: ./src/lib/extractInputValue.ts
1002
+ const extractInputValue = (input)=>{
1003
+ const value = input.value.toLocaleLowerCase();
1004
+ if (input.selectionStart === null || input.selectionEnd === null) {
1005
+ return value;
1006
+ }
1007
+ const index = Math.min(input.selectionStart, input.selectionEnd);
1008
+ if (index > 0) {
1009
+ return value.substring(index - 1, index);
1010
+ }
1011
+ return value;
1012
+ };
1013
+ /* harmony default export */ const lib_extractInputValue = (extractInputValue);
1014
+
976
1015
  ;// CONCATENATED MODULE: ./src/lib/findCell.ts
977
1016
  const findCell = (cells, x, y)=>{
978
1017
  return cells.find((cell)=>cell.x === x && cell.y === y);
@@ -991,8 +1030,6 @@ const getCellSize = (config, width, height)=>{
991
1030
  };
992
1031
  /* harmony default export */ const lib_getCellSize = (getCellSize);
993
1032
 
994
- // EXTERNAL MODULE: ../constants/build/index.js
995
- var constants_build = __webpack_require__(7618);
996
1033
  ;// CONCATENATED MODULE: ./src/lib/numberComparator.ts
997
1034
  const numberComparator = (a, b)=>a - b;
998
1035
  /* harmony default export */ const lib_numberComparator = (numberComparator);
@@ -1161,6 +1198,12 @@ const memoize = (fn)=>{
1161
1198
  const readCache = (parameters)=>{
1162
1199
  return cache.find((entry)=>parametersEqual(entry.parameters, parameters))?.result;
1163
1200
  };
1201
+ const removeCache = (parameters)=>{
1202
+ const index = cache.findIndex((entry)=>parametersEqual(entry.parameters, parameters));
1203
+ if (index >= 0) {
1204
+ cache.splice(index, 1);
1205
+ }
1206
+ };
1164
1207
  const writeCache = (parameters, result)=>{
1165
1208
  cache.push({
1166
1209
  parameters,
@@ -1173,6 +1216,11 @@ const memoize = (fn)=>{
1173
1216
  return cached;
1174
1217
  }
1175
1218
  const result = fn(...parameters);
1219
+ if (result instanceof Promise) {
1220
+ result.catch(()=>{
1221
+ removeCache(parameters);
1222
+ });
1223
+ }
1176
1224
  writeCache(parameters, result);
1177
1225
  return result;
1178
1226
  };
@@ -1306,6 +1354,8 @@ const zipCharactersAndTiles = (characters, tiles)=>{
1306
1354
 
1307
1355
 
1308
1356
 
1357
+
1358
+
1309
1359
 
1310
1360
 
1311
1361
 
@@ -1416,7 +1466,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
1416
1466
  /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(redux__WEBPACK_IMPORTED_MODULE_0__);
1417
1467
  /* harmony import */ var redux_saga__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75998);
1418
1468
  /* harmony import */ var _rootReducer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12935);
1419
- /* harmony import */ var _sagas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21701);
1469
+ /* harmony import */ var _sagas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22418);
1420
1470
  var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([redux_saga__WEBPACK_IMPORTED_MODULE_1__]);
1421
1471
  redux_saga__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1422
1472
 
@@ -1454,6 +1504,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
1454
1504
  /* harmony export */ "QB": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.QB),
1455
1505
  /* harmony export */ "QL": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.QL),
1456
1506
  /* harmony export */ "R": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.R),
1507
+ /* harmony export */ "Rn": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.Rn),
1457
1508
  /* harmony export */ "TP": () => (/* reexport safe */ _slices__WEBPACK_IMPORTED_MODULE_4__.TP),
1458
1509
  /* harmony export */ "Xb": () => (/* reexport safe */ _localStorage__WEBPACK_IMPORTED_MODULE_2__.Z),
1459
1510
  /* harmony export */ "Yj": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.Yj),
@@ -1469,6 +1520,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
1469
1520
  /* harmony export */ "ix": () => (/* reexport safe */ _useTypedSelector__WEBPACK_IMPORTED_MODULE_6__.Z),
1470
1521
  /* harmony export */ "j2": () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_0__.j),
1471
1522
  /* harmony export */ "lj": () => (/* reexport safe */ _slices__WEBPACK_IMPORTED_MODULE_4__.lj),
1523
+ /* harmony export */ "mK": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.mK),
1472
1524
  /* harmony export */ "mO": () => (/* reexport safe */ _slices__WEBPACK_IMPORTED_MODULE_4__.mO),
1473
1525
  /* harmony export */ "mc": () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_0__.m),
1474
1526
  /* harmony export */ "md": () => (/* reexport safe */ _selectors__WEBPACK_IMPORTED_MODULE_3__.md),
@@ -1586,7 +1638,7 @@ const rootReducer = (0,redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers)({
1586
1638
 
1587
1639
  /***/ }),
1588
1640
 
1589
- /***/ 21701:
1641
+ /***/ 22418:
1590
1642
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1591
1643
 
1592
1644
 
@@ -1595,51 +1647,80 @@ __webpack_require__.d(__webpack_exports__, {
1595
1647
  "R": () => (/* binding */ rootSaga)
1596
1648
  });
1597
1649
 
1598
- // EXTERNAL MODULE: ../types/build/index.js
1599
- var build = __webpack_require__(34046);
1600
1650
  // EXTERNAL MODULE: external "redux-saga/effects"
1601
1651
  var effects_ = __webpack_require__(56477);
1602
- // EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
1603
- var lib = __webpack_require__(92237);
1652
+ // EXTERNAL MODULE: ./src/lib/index.ts + 29 modules
1653
+ var lib = __webpack_require__(75558);
1654
+ // EXTERNAL MODULE: ../types/build/index.js
1655
+ var build = __webpack_require__(34046);
1656
+ ;// CONCATENATED MODULE: ./src/sdk/fetchJson.ts
1657
+
1658
+ const fetchJson = async (input, init)=>{
1659
+ let response;
1660
+ try {
1661
+ response = await fetch(input, {
1662
+ ...init,
1663
+ headers: {
1664
+ "Content-Type": "application/json",
1665
+ ...init?.headers
1666
+ }
1667
+ });
1668
+ } catch (error) {
1669
+ const message = (0,build.isError)(error) ? error.message : "Unknown error";
1670
+ throw new Error(`Network error: ${message}`);
1671
+ }
1672
+ if (response.ok) {
1673
+ return response.json();
1674
+ }
1675
+ try {
1676
+ const json = await response.json();
1677
+ if ((0,build.isError)(json)) {
1678
+ throw new Error(json.message);
1679
+ }
1680
+ } finally{
1681
+ // do nothing
1682
+ }
1683
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
1684
+ };
1685
+ /* harmony default export */ const sdk_fetchJson = (fetchJson);
1686
+
1604
1687
  ;// CONCATENATED MODULE: ./src/sdk/findWordDefinitions.ts
1605
1688
 
1689
+
1606
1690
  const findWordDefinitions = async (locale, word)=>{
1607
- const url = `/api/dictionary/${locale}/${word}`;
1608
- const json = await fetch(url).then((response)=>response.json());
1691
+ const json = await sdk_fetchJson(`/api/dictionary/${locale}/${word}`);
1609
1692
  return json.map(build.WordDefinition.fromJson);
1610
1693
  };
1611
1694
  /* harmony default export */ const sdk_findWordDefinitions = (findWordDefinitions);
1612
1695
 
1613
1696
  ;// CONCATENATED MODULE: ./src/sdk/solve.ts
1614
- const solve = ({ board , characters , configId , locale })=>{
1615
- return fetch("/api/solve", {
1697
+
1698
+
1699
+ const solve = async ({ board , characters , configId , locale })=>{
1700
+ const json = await sdk_fetchJson("/api/solve", {
1616
1701
  method: "POST",
1617
- headers: {
1618
- "Content-Type": "application/json"
1619
- },
1620
1702
  body: JSON.stringify({
1621
1703
  board,
1622
1704
  characters,
1623
1705
  configId,
1624
1706
  locale
1625
1707
  })
1626
- }).then((response)=>response.json());
1708
+ });
1709
+ return json.map(build.Result.fromJson);
1627
1710
  };
1628
1711
  /* harmony default export */ const sdk_solve = (solve);
1629
1712
 
1630
1713
  ;// CONCATENATED MODULE: ./src/sdk/verify.ts
1631
- const verify = ({ board , configId , locale })=>{
1632
- return fetch("/api/verify", {
1714
+
1715
+ const verify = async ({ board , configId , locale })=>{
1716
+ return sdk_fetchJson("/api/verify", {
1633
1717
  method: "POST",
1634
- headers: {
1635
- "Content-Type": "application/json"
1636
- },
1637
1718
  body: JSON.stringify({
1638
1719
  board,
1639
1720
  configId,
1640
1721
  locale
1641
1722
  })
1642
- }).then((response)=>response.json());
1723
+ });
1643
1724
  };
1644
1725
  /* harmony default export */ const sdk_verify = (verify);
1645
1726
 
@@ -1670,11 +1751,14 @@ var slices = __webpack_require__(99134);
1670
1751
 
1671
1752
 
1672
1753
 
1673
-
1674
1754
  const SUBMIT_DELAY = 150;
1675
1755
  const memoizedFindWordDefinitions = (0,lib/* memoize */.HP)(sdk_findWordDefinitions);
1676
1756
  function* rootSaga() {
1677
1757
  yield (0,effects_.takeEvery)(slices/* boardSlice.actions.changeCellValue.type */.I8.actions.changeCellValue.type, onCellValueChange);
1758
+ yield (0,effects_.takeEvery)([
1759
+ slices/* rackSlice.actions.changeCharacter.type */.O_.actions.changeCharacter.type,
1760
+ slices/* rackSlice.actions.changeCharacters.type */.O_.actions.changeCharacters.type
1761
+ ], onRackValueChange);
1678
1762
  yield (0,effects_.takeEvery)(slices/* resultsSlice.actions.applyResult.type */._C.actions.applyResult.type, onApplyResult);
1679
1763
  yield (0,effects_.takeEvery)(slices/* resultsSlice.actions.changeResultCandidate.type */._C.actions.changeResultCandidate.type, onResultCandidateChange);
1680
1764
  yield (0,effects_.takeEvery)(slices/* settingsSlice.actions.changeConfigId.type */.xj.actions.changeConfigId.type, onConfigIdChange);
@@ -1690,8 +1774,12 @@ function* onCellValueChange({ payload }) {
1690
1774
  if (isFiltered) {
1691
1775
  yield (0,effects_.put)(slices/* cellFilterSlice.actions.toggle */.mO.actions.toggle(payload));
1692
1776
  }
1777
+ yield (0,effects_.put)(slices/* resultsSlice.actions.changeResultCandidate */._C.actions.changeResultCandidate(null));
1693
1778
  yield (0,effects_.put)(slices/* verifySlice.actions.submit */.Gt.actions.submit());
1694
1779
  }
1780
+ function* onRackValueChange() {
1781
+ yield (0,effects_.put)(slices/* resultsSlice.actions.changeResultCandidate */._C.actions.changeResultCandidate(null));
1782
+ }
1695
1783
  function* onApplyResult({ payload: result }) {
1696
1784
  const autoGroupTiles = yield (0,effects_.select)(selectors/* selectAutoGroupTiles */.uz);
1697
1785
  yield (0,effects_.put)(slices/* boardSlice.actions.applyResult */.I8.actions.applyResult(result));
@@ -1716,7 +1804,7 @@ function* onDictionarySubmit() {
1716
1804
  const wordDefinitions = yield (0,effects_.call)(memoizedFindWordDefinitions, locale, word);
1717
1805
  yield (0,effects_.put)(slices/* dictionarySlice.actions.submitSuccess */.lj.actions.submitSuccess(wordDefinitions));
1718
1806
  } catch (error) {
1719
- yield (0,effects_.put)(slices/* dictionarySlice.actions.submitFailure */.lj.actions.submitFailure());
1807
+ yield (0,effects_.put)(slices/* dictionarySlice.actions.submitFailure */.lj.actions.submitFailure(error));
1720
1808
  }
1721
1809
  }
1722
1810
  function* onInitialize() {
@@ -1763,14 +1851,14 @@ function* onSolve() {
1763
1851
  configId: config.id,
1764
1852
  locale
1765
1853
  });
1766
- yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults(results.map(build.Result.fromJson)));
1854
+ yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults(results));
1767
1855
  yield (0,effects_.put)(slices/* solveSlice.actions.submitSuccess */.TP.actions.submitSuccess({
1768
1856
  board,
1769
1857
  characters
1770
1858
  }));
1771
1859
  } catch (error) {
1772
1860
  yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults([]));
1773
- yield (0,effects_.put)(slices/* solveSlice.actions.submitFailure */.TP.actions.submitFailure());
1861
+ yield (0,effects_.put)(slices/* solveSlice.actions.submitFailure */.TP.actions.submitFailure(error));
1774
1862
  }
1775
1863
  }
1776
1864
  function* onVerify() {
@@ -1833,6 +1921,7 @@ __webpack_require__.d(__webpack_exports__, {
1833
1921
  "$o": () => (/* binding */ selectConfig),
1834
1922
  "md": () => (/* binding */ selectConfigId),
1835
1923
  "w1": () => (/* binding */ selectDictionary),
1924
+ "mK": () => (/* binding */ selectDictionaryError),
1836
1925
  "bs": () => (/* binding */ selectHasInvalidWords),
1837
1926
  "En": () => (/* binding */ selectHasOverusedTiles),
1838
1927
  "xU": () => (/* binding */ selectIsLoading),
@@ -1844,6 +1933,7 @@ __webpack_require__.d(__webpack_exports__, {
1844
1933
  "R": () => (/* binding */ selectResultsSortColumn),
1845
1934
  "sH": () => (/* binding */ selectResultsSortDirection),
1846
1935
  "ZA": () => (/* binding */ selectRowsWithCandidate),
1936
+ "Rn": () => (/* binding */ selectSolveError),
1847
1937
  "dN": () => (/* binding */ selectSortedFilteredResults),
1848
1938
  "f2": () => (/* binding */ selectSortedResults),
1849
1939
  "Zf": () => (/* binding */ selectTilePoints),
@@ -1886,13 +1976,14 @@ const i18n = {
1886
1976
  };
1887
1977
  /* harmony default export */ const src_i18n = (i18n);
1888
1978
 
1889
- // EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
1890
- var lib = __webpack_require__(92237);
1979
+ // EXTERNAL MODULE: ./src/lib/index.ts + 29 modules
1980
+ var lib = __webpack_require__(75558);
1891
1981
  ;// CONCATENATED MODULE: ./src/state/selectors.ts
1892
1982
 
1893
1983
 
1894
1984
 
1895
1985
 
1986
+
1896
1987
  const selectCell = (_, cell)=>cell;
1897
1988
  const selectPoint = (_, point)=>point;
1898
1989
  const selectCharacter = (_, character)=>character;
@@ -1906,6 +1997,11 @@ const selectSettingsRoot = (state)=>state.settings;
1906
1997
  const selectSolveRoot = (state)=>state.solve;
1907
1998
  const selectVerifyRoot = (state)=>state.verify;
1908
1999
  const selectDictionary = selectDictionaryRoot;
2000
+ const selectDictionaryError = (0,toolkit_.createSelector)([
2001
+ selectDictionaryRoot
2002
+ ], (dictionary)=>{
2003
+ return (0,types_build.isError)(dictionary.error) ? dictionary.error : undefined;
2004
+ });
1909
2005
  const selectAutoGroupTiles = (0,toolkit_.createSelector)([
1910
2006
  selectSettingsRoot
1911
2007
  ], (settings)=>settings.autoGroupTiles);
@@ -2030,6 +2126,11 @@ const selectLastSolvedParameters = (0,toolkit_.createSelector)([
2030
2126
  const selectIsLoading = (0,toolkit_.createSelector)([
2031
2127
  selectSolveRoot
2032
2128
  ], (solve)=>solve.isLoading);
2129
+ const selectSolveError = (0,toolkit_.createSelector)([
2130
+ selectSolveRoot
2131
+ ], (solve)=>{
2132
+ return (0,types_build.isError)(solve.error) ? solve.error : undefined;
2133
+ });
2033
2134
  const selectHaveCharactersChanged = (0,toolkit_.createSelector)([
2034
2135
  selectLastSolvedParameters,
2035
2136
  selectCharacters
@@ -2207,6 +2308,7 @@ const cellFilterSlice = (0,toolkit_.createSlice)({
2207
2308
 
2208
2309
  ;// CONCATENATED MODULE: ./src/state/slices/dictionaryInitialState.ts
2209
2310
  const dictionaryInitialState = {
2311
+ error: undefined,
2210
2312
  input: "",
2211
2313
  isLoading: false,
2212
2314
  results: []
@@ -2228,32 +2330,41 @@ const dictionarySlice = (0,toolkit_.createSlice)({
2228
2330
  },
2229
2331
  reset: ()=>slices_dictionaryInitialState,
2230
2332
  submit: (state)=>{
2333
+ const error = slices_dictionaryInitialState.error;
2334
+ const results = slices_dictionaryInitialState.results;
2231
2335
  return {
2232
2336
  ...state,
2337
+ error,
2233
2338
  isLoading: true,
2234
- results: slices_dictionaryInitialState.results
2339
+ results
2235
2340
  };
2236
2341
  },
2237
- submitFailure: (state)=>{
2342
+ submitFailure: (state, action)=>{
2343
+ const error = action.payload;
2344
+ const results = slices_dictionaryInitialState.results;
2238
2345
  return {
2239
2346
  ...state,
2347
+ error,
2240
2348
  isLoading: false,
2241
- results: slices_dictionaryInitialState.results
2349
+ results
2242
2350
  };
2243
2351
  },
2244
2352
  submitSuccess: (state, action)=>{
2353
+ const error = slices_dictionaryInitialState.error;
2354
+ const results = action.payload;
2245
2355
  return {
2246
2356
  ...state,
2357
+ error,
2247
2358
  isLoading: false,
2248
- results: action.payload
2359
+ results
2249
2360
  };
2250
2361
  }
2251
2362
  }
2252
2363
  });
2253
2364
  /* harmony default export */ const slices_dictionarySlice = (dictionarySlice);
2254
2365
 
2255
- // EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
2256
- var lib = __webpack_require__(92237);
2366
+ // EXTERNAL MODULE: ./src/lib/index.ts + 29 modules
2367
+ var lib = __webpack_require__(75558);
2257
2368
  ;// CONCATENATED MODULE: ./src/state/slices/rackInitialState.ts
2258
2369
  const rackInitialState = [
2259
2370
  null,
@@ -2274,10 +2385,6 @@ const rackSlice = (0,toolkit_.createSlice)({
2274
2385
  initialState: slices_rackInitialState,
2275
2386
  name: "rack",
2276
2387
  reducers: {
2277
- change: (_state, action)=>{
2278
- const rack = action.payload;
2279
- return rack;
2280
- },
2281
2388
  changeCharacter: (state, action)=>{
2282
2389
  const { character , index } = action.payload;
2283
2390
  return [
@@ -2286,6 +2393,16 @@ const rackSlice = (0,toolkit_.createSlice)({
2286
2393
  ...state.slice(index + 1)
2287
2394
  ];
2288
2395
  },
2396
+ changeCharacters: (state, action)=>{
2397
+ const { characters , index } = action.payload;
2398
+ const expectedRackLength = state.length;
2399
+ const rack = [
2400
+ ...state.slice(0, index),
2401
+ ...characters,
2402
+ ...state.slice(index + characters.length)
2403
+ ];
2404
+ return rack.slice(0, expectedRackLength);
2405
+ },
2289
2406
  groupTiles: (state, action)=>{
2290
2407
  const direction = action.payload;
2291
2408
  if (direction === null) {
@@ -2421,6 +2538,7 @@ const settingsSlice = (0,toolkit_.createSlice)({
2421
2538
  ;// CONCATENATED MODULE: ./src/state/slices/solveInitialState.ts
2422
2539
 
2423
2540
  const solveInitialState = {
2541
+ error: undefined,
2424
2542
  isLoading: false,
2425
2543
  lastSolvedParameters: {
2426
2544
  board: slices_boardInitialState,
@@ -2437,21 +2555,27 @@ const solveSlice = (0,toolkit_.createSlice)({
2437
2555
  name: "solve",
2438
2556
  reducers: {
2439
2557
  submit: (state)=>{
2558
+ const error = slices_solveInitialState.error;
2440
2559
  return {
2441
2560
  ...state,
2561
+ error,
2442
2562
  isLoading: true
2443
2563
  };
2444
2564
  },
2445
- submitFailure: (state)=>{
2565
+ submitFailure: (state, action)=>{
2566
+ const error = action.payload;
2446
2567
  return {
2447
2568
  ...state,
2569
+ error,
2448
2570
  isLoading: false
2449
2571
  };
2450
2572
  },
2451
2573
  submitSuccess: (state, action)=>{
2574
+ const error = slices_solveInitialState.error;
2452
2575
  const lastSolvedParameters = action.payload;
2453
2576
  return {
2454
2577
  ...state,
2578
+ error,
2455
2579
  isLoading: false,
2456
2580
  lastSolvedParameters
2457
2581
  };
@@ -2672,7 +2796,7 @@ class Board {
2672
2796
  }
2673
2797
  getBlanksCount() {
2674
2798
  return this.rows.reduce((count, row) => {
2675
- return count + row.reduce((rowCount, cell) => (cell.tile.isBlank ? rowCount + 1 : rowCount), 0);
2799
+ return count + row.reduce((rowCount, cell) => rowCount + (cell.tile.isBlank ? 1 : 0), 0);
2676
2800
  }, 0);
2677
2801
  }
2678
2802
  getColumn(index) {
@@ -2683,7 +2807,7 @@ class Board {
2683
2807
  }
2684
2808
  getTilesCount() {
2685
2809
  return this.rows.reduce((count, row) => {
2686
- return count + row.reduce((rowCount, cell) => (cell.hasTile() ? rowCount + 1 : rowCount), 0);
2810
+ return count + row.reduce((rowCount, cell) => rowCount + (cell.hasTile() ? 1 : 0), 0);
2687
2811
  }, 0);
2688
2812
  }
2689
2813
  getWords() {
@@ -3412,7 +3536,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3412
3536
  return (mod && mod.__esModule) ? mod : { "default": mod };
3413
3537
  };
3414
3538
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3415
- exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.isTileJson = exports.Tile = exports.Result = exports.Pattern = exports.isLocale = exports.Locale = exports.isObject = exports.HorizontalPattern = exports.FinalPattern = exports.Config = exports.CharacterBonus = exports.isCellJson = exports.Cell = exports.Bonus = exports.isBoardJson = exports.Board = void 0;
3539
+ exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.isTileJson = exports.Tile = exports.Result = exports.Pattern = exports.isLocale = exports.Locale = exports.isObject = exports.isError = exports.HorizontalPattern = exports.FinalPattern = exports.Config = exports.CharacterBonus = exports.isCellJson = exports.Cell = exports.Bonus = exports.isBoardJson = exports.Board = void 0;
3416
3540
  var Board_1 = __webpack_require__(80559);
3417
3541
  Object.defineProperty(exports, "Board", ({ enumerable: true, get: function () { return __importDefault(Board_1).default; } }));
3418
3542
  var BoardJson_1 = __webpack_require__(46936);
@@ -3431,6 +3555,8 @@ var FinalPattern_1 = __webpack_require__(35905);
3431
3555
  Object.defineProperty(exports, "FinalPattern", ({ enumerable: true, get: function () { return __importDefault(FinalPattern_1).default; } }));
3432
3556
  var HorizontalPattern_1 = __webpack_require__(49594);
3433
3557
  Object.defineProperty(exports, "HorizontalPattern", ({ enumerable: true, get: function () { return __importDefault(HorizontalPattern_1).default; } }));
3558
+ var isError_1 = __webpack_require__(96255);
3559
+ Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return __importDefault(isError_1).default; } }));
3434
3560
  var isObject_1 = __webpack_require__(24814);
3435
3561
  Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return __importDefault(isObject_1).default; } }));
3436
3562
  var Locale_1 = __webpack_require__(26634);
@@ -3452,6 +3578,26 @@ var WordDefinition_1 = __webpack_require__(31560);
3452
3578
  Object.defineProperty(exports, "WordDefinition", ({ enumerable: true, get: function () { return __importDefault(WordDefinition_1).default; } }));
3453
3579
 
3454
3580
 
3581
+ /***/ }),
3582
+
3583
+ /***/ 96255:
3584
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3585
+
3586
+
3587
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3588
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3589
+ };
3590
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3591
+ const isObject_1 = __importDefault(__webpack_require__(24814));
3592
+ const isError = (value) => {
3593
+ if (!(0, isObject_1.default)(value)) {
3594
+ return false;
3595
+ }
3596
+ return typeof value.message === 'string';
3597
+ };
3598
+ exports["default"] = isError;
3599
+
3600
+
3455
3601
  /***/ }),
3456
3602
 
3457
3603
  /***/ 24814:
@@ -24,7 +24,7 @@ class Trie {
24
24
  /**
25
25
  * Creates a new {@link Trie} by deserializing given string.
26
26
  *
27
- * The inverse of {@link Trie.serialize | asd}.
27
+ * The inverse of {@link Trie.serialize | serialize}.
28
28
  *
29
29
  * @param serialized - String with serialized data.
30
30
  * @returns {@link Trie} representing deserialized data.
@@ -91,7 +91,7 @@ class Trie {
91
91
  /**
92
92
  * Converts the {@link Trie} into a string.
93
93
  *
94
- * The inverse of {@link Trie.deserialize | asd}.
94
+ * The inverse of {@link Trie.deserialize | deserialize}.
95
95
  *
96
96
  * It serializes {@link https://sjp.pl/slownik/growy/ | 42.8 MB Polish dictionary} down to 18.7 MB (-56%).
97
97
  *
@@ -175,7 +175,6 @@ const Trie_1 = __importDefault(__webpack_require__(43210));
175
175
  Object.defineProperty(exports, "Trie", ({ enumerable: true, get: function () { return Trie_1.default; } }));
176
176
  __exportStar(__webpack_require__(31430), exports);
177
177
  __exportStar(__webpack_require__(19336), exports);
178
- __exportStar(__webpack_require__(36959), exports);
179
178
 
180
179
 
181
180
  /***/ }),
@@ -611,16 +610,6 @@ const traverse = (node, callback, options = {}) => {
611
610
  exports["default"] = traverse;
612
611
 
613
612
 
614
- /***/ }),
615
-
616
- /***/ 36959:
617
- /***/ ((__unused_webpack_module, exports) => {
618
-
619
- "use strict";
620
-
621
- Object.defineProperty(exports, "__esModule", ({ value: true }));
622
-
623
-
624
613
  /***/ }),
625
614
 
626
615
  /***/ 66255: