@mnbroatch/boardgame.io 0.0.1

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 (296) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/ai/package.json +7 -0
  4. package/client/package.json +7 -0
  5. package/core/package.json +7 -0
  6. package/debug/package.json +7 -0
  7. package/dist/boardgameio.es.js +14238 -0
  8. package/dist/boardgameio.js +14277 -0
  9. package/dist/boardgameio.min.js +16 -0
  10. package/dist/cjs/Debug-9d141c06.js +9586 -0
  11. package/dist/cjs/ai-e0e8a768.js +377 -0
  12. package/dist/cjs/ai.js +20 -0
  13. package/dist/cjs/client-76dec77b.js +258 -0
  14. package/dist/cjs/client-a22d7500.js +524 -0
  15. package/dist/cjs/client.js +26 -0
  16. package/dist/cjs/core.js +52 -0
  17. package/dist/cjs/debug.js +18 -0
  18. package/dist/cjs/filter-player-view-bb02e2f6.js +89 -0
  19. package/dist/cjs/initialize-267fcd69.js +61 -0
  20. package/dist/cjs/internal.js +25 -0
  21. package/dist/cjs/master-2904879d.js +320 -0
  22. package/dist/cjs/master.js +18 -0
  23. package/dist/cjs/multiplayer.js +23 -0
  24. package/dist/cjs/plugin-random-7425844d.js +229 -0
  25. package/dist/cjs/plugins.js +59 -0
  26. package/dist/cjs/react-native.js +182 -0
  27. package/dist/cjs/react.js +727 -0
  28. package/dist/cjs/reducer-16eec232.js +1203 -0
  29. package/dist/cjs/server.js +4087 -0
  30. package/dist/cjs/socketio-7a0837eb.js +478 -0
  31. package/dist/cjs/testing.js +30 -0
  32. package/dist/cjs/transport-b1874dfa.js +37 -0
  33. package/dist/cjs/turn-order-b2ff8740.js +1136 -0
  34. package/dist/cjs/util-fcfd8fb8.js +140 -0
  35. package/dist/esm/Debug-0141fe2d.js +9577 -0
  36. package/dist/esm/ai-5c06e761.js +371 -0
  37. package/dist/esm/ai.js +8 -0
  38. package/dist/esm/client-2e653027.js +522 -0
  39. package/dist/esm/client-5f57c3f2.js +255 -0
  40. package/dist/esm/client.js +16 -0
  41. package/dist/esm/core.js +40 -0
  42. package/dist/esm/debug.js +10 -0
  43. package/dist/esm/filter-player-view-2c6cc96f.js +87 -0
  44. package/dist/esm/initialize-11d626ca.js +59 -0
  45. package/dist/esm/internal.js +10 -0
  46. package/dist/esm/master-fa8f2e43.js +318 -0
  47. package/dist/esm/master.js +10 -0
  48. package/dist/esm/multiplayer.js +14 -0
  49. package/dist/esm/plugin-random-087f861e.js +226 -0
  50. package/dist/esm/plugins.js +55 -0
  51. package/dist/esm/react-native.js +173 -0
  52. package/dist/esm/react.js +716 -0
  53. package/dist/esm/reducer-c46da7e5.js +1198 -0
  54. package/dist/esm/socketio-c22ffa65.js +455 -0
  55. package/dist/esm/testing.js +26 -0
  56. package/dist/esm/transport-ce07b771.js +35 -0
  57. package/dist/esm/turn-order-376d315e.js +1091 -0
  58. package/dist/esm/util-b6147cef.js +135 -0
  59. package/dist/types/packages/ai.d.ts +5 -0
  60. package/dist/types/packages/client.d.ts +3 -0
  61. package/dist/types/packages/core.d.ts +5 -0
  62. package/dist/types/packages/debug.d.ts +2 -0
  63. package/dist/types/packages/internal.d.ts +8 -0
  64. package/dist/types/packages/master.d.ts +2 -0
  65. package/dist/types/packages/multiplayer.d.ts +3 -0
  66. package/dist/types/packages/plugins.d.ts +3 -0
  67. package/dist/types/packages/react-native.d.ts +2 -0
  68. package/dist/types/packages/react.d.ts +3 -0
  69. package/dist/types/packages/server.d.ts +6 -0
  70. package/dist/types/packages/testing.d.ts +1 -0
  71. package/dist/types/src/ai/ai.d.ts +53 -0
  72. package/dist/types/src/ai/ai.test.d.ts +1 -0
  73. package/dist/types/src/ai/bot.d.ts +40 -0
  74. package/dist/types/src/ai/mcts-bot.d.ts +60 -0
  75. package/dist/types/src/ai/random-bot.d.ts +27 -0
  76. package/dist/types/src/client/client.d.ts +104 -0
  77. package/dist/types/src/client/client.test.d.ts +1 -0
  78. package/dist/types/src/client/debug/tests/debug.test.d.ts +1 -0
  79. package/dist/types/src/client/manager.d.ts +61 -0
  80. package/dist/types/src/client/react.d.ts +75 -0
  81. package/dist/types/src/client/react.ssr.test.d.ts +4 -0
  82. package/dist/types/src/client/react.test.d.ts +1 -0
  83. package/dist/types/src/client/transport/dummy.d.ts +18 -0
  84. package/dist/types/src/client/transport/local.d.ts +59 -0
  85. package/dist/types/src/client/transport/local.test.d.ts +1 -0
  86. package/dist/types/src/client/transport/socketio.d.ts +45 -0
  87. package/dist/types/src/client/transport/socketio.test.d.ts +1 -0
  88. package/dist/types/src/client/transport/transport.d.ts +50 -0
  89. package/dist/types/src/client/transport/transport.test.d.ts +1 -0
  90. package/dist/types/src/core/action-creators.d.ts +144 -0
  91. package/dist/types/src/core/action-types.d.ts +10 -0
  92. package/dist/types/src/core/backwards-compatibility.d.ts +12 -0
  93. package/dist/types/src/core/constants.d.ts +6 -0
  94. package/dist/types/src/core/errors.d.ts +15 -0
  95. package/dist/types/src/core/flow.d.ts +28 -0
  96. package/dist/types/src/core/flow.test.d.ts +1 -0
  97. package/dist/types/src/core/game-methods.d.ts +9 -0
  98. package/dist/types/src/core/game.d.ts +26 -0
  99. package/dist/types/src/core/game.test.d.ts +1 -0
  100. package/dist/types/src/core/initialize.d.ts +9 -0
  101. package/dist/types/src/core/logger.d.ts +2 -0
  102. package/dist/types/src/core/player-view.d.ts +7 -0
  103. package/dist/types/src/core/player-view.test.d.ts +1 -0
  104. package/dist/types/src/core/reducer.d.ts +155 -0
  105. package/dist/types/src/core/reducer.test.d.ts +1 -0
  106. package/dist/types/src/core/turn-order.d.ts +179 -0
  107. package/dist/types/src/core/turn-order.test.d.ts +8 -0
  108. package/dist/types/src/lobby/client.d.ts +194 -0
  109. package/dist/types/src/lobby/client.test.d.ts +1 -0
  110. package/dist/types/src/lobby/connection.d.ts +44 -0
  111. package/dist/types/src/lobby/connection.test.d.ts +1 -0
  112. package/dist/types/src/lobby/create-match-form.d.ts +26 -0
  113. package/dist/types/src/lobby/login-form.d.ts +23 -0
  114. package/dist/types/src/lobby/match-instance.d.ts +31 -0
  115. package/dist/types/src/lobby/react.d.ts +113 -0
  116. package/dist/types/src/lobby/react.ssr.test.d.ts +4 -0
  117. package/dist/types/src/lobby/react.test.d.ts +1 -0
  118. package/dist/types/src/master/filter-player-view.d.ts +96 -0
  119. package/dist/types/src/master/filter-player-view.test.d.ts +1 -0
  120. package/dist/types/src/master/master.d.ts +94 -0
  121. package/dist/types/src/master/master.test.d.ts +1 -0
  122. package/dist/types/src/plugins/events/events.d.ts +54 -0
  123. package/dist/types/src/plugins/events/events.test.d.ts +1 -0
  124. package/dist/types/src/plugins/main.d.ts +75 -0
  125. package/dist/types/src/plugins/main.test.d.ts +1 -0
  126. package/dist/types/src/plugins/plugin-events.d.ts +5 -0
  127. package/dist/types/src/plugins/plugin-immer.d.ts +7 -0
  128. package/dist/types/src/plugins/plugin-immer.test.d.ts +1 -0
  129. package/dist/types/src/plugins/plugin-log.d.ts +14 -0
  130. package/dist/types/src/plugins/plugin-log.test.d.ts +1 -0
  131. package/dist/types/src/plugins/plugin-player.d.ts +29 -0
  132. package/dist/types/src/plugins/plugin-player.test.d.ts +1 -0
  133. package/dist/types/src/plugins/plugin-random.d.ts +4 -0
  134. package/dist/types/src/plugins/plugin-serializable.d.ts +7 -0
  135. package/dist/types/src/plugins/plugin-serializable.test.d.ts +1 -0
  136. package/dist/types/src/plugins/random/random.alea.d.ts +19 -0
  137. package/dist/types/src/plugins/random/random.d.ts +54 -0
  138. package/dist/types/src/plugins/random/random.test.d.ts +1 -0
  139. package/dist/types/src/server/api.d.ts +13 -0
  140. package/dist/types/src/server/api.test.d.ts +1 -0
  141. package/dist/types/src/server/auth.d.ts +38 -0
  142. package/dist/types/src/server/auth.test.d.ts +1 -0
  143. package/dist/types/src/server/cors.d.ts +4 -0
  144. package/dist/types/src/server/cors.test.d.ts +1 -0
  145. package/dist/types/src/server/db/base.d.ts +192 -0
  146. package/dist/types/src/server/db/flatfile.d.ts +44 -0
  147. package/dist/types/src/server/db/flatfile.test.d.ts +1 -0
  148. package/dist/types/src/server/db/index.d.ts +4 -0
  149. package/dist/types/src/server/db/index.test.d.ts +1 -0
  150. package/dist/types/src/server/db/inmemory.d.ts +43 -0
  151. package/dist/types/src/server/db/inmemory.test.d.ts +1 -0
  152. package/dist/types/src/server/db/localstorage.d.ts +7 -0
  153. package/dist/types/src/server/db/localstorage.test.d.ts +1 -0
  154. package/dist/types/src/server/index.d.ts +68 -0
  155. package/dist/types/src/server/index.test.d.ts +1 -0
  156. package/dist/types/src/server/transport/pubsub/generic-pub-sub.d.ts +6 -0
  157. package/dist/types/src/server/transport/pubsub/in-memory-pub-sub.d.ts +7 -0
  158. package/dist/types/src/server/transport/pubsub/in-memory-pub-sub.test.d.ts +1 -0
  159. package/dist/types/src/server/transport/socketio-simultaneous.test.d.ts +1 -0
  160. package/dist/types/src/server/transport/socketio.d.ts +65 -0
  161. package/dist/types/src/server/transport/socketio.test.d.ts +1 -0
  162. package/dist/types/src/server/util.d.ts +35 -0
  163. package/dist/types/src/testing/mock-random.d.ts +15 -0
  164. package/dist/types/src/testing/mock-random.test.d.ts +1 -0
  165. package/dist/types/src/types.d.ts +387 -0
  166. package/internal/package.json +7 -0
  167. package/master/package.json +7 -0
  168. package/multiplayer/package.json +7 -0
  169. package/package.json +211 -0
  170. package/plugins/package.json +7 -0
  171. package/react/package.json +7 -0
  172. package/react-native/package.json +7 -0
  173. package/server/package.json +6 -0
  174. package/src/ai/ai.test.ts +433 -0
  175. package/src/ai/ai.ts +84 -0
  176. package/src/ai/bot.ts +122 -0
  177. package/src/ai/mcts-bot.ts +331 -0
  178. package/src/ai/random-bot.ts +20 -0
  179. package/src/client/client.test.ts +993 -0
  180. package/src/client/client.ts +588 -0
  181. package/src/client/debug/Debug.svelte +239 -0
  182. package/src/client/debug/Menu.svelte +65 -0
  183. package/src/client/debug/ai/AI.svelte +215 -0
  184. package/src/client/debug/ai/Options.svelte +48 -0
  185. package/src/client/debug/info/Info.svelte +22 -0
  186. package/src/client/debug/info/Item.svelte +24 -0
  187. package/src/client/debug/log/Log.svelte +157 -0
  188. package/src/client/debug/log/LogEvent.svelte +149 -0
  189. package/src/client/debug/log/LogMetadata.svelte +7 -0
  190. package/src/client/debug/log/PhaseMarker.svelte +27 -0
  191. package/src/client/debug/log/TurnMarker.svelte +23 -0
  192. package/src/client/debug/main/ClientSwitcher.svelte +59 -0
  193. package/src/client/debug/main/Controls.svelte +58 -0
  194. package/src/client/debug/main/Hotkey.svelte +84 -0
  195. package/src/client/debug/main/InteractiveFunction.svelte +85 -0
  196. package/src/client/debug/main/Main.svelte +121 -0
  197. package/src/client/debug/main/Move.svelte +68 -0
  198. package/src/client/debug/main/PlayerInfo.svelte +70 -0
  199. package/src/client/debug/mcts/Action.svelte +22 -0
  200. package/src/client/debug/mcts/MCTS.svelte +78 -0
  201. package/src/client/debug/mcts/Table.svelte +98 -0
  202. package/src/client/debug/tests/JSONTree.mock.svelte +3 -0
  203. package/src/client/debug/tests/debug.test.ts +183 -0
  204. package/src/client/debug/utils/shortcuts.js +50 -0
  205. package/src/client/debug/utils/shortcuts.test.js +49 -0
  206. package/src/client/manager.ts +177 -0
  207. package/src/client/react-native.js +136 -0
  208. package/src/client/react-native.test.js +229 -0
  209. package/src/client/react.ssr.test.tsx +24 -0
  210. package/src/client/react.test.tsx +213 -0
  211. package/src/client/react.tsx +192 -0
  212. package/src/client/transport/dummy.ts +19 -0
  213. package/src/client/transport/local.test.ts +353 -0
  214. package/src/client/transport/local.ts +230 -0
  215. package/src/client/transport/socketio.test.ts +328 -0
  216. package/src/client/transport/socketio.ts +210 -0
  217. package/src/client/transport/transport.test.ts +27 -0
  218. package/src/client/transport/transport.ts +95 -0
  219. package/src/core/action-creators.ts +159 -0
  220. package/src/core/action-types.ts +18 -0
  221. package/src/core/backwards-compatibility.ts +23 -0
  222. package/src/core/constants.ts +6 -0
  223. package/src/core/errors.ts +35 -0
  224. package/src/core/flow.test.ts +2433 -0
  225. package/src/core/flow.ts +897 -0
  226. package/src/core/game-methods.ts +9 -0
  227. package/src/core/game.test.ts +286 -0
  228. package/src/core/game.ts +114 -0
  229. package/src/core/initialize.ts +77 -0
  230. package/src/core/logger.test.js +90 -0
  231. package/src/core/logger.ts +18 -0
  232. package/src/core/player-view.test.ts +50 -0
  233. package/src/core/player-view.ts +39 -0
  234. package/src/core/reducer.test.ts +991 -0
  235. package/src/core/reducer.ts +532 -0
  236. package/src/core/turn-order.test.ts +1123 -0
  237. package/src/core/turn-order.ts +473 -0
  238. package/src/lobby/client.test.ts +385 -0
  239. package/src/lobby/client.ts +358 -0
  240. package/src/lobby/connection.test.ts +207 -0
  241. package/src/lobby/connection.ts +162 -0
  242. package/src/lobby/create-match-form.tsx +122 -0
  243. package/src/lobby/login-form.tsx +75 -0
  244. package/src/lobby/match-instance.tsx +135 -0
  245. package/src/lobby/react.ssr.test.tsx +22 -0
  246. package/src/lobby/react.test.tsx +594 -0
  247. package/src/lobby/react.tsx +402 -0
  248. package/src/master/filter-player-view.test.ts +381 -0
  249. package/src/master/filter-player-view.ts +102 -0
  250. package/src/master/master.test.ts +1068 -0
  251. package/src/master/master.ts +492 -0
  252. package/src/plugins/events/events.test.ts +108 -0
  253. package/src/plugins/events/events.ts +209 -0
  254. package/src/plugins/main.test.ts +411 -0
  255. package/src/plugins/main.ts +314 -0
  256. package/src/plugins/plugin-events.ts +40 -0
  257. package/src/plugins/plugin-immer.test.ts +86 -0
  258. package/src/plugins/plugin-immer.ts +37 -0
  259. package/src/plugins/plugin-log.test.ts +37 -0
  260. package/src/plugins/plugin-log.ts +40 -0
  261. package/src/plugins/plugin-player.test.ts +172 -0
  262. package/src/plugins/plugin-player.ts +100 -0
  263. package/src/plugins/plugin-random.ts +40 -0
  264. package/src/plugins/plugin-serializable.test.ts +40 -0
  265. package/src/plugins/plugin-serializable.ts +55 -0
  266. package/src/plugins/random/random.alea.ts +109 -0
  267. package/src/plugins/random/random.test.ts +167 -0
  268. package/src/plugins/random/random.ts +198 -0
  269. package/src/server/api.test.ts +1699 -0
  270. package/src/server/api.ts +527 -0
  271. package/src/server/auth.test.ts +275 -0
  272. package/src/server/auth.ts +89 -0
  273. package/src/server/cors.test.ts +121 -0
  274. package/src/server/cors.ts +7 -0
  275. package/src/server/db/base.ts +296 -0
  276. package/src/server/db/flatfile.test.ts +221 -0
  277. package/src/server/db/flatfile.ts +228 -0
  278. package/src/server/db/index.test.ts +8 -0
  279. package/src/server/db/index.ts +12 -0
  280. package/src/server/db/inmemory.test.ts +143 -0
  281. package/src/server/db/inmemory.ts +143 -0
  282. package/src/server/db/localstorage.test.ts +73 -0
  283. package/src/server/db/localstorage.ts +44 -0
  284. package/src/server/index.test.ts +265 -0
  285. package/src/server/index.ts +175 -0
  286. package/src/server/transport/pubsub/generic-pub-sub.ts +11 -0
  287. package/src/server/transport/pubsub/in-memory-pub-sub.test.ts +47 -0
  288. package/src/server/transport/pubsub/in-memory-pub-sub.ts +28 -0
  289. package/src/server/transport/socketio-simultaneous.test.ts +603 -0
  290. package/src/server/transport/socketio.test.ts +303 -0
  291. package/src/server/transport/socketio.ts +279 -0
  292. package/src/server/util.ts +85 -0
  293. package/src/testing/mock-random.test.ts +45 -0
  294. package/src/testing/mock-random.ts +27 -0
  295. package/src/types.ts +511 -0
  296. package/testing/package.json +7 -0
@@ -0,0 +1,727 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var PropTypes = require('prop-types');
7
+ var client = require('./client-a22d7500.js');
8
+ var Cookies = require('react-cookies');
9
+ var ai = require('./ai-e0e8a768.js');
10
+ var socketio = require('./socketio-7a0837eb.js');
11
+ var client$1 = require('./client-76dec77b.js');
12
+ require('nanoid/non-secure');
13
+ require('./Debug-9d141c06.js');
14
+ require('./turn-order-b2ff8740.js');
15
+ require('immer');
16
+ require('./plugin-random-7425844d.js');
17
+ require('lodash.isplainobject');
18
+ require('flatted');
19
+ require('./reducer-16eec232.js');
20
+ require('rfc6902');
21
+ require('redux');
22
+ require('./initialize-267fcd69.js');
23
+ require('./transport-b1874dfa.js');
24
+ require('setimmediate');
25
+ require('./util-fcfd8fb8.js');
26
+ require('./master-2904879d.js');
27
+ require('./filter-player-view-bb02e2f6.js');
28
+ require('socket.io-client');
29
+
30
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
31
+
32
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
33
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
34
+ var Cookies__default = /*#__PURE__*/_interopDefaultLegacy(Cookies);
35
+
36
+ /*
37
+ * Copyright 2017 The boardgame.io Authors
38
+ *
39
+ * Use of this source code is governed by a MIT-style
40
+ * license that can be found in the LICENSE file or at
41
+ * https://opensource.org/licenses/MIT.
42
+ */
43
+ /**
44
+ * Client
45
+ *
46
+ * boardgame.io React client.
47
+ *
48
+ * @param {...object} game - The return value of `Game`.
49
+ * @param {...object} numPlayers - The number of players.
50
+ * @param {...object} board - The React component for the game.
51
+ * @param {...object} loading - (optional) The React component for the loading state.
52
+ * @param {...object} multiplayer - Set to a falsy value or a transportFactory, e.g., SocketIO()
53
+ * @param {...object} debug - Enables the Debug UI.
54
+ * @param {...object} enhancer - Optional enhancer to send to the Redux store
55
+ *
56
+ * Returns:
57
+ * A React component that wraps board and provides an
58
+ * API through props for it to interact with the framework
59
+ * and dispatch actions such as MAKE_MOVE, GAME_EVENT, RESET,
60
+ * UNDO and REDO.
61
+ */
62
+ function Client(opts) {
63
+ var _a;
64
+ const { game, numPlayers, board, multiplayer, enhancer } = opts;
65
+ let { loading, debug } = opts;
66
+ // Component that is displayed before the client has synced
67
+ // with the game master.
68
+ if (loading === undefined) {
69
+ const Loading = () => React__default["default"].createElement("div", { className: "bgio-loading" }, "connecting...");
70
+ loading = Loading;
71
+ }
72
+ /*
73
+ * WrappedBoard
74
+ *
75
+ * The main React component that wraps the passed in
76
+ * board component and adds the API to its props.
77
+ */
78
+ return _a = class WrappedBoard extends React__default["default"].Component {
79
+ constructor(props) {
80
+ super(props);
81
+ if (debug === undefined) {
82
+ debug = props.debug;
83
+ }
84
+ this.client = client.Client({
85
+ game,
86
+ debug,
87
+ numPlayers,
88
+ multiplayer,
89
+ matchID: props.matchID,
90
+ playerID: props.playerID,
91
+ credentials: props.credentials,
92
+ enhancer,
93
+ });
94
+ }
95
+ componentDidMount() {
96
+ this.unsubscribe = this.client.subscribe(() => this.forceUpdate());
97
+ this.client.start();
98
+ }
99
+ componentWillUnmount() {
100
+ this.client.stop();
101
+ this.unsubscribe();
102
+ }
103
+ componentDidUpdate(prevProps) {
104
+ if (this.props.matchID != prevProps.matchID) {
105
+ this.client.updateMatchID(this.props.matchID);
106
+ }
107
+ if (this.props.playerID != prevProps.playerID) {
108
+ this.client.updatePlayerID(this.props.playerID);
109
+ }
110
+ if (this.props.credentials != prevProps.credentials) {
111
+ this.client.updateCredentials(this.props.credentials);
112
+ }
113
+ }
114
+ render() {
115
+ const state = this.client.getState();
116
+ if (state === null) {
117
+ return React__default["default"].createElement(loading);
118
+ }
119
+ let _board = null;
120
+ if (board) {
121
+ _board = React__default["default"].createElement(board, {
122
+ ...state,
123
+ ...this.props,
124
+ isMultiplayer: !!multiplayer,
125
+ moves: this.client.moves,
126
+ events: this.client.events,
127
+ matchID: this.client.matchID,
128
+ playerID: this.client.playerID,
129
+ reset: this.client.reset,
130
+ undo: this.client.undo,
131
+ redo: this.client.redo,
132
+ log: this.client.log,
133
+ matchData: this.client.matchData,
134
+ sendChatMessage: this.client.sendChatMessage,
135
+ chatMessages: this.client.chatMessages,
136
+ });
137
+ }
138
+ return React__default["default"].createElement("div", { className: "bgio-client" }, _board);
139
+ }
140
+ },
141
+ _a.propTypes = {
142
+ // The ID of a game to connect to.
143
+ // Only relevant in multiplayer.
144
+ matchID: PropTypes__default["default"].string,
145
+ // The ID of the player associated with this client.
146
+ // Only relevant in multiplayer.
147
+ playerID: PropTypes__default["default"].string,
148
+ // This client's authentication credentials.
149
+ // Only relevant in multiplayer.
150
+ credentials: PropTypes__default["default"].string,
151
+ // Enable / disable the Debug UI.
152
+ debug: PropTypes__default["default"].any,
153
+ },
154
+ _a.defaultProps = {
155
+ matchID: 'default',
156
+ playerID: null,
157
+ credentials: null,
158
+ debug: true,
159
+ },
160
+ _a;
161
+ }
162
+
163
+ /*
164
+ * Copyright 2018 The boardgame.io Authors
165
+ *
166
+ * Use of this source code is governed by a MIT-style
167
+ * license that can be found in the LICENSE file or at
168
+ * https://opensource.org/licenses/MIT.
169
+ */
170
+ class _LobbyConnectionImpl {
171
+ constructor({ server, gameComponents, playerName, playerCredentials, }) {
172
+ this.client = new client$1.LobbyClient({ server });
173
+ this.gameComponents = gameComponents;
174
+ this.playerName = playerName || 'Visitor';
175
+ this.playerCredentials = playerCredentials;
176
+ this.matches = [];
177
+ }
178
+ async refresh() {
179
+ try {
180
+ this.matches = [];
181
+ const games = await this.client.listGames();
182
+ for (const game of games) {
183
+ if (!this._getGameComponents(game))
184
+ continue;
185
+ const { matches } = await this.client.listMatches(game);
186
+ this.matches.push(...matches);
187
+ }
188
+ }
189
+ catch (error) {
190
+ throw new Error('failed to retrieve list of matches (' + error + ')');
191
+ }
192
+ }
193
+ _getMatchInstance(matchID) {
194
+ for (const inst of this.matches) {
195
+ if (inst['matchID'] === matchID)
196
+ return inst;
197
+ }
198
+ }
199
+ _getGameComponents(gameName) {
200
+ for (const comp of this.gameComponents) {
201
+ if (comp.game.name === gameName)
202
+ return comp;
203
+ }
204
+ }
205
+ _findPlayer(playerName) {
206
+ for (const inst of this.matches) {
207
+ if (inst.players.some((player) => player.name === playerName))
208
+ return inst;
209
+ }
210
+ }
211
+ async join(gameName, matchID, playerID) {
212
+ try {
213
+ let inst = this._findPlayer(this.playerName);
214
+ if (inst) {
215
+ throw new Error('player has already joined ' + inst.matchID);
216
+ }
217
+ inst = this._getMatchInstance(matchID);
218
+ if (!inst) {
219
+ throw new Error('game instance ' + matchID + ' not found');
220
+ }
221
+ const json = await this.client.joinMatch(gameName, matchID, {
222
+ playerID,
223
+ playerName: this.playerName,
224
+ });
225
+ inst.players[Number.parseInt(playerID)].name = this.playerName;
226
+ this.playerCredentials = json.playerCredentials;
227
+ }
228
+ catch (error) {
229
+ throw new Error('failed to join match ' + matchID + ' (' + error + ')');
230
+ }
231
+ }
232
+ async leave(gameName, matchID) {
233
+ try {
234
+ const inst = this._getMatchInstance(matchID);
235
+ if (!inst)
236
+ throw new Error('match instance not found');
237
+ for (const player of inst.players) {
238
+ if (player.name === this.playerName) {
239
+ await this.client.leaveMatch(gameName, matchID, {
240
+ playerID: player.id.toString(),
241
+ credentials: this.playerCredentials,
242
+ });
243
+ delete player.name;
244
+ delete this.playerCredentials;
245
+ return;
246
+ }
247
+ }
248
+ throw new Error('player not found in match');
249
+ }
250
+ catch (error) {
251
+ throw new Error('failed to leave match ' + matchID + ' (' + error + ')');
252
+ }
253
+ }
254
+ async disconnect() {
255
+ const inst = this._findPlayer(this.playerName);
256
+ if (inst) {
257
+ await this.leave(inst.gameName, inst.matchID);
258
+ }
259
+ this.matches = [];
260
+ this.playerName = 'Visitor';
261
+ }
262
+ async create(gameName, numPlayers) {
263
+ try {
264
+ const comp = this._getGameComponents(gameName);
265
+ if (!comp)
266
+ throw new Error('game not found');
267
+ if (numPlayers < comp.game.minPlayers ||
268
+ numPlayers > comp.game.maxPlayers)
269
+ throw new Error('invalid number of players ' + numPlayers);
270
+ await this.client.createMatch(gameName, { numPlayers });
271
+ }
272
+ catch (error) {
273
+ throw new Error('failed to create match for ' + gameName + ' (' + error + ')');
274
+ }
275
+ }
276
+ }
277
+ /**
278
+ * LobbyConnection
279
+ *
280
+ * Lobby model.
281
+ *
282
+ * @param {string} server - '<host>:<port>' of the server.
283
+ * @param {Array} gameComponents - A map of Board and Game objects for the supported games.
284
+ * @param {string} playerName - The name of the player.
285
+ * @param {string} playerCredentials - The credentials currently used by the player, if any.
286
+ *
287
+ * Returns:
288
+ * A JS object that synchronizes the list of running game instances with the server and provides an API to create/join/start instances.
289
+ */
290
+ function LobbyConnection(opts) {
291
+ return new _LobbyConnectionImpl(opts);
292
+ }
293
+
294
+ /*
295
+ * Copyright 2018 The boardgame.io Authors.
296
+ *
297
+ * Use of this source code is governed by a MIT-style
298
+ * license that can be found in the LICENSE file or at
299
+ * https://opensource.org/licenses/MIT.
300
+ */
301
+ class LobbyLoginForm extends React__default["default"].Component {
302
+ constructor() {
303
+ super(...arguments);
304
+ this.state = {
305
+ playerName: this.props.playerName,
306
+ nameErrorMsg: '',
307
+ };
308
+ this.onClickEnter = () => {
309
+ if (this.state.playerName === '')
310
+ return;
311
+ this.props.onEnter(this.state.playerName);
312
+ };
313
+ this.onKeyPress = (event) => {
314
+ if (event.key === 'Enter') {
315
+ this.onClickEnter();
316
+ }
317
+ };
318
+ this.onChangePlayerName = (event) => {
319
+ const name = event.target.value.trim();
320
+ this.setState({
321
+ playerName: name,
322
+ nameErrorMsg: name.length > 0 ? '' : 'empty player name',
323
+ });
324
+ };
325
+ }
326
+ render() {
327
+ return (React__default["default"].createElement("div", null,
328
+ React__default["default"].createElement("p", { className: "phase-title" }, "Choose a player name:"),
329
+ React__default["default"].createElement("input", { type: "text", value: this.state.playerName, onChange: this.onChangePlayerName, onKeyPress: this.onKeyPress }),
330
+ React__default["default"].createElement("span", { className: "buttons" },
331
+ React__default["default"].createElement("button", { className: "buttons", onClick: this.onClickEnter }, "Enter")),
332
+ React__default["default"].createElement("br", null),
333
+ React__default["default"].createElement("span", { className: "error-msg" },
334
+ this.state.nameErrorMsg,
335
+ React__default["default"].createElement("br", null))));
336
+ }
337
+ }
338
+ LobbyLoginForm.defaultProps = {
339
+ playerName: '',
340
+ };
341
+
342
+ /*
343
+ * Copyright 2018 The boardgame.io Authors.
344
+ *
345
+ * Use of this source code is governed by a MIT-style
346
+ * license that can be found in the LICENSE file or at
347
+ * https://opensource.org/licenses/MIT.
348
+ */
349
+ class LobbyMatchInstance extends React__default["default"].Component {
350
+ constructor() {
351
+ super(...arguments);
352
+ this._createSeat = (player) => {
353
+ return player.name || '[free]';
354
+ };
355
+ this._createButtonJoin = (inst, seatId) => (React__default["default"].createElement("button", { key: 'button-join-' + inst.matchID, onClick: () => this.props.onClickJoin(inst.gameName, inst.matchID, '' + seatId) }, "Join"));
356
+ this._createButtonLeave = (inst) => (React__default["default"].createElement("button", { key: 'button-leave-' + inst.matchID, onClick: () => this.props.onClickLeave(inst.gameName, inst.matchID) }, "Leave"));
357
+ this._createButtonPlay = (inst, seatId) => (React__default["default"].createElement("button", { key: 'button-play-' + inst.matchID, onClick: () => this.props.onClickPlay(inst.gameName, {
358
+ matchID: inst.matchID,
359
+ playerID: '' + seatId,
360
+ numPlayers: inst.players.length,
361
+ }) }, "Play"));
362
+ this._createButtonSpectate = (inst) => (React__default["default"].createElement("button", { key: 'button-spectate-' + inst.matchID, onClick: () => this.props.onClickPlay(inst.gameName, {
363
+ matchID: inst.matchID,
364
+ numPlayers: inst.players.length,
365
+ }) }, "Spectate"));
366
+ this._createInstanceButtons = (inst) => {
367
+ const playerSeat = inst.players.find((player) => player.name === this.props.playerName);
368
+ const freeSeat = inst.players.find((player) => !player.name);
369
+ if (playerSeat && freeSeat) {
370
+ // already seated: waiting for match to start
371
+ return this._createButtonLeave(inst);
372
+ }
373
+ if (freeSeat) {
374
+ // at least 1 seat is available
375
+ return this._createButtonJoin(inst, freeSeat.id);
376
+ }
377
+ // match is full
378
+ if (playerSeat) {
379
+ return (React__default["default"].createElement("div", null, [
380
+ this._createButtonPlay(inst, playerSeat.id),
381
+ this._createButtonLeave(inst),
382
+ ]));
383
+ }
384
+ // allow spectating
385
+ return this._createButtonSpectate(inst);
386
+ };
387
+ }
388
+ render() {
389
+ const match = this.props.match;
390
+ let status = 'OPEN';
391
+ if (!match.players.some((player) => !player.name)) {
392
+ status = 'RUNNING';
393
+ }
394
+ return (React__default["default"].createElement("tr", { key: 'line-' + match.matchID },
395
+ React__default["default"].createElement("td", { key: 'cell-name-' + match.matchID }, match.gameName),
396
+ React__default["default"].createElement("td", { key: 'cell-status-' + match.matchID }, status),
397
+ React__default["default"].createElement("td", { key: 'cell-seats-' + match.matchID }, match.players.map((player) => this._createSeat(player)).join(', ')),
398
+ React__default["default"].createElement("td", { key: 'cell-buttons-' + match.matchID }, this._createInstanceButtons(match))));
399
+ }
400
+ }
401
+
402
+ /*
403
+ * Copyright 2018 The boardgame.io Authors.
404
+ *
405
+ * Use of this source code is governed by a MIT-style
406
+ * license that can be found in the LICENSE file or at
407
+ * https://opensource.org/licenses/MIT.
408
+ */
409
+ class LobbyCreateMatchForm extends React__default["default"].Component {
410
+ constructor(props) {
411
+ super(props);
412
+ this.state = {
413
+ selectedGame: 0,
414
+ numPlayers: 2,
415
+ };
416
+ this._createGameNameOption = (game, idx) => {
417
+ return (React__default["default"].createElement("option", { key: 'name-option-' + idx, value: idx }, game.game.name));
418
+ };
419
+ this._createNumPlayersOption = (idx) => {
420
+ return (React__default["default"].createElement("option", { key: 'num-option-' + idx, value: idx }, idx));
421
+ };
422
+ this._createNumPlayersRange = (game) => {
423
+ return Array.from({ length: game.maxPlayers + 1 })
424
+ .map((_, i) => i)
425
+ .slice(game.minPlayers);
426
+ };
427
+ this.onChangeNumPlayers = (event) => {
428
+ this.setState({
429
+ numPlayers: Number.parseInt(event.target.value),
430
+ });
431
+ };
432
+ this.onChangeSelectedGame = (event) => {
433
+ const idx = Number.parseInt(event.target.value);
434
+ this.setState({
435
+ selectedGame: idx,
436
+ numPlayers: this.props.games[idx].game.minPlayers,
437
+ });
438
+ };
439
+ this.onClickCreate = () => {
440
+ this.props.createMatch(this.props.games[this.state.selectedGame].game.name, this.state.numPlayers);
441
+ };
442
+ /* fix min and max number of players */
443
+ for (const game of props.games) {
444
+ const matchDetails = game.game;
445
+ if (!matchDetails.minPlayers) {
446
+ matchDetails.minPlayers = 1;
447
+ }
448
+ if (!matchDetails.maxPlayers) {
449
+ matchDetails.maxPlayers = 4;
450
+ }
451
+ console.assert(matchDetails.maxPlayers >= matchDetails.minPlayers);
452
+ }
453
+ this.state = {
454
+ selectedGame: 0,
455
+ numPlayers: props.games[0].game.minPlayers,
456
+ };
457
+ }
458
+ render() {
459
+ return (React__default["default"].createElement("div", null,
460
+ React__default["default"].createElement("select", { value: this.state.selectedGame, onChange: (evt) => this.onChangeSelectedGame(evt) }, this.props.games.map((game, index) => this._createGameNameOption(game, index))),
461
+ React__default["default"].createElement("span", null, "Players:"),
462
+ React__default["default"].createElement("select", { value: this.state.numPlayers, onChange: this.onChangeNumPlayers }, this._createNumPlayersRange(this.props.games[this.state.selectedGame].game).map((number) => this._createNumPlayersOption(number))),
463
+ React__default["default"].createElement("span", { className: "buttons" },
464
+ React__default["default"].createElement("button", { onClick: this.onClickCreate }, "Create"))));
465
+ }
466
+ }
467
+
468
+ /*
469
+ * Copyright 2018 The boardgame.io Authors.
470
+ *
471
+ * Use of this source code is governed by a MIT-style
472
+ * license that can be found in the LICENSE file or at
473
+ * https://opensource.org/licenses/MIT.
474
+ */
475
+ var LobbyPhases;
476
+ (function (LobbyPhases) {
477
+ LobbyPhases["ENTER"] = "enter";
478
+ LobbyPhases["PLAY"] = "play";
479
+ LobbyPhases["LIST"] = "list";
480
+ })(LobbyPhases || (LobbyPhases = {}));
481
+ /**
482
+ * Lobby
483
+ *
484
+ * React lobby component.
485
+ *
486
+ * @param {Array} gameComponents - An array of Board and Game objects for the supported games.
487
+ * @param {string} lobbyServer - Address of the lobby server (for example 'localhost:8000').
488
+ * If not set, defaults to the server that served the page.
489
+ * @param {string} gameServer - Address of the game server (for example 'localhost:8001').
490
+ * If not set, defaults to the server that served the page.
491
+ * @param {function} clientFactory - Function that is used to create the game clients.
492
+ * @param {number} refreshInterval - Interval between server updates (default: 2000ms).
493
+ * @param {bool} debug - Enable debug information (default: false).
494
+ *
495
+ * Returns:
496
+ * A React component that provides a UI to create, list, join, leave, play or
497
+ * spectate matches (game instances).
498
+ */
499
+ class Lobby extends React__default["default"].Component {
500
+ constructor(props) {
501
+ super(props);
502
+ this.state = {
503
+ phase: LobbyPhases.ENTER,
504
+ playerName: 'Visitor',
505
+ runningMatch: null,
506
+ errorMsg: '',
507
+ credentialStore: {},
508
+ };
509
+ this._createConnection = (props) => {
510
+ const name = this.state.playerName;
511
+ this.connection = LobbyConnection({
512
+ server: props.lobbyServer,
513
+ gameComponents: props.gameComponents,
514
+ playerName: name,
515
+ playerCredentials: this.state.credentialStore[name],
516
+ });
517
+ };
518
+ this._updateCredentials = (playerName, credentials) => {
519
+ this.setState((prevState) => {
520
+ // clone store or componentDidUpdate will not be triggered
521
+ const store = Object.assign({}, prevState.credentialStore);
522
+ store[playerName] = credentials;
523
+ return { credentialStore: store };
524
+ });
525
+ };
526
+ this._updateConnection = async () => {
527
+ await this.connection.refresh();
528
+ this.forceUpdate();
529
+ };
530
+ this._enterLobby = (playerName) => {
531
+ this._startRefreshInterval();
532
+ this.setState({ playerName, phase: LobbyPhases.LIST });
533
+ };
534
+ this._exitLobby = async () => {
535
+ this._clearRefreshInterval();
536
+ await this.connection.disconnect();
537
+ this.setState({ phase: LobbyPhases.ENTER, errorMsg: '' });
538
+ };
539
+ this._createMatch = async (gameName, numPlayers) => {
540
+ try {
541
+ await this.connection.create(gameName, numPlayers);
542
+ await this.connection.refresh();
543
+ // rerender
544
+ this.setState({});
545
+ }
546
+ catch (error) {
547
+ this.setState({ errorMsg: error.message });
548
+ }
549
+ };
550
+ this._joinMatch = async (gameName, matchID, playerID) => {
551
+ try {
552
+ await this.connection.join(gameName, matchID, playerID);
553
+ await this.connection.refresh();
554
+ this._updateCredentials(this.connection.playerName, this.connection.playerCredentials);
555
+ }
556
+ catch (error) {
557
+ this.setState({ errorMsg: error.message });
558
+ }
559
+ };
560
+ this._leaveMatch = async (gameName, matchID) => {
561
+ try {
562
+ await this.connection.leave(gameName, matchID);
563
+ await this.connection.refresh();
564
+ this._updateCredentials(this.connection.playerName, this.connection.playerCredentials);
565
+ }
566
+ catch (error) {
567
+ this.setState({ errorMsg: error.message });
568
+ }
569
+ };
570
+ this._startMatch = (gameName, matchOpts) => {
571
+ const gameCode = this.connection._getGameComponents(gameName);
572
+ if (!gameCode) {
573
+ this.setState({
574
+ errorMsg: 'game ' + gameName + ' not supported',
575
+ });
576
+ return;
577
+ }
578
+ let multiplayer = undefined;
579
+ if (matchOpts.numPlayers > 1) {
580
+ multiplayer = this.props.gameServer
581
+ ? socketio.SocketIO({ server: this.props.gameServer })
582
+ : socketio.SocketIO();
583
+ }
584
+ if (matchOpts.numPlayers == 1) {
585
+ const maxPlayers = gameCode.game.maxPlayers;
586
+ const bots = {};
587
+ for (let i = 1; i < maxPlayers; i++) {
588
+ bots[i + ''] = ai.MCTSBot;
589
+ }
590
+ multiplayer = socketio.Local({ bots });
591
+ }
592
+ const app = this.props.clientFactory({
593
+ game: gameCode.game,
594
+ board: gameCode.board,
595
+ debug: this.props.debug,
596
+ multiplayer,
597
+ });
598
+ const match = {
599
+ app: app,
600
+ matchID: matchOpts.matchID,
601
+ playerID: matchOpts.numPlayers > 1 ? matchOpts.playerID : '0',
602
+ credentials: this.connection.playerCredentials,
603
+ };
604
+ this._clearRefreshInterval();
605
+ this.setState({ phase: LobbyPhases.PLAY, runningMatch: match });
606
+ };
607
+ this._exitMatch = () => {
608
+ this._startRefreshInterval();
609
+ this.setState({ phase: LobbyPhases.LIST, runningMatch: null });
610
+ };
611
+ this._getPhaseVisibility = (phase) => {
612
+ return this.state.phase !== phase ? 'hidden' : 'phase';
613
+ };
614
+ this.renderMatches = (matches, playerName) => {
615
+ return matches.map((match) => {
616
+ const { matchID, gameName, players } = match;
617
+ return (React__default["default"].createElement(LobbyMatchInstance, { key: 'instance-' + matchID, match: { matchID, gameName, players: Object.values(players) }, playerName: playerName, onClickJoin: this._joinMatch, onClickLeave: this._leaveMatch, onClickPlay: this._startMatch }));
618
+ });
619
+ };
620
+ this._createConnection(this.props);
621
+ }
622
+ componentDidMount() {
623
+ const cookie = Cookies__default["default"].load('lobbyState') || {};
624
+ if (cookie.phase && cookie.phase === LobbyPhases.PLAY) {
625
+ cookie.phase = LobbyPhases.LIST;
626
+ }
627
+ if (cookie.phase && cookie.phase !== LobbyPhases.ENTER) {
628
+ this._startRefreshInterval();
629
+ }
630
+ this.setState({
631
+ phase: cookie.phase || LobbyPhases.ENTER,
632
+ playerName: cookie.playerName || 'Visitor',
633
+ credentialStore: cookie.credentialStore || {},
634
+ });
635
+ }
636
+ componentDidUpdate(prevProps, prevState) {
637
+ const name = this.state.playerName;
638
+ const creds = this.state.credentialStore[name];
639
+ if (prevState.phase !== this.state.phase ||
640
+ prevState.credentialStore[name] !== creds ||
641
+ prevState.playerName !== name) {
642
+ this._createConnection(this.props);
643
+ this._updateConnection();
644
+ const cookie = {
645
+ phase: this.state.phase,
646
+ playerName: name,
647
+ credentialStore: this.state.credentialStore,
648
+ };
649
+ Cookies__default["default"].save('lobbyState', cookie, { path: '/' });
650
+ }
651
+ if (prevProps.refreshInterval !== this.props.refreshInterval) {
652
+ this._startRefreshInterval();
653
+ }
654
+ }
655
+ componentWillUnmount() {
656
+ this._clearRefreshInterval();
657
+ }
658
+ _startRefreshInterval() {
659
+ this._clearRefreshInterval();
660
+ this._currentInterval = setInterval(this._updateConnection, this.props.refreshInterval);
661
+ }
662
+ _clearRefreshInterval() {
663
+ clearInterval(this._currentInterval);
664
+ }
665
+ render() {
666
+ const { gameComponents, renderer } = this.props;
667
+ const { errorMsg, playerName, phase, runningMatch } = this.state;
668
+ if (renderer) {
669
+ return renderer({
670
+ errorMsg,
671
+ gameComponents,
672
+ matches: this.connection.matches,
673
+ phase,
674
+ playerName,
675
+ runningMatch,
676
+ handleEnterLobby: this._enterLobby,
677
+ handleExitLobby: this._exitLobby,
678
+ handleCreateMatch: this._createMatch,
679
+ handleJoinMatch: this._joinMatch,
680
+ handleLeaveMatch: this._leaveMatch,
681
+ handleExitMatch: this._exitMatch,
682
+ handleRefreshMatches: this._updateConnection,
683
+ handleStartMatch: this._startMatch,
684
+ });
685
+ }
686
+ return (React__default["default"].createElement("div", { id: "lobby-view", style: { padding: 50 } },
687
+ React__default["default"].createElement("div", { className: this._getPhaseVisibility(LobbyPhases.ENTER) },
688
+ React__default["default"].createElement(LobbyLoginForm, { key: playerName, playerName: playerName, onEnter: this._enterLobby })),
689
+ React__default["default"].createElement("div", { className: this._getPhaseVisibility(LobbyPhases.LIST) },
690
+ React__default["default"].createElement("p", null,
691
+ "Welcome, ",
692
+ playerName),
693
+ React__default["default"].createElement("div", { className: "phase-title", id: "match-creation" },
694
+ React__default["default"].createElement("span", null, "Create a match:"),
695
+ React__default["default"].createElement(LobbyCreateMatchForm, { games: gameComponents, createMatch: this._createMatch })),
696
+ React__default["default"].createElement("p", { className: "phase-title" }, "Join a match:"),
697
+ React__default["default"].createElement("div", { id: "instances" },
698
+ React__default["default"].createElement("table", null,
699
+ React__default["default"].createElement("tbody", null, this.renderMatches(this.connection.matches, playerName))),
700
+ React__default["default"].createElement("span", { className: "error-msg" },
701
+ errorMsg,
702
+ React__default["default"].createElement("br", null))),
703
+ React__default["default"].createElement("p", { className: "phase-title" }, "Matches that become empty are automatically deleted.")),
704
+ React__default["default"].createElement("div", { className: this._getPhaseVisibility(LobbyPhases.PLAY) },
705
+ runningMatch && (React__default["default"].createElement(runningMatch.app, { matchID: runningMatch.matchID, playerID: runningMatch.playerID, credentials: runningMatch.credentials })),
706
+ React__default["default"].createElement("div", { className: "buttons", id: "match-exit" },
707
+ React__default["default"].createElement("button", { onClick: this._exitMatch }, "Exit match"))),
708
+ React__default["default"].createElement("div", { className: "buttons", id: "lobby-exit" },
709
+ React__default["default"].createElement("button", { onClick: this._exitLobby }, "Exit lobby"))));
710
+ }
711
+ }
712
+ Lobby.propTypes = {
713
+ gameComponents: PropTypes__default["default"].array.isRequired,
714
+ lobbyServer: PropTypes__default["default"].string,
715
+ gameServer: PropTypes__default["default"].string,
716
+ debug: PropTypes__default["default"].bool,
717
+ clientFactory: PropTypes__default["default"].func,
718
+ refreshInterval: PropTypes__default["default"].number,
719
+ };
720
+ Lobby.defaultProps = {
721
+ debug: false,
722
+ clientFactory: Client,
723
+ refreshInterval: 2000,
724
+ };
725
+
726
+ exports.Client = Client;
727
+ exports.Lobby = Lobby;