@scrabble-solver/scrabble-solver 2.8.9 → 2.8.10

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 (73) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +10 -10
  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 +181 -39
  14. package/.next/server/chunks/429.js +2 -13
  15. package/.next/server/chunks/515.js +408 -227
  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/_document.js.nft.json +1 -1
  23. package/.next/server/pages/_error.js.nft.json +1 -1
  24. package/.next/server/pages/api/solve.js +52 -19
  25. package/.next/server/pages/index.html +3 -3
  26. package/.next/server/pages/index.js +1 -1
  27. package/.next/server/pages/index.js.nft.json +1 -1
  28. package/.next/server/pages/index.json +1 -1
  29. package/.next/static/A8A_Lmg8cM-Bkf-Jo1CLh/_buildManifest.js +1 -0
  30. package/.next/static/{yCxjzzYpw5JjJE53PO_s6 → A8A_Lmg8cM-Bkf-Jo1CLh}/_ssgManifest.js +0 -0
  31. package/.next/static/chunks/317-95ab9051449362fa.js +1 -0
  32. package/.next/static/chunks/758-eff80059a1365d5d.js +1 -0
  33. package/.next/static/chunks/pages/_app-0e358b5622cf9e66.js +1 -0
  34. package/.next/static/chunks/pages/index-0cc5e6eda5adac73.js +1 -0
  35. package/.next/static/css/9ac903004135f4b1.css +1 -0
  36. package/.next/trace +42 -42
  37. package/package.json +12 -12
  38. package/src/components/Badge/Badge.module.scss +1 -1
  39. package/src/components/Board/Board.tsx +4 -2
  40. package/src/components/Board/BoardPure.tsx +25 -5
  41. package/src/components/Board/hooks/useGrid.ts +212 -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/SquareButton/Link.tsx +1 -1
  47. package/src/components/Tile/Tile.module.scss +4 -0
  48. package/src/components/Tile/Tile.tsx +13 -4
  49. package/src/components/Tile/TilePure.tsx +3 -4
  50. package/src/lib/extractCharacters.ts +26 -0
  51. package/src/lib/extractInputValue.ts +17 -0
  52. package/src/lib/index.ts +2 -0
  53. package/src/lib/isCtrl.ts +1 -1
  54. package/src/lib/memoize.ts +15 -1
  55. package/src/pages/api/solve.ts +1 -1
  56. package/src/sdk/fetchJson.ts +36 -0
  57. package/src/sdk/findWordDefinitions.ts +4 -3
  58. package/src/sdk/solve.ts +8 -7
  59. package/src/sdk/verify.ts +5 -6
  60. package/src/state/sagas.ts +3 -3
  61. package/src/state/selectors.ts +9 -1
  62. package/src/state/slices/dictionaryInitialState.ts +10 -2
  63. package/src/state/slices/dictionarySlice.ts +10 -16
  64. package/src/state/slices/rackSlice.ts +7 -0
  65. package/src/state/slices/solveInitialState.ts +14 -2
  66. package/src/state/slices/solveSlice.ts +7 -4
  67. package/src/types/index.ts +2 -0
  68. package/.next/static/chunks/317-a33dd38e9b9a17ed.js +0 -1
  69. package/.next/static/chunks/758-f333b1dcdb941547.js +0 -1
  70. package/.next/static/chunks/pages/_app-f8f360878e1c2aff.js +0 -1
  71. package/.next/static/chunks/pages/index-ecea697d3e5d8a6f.js +0 -1
  72. package/.next/static/css/64dc2ce1811912f1.css +0 -1
  73. 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,7 +1751,6 @@ 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() {
@@ -1716,7 +1796,7 @@ function* onDictionarySubmit() {
1716
1796
  const wordDefinitions = yield (0,effects_.call)(memoizedFindWordDefinitions, locale, word);
1717
1797
  yield (0,effects_.put)(slices/* dictionarySlice.actions.submitSuccess */.lj.actions.submitSuccess(wordDefinitions));
1718
1798
  } catch (error) {
1719
- yield (0,effects_.put)(slices/* dictionarySlice.actions.submitFailure */.lj.actions.submitFailure());
1799
+ yield (0,effects_.put)(slices/* dictionarySlice.actions.submitFailure */.lj.actions.submitFailure(error));
1720
1800
  }
1721
1801
  }
1722
1802
  function* onInitialize() {
@@ -1763,14 +1843,14 @@ function* onSolve() {
1763
1843
  configId: config.id,
1764
1844
  locale
1765
1845
  });
1766
- yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults(results.map(build.Result.fromJson)));
1846
+ yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults(results));
1767
1847
  yield (0,effects_.put)(slices/* solveSlice.actions.submitSuccess */.TP.actions.submitSuccess({
1768
1848
  board,
1769
1849
  characters
1770
1850
  }));
1771
1851
  } catch (error) {
1772
1852
  yield (0,effects_.put)(slices/* resultsSlice.actions.changeResults */._C.actions.changeResults([]));
1773
- yield (0,effects_.put)(slices/* solveSlice.actions.submitFailure */.TP.actions.submitFailure());
1853
+ yield (0,effects_.put)(slices/* solveSlice.actions.submitFailure */.TP.actions.submitFailure(error));
1774
1854
  }
1775
1855
  }
1776
1856
  function* onVerify() {
@@ -1833,6 +1913,7 @@ __webpack_require__.d(__webpack_exports__, {
1833
1913
  "$o": () => (/* binding */ selectConfig),
1834
1914
  "md": () => (/* binding */ selectConfigId),
1835
1915
  "w1": () => (/* binding */ selectDictionary),
1916
+ "mK": () => (/* binding */ selectDictionaryError),
1836
1917
  "bs": () => (/* binding */ selectHasInvalidWords),
1837
1918
  "En": () => (/* binding */ selectHasOverusedTiles),
1838
1919
  "xU": () => (/* binding */ selectIsLoading),
@@ -1844,6 +1925,7 @@ __webpack_require__.d(__webpack_exports__, {
1844
1925
  "R": () => (/* binding */ selectResultsSortColumn),
1845
1926
  "sH": () => (/* binding */ selectResultsSortDirection),
1846
1927
  "ZA": () => (/* binding */ selectRowsWithCandidate),
1928
+ "Rn": () => (/* binding */ selectSolveError),
1847
1929
  "dN": () => (/* binding */ selectSortedFilteredResults),
1848
1930
  "f2": () => (/* binding */ selectSortedResults),
1849
1931
  "Zf": () => (/* binding */ selectTilePoints),
@@ -1886,13 +1968,14 @@ const i18n = {
1886
1968
  };
1887
1969
  /* harmony default export */ const src_i18n = (i18n);
1888
1970
 
1889
- // EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
1890
- var lib = __webpack_require__(92237);
1971
+ // EXTERNAL MODULE: ./src/lib/index.ts + 29 modules
1972
+ var lib = __webpack_require__(75558);
1891
1973
  ;// CONCATENATED MODULE: ./src/state/selectors.ts
1892
1974
 
1893
1975
 
1894
1976
 
1895
1977
 
1978
+
1896
1979
  const selectCell = (_, cell)=>cell;
1897
1980
  const selectPoint = (_, point)=>point;
1898
1981
  const selectCharacter = (_, character)=>character;
@@ -1906,6 +1989,11 @@ const selectSettingsRoot = (state)=>state.settings;
1906
1989
  const selectSolveRoot = (state)=>state.solve;
1907
1990
  const selectVerifyRoot = (state)=>state.verify;
1908
1991
  const selectDictionary = selectDictionaryRoot;
1992
+ const selectDictionaryError = (0,toolkit_.createSelector)([
1993
+ selectDictionaryRoot
1994
+ ], (dictionary)=>{
1995
+ return (0,types_build.isError)(dictionary.error) ? dictionary.error : undefined;
1996
+ });
1909
1997
  const selectAutoGroupTiles = (0,toolkit_.createSelector)([
1910
1998
  selectSettingsRoot
1911
1999
  ], (settings)=>settings.autoGroupTiles);
@@ -2030,6 +2118,11 @@ const selectLastSolvedParameters = (0,toolkit_.createSelector)([
2030
2118
  const selectIsLoading = (0,toolkit_.createSelector)([
2031
2119
  selectSolveRoot
2032
2120
  ], (solve)=>solve.isLoading);
2121
+ const selectSolveError = (0,toolkit_.createSelector)([
2122
+ selectSolveRoot
2123
+ ], (solve)=>{
2124
+ return (0,types_build.isError)(solve.error) ? solve.error : undefined;
2125
+ });
2033
2126
  const selectHaveCharactersChanged = (0,toolkit_.createSelector)([
2034
2127
  selectLastSolvedParameters,
2035
2128
  selectCharacters
@@ -2207,6 +2300,7 @@ const cellFilterSlice = (0,toolkit_.createSlice)({
2207
2300
 
2208
2301
  ;// CONCATENATED MODULE: ./src/state/slices/dictionaryInitialState.ts
2209
2302
  const dictionaryInitialState = {
2303
+ error: undefined,
2210
2304
  input: "",
2211
2305
  isLoading: false,
2212
2306
  results: []
@@ -2228,32 +2322,41 @@ const dictionarySlice = (0,toolkit_.createSlice)({
2228
2322
  },
2229
2323
  reset: ()=>slices_dictionaryInitialState,
2230
2324
  submit: (state)=>{
2325
+ const error = slices_dictionaryInitialState.error;
2326
+ const results = slices_dictionaryInitialState.results;
2231
2327
  return {
2232
2328
  ...state,
2329
+ error,
2233
2330
  isLoading: true,
2234
- results: slices_dictionaryInitialState.results
2331
+ results
2235
2332
  };
2236
2333
  },
2237
- submitFailure: (state)=>{
2334
+ submitFailure: (state, action)=>{
2335
+ const error = action.payload;
2336
+ const results = slices_dictionaryInitialState.results;
2238
2337
  return {
2239
2338
  ...state,
2339
+ error,
2240
2340
  isLoading: false,
2241
- results: slices_dictionaryInitialState.results
2341
+ results
2242
2342
  };
2243
2343
  },
2244
2344
  submitSuccess: (state, action)=>{
2345
+ const error = slices_dictionaryInitialState.error;
2346
+ const results = action.payload;
2245
2347
  return {
2246
2348
  ...state,
2349
+ error,
2247
2350
  isLoading: false,
2248
- results: action.payload
2351
+ results
2249
2352
  };
2250
2353
  }
2251
2354
  }
2252
2355
  });
2253
2356
  /* harmony default export */ const slices_dictionarySlice = (dictionarySlice);
2254
2357
 
2255
- // EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
2256
- var lib = __webpack_require__(92237);
2358
+ // EXTERNAL MODULE: ./src/lib/index.ts + 29 modules
2359
+ var lib = __webpack_require__(75558);
2257
2360
  ;// CONCATENATED MODULE: ./src/state/slices/rackInitialState.ts
2258
2361
  const rackInitialState = [
2259
2362
  null,
@@ -2286,6 +2389,16 @@ const rackSlice = (0,toolkit_.createSlice)({
2286
2389
  ...state.slice(index + 1)
2287
2390
  ];
2288
2391
  },
2392
+ changeCharacters: (state, action)=>{
2393
+ const { characters , index } = action.payload;
2394
+ const expectedRackLength = state.length;
2395
+ const rack = [
2396
+ ...state.slice(0, index),
2397
+ ...characters,
2398
+ ...state.slice(index + characters.length)
2399
+ ];
2400
+ return rack.slice(0, expectedRackLength);
2401
+ },
2289
2402
  groupTiles: (state, action)=>{
2290
2403
  const direction = action.payload;
2291
2404
  if (direction === null) {
@@ -2421,6 +2534,7 @@ const settingsSlice = (0,toolkit_.createSlice)({
2421
2534
  ;// CONCATENATED MODULE: ./src/state/slices/solveInitialState.ts
2422
2535
 
2423
2536
  const solveInitialState = {
2537
+ error: undefined,
2424
2538
  isLoading: false,
2425
2539
  lastSolvedParameters: {
2426
2540
  board: slices_boardInitialState,
@@ -2437,21 +2551,27 @@ const solveSlice = (0,toolkit_.createSlice)({
2437
2551
  name: "solve",
2438
2552
  reducers: {
2439
2553
  submit: (state)=>{
2554
+ const error = slices_solveInitialState.error;
2440
2555
  return {
2441
2556
  ...state,
2557
+ error,
2442
2558
  isLoading: true
2443
2559
  };
2444
2560
  },
2445
- submitFailure: (state)=>{
2561
+ submitFailure: (state, action)=>{
2562
+ const error = action.payload;
2446
2563
  return {
2447
2564
  ...state,
2565
+ error,
2448
2566
  isLoading: false
2449
2567
  };
2450
2568
  },
2451
2569
  submitSuccess: (state, action)=>{
2570
+ const error = slices_solveInitialState.error;
2452
2571
  const lastSolvedParameters = action.payload;
2453
2572
  return {
2454
2573
  ...state,
2574
+ error,
2455
2575
  isLoading: false,
2456
2576
  lastSolvedParameters
2457
2577
  };
@@ -2672,7 +2792,7 @@ class Board {
2672
2792
  }
2673
2793
  getBlanksCount() {
2674
2794
  return this.rows.reduce((count, row) => {
2675
- return count + row.reduce((rowCount, cell) => (cell.tile.isBlank ? rowCount + 1 : rowCount), 0);
2795
+ return count + row.reduce((rowCount, cell) => rowCount + (cell.tile.isBlank ? 1 : 0), 0);
2676
2796
  }, 0);
2677
2797
  }
2678
2798
  getColumn(index) {
@@ -2683,7 +2803,7 @@ class Board {
2683
2803
  }
2684
2804
  getTilesCount() {
2685
2805
  return this.rows.reduce((count, row) => {
2686
- return count + row.reduce((rowCount, cell) => (cell.hasTile() ? rowCount + 1 : rowCount), 0);
2806
+ return count + row.reduce((rowCount, cell) => rowCount + (cell.hasTile() ? 1 : 0), 0);
2687
2807
  }, 0);
2688
2808
  }
2689
2809
  getWords() {
@@ -3412,7 +3532,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3412
3532
  return (mod && mod.__esModule) ? mod : { "default": mod };
3413
3533
  };
3414
3534
  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;
3535
+ 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
3536
  var Board_1 = __webpack_require__(80559);
3417
3537
  Object.defineProperty(exports, "Board", ({ enumerable: true, get: function () { return __importDefault(Board_1).default; } }));
3418
3538
  var BoardJson_1 = __webpack_require__(46936);
@@ -3431,6 +3551,8 @@ var FinalPattern_1 = __webpack_require__(35905);
3431
3551
  Object.defineProperty(exports, "FinalPattern", ({ enumerable: true, get: function () { return __importDefault(FinalPattern_1).default; } }));
3432
3552
  var HorizontalPattern_1 = __webpack_require__(49594);
3433
3553
  Object.defineProperty(exports, "HorizontalPattern", ({ enumerable: true, get: function () { return __importDefault(HorizontalPattern_1).default; } }));
3554
+ var isError_1 = __webpack_require__(96255);
3555
+ Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return __importDefault(isError_1).default; } }));
3434
3556
  var isObject_1 = __webpack_require__(24814);
3435
3557
  Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return __importDefault(isObject_1).default; } }));
3436
3558
  var Locale_1 = __webpack_require__(26634);
@@ -3452,6 +3574,26 @@ var WordDefinition_1 = __webpack_require__(31560);
3452
3574
  Object.defineProperty(exports, "WordDefinition", ({ enumerable: true, get: function () { return __importDefault(WordDefinition_1).default; } }));
3453
3575
 
3454
3576
 
3577
+ /***/ }),
3578
+
3579
+ /***/ 96255:
3580
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3581
+
3582
+
3583
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3584
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3585
+ };
3586
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3587
+ const isObject_1 = __importDefault(__webpack_require__(24814));
3588
+ const isError = (value) => {
3589
+ if (!(0, isObject_1.default)(value)) {
3590
+ return false;
3591
+ }
3592
+ return typeof value.message === 'string';
3593
+ };
3594
+ exports["default"] = isError;
3595
+
3596
+
3455
3597
  /***/ }),
3456
3598
 
3457
3599
  /***/ 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: