@mtgame/core 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 (293) hide show
  1. package/README.md +24 -0
  2. package/api/basketball-game-api.d.ts +17 -0
  3. package/api/league-api.d.ts +16 -0
  4. package/api/media-api.d.ts +24 -0
  5. package/api/notification-api.d.ts +4 -0
  6. package/api/notification-base-api.d.ts +22 -0
  7. package/api/org-notification-api.d.ts +4 -0
  8. package/api/paginated-response.interface.d.ts +4 -0
  9. package/api/public-api.d.ts +12 -0
  10. package/api/reference-api.d.ts +11 -0
  11. package/api/tournament-api.d.ts +64 -0
  12. package/api/tournament-join-api.d.ts +14 -0
  13. package/api/tournament-stage-api.d.ts +15 -0
  14. package/api/volleyball-game-api.d.ts +17 -0
  15. package/bundles/mtgame-core.umd.js +4785 -0
  16. package/bundles/mtgame-core.umd.js.map +1 -0
  17. package/bundles/mtgame-core.umd.min.js +16 -0
  18. package/bundles/mtgame-core.umd.min.js.map +1 -0
  19. package/esm2015/api/basketball-game-api.js +54 -0
  20. package/esm2015/api/league-api.js +60 -0
  21. package/esm2015/api/media-api.js +110 -0
  22. package/esm2015/api/notification-api.js +18 -0
  23. package/esm2015/api/notification-base-api.js +83 -0
  24. package/esm2015/api/org-notification-api.js +18 -0
  25. package/esm2015/api/paginated-response.interface.js +1 -0
  26. package/esm2015/api/public-api.js +12 -0
  27. package/esm2015/api/reference-api.js +40 -0
  28. package/esm2015/api/tournament-api.js +187 -0
  29. package/esm2015/api/tournament-join-api.js +51 -0
  30. package/esm2015/api/tournament-stage-api.js +56 -0
  31. package/esm2015/api/volleyball-game-api.js +54 -0
  32. package/esm2015/http-cookie.interceptor.js +34 -0
  33. package/esm2015/localization/basketball-game-log-types.js +26 -0
  34. package/esm2015/localization/overtime-types.js +7 -0
  35. package/esm2015/localization/public-api.js +7 -0
  36. package/esm2015/localization/team-event-type.js +6 -0
  37. package/esm2015/localization/team-user-role.js +7 -0
  38. package/esm2015/localization/user-profile.js +46 -0
  39. package/esm2015/localization/volleyball-game-log-types.js +25 -0
  40. package/esm2015/models/basketball-game-config.js +42 -0
  41. package/esm2015/models/basketball-game-log.js +109 -0
  42. package/esm2015/models/basketball-game-statistic.js +50 -0
  43. package/esm2015/models/basketball-game-team-statistic.js +27 -0
  44. package/esm2015/models/basketball-profile.js +43 -0
  45. package/esm2015/models/basketball-statistic.js +69 -0
  46. package/esm2015/models/city.js +22 -0
  47. package/esm2015/models/file.js +38 -0
  48. package/esm2015/models/game-invite.js +37 -0
  49. package/esm2015/models/game-log-base.js +1 -0
  50. package/esm2015/models/game-statistic-base.js +1 -0
  51. package/esm2015/models/game-timeline-stages.js +49 -0
  52. package/esm2015/models/game-user.js +32 -0
  53. package/esm2015/models/game.js +108 -0
  54. package/esm2015/models/league-court.js +24 -0
  55. package/esm2015/models/league.js +52 -0
  56. package/esm2015/models/media-item.js +40 -0
  57. package/esm2015/models/notification-settings.js +35 -0
  58. package/esm2015/models/notification.js +134 -0
  59. package/esm2015/models/organization.js +27 -0
  60. package/esm2015/models/playoff.js +78 -0
  61. package/esm2015/models/poll.js +132 -0
  62. package/esm2015/models/public-api.js +50 -0
  63. package/esm2015/models/sport.js +47 -0
  64. package/esm2015/models/team-event-invite.js +32 -0
  65. package/esm2015/models/team-event-type.js +6 -0
  66. package/esm2015/models/team-event.js +45 -0
  67. package/esm2015/models/team-invite-external.js +25 -0
  68. package/esm2015/models/team-invite.js +41 -0
  69. package/esm2015/models/team-user.js +39 -0
  70. package/esm2015/models/team.js +56 -0
  71. package/esm2015/models/tournament-disqualification.js +29 -0
  72. package/esm2015/models/tournament-event.js +38 -0
  73. package/esm2015/models/tournament-group.js +23 -0
  74. package/esm2015/models/tournament-invite.js +39 -0
  75. package/esm2015/models/tournament-join-team.js +55 -0
  76. package/esm2015/models/tournament-news.js +33 -0
  77. package/esm2015/models/tournament-stage-team.js +45 -0
  78. package/esm2015/models/tournament-stage.js +35 -0
  79. package/esm2015/models/tournament-team-user-invite.js +29 -0
  80. package/esm2015/models/tournament-team-user.js +49 -0
  81. package/esm2015/models/tournament-team.js +54 -0
  82. package/esm2015/models/tournament.js +161 -0
  83. package/esm2015/models/user-profile.js +24 -0
  84. package/esm2015/models/user.js +74 -0
  85. package/esm2015/models/util.js +208 -0
  86. package/esm2015/models/volleyball-game-config.js +40 -0
  87. package/esm2015/models/volleyball-game-log.js +139 -0
  88. package/esm2015/models/volleyball-game-statistic.js +50 -0
  89. package/esm2015/models/volleyball-game-team-statistic.js +27 -0
  90. package/esm2015/models/volleyball-profile.js +43 -0
  91. package/esm2015/models/volleyball-statistic.js +66 -0
  92. package/esm2015/mtgame-core.js +5 -0
  93. package/esm2015/public-api.js +8 -0
  94. package/esm2015/services/base.service.js +18 -0
  95. package/esm2015/services/centrifugo.service.js +107 -0
  96. package/esm2015/services/config.service.js +40 -0
  97. package/esm2015/services/public-api.js +4 -0
  98. package/esm2015/storage/local-storage-engine.js +18 -0
  99. package/esm2015/storage/public-api.js +4 -0
  100. package/esm2015/storage/storage-engine.js +61 -0
  101. package/esm2015/storage/store.js +63 -0
  102. package/esm2015/utils/array.js +18 -0
  103. package/esm2015/utils/component-destroyed.js +21 -0
  104. package/esm2015/utils/cookie.js +9 -0
  105. package/esm2015/utils/data.js +75 -0
  106. package/esm2015/utils/device.js +14 -0
  107. package/esm2015/utils/enum.js +7 -0
  108. package/esm2015/utils/errors.js +10 -0
  109. package/esm2015/utils/favicon.js +25 -0
  110. package/esm2015/utils/form.js +22 -0
  111. package/esm2015/utils/public-api.js +11 -0
  112. package/esm2015/utils/validators.js +47 -0
  113. package/esm5/api/basketball-game-api.js +65 -0
  114. package/esm5/api/league-api.js +70 -0
  115. package/esm5/api/media-api.js +125 -0
  116. package/esm5/api/notification-api.js +21 -0
  117. package/esm5/api/notification-base-api.js +109 -0
  118. package/esm5/api/org-notification-api.js +21 -0
  119. package/esm5/api/paginated-response.interface.js +1 -0
  120. package/esm5/api/public-api.js +12 -0
  121. package/esm5/api/reference-api.js +45 -0
  122. package/esm5/api/tournament-api.js +245 -0
  123. package/esm5/api/tournament-join-api.js +59 -0
  124. package/esm5/api/tournament-stage-api.js +65 -0
  125. package/esm5/api/volleyball-game-api.js +65 -0
  126. package/esm5/http-cookie.interceptor.js +35 -0
  127. package/esm5/localization/basketball-game-log-types.js +27 -0
  128. package/esm5/localization/overtime-types.js +8 -0
  129. package/esm5/localization/public-api.js +7 -0
  130. package/esm5/localization/team-event-type.js +7 -0
  131. package/esm5/localization/team-user-role.js +8 -0
  132. package/esm5/localization/user-profile.js +47 -0
  133. package/esm5/localization/volleyball-game-log-types.js +26 -0
  134. package/esm5/models/basketball-game-config.js +47 -0
  135. package/esm5/models/basketball-game-log.js +117 -0
  136. package/esm5/models/basketball-game-statistic.js +63 -0
  137. package/esm5/models/basketball-game-team-statistic.js +32 -0
  138. package/esm5/models/basketball-profile.js +48 -0
  139. package/esm5/models/basketball-statistic.js +78 -0
  140. package/esm5/models/city.js +27 -0
  141. package/esm5/models/file.js +41 -0
  142. package/esm5/models/game-invite.js +42 -0
  143. package/esm5/models/game-log-base.js +1 -0
  144. package/esm5/models/game-statistic-base.js +1 -0
  145. package/esm5/models/game-timeline-stages.js +57 -0
  146. package/esm5/models/game-user.js +37 -0
  147. package/esm5/models/game.js +134 -0
  148. package/esm5/models/league-court.js +29 -0
  149. package/esm5/models/league.js +69 -0
  150. package/esm5/models/media-item.js +49 -0
  151. package/esm5/models/notification-settings.js +40 -0
  152. package/esm5/models/notification.js +143 -0
  153. package/esm5/models/organization.js +32 -0
  154. package/esm5/models/playoff.js +91 -0
  155. package/esm5/models/poll.js +154 -0
  156. package/esm5/models/public-api.js +50 -0
  157. package/esm5/models/sport.js +52 -0
  158. package/esm5/models/team-event-invite.js +35 -0
  159. package/esm5/models/team-event-type.js +6 -0
  160. package/esm5/models/team-event.js +58 -0
  161. package/esm5/models/team-invite-external.js +30 -0
  162. package/esm5/models/team-invite.js +46 -0
  163. package/esm5/models/team-user.js +44 -0
  164. package/esm5/models/team.js +61 -0
  165. package/esm5/models/tournament-disqualification.js +34 -0
  166. package/esm5/models/tournament-event.js +43 -0
  167. package/esm5/models/tournament-group.js +28 -0
  168. package/esm5/models/tournament-invite.js +48 -0
  169. package/esm5/models/tournament-join-team.js +73 -0
  170. package/esm5/models/tournament-news.js +38 -0
  171. package/esm5/models/tournament-stage-team.js +54 -0
  172. package/esm5/models/tournament-stage.js +40 -0
  173. package/esm5/models/tournament-team-user-invite.js +34 -0
  174. package/esm5/models/tournament-team-user.js +66 -0
  175. package/esm5/models/tournament-team.js +63 -0
  176. package/esm5/models/tournament.js +176 -0
  177. package/esm5/models/user-profile.js +27 -0
  178. package/esm5/models/user.js +95 -0
  179. package/esm5/models/util.js +275 -0
  180. package/esm5/models/volleyball-game-config.js +49 -0
  181. package/esm5/models/volleyball-game-log.js +142 -0
  182. package/esm5/models/volleyball-game-statistic.js +71 -0
  183. package/esm5/models/volleyball-game-team-statistic.js +32 -0
  184. package/esm5/models/volleyball-profile.js +48 -0
  185. package/esm5/models/volleyball-statistic.js +71 -0
  186. package/esm5/mtgame-core.js +5 -0
  187. package/esm5/public-api.js +8 -0
  188. package/esm5/services/base.service.js +19 -0
  189. package/esm5/services/centrifugo.service.js +111 -0
  190. package/esm5/services/config.service.js +52 -0
  191. package/esm5/services/public-api.js +4 -0
  192. package/esm5/storage/local-storage-engine.js +25 -0
  193. package/esm5/storage/public-api.js +4 -0
  194. package/esm5/storage/storage-engine.js +77 -0
  195. package/esm5/storage/store.js +77 -0
  196. package/esm5/utils/array.js +18 -0
  197. package/esm5/utils/component-destroyed.js +21 -0
  198. package/esm5/utils/cookie.js +9 -0
  199. package/esm5/utils/data.js +79 -0
  200. package/esm5/utils/device.js +14 -0
  201. package/esm5/utils/enum.js +7 -0
  202. package/esm5/utils/errors.js +12 -0
  203. package/esm5/utils/favicon.js +47 -0
  204. package/esm5/utils/form.js +22 -0
  205. package/esm5/utils/public-api.js +11 -0
  206. package/esm5/utils/validators.js +49 -0
  207. package/fesm2015/mtgame-core.js +3749 -0
  208. package/fesm2015/mtgame-core.js.map +1 -0
  209. package/fesm5/mtgame-core.js +4455 -0
  210. package/fesm5/mtgame-core.js.map +1 -0
  211. package/http-cookie.interceptor.d.ts +10 -0
  212. package/localization/basketball-game-log-types.d.ts +25 -0
  213. package/localization/overtime-types.d.ts +6 -0
  214. package/localization/public-api.d.ts +6 -0
  215. package/localization/team-event-type.d.ts +5 -0
  216. package/localization/team-user-role.d.ts +6 -0
  217. package/localization/user-profile.d.ts +45 -0
  218. package/localization/volleyball-game-log-types.d.ts +24 -0
  219. package/models/basketball-game-config.d.ts +22 -0
  220. package/models/basketball-game-log.d.ts +52 -0
  221. package/models/basketball-game-statistic.d.ts +29 -0
  222. package/models/basketball-game-team-statistic.d.ts +8 -0
  223. package/models/basketball-profile.d.ts +20 -0
  224. package/models/basketball-statistic.d.ts +44 -0
  225. package/models/city.d.ts +7 -0
  226. package/models/file.d.ts +14 -0
  227. package/models/game-invite.d.ts +16 -0
  228. package/models/game-log-base.d.ts +10 -0
  229. package/models/game-statistic-base.d.ts +3 -0
  230. package/models/game-timeline-stages.d.ts +18 -0
  231. package/models/game-user.d.ts +12 -0
  232. package/models/game.d.ts +56 -0
  233. package/models/league-court.d.ts +9 -0
  234. package/models/league.d.ts +25 -0
  235. package/models/media-item.d.ts +15 -0
  236. package/models/notification-settings.d.ts +15 -0
  237. package/models/notification.d.ts +98 -0
  238. package/models/organization.d.ts +9 -0
  239. package/models/playoff.d.ts +25 -0
  240. package/models/poll.d.ts +46 -0
  241. package/models/public-api.d.ts +50 -0
  242. package/models/sport.d.ts +19 -0
  243. package/models/team-event-invite.d.ts +12 -0
  244. package/models/team-event-type.d.ts +4 -0
  245. package/models/team-event.d.ts +17 -0
  246. package/models/team-invite-external.d.ts +10 -0
  247. package/models/team-invite.d.ts +20 -0
  248. package/models/team-user.d.ts +18 -0
  249. package/models/team.d.ts +21 -0
  250. package/models/tournament-disqualification.d.ts +10 -0
  251. package/models/tournament-event.d.ts +16 -0
  252. package/models/tournament-group.d.ts +10 -0
  253. package/models/tournament-invite.d.ts +17 -0
  254. package/models/tournament-join-team.d.ts +19 -0
  255. package/models/tournament-news.d.ts +13 -0
  256. package/models/tournament-stage-team.d.ts +21 -0
  257. package/models/tournament-stage.d.ts +15 -0
  258. package/models/tournament-team-user-invite.d.ts +11 -0
  259. package/models/tournament-team-user.d.ts +22 -0
  260. package/models/tournament-team.d.ts +28 -0
  261. package/models/tournament.d.ts +87 -0
  262. package/models/user-profile.d.ts +8 -0
  263. package/models/user.d.ts +33 -0
  264. package/models/util.d.ts +49 -0
  265. package/models/volleyball-game-config.d.ts +17 -0
  266. package/models/volleyball-game-log.d.ts +54 -0
  267. package/models/volleyball-game-statistic.d.ts +28 -0
  268. package/models/volleyball-game-team-statistic.d.ts +8 -0
  269. package/models/volleyball-profile.d.ts +20 -0
  270. package/models/volleyball-statistic.d.ts +43 -0
  271. package/mtgame-core.d.ts +4 -0
  272. package/mtgame-core.metadata.json +1 -0
  273. package/package.json +23 -0
  274. package/public-api.d.ts +7 -0
  275. package/services/base.service.d.ts +5 -0
  276. package/services/centrifugo.service.d.ts +20 -0
  277. package/services/config.service.d.ts +11 -0
  278. package/services/public-api.d.ts +3 -0
  279. package/storage/local-storage-engine.d.ts +6 -0
  280. package/storage/public-api.d.ts +3 -0
  281. package/storage/storage-engine.d.ts +24 -0
  282. package/storage/store.d.ts +21 -0
  283. package/utils/array.d.ts +2 -0
  284. package/utils/component-destroyed.d.ts +7 -0
  285. package/utils/cookie.d.ts +1 -0
  286. package/utils/data.d.ts +6 -0
  287. package/utils/device.d.ts +1 -0
  288. package/utils/enum.d.ts +1 -0
  289. package/utils/errors.d.ts +1 -0
  290. package/utils/favicon.d.ts +9 -0
  291. package/utils/form.d.ts +2 -0
  292. package/utils/public-api.d.ts +10 -0
  293. package/utils/validators.d.ts +25 -0
@@ -0,0 +1,4785 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('rxjs/internal/Subject'), require('rxjs/internal/ReplaySubject'), require('centrifuge'), require('@sentry/browser'), require('@angular/forms'), require('@angular/common')) :
3
+ typeof define === 'function' && define.amd ? define('@mtgame/core', ['exports', '@angular/core', '@angular/common/http', 'rxjs/operators', 'rxjs', 'rxjs/internal/Subject', 'rxjs/internal/ReplaySubject', 'centrifuge', '@sentry/browser', '@angular/forms', '@angular/common'], factory) :
4
+ (global = global || self, factory((global.mtgame = global.mtgame || {}, global.mtgame.core = {}), global.ng.core, global.ng.common.http, global.rxjs.operators, global.rxjs, global.rxjs['internal/Subject'], global.rxjs['internal/ReplaySubject'], global.Centrifuge, global.browser, global.ng.forms, global.ng.common));
5
+ }(this, (function (exports, core, http, operators, rxjs, Subject, ReplaySubject, Centrifuge, browser, forms, common) { 'use strict';
6
+
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ extendStatics(d, b);
32
+ function __() { this.constructor = d; }
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ }
35
+
36
+ var __assign = function() {
37
+ __assign = Object.assign || function __assign(t) {
38
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39
+ s = arguments[i];
40
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
+ }
42
+ return t;
43
+ };
44
+ return __assign.apply(this, arguments);
45
+ };
46
+
47
+ function __rest(s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ }
58
+
59
+ function __decorate(decorators, target, key, desc) {
60
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
64
+ }
65
+
66
+ function __param(paramIndex, decorator) {
67
+ return function (target, key) { decorator(target, key, paramIndex); }
68
+ }
69
+
70
+ function __metadata(metadataKey, metadataValue) {
71
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
+ }
73
+
74
+ function __awaiter(thisArg, _arguments, P, generator) {
75
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
+ return new (P || (P = Promise))(function (resolve, reject) {
77
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
81
+ });
82
+ }
83
+
84
+ function __generator(thisArg, body) {
85
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
+ function verb(n) { return function (v) { return step([n, v]); }; }
88
+ function step(op) {
89
+ if (f) throw new TypeError("Generator is already executing.");
90
+ while (_) try {
91
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92
+ if (y = 0, t) op = [op[0] & 2, t.value];
93
+ switch (op[0]) {
94
+ case 0: case 1: t = op; break;
95
+ case 4: _.label++; return { value: op[1], done: false };
96
+ case 5: _.label++; y = op[1]; op = [0]; continue;
97
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
+ default:
99
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
+ if (t[2]) _.ops.pop();
104
+ _.trys.pop(); continue;
105
+ }
106
+ op = body.call(thisArg, _);
107
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
+ }
110
+ }
111
+
112
+ function __createBinding(o, m, k, k2) {
113
+ if (k2 === undefined) k2 = k;
114
+ o[k2] = m[k];
115
+ }
116
+
117
+ function __exportStar(m, exports) {
118
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
119
+ }
120
+
121
+ function __values(o) {
122
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
123
+ if (m) return m.call(o);
124
+ if (o && typeof o.length === "number") return {
125
+ next: function () {
126
+ if (o && i >= o.length) o = void 0;
127
+ return { value: o && o[i++], done: !o };
128
+ }
129
+ };
130
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
131
+ }
132
+
133
+ function __read(o, n) {
134
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
135
+ if (!m) return o;
136
+ var i = m.call(o), r, ar = [], e;
137
+ try {
138
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
139
+ }
140
+ catch (error) { e = { error: error }; }
141
+ finally {
142
+ try {
143
+ if (r && !r.done && (m = i["return"])) m.call(i);
144
+ }
145
+ finally { if (e) throw e.error; }
146
+ }
147
+ return ar;
148
+ }
149
+
150
+ function __spread() {
151
+ for (var ar = [], i = 0; i < arguments.length; i++)
152
+ ar = ar.concat(__read(arguments[i]));
153
+ return ar;
154
+ }
155
+
156
+ function __spreadArrays() {
157
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
158
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
159
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
160
+ r[k] = a[j];
161
+ return r;
162
+ };
163
+
164
+ function __await(v) {
165
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
166
+ }
167
+
168
+ function __asyncGenerator(thisArg, _arguments, generator) {
169
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
170
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
171
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
172
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
173
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
174
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
175
+ function fulfill(value) { resume("next", value); }
176
+ function reject(value) { resume("throw", value); }
177
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
178
+ }
179
+
180
+ function __asyncDelegator(o) {
181
+ var i, p;
182
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
183
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
184
+ }
185
+
186
+ function __asyncValues(o) {
187
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
188
+ var m = o[Symbol.asyncIterator], i;
189
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
190
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
191
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
192
+ }
193
+
194
+ function __makeTemplateObject(cooked, raw) {
195
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
196
+ return cooked;
197
+ };
198
+
199
+ function __importStar(mod) {
200
+ if (mod && mod.__esModule) return mod;
201
+ var result = {};
202
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
203
+ result.default = mod;
204
+ return result;
205
+ }
206
+
207
+ function __importDefault(mod) {
208
+ return (mod && mod.__esModule) ? mod : { default: mod };
209
+ }
210
+
211
+ function __classPrivateFieldGet(receiver, privateMap) {
212
+ if (!privateMap.has(receiver)) {
213
+ throw new TypeError("attempted to get private field on non-instance");
214
+ }
215
+ return privateMap.get(receiver);
216
+ }
217
+
218
+ function __classPrivateFieldSet(receiver, privateMap, value) {
219
+ if (!privateMap.has(receiver)) {
220
+ throw new TypeError("attempted to set private field on non-instance");
221
+ }
222
+ privateMap.set(receiver, value);
223
+ return value;
224
+ }
225
+
226
+ var MODEL_MAPPING_FIELDS_KEY = '_mapping_fields_';
227
+ var MODEL_RELATION_KEY = '_relation_';
228
+ var MODEL_TO_FRONT_KEY = '_to_front_';
229
+ var MODEL_TO_BACK_KEY = '_to_back_';
230
+ var BaseModel = /** @class */ (function () {
231
+ function BaseModel(data) {
232
+ var e_1, _a;
233
+ if (data) {
234
+ try {
235
+ for (var _b = __values(Object.keys(data)), _c = _b.next(); !_c.done; _c = _b.next()) {
236
+ var key = _c.value;
237
+ this[key] = data[key];
238
+ }
239
+ }
240
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
241
+ finally {
242
+ try {
243
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
244
+ }
245
+ finally { if (e_1) throw e_1.error; }
246
+ }
247
+ }
248
+ }
249
+ BaseModel.toFront = function (dto) {
250
+ return undefined;
251
+ };
252
+ BaseModel.toBack = function (dto) {
253
+ return undefined;
254
+ };
255
+ return BaseModel;
256
+ }());
257
+ function enumField(enumClass) {
258
+ return {
259
+ toFront: function (value) {
260
+ if (isNaN(+value)) {
261
+ return enumClass[value];
262
+ }
263
+ else {
264
+ return value;
265
+ }
266
+ },
267
+ toBack: function (value) {
268
+ if (isNaN(+value)) {
269
+ return value;
270
+ }
271
+ else {
272
+ return enumClass[value];
273
+ }
274
+ }
275
+ };
276
+ }
277
+ function listField(modelClass) {
278
+ return {
279
+ toFront: function (value) {
280
+ if (!Array.isArray(value)) {
281
+ return [];
282
+ }
283
+ return modelClass.toFront(value);
284
+ },
285
+ toBack: function (value) {
286
+ if (!Array.isArray(value)) {
287
+ return [];
288
+ }
289
+ return modelClass.toBack(value);
290
+ }
291
+ };
292
+ }
293
+ var DateField = /** @class */ (function (_super) {
294
+ __extends(DateField, _super);
295
+ function DateField() {
296
+ return _super !== null && _super.apply(this, arguments) || this;
297
+ }
298
+ DateField.toFront = function (date) {
299
+ if (date) {
300
+ return new Date(date);
301
+ }
302
+ else {
303
+ return undefined;
304
+ }
305
+ };
306
+ DateField.toBack = function (date) {
307
+ if (date) {
308
+ var dateUtc = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
309
+ return dateUtc.toISOString().slice(0, 10);
310
+ }
311
+ else {
312
+ return undefined;
313
+ }
314
+ };
315
+ return DateField;
316
+ }(BaseModel));
317
+ var DateTimeField = /** @class */ (function (_super) {
318
+ __extends(DateTimeField, _super);
319
+ function DateTimeField() {
320
+ return _super !== null && _super.apply(this, arguments) || this;
321
+ }
322
+ DateTimeField.toFront = function (date) {
323
+ if (date) {
324
+ return new Date(date);
325
+ }
326
+ else {
327
+ return undefined;
328
+ }
329
+ };
330
+ DateTimeField.toBack = function (date) {
331
+ if (date) {
332
+ var dateUtc = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
333
+ return date.toISOString();
334
+ }
335
+ else {
336
+ return undefined;
337
+ }
338
+ };
339
+ return DateTimeField;
340
+ }(BaseModel));
341
+ function ModelInstance(config) {
342
+ return function (target) {
343
+ if (config) {
344
+ if (config.mappingFields) {
345
+ target[MODEL_MAPPING_FIELDS_KEY] = config.mappingFields;
346
+ }
347
+ if (config.relation) {
348
+ target[MODEL_RELATION_KEY] = config.relation;
349
+ }
350
+ target[MODEL_TO_FRONT_KEY] = function (dto, path) {
351
+ return toFront(target, dto, path);
352
+ };
353
+ target[MODEL_TO_BACK_KEY] = function (dto, path) {
354
+ return toBack(target, dto, path);
355
+ };
356
+ }
357
+ };
358
+ }
359
+ var ToFrontHook = function (target, key, descriptor) {
360
+ return {
361
+ value: function () {
362
+ var args = [];
363
+ for (var _i = 0; _i < arguments.length; _i++) {
364
+ args[_i] = arguments[_i];
365
+ }
366
+ var parseMethod = target[MODEL_TO_FRONT_KEY];
367
+ if (parseMethod) {
368
+ return parseMethod(args[0], (args.length > 1 ? args[1] : undefined));
369
+ }
370
+ return undefined;
371
+ }
372
+ };
373
+ };
374
+ var ToBackHook = function (target, key, descriptor) {
375
+ return {
376
+ value: function () {
377
+ var args = [];
378
+ for (var _i = 0; _i < arguments.length; _i++) {
379
+ args[_i] = arguments[_i];
380
+ }
381
+ var parseMethod = target[MODEL_TO_BACK_KEY];
382
+ if (parseMethod) {
383
+ return parseMethod(args[0]);
384
+ }
385
+ return undefined;
386
+ }
387
+ };
388
+ };
389
+ function extractValue(key, data) {
390
+ var e_2, _a;
391
+ if (!data) {
392
+ return undefined;
393
+ }
394
+ var keyParts = key.split('.');
395
+ if (keyParts.length === 1) {
396
+ if (key in data) {
397
+ return data[key];
398
+ }
399
+ else {
400
+ return undefined;
401
+ }
402
+ }
403
+ try {
404
+ for (var keyParts_1 = __values(keyParts), keyParts_1_1 = keyParts_1.next(); !keyParts_1_1.done; keyParts_1_1 = keyParts_1.next()) {
405
+ var k = keyParts_1_1.value;
406
+ if (data && k in data) {
407
+ data = data[k];
408
+ }
409
+ else {
410
+ return undefined;
411
+ }
412
+ }
413
+ }
414
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
415
+ finally {
416
+ try {
417
+ if (keyParts_1_1 && !keyParts_1_1.done && (_a = keyParts_1.return)) _a.call(keyParts_1);
418
+ }
419
+ finally { if (e_2) throw e_2.error; }
420
+ }
421
+ return data;
422
+ }
423
+ function toFront(modelType, data, path) {
424
+ var e_3, _a;
425
+ // Check if recursion is required
426
+ if (Array.isArray(data)) {
427
+ return data.map(function (item) {
428
+ return toFront(modelType, item);
429
+ });
430
+ }
431
+ var instance = new modelType();
432
+ // Mapping fields
433
+ var mappingFields = modelType[MODEL_MAPPING_FIELDS_KEY];
434
+ var relation = modelType[MODEL_RELATION_KEY];
435
+ if (mappingFields) {
436
+ try {
437
+ for (var _b = __values(Object.keys(mappingFields)), _c = _b.next(); !_c.done; _c = _b.next()) {
438
+ var backField = _c.value;
439
+ var frontField = mappingFields[backField];
440
+ var value = extractValue(backField, data);
441
+ if (relation && relation.hasOwnProperty(frontField)) {
442
+ instance[frontField] = relation[frontField].toFront(value);
443
+ }
444
+ else {
445
+ instance[frontField] = value;
446
+ }
447
+ }
448
+ }
449
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
450
+ finally {
451
+ try {
452
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
453
+ }
454
+ finally { if (e_3) throw e_3.error; }
455
+ }
456
+ }
457
+ return instance;
458
+ }
459
+ function toBack(modelType, instance, path) {
460
+ var e_4, _a;
461
+ if (!instance) {
462
+ return instance;
463
+ }
464
+ // Check if recursion is required
465
+ if (Array.isArray(instance)) {
466
+ return instance.map(function (item) {
467
+ return toBack(modelType, item);
468
+ });
469
+ }
470
+ var data = {};
471
+ var mappingFields = modelType[MODEL_MAPPING_FIELDS_KEY];
472
+ var relation = modelType[MODEL_RELATION_KEY];
473
+ if (mappingFields) {
474
+ try {
475
+ for (var _b = __values(Object.keys(mappingFields)), _c = _b.next(); !_c.done; _c = _b.next()) {
476
+ var backField = _c.value;
477
+ var frontField = mappingFields[backField];
478
+ if (relation && relation.hasOwnProperty(frontField) && instance[frontField] !== undefined) {
479
+ data[backField] = relation[frontField].toBack(instance[frontField]);
480
+ }
481
+ else {
482
+ data[backField] = instance[frontField];
483
+ }
484
+ }
485
+ }
486
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
487
+ finally {
488
+ try {
489
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
490
+ }
491
+ finally { if (e_4) throw e_4.error; }
492
+ }
493
+ }
494
+ return data;
495
+ }
496
+
497
+
498
+ (function (FileEngine) {
499
+ FileEngine[FileEngine["django"] = 1] = "django";
500
+ FileEngine[FileEngine["s3"] = 2] = "s3";
501
+ })(exports.FileEngine || (exports.FileEngine = {}));
502
+ var File = /** @class */ (function () {
503
+ function File() {
504
+ }
505
+ File.toFront = function (data) {
506
+ return null;
507
+ };
508
+ File.toBack = function (file) {
509
+ return null;
510
+ };
511
+ __decorate([
512
+ ToFrontHook
513
+ ], File, "toFront", null);
514
+ __decorate([
515
+ ToBackHook
516
+ ], File, "toBack", null);
517
+ File = __decorate([
518
+ ModelInstance({
519
+ mappingFields: {
520
+ id: 'id',
521
+ name: 'name',
522
+ path: 'path',
523
+ mime_type: 'mimeType',
524
+ size: 'size',
525
+ engine: 'engine',
526
+ },
527
+ relation: {
528
+ engine: enumField(exports.FileEngine)
529
+ }
530
+ })
531
+ ], File);
532
+ return File;
533
+ }());
534
+
535
+
536
+ (function (SportTypes) {
537
+ SportTypes[SportTypes["basketball"] = 1] = "basketball";
538
+ SportTypes[SportTypes["volleyball"] = 2] = "volleyball";
539
+ SportTypes[SportTypes["classic_basketball"] = 3] = "classic_basketball";
540
+ SportTypes[SportTypes["streetball"] = 4] = "streetball";
541
+ })(exports.SportTypes || (exports.SportTypes = {}));
542
+ var Sport = /** @class */ (function (_super) {
543
+ __extends(Sport, _super);
544
+ function Sport() {
545
+ return _super !== null && _super.apply(this, arguments) || this;
546
+ }
547
+ Sport.prototype.isBasketball = function () {
548
+ return this.id === exports.SportTypes.basketball || this.parentId === exports.SportTypes.basketball;
549
+ };
550
+ Sport.prototype.isClassicBasketball = function () {
551
+ return this.id === exports.SportTypes.classic_basketball;
552
+ };
553
+ Sport.prototype.isVolleyball = function () {
554
+ return this.id === exports.SportTypes.volleyball || this.parentId === exports.SportTypes.volleyball;
555
+ };
556
+ Sport.prototype.isStreetball = function () {
557
+ return this.id === exports.SportTypes.streetball;
558
+ };
559
+ Sport.toFront = function (data) {
560
+ return null;
561
+ };
562
+ Sport.toBack = function (sport) {
563
+ return null;
564
+ };
565
+ __decorate([
566
+ ToFrontHook
567
+ ], Sport, "toFront", null);
568
+ __decorate([
569
+ ToBackHook
570
+ ], Sport, "toBack", null);
571
+ Sport = __decorate([
572
+ ModelInstance({
573
+ mappingFields: {
574
+ id: 'id',
575
+ name: 'name',
576
+ parent_id: 'parentId',
577
+ sub_sports: 'subSports'
578
+ }
579
+ })
580
+ ], Sport);
581
+ return Sport;
582
+ }(BaseModel));
583
+
584
+ var UserProfile = /** @class */ (function () {
585
+ function UserProfile() {
586
+ }
587
+ UserProfile.toFront = function (value) { };
588
+ UserProfile.toBack = function (value) { };
589
+ __decorate([
590
+ ToFrontHook
591
+ ], UserProfile, "toFront", null);
592
+ __decorate([
593
+ ToBackHook
594
+ ], UserProfile, "toBack", null);
595
+ UserProfile = __decorate([
596
+ ModelInstance({
597
+ mappingFields: {
598
+ id: 'id',
599
+ user_id: 'userId',
600
+ height: 'height',
601
+ weight: 'weight'
602
+ }
603
+ })
604
+ ], UserProfile);
605
+ return UserProfile;
606
+ }());
607
+
608
+ var City = /** @class */ (function (_super) {
609
+ __extends(City, _super);
610
+ function City() {
611
+ return _super !== null && _super.apply(this, arguments) || this;
612
+ }
613
+ City.toFront = function (value) { };
614
+ City.toBack = function (value) { };
615
+ __decorate([
616
+ ToFrontHook
617
+ ], City, "toFront", null);
618
+ __decorate([
619
+ ToBackHook
620
+ ], City, "toBack", null);
621
+ City = __decorate([
622
+ ModelInstance({
623
+ mappingFields: {
624
+ id: 'id',
625
+ name: 'name'
626
+ }
627
+ })
628
+ ], City);
629
+ return City;
630
+ }(BaseModel));
631
+
632
+
633
+ (function (GameBasketballPosition) {
634
+ GameBasketballPosition[GameBasketballPosition["point_guard"] = 1] = "point_guard";
635
+ GameBasketballPosition[GameBasketballPosition["shooting_guard"] = 2] = "shooting_guard";
636
+ GameBasketballPosition[GameBasketballPosition["small_forward"] = 3] = "small_forward";
637
+ GameBasketballPosition[GameBasketballPosition["power_forward"] = 4] = "power_forward";
638
+ GameBasketballPosition[GameBasketballPosition["center"] = 5] = "center";
639
+ })(exports.GameBasketballPosition || (exports.GameBasketballPosition = {}));
640
+
641
+ (function (WorkHand) {
642
+ WorkHand[WorkHand["left"] = 1] = "left";
643
+ WorkHand[WorkHand["right"] = 2] = "right";
644
+ })(exports.WorkHand || (exports.WorkHand = {}));
645
+ var BasketballProfile = /** @class */ (function (_super) {
646
+ __extends(BasketballProfile, _super);
647
+ function BasketballProfile() {
648
+ return _super !== null && _super.apply(this, arguments) || this;
649
+ }
650
+ BasketballProfile.toFront = function (value) {
651
+ };
652
+ BasketballProfile.toBack = function (value) {
653
+ };
654
+ __decorate([
655
+ ToFrontHook
656
+ ], BasketballProfile, "toFront", null);
657
+ __decorate([
658
+ ToBackHook
659
+ ], BasketballProfile, "toBack", null);
660
+ BasketballProfile = __decorate([
661
+ ModelInstance({
662
+ mappingFields: {
663
+ id: 'id',
664
+ user_id: 'userId',
665
+ position: 'position',
666
+ work_hand: 'workHand'
667
+ },
668
+ relation: {
669
+ position: enumField(exports.GameBasketballPosition),
670
+ workHand: enumField(exports.WorkHand)
671
+ }
672
+ })
673
+ ], BasketballProfile);
674
+ return BasketballProfile;
675
+ }(BaseModel));
676
+
677
+
678
+ (function (GameVolleyballPosition) {
679
+ GameVolleyballPosition[GameVolleyballPosition["setter"] = 1] = "setter";
680
+ GameVolleyballPosition[GameVolleyballPosition["libero"] = 2] = "libero";
681
+ GameVolleyballPosition[GameVolleyballPosition["middle_player"] = 3] = "middle_player";
682
+ GameVolleyballPosition[GameVolleyballPosition["receiver_attacker"] = 4] = "receiver_attacker";
683
+ GameVolleyballPosition[GameVolleyballPosition["dioganal"] = 5] = "dioganal";
684
+ })(exports.GameVolleyballPosition || (exports.GameVolleyballPosition = {}));
685
+
686
+ (function (VolleyballWorkHand) {
687
+ VolleyballWorkHand[VolleyballWorkHand["left"] = 1] = "left";
688
+ VolleyballWorkHand[VolleyballWorkHand["right"] = 2] = "right";
689
+ })(exports.VolleyballWorkHand || (exports.VolleyballWorkHand = {}));
690
+ var VolleyballProfile = /** @class */ (function (_super) {
691
+ __extends(VolleyballProfile, _super);
692
+ function VolleyballProfile() {
693
+ return _super !== null && _super.apply(this, arguments) || this;
694
+ }
695
+ VolleyballProfile.toFront = function (value) {
696
+ };
697
+ VolleyballProfile.toBack = function (value) {
698
+ };
699
+ __decorate([
700
+ ToFrontHook
701
+ ], VolleyballProfile, "toFront", null);
702
+ __decorate([
703
+ ToBackHook
704
+ ], VolleyballProfile, "toBack", null);
705
+ VolleyballProfile = __decorate([
706
+ ModelInstance({
707
+ mappingFields: {
708
+ id: 'id',
709
+ user_id: 'userId',
710
+ position: 'position',
711
+ work_hand: 'workHand'
712
+ },
713
+ relation: {
714
+ position: enumField(exports.GameVolleyballPosition),
715
+ workHand: enumField(exports.VolleyballWorkHand)
716
+ }
717
+ })
718
+ ], VolleyballProfile);
719
+ return VolleyballProfile;
720
+ }(BaseModel));
721
+
722
+
723
+ (function (UserGender) {
724
+ UserGender[UserGender["male"] = 1] = "male";
725
+ UserGender[UserGender["female"] = 2] = "female";
726
+ })(exports.UserGender || (exports.UserGender = {}));
727
+ var User = /** @class */ (function (_super) {
728
+ __extends(User, _super);
729
+ function User() {
730
+ return _super !== null && _super.apply(this, arguments) || this;
731
+ }
732
+ User.toFront = function (data) {
733
+ return null;
734
+ };
735
+ User.toBack = function (user) {
736
+ return null;
737
+ };
738
+ Object.defineProperty(User.prototype, "fullName", {
739
+ get: function () {
740
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).join(' ');
741
+ },
742
+ enumerable: true,
743
+ configurable: true
744
+ });
745
+ Object.defineProperty(User.prototype, "shortName", {
746
+ get: function () {
747
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).join(' ');
748
+ },
749
+ enumerable: true,
750
+ configurable: true
751
+ });
752
+ Object.defineProperty(User.prototype, "initials", {
753
+ get: function () {
754
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).map(function (s) { return s.substr(0, 1); }).join('');
755
+ },
756
+ enumerable: true,
757
+ configurable: true
758
+ });
759
+ Object.defineProperty(User.prototype, "age", {
760
+ get: function () {
761
+ if (!this.birthDate) {
762
+ return null;
763
+ }
764
+ var diff = (new Date()).getTime() - this.birthDate.getTime();
765
+ return Math.floor(diff / (365 * 86400 * 1000));
766
+ },
767
+ enumerable: true,
768
+ configurable: true
769
+ });
770
+ __decorate([
771
+ ToFrontHook
772
+ ], User, "toFront", null);
773
+ __decorate([
774
+ ToBackHook
775
+ ], User, "toBack", null);
776
+ User = __decorate([
777
+ ModelInstance({
778
+ mappingFields: {
779
+ id: 'id',
780
+ last_name: 'lastName',
781
+ first_name: 'firstName',
782
+ middle_name: 'middleName',
783
+ email: 'email',
784
+ phone: 'phone',
785
+ birth_date: 'birthDate',
786
+ photo: 'photo',
787
+ profile: 'profile',
788
+ basketball_profile: 'basketballProfile',
789
+ volleyball_profile: 'volleyballProfile',
790
+ wizards: 'wizards',
791
+ city: 'city',
792
+ gender: 'gender',
793
+ is_active: 'isActive',
794
+ },
795
+ relation: {
796
+ birthDate: DateField,
797
+ photo: File,
798
+ profile: UserProfile,
799
+ basketballProfile: BasketballProfile,
800
+ volleyballProfile: VolleyballProfile,
801
+ city: City,
802
+ gender: enumField(exports.UserGender)
803
+ }
804
+ })
805
+ ], User);
806
+ return User;
807
+ }(BaseModel));
808
+
809
+ var Team = /** @class */ (function (_super) {
810
+ __extends(Team, _super);
811
+ function Team() {
812
+ return _super !== null && _super.apply(this, arguments) || this;
813
+ }
814
+ Team.prototype.getEmptyLogoClass = function () {
815
+ var classList = ['empty-logo'];
816
+ if (this.sport.isBasketball()) {
817
+ classList.push('empty-logo-basketball');
818
+ }
819
+ if (this.sport.isVolleyball()) {
820
+ classList.push('empty-logo-volleyball');
821
+ }
822
+ return classList.join(' ');
823
+ };
824
+ Team.toFront = function (data) {
825
+ return null;
826
+ };
827
+ Team.toBack = function (team) {
828
+ return null;
829
+ };
830
+ __decorate([
831
+ ToFrontHook
832
+ ], Team, "toFront", null);
833
+ __decorate([
834
+ ToBackHook
835
+ ], Team, "toBack", null);
836
+ Team = __decorate([
837
+ ModelInstance({
838
+ mappingFields: {
839
+ id: 'id',
840
+ name: 'name',
841
+ sport: 'sport',
842
+ logo: 'logo',
843
+ owner: 'owner',
844
+ city: 'city',
845
+ users_count: 'usersCount',
846
+ won_games_count: 'wonGamesCount',
847
+ games_count: 'gamesCount',
848
+ score_sum: 'scoreSum',
849
+ closest_game_datetime: 'closestGameDatetime',
850
+ },
851
+ relation: {
852
+ sport: Sport,
853
+ logo: File,
854
+ owner: User,
855
+ city: City,
856
+ closestGameDatetime: DateField,
857
+ }
858
+ })
859
+ ], Team);
860
+ return Team;
861
+ }(BaseModel));
862
+
863
+ var Organization = /** @class */ (function (_super) {
864
+ __extends(Organization, _super);
865
+ function Organization() {
866
+ return _super !== null && _super.apply(this, arguments) || this;
867
+ }
868
+ Organization.toFront = function (data) { };
869
+ Organization.toBack = function (data) { };
870
+ __decorate([
871
+ ToFrontHook
872
+ ], Organization, "toFront", null);
873
+ __decorate([
874
+ ToBackHook
875
+ ], Organization, "toBack", null);
876
+ Organization = __decorate([
877
+ ModelInstance({
878
+ mappingFields: {
879
+ id: 'id',
880
+ owner_id: 'ownerId',
881
+ owner: 'owner',
882
+ },
883
+ relation: {
884
+ owner: User,
885
+ }
886
+ })
887
+ ], Organization);
888
+ return Organization;
889
+ }(BaseModel));
890
+
891
+ var League = /** @class */ (function (_super) {
892
+ __extends(League, _super);
893
+ function League() {
894
+ return _super !== null && _super.apply(this, arguments) || this;
895
+ }
896
+ League.toFront = function (data) { };
897
+ League.toBack = function (data) { };
898
+ Object.defineProperty(League.prototype, "vkLink", {
899
+ get: function () {
900
+ return this.socialLinks.find(function (link) { return link.substr(0, 15) === 'https://vk.com/'; });
901
+ },
902
+ enumerable: true,
903
+ configurable: true
904
+ });
905
+ Object.defineProperty(League.prototype, "fbLink", {
906
+ get: function () {
907
+ return this.socialLinks.find(function (link) { return link.substr(0, 25) === 'https://www.facebook.com/'; });
908
+ },
909
+ enumerable: true,
910
+ configurable: true
911
+ });
912
+ Object.defineProperty(League.prototype, "instaLink", {
913
+ get: function () {
914
+ return this.socialLinks.find(function (link) { return link.substr(0, 25) === 'https://www.instagram.com'; });
915
+ },
916
+ enumerable: true,
917
+ configurable: true
918
+ });
919
+ __decorate([
920
+ ToFrontHook
921
+ ], League, "toFront", null);
922
+ __decorate([
923
+ ToBackHook
924
+ ], League, "toBack", null);
925
+ League = __decorate([
926
+ ModelInstance({
927
+ mappingFields: {
928
+ id: 'id',
929
+ logo: 'logo',
930
+ contact_email: 'contactEmail',
931
+ contact_phone: 'contactPhone',
932
+ name: 'name',
933
+ alias: 'alias',
934
+ sport: 'sport',
935
+ description: 'description',
936
+ social_links: 'socialLinks',
937
+ links: 'links',
938
+ organization: 'organization',
939
+ tournaments_count: 'tournamentsCount',
940
+ closest_game_datetime: 'closestGameDatetime',
941
+ cover: 'cover',
942
+ },
943
+ relation: {
944
+ organization: Organization,
945
+ logo: File,
946
+ cover: File,
947
+ sport: Sport
948
+ }
949
+ })
950
+ ], League);
951
+ return League;
952
+ }(BaseModel));
953
+
954
+
955
+ (function (TournamentTypes) {
956
+ TournamentTypes["group"] = "group";
957
+ TournamentTypes["elimination"] = "elimination";
958
+ TournamentTypes["fiba"] = "fiba";
959
+ })(exports.TournamentTypes || (exports.TournamentTypes = {}));
960
+
961
+ (function (TournamentStatuses) {
962
+ TournamentStatuses[TournamentStatuses["open"] = 0] = "open";
963
+ TournamentStatuses[TournamentStatuses["in_progress"] = 1] = "in_progress";
964
+ TournamentStatuses[TournamentStatuses["closed"] = 2] = "closed";
965
+ })(exports.TournamentStatuses || (exports.TournamentStatuses = {}));
966
+
967
+ (function (TournamentGender) {
968
+ TournamentGender[TournamentGender["male"] = 1] = "male";
969
+ TournamentGender[TournamentGender["female"] = 2] = "female";
970
+ TournamentGender[TournamentGender["all"] = 3] = "all";
971
+ })(exports.TournamentGender || (exports.TournamentGender = {}));
972
+
973
+ (function (BasketballStatisticTypes) {
974
+ BasketballStatisticTypes[BasketballStatisticTypes["standard"] = 1] = "standard";
975
+ BasketballStatisticTypes[BasketballStatisticTypes["light"] = 2] = "light";
976
+ BasketballStatisticTypes[BasketballStatisticTypes["extended"] = 3] = "extended";
977
+ })(exports.BasketballStatisticTypes || (exports.BasketballStatisticTypes = {}));
978
+ var TournamentSettings = /** @class */ (function (_super) {
979
+ __extends(TournamentSettings, _super);
980
+ function TournamentSettings() {
981
+ return _super !== null && _super.apply(this, arguments) || this;
982
+ }
983
+ TournamentSettings.toFront = function (data) { };
984
+ TournamentSettings.toBack = function (data) { };
985
+ __decorate([
986
+ ToFrontHook
987
+ ], TournamentSettings, "toFront", null);
988
+ __decorate([
989
+ ToBackHook
990
+ ], TournamentSettings, "toBack", null);
991
+ TournamentSettings = __decorate([
992
+ ModelInstance({
993
+ mappingFields: {
994
+ id: 'id',
995
+ gender: 'gender',
996
+ age_from: 'ageFrom',
997
+ age_to: 'ageTo',
998
+ max_team_players: 'maxTeamPlayers',
999
+ max_game_players: 'maxGamePlayers',
1000
+ type: 'type',
1001
+ tours_count: 'toursCount',
1002
+ periods_count: 'periodsCount',
1003
+ period_time: 'periodTime',
1004
+ overtime_type: 'overtimeType',
1005
+ overtime_time: 'overtimeTime',
1006
+ overtime_score: 'overtimeScore',
1007
+ game_type: 'gameType',
1008
+ timeout_count: 'timeoutCount',
1009
+ timeout_time: 'timeoutTime',
1010
+ substitute_count: 'substituteCount',
1011
+ game_up_to_score: 'gameUpToScore',
1012
+ volleyball_score_in_set: 'volleyballScoreInSet',
1013
+ volleyball_score_in_last_set: 'volleyballScoreInLastSet',
1014
+ manage_team_application: 'manageTeamApplication',
1015
+ recruitment_is_open: 'recruitmentIsOpen',
1016
+ transfer_is_open: 'transferIsOpen',
1017
+ basketball_statistic_type: 'basketballStatisticType',
1018
+ },
1019
+ relation: {
1020
+ type: enumField(exports.TournamentTypes),
1021
+ gender: enumField(exports.TournamentGender),
1022
+ basketballStatisticType: enumField(exports.BasketballStatisticTypes),
1023
+ }
1024
+ })
1025
+ ], TournamentSettings);
1026
+ return TournamentSettings;
1027
+ }(BaseModel));
1028
+ var TournamentTeamWinner = /** @class */ (function (_super) {
1029
+ __extends(TournamentTeamWinner, _super);
1030
+ function TournamentTeamWinner() {
1031
+ return _super !== null && _super.apply(this, arguments) || this;
1032
+ }
1033
+ TournamentTeamWinner.toFront = function (data) { };
1034
+ TournamentTeamWinner.toBack = function (data) { };
1035
+ __decorate([
1036
+ ToFrontHook
1037
+ ], TournamentTeamWinner, "toFront", null);
1038
+ __decorate([
1039
+ ToBackHook
1040
+ ], TournamentTeamWinner, "toBack", null);
1041
+ TournamentTeamWinner = __decorate([
1042
+ ModelInstance({
1043
+ mappingFields: {
1044
+ id: 'id',
1045
+ team_id: 'teamId',
1046
+ tournament_id: 'tournamentId',
1047
+ team: 'team',
1048
+ points: 'points',
1049
+ },
1050
+ relation: {
1051
+ team: Team,
1052
+ }
1053
+ })
1054
+ ], TournamentTeamWinner);
1055
+ return TournamentTeamWinner;
1056
+ }(BaseModel));
1057
+ var Tournament = /** @class */ (function (_super) {
1058
+ __extends(Tournament, _super);
1059
+ function Tournament() {
1060
+ return _super !== null && _super.apply(this, arguments) || this;
1061
+ }
1062
+ Tournament.prototype.getEmptyLogoClass = function () {
1063
+ var classList = ['empty-logo'];
1064
+ if (this.sport.isBasketball()) {
1065
+ classList.push('empty-logo-basketball');
1066
+ }
1067
+ if (this.sport.isVolleyball()) {
1068
+ classList.push('empty-logo-volleyball');
1069
+ }
1070
+ return classList.join(' ');
1071
+ };
1072
+ Tournament.toFront = function (data) { };
1073
+ Tournament.toBack = function (data) { };
1074
+ __decorate([
1075
+ ToFrontHook
1076
+ ], Tournament, "toFront", null);
1077
+ __decorate([
1078
+ ToBackHook
1079
+ ], Tournament, "toBack", null);
1080
+ Tournament = __decorate([
1081
+ ModelInstance({
1082
+ mappingFields: {
1083
+ id: 'id',
1084
+ name: 'name',
1085
+ alias: 'alias',
1086
+ logo: 'logo',
1087
+ cover: 'cover',
1088
+ preview_image: 'previewImage',
1089
+ city: 'city',
1090
+ sport: 'sport',
1091
+ location: 'location',
1092
+ description: 'description',
1093
+ date: 'date',
1094
+ price: 'price',
1095
+ regulation_files: 'regulationFiles',
1096
+ settings: 'settings',
1097
+ league: 'league',
1098
+ teams_count: 'teamsCount',
1099
+ closest_game_datetime: 'closestGameDatetime',
1100
+ status: 'status',
1101
+ team_winner: 'teamWinner'
1102
+ },
1103
+ relation: {
1104
+ logo: File,
1105
+ cover: File,
1106
+ city: City,
1107
+ sport: Sport,
1108
+ regulationFile: File,
1109
+ settings: TournamentSettings,
1110
+ date: DateTimeField,
1111
+ league: League,
1112
+ status: enumField(exports.TournamentStatuses),
1113
+ teamWinner: TournamentTeamWinner
1114
+ }
1115
+ })
1116
+ ], Tournament);
1117
+ return Tournament;
1118
+ }(BaseModel));
1119
+
1120
+
1121
+ (function (OvertimeTypes) {
1122
+ OvertimeTypes[OvertimeTypes["to_score_total"] = 0] = "to_score_total";
1123
+ OvertimeTypes[OvertimeTypes["to_score_diff"] = 1] = "to_score_diff";
1124
+ OvertimeTypes[OvertimeTypes["time"] = 2] = "time";
1125
+ })(exports.OvertimeTypes || (exports.OvertimeTypes = {}));
1126
+ var BasketballGameConfig = /** @class */ (function (_super) {
1127
+ __extends(BasketballGameConfig, _super);
1128
+ function BasketballGameConfig() {
1129
+ return _super !== null && _super.apply(this, arguments) || this;
1130
+ }
1131
+ BasketballGameConfig.toFront = function (data) { };
1132
+ BasketballGameConfig.toBack = function (data) { };
1133
+ __decorate([
1134
+ ToFrontHook
1135
+ ], BasketballGameConfig, "toFront", null);
1136
+ __decorate([
1137
+ ToBackHook
1138
+ ], BasketballGameConfig, "toBack", null);
1139
+ BasketballGameConfig = __decorate([
1140
+ ModelInstance({
1141
+ mappingFields: {
1142
+ periods_count: 'periodsCount',
1143
+ period_time: 'periodTime',
1144
+ game_up_to_score: 'gameUpToScore',
1145
+ overtime_type: 'overtimeType',
1146
+ overtime_time: 'overtimeTime',
1147
+ overtime_score: 'overtimeScore',
1148
+ max_game_players: 'maxGamePlayers',
1149
+ timeout_count: 'timeoutCount',
1150
+ overtime_timeout_count: 'overtimeTimeoutCount',
1151
+ timeout_time: 'timeoutTime',
1152
+ statistic_type: 'statisticType',
1153
+ },
1154
+ relation: {
1155
+ overtimeType: enumField(exports.OvertimeTypes),
1156
+ statisticType: enumField(exports.BasketballStatisticTypes)
1157
+ }
1158
+ })
1159
+ ], BasketballGameConfig);
1160
+ return BasketballGameConfig;
1161
+ }(BaseModel));
1162
+
1163
+
1164
+ (function (VolleyballGameTypes) {
1165
+ VolleyballGameTypes[VolleyballGameTypes["best_of_five"] = 1] = "best_of_five";
1166
+ VolleyballGameTypes[VolleyballGameTypes["best_of_three"] = 2] = "best_of_three";
1167
+ })(exports.VolleyballGameTypes || (exports.VolleyballGameTypes = {}));
1168
+ var VolleyballGameConfig = /** @class */ (function (_super) {
1169
+ __extends(VolleyballGameConfig, _super);
1170
+ function VolleyballGameConfig() {
1171
+ return _super !== null && _super.apply(this, arguments) || this;
1172
+ }
1173
+ Object.defineProperty(VolleyballGameConfig.prototype, "setsCount", {
1174
+ get: function () {
1175
+ return this.gameType === exports.VolleyballGameTypes.best_of_three ? 3 : 5;
1176
+ },
1177
+ enumerable: true,
1178
+ configurable: true
1179
+ });
1180
+ VolleyballGameConfig.prototype.getSetMaxScore = function (set) {
1181
+ return set === this.setsCount ? this.scoreInLastSet : this.scoreInSet;
1182
+ };
1183
+ VolleyballGameConfig.toFront = function (data) { };
1184
+ VolleyballGameConfig.toBack = function (data) { };
1185
+ __decorate([
1186
+ ToFrontHook
1187
+ ], VolleyballGameConfig, "toFront", null);
1188
+ __decorate([
1189
+ ToBackHook
1190
+ ], VolleyballGameConfig, "toBack", null);
1191
+ VolleyballGameConfig = __decorate([
1192
+ ModelInstance({
1193
+ mappingFields: {
1194
+ game_type: 'gameType',
1195
+ timeout_count: 'timeoutCount',
1196
+ timeout_time: 'timeoutTime',
1197
+ substitute_count: 'substituteCount',
1198
+ score_in_set: 'scoreInSet',
1199
+ score_in_last_set: 'scoreInLastSet'
1200
+ },
1201
+ relation: {
1202
+ gameType: enumField(exports.VolleyballGameTypes)
1203
+ }
1204
+ })
1205
+ ], VolleyballGameConfig);
1206
+ return VolleyballGameConfig;
1207
+ }(BaseModel));
1208
+
1209
+ var LeagueCourt = /** @class */ (function (_super) {
1210
+ __extends(LeagueCourt, _super);
1211
+ function LeagueCourt() {
1212
+ return _super !== null && _super.apply(this, arguments) || this;
1213
+ }
1214
+ LeagueCourt.toFront = function (data) { };
1215
+ LeagueCourt.toBack = function (data) { };
1216
+ __decorate([
1217
+ ToFrontHook
1218
+ ], LeagueCourt, "toFront", null);
1219
+ __decorate([
1220
+ ToBackHook
1221
+ ], LeagueCourt, "toBack", null);
1222
+ LeagueCourt = __decorate([
1223
+ ModelInstance({
1224
+ mappingFields: {
1225
+ id: 'id',
1226
+ name: 'name',
1227
+ address: 'address',
1228
+ league_id: 'leagueId'
1229
+ }
1230
+ })
1231
+ ], LeagueCourt);
1232
+ return LeagueCourt;
1233
+ }(BaseModel));
1234
+
1235
+ var MediaItem = /** @class */ (function (_super) {
1236
+ __extends(MediaItem, _super);
1237
+ function MediaItem() {
1238
+ return _super !== null && _super.apply(this, arguments) || this;
1239
+ }
1240
+ Object.defineProperty(MediaItem.prototype, "isVideo", {
1241
+ get: function () {
1242
+ return Boolean(this.videoUrl);
1243
+ },
1244
+ enumerable: true,
1245
+ configurable: true
1246
+ });
1247
+ MediaItem.toFront = function (data) { };
1248
+ MediaItem.toBack = function (data) { };
1249
+ __decorate([
1250
+ ToFrontHook
1251
+ ], MediaItem, "toFront", null);
1252
+ __decorate([
1253
+ ToBackHook
1254
+ ], MediaItem, "toBack", null);
1255
+ MediaItem = __decorate([
1256
+ ModelInstance({
1257
+ mappingFields: {
1258
+ id: 'id',
1259
+ original_photo: 'originalPhoto',
1260
+ list_photo: 'listPhoto',
1261
+ detail_photo: 'detailPhoto',
1262
+ game: 'game',
1263
+ tournament: 'tournament',
1264
+ game_id: 'gameId',
1265
+ tournament_id: 'tournament_id',
1266
+ video_url: 'videoUrl',
1267
+ video_preview: 'videoPreview',
1268
+ },
1269
+ relation: {
1270
+ originalPhoto: File,
1271
+ listPhoto: File,
1272
+ detailPhoto: File,
1273
+ videoPreview: File
1274
+ }
1275
+ })
1276
+ ], MediaItem);
1277
+ return MediaItem;
1278
+ }(BaseModel));
1279
+
1280
+
1281
+ (function (GameStatuses) {
1282
+ GameStatuses[GameStatuses["open"] = 1] = "open";
1283
+ GameStatuses[GameStatuses["in_progress"] = 2] = "in_progress";
1284
+ GameStatuses[GameStatuses["closed"] = 3] = "closed";
1285
+ GameStatuses[GameStatuses["archived"] = 4] = "archived";
1286
+ GameStatuses[GameStatuses["draft"] = 5] = "draft";
1287
+ })(exports.GameStatuses || (exports.GameStatuses = {}));
1288
+
1289
+ (function (GameResultTypes) {
1290
+ GameResultTypes[GameResultTypes["team_won"] = 1] = "team_won";
1291
+ GameResultTypes[GameResultTypes["competitor_team_won"] = 2] = "competitor_team_won";
1292
+ GameResultTypes[GameResultTypes["team_technical_defeat"] = 3] = "team_technical_defeat";
1293
+ GameResultTypes[GameResultTypes["competitor_team_technical_defeat"] = 4] = "competitor_team_technical_defeat";
1294
+ })(exports.GameResultTypes || (exports.GameResultTypes = {}));
1295
+ var Game = /** @class */ (function (_super) {
1296
+ __extends(Game, _super);
1297
+ function Game() {
1298
+ return _super !== null && _super.apply(this, arguments) || this;
1299
+ }
1300
+ Object.defineProperty(Game.prototype, "scoreByPeriodList", {
1301
+ get: function () {
1302
+ var _this = this;
1303
+ if (!this.scoreByPeriod) {
1304
+ return [];
1305
+ }
1306
+ return Object.keys(this.scoreByPeriod).map(function (period) { return ({
1307
+ period: +period,
1308
+ teamScore: _this.scoreByPeriod[period][0],
1309
+ competitorTeamScore: _this.scoreByPeriod[period][1]
1310
+ }); });
1311
+ },
1312
+ enumerable: true,
1313
+ configurable: true
1314
+ });
1315
+ Object.defineProperty(Game.prototype, "isClosed", {
1316
+ get: function () {
1317
+ return this.status === exports.GameStatuses.closed;
1318
+ },
1319
+ enumerable: true,
1320
+ configurable: true
1321
+ });
1322
+ Object.defineProperty(Game.prototype, "isTeamWon", {
1323
+ get: function () {
1324
+ return this.teamScore > this.competitorTeamScore;
1325
+ },
1326
+ enumerable: true,
1327
+ configurable: true
1328
+ });
1329
+ Object.defineProperty(Game.prototype, "isCompetitorTeamWon", {
1330
+ get: function () {
1331
+ return this.competitorTeamScore > this.teamScore;
1332
+ },
1333
+ enumerable: true,
1334
+ configurable: true
1335
+ });
1336
+ Object.defineProperty(Game.prototype, "teamWinnerId", {
1337
+ get: function () {
1338
+ if (this.status !== exports.GameStatuses.closed) {
1339
+ return null;
1340
+ }
1341
+ if (this.teamScore === this.competitorTeamScore) {
1342
+ return null;
1343
+ }
1344
+ if (this.team.id) {
1345
+ return this.teamScore > this.competitorTeamScore ? this.team.id : this.competitorTeam.id;
1346
+ }
1347
+ else {
1348
+ return this.teamScore > this.competitorTeamScore ? this.teamId : this.competitorTeamId;
1349
+ }
1350
+ },
1351
+ enumerable: true,
1352
+ configurable: true
1353
+ });
1354
+ Game.toFront = function (data) { };
1355
+ Game.toBack = function (data) { };
1356
+ __decorate([
1357
+ ToFrontHook
1358
+ ], Game, "toFront", null);
1359
+ __decorate([
1360
+ ToBackHook
1361
+ ], Game, "toBack", null);
1362
+ Game = __decorate([
1363
+ ModelInstance({
1364
+ mappingFields: {
1365
+ id: 'id',
1366
+ status: 'status',
1367
+ team: 'team',
1368
+ team_id: 'teamId',
1369
+ competitor_team: 'competitorTeam',
1370
+ competitor_team_id: 'competitorTeamId',
1371
+ competitor_team_name: 'competitorTeamName',
1372
+ datetime: 'datetime',
1373
+ location: 'location',
1374
+ team_score: 'teamScore',
1375
+ competitor_team_score: 'competitorTeamScore',
1376
+ result_type: 'resultType',
1377
+ playoff_number: 'playoffNumber',
1378
+ tournament_id: 'tournamentId',
1379
+ tournament_tour: 'tournamentTour',
1380
+ basketball_game_config: 'basketballGameConfig',
1381
+ volleyball_game_config: 'volleyballGameConfig',
1382
+ score_by_period: 'scoreByPeriod',
1383
+ playoff_stage: 'playoffStage',
1384
+ tournament_stage_id: 'tournamentStageId',
1385
+ tournament_playoff_id: 'tournamentPlayoffId',
1386
+ tournament_court: 'tournamentCourt',
1387
+ media_count: 'mediaCount',
1388
+ media: 'media',
1389
+ },
1390
+ relation: {
1391
+ status: enumField(exports.GameStatuses),
1392
+ team: Team,
1393
+ competitorTeam: Team,
1394
+ datetime: DateTimeField,
1395
+ resultType: enumField(exports.GameResultTypes),
1396
+ basketballGameConfig: BasketballGameConfig,
1397
+ volleyballGameConfig: VolleyballGameConfig,
1398
+ tournamentCourt: LeagueCourt,
1399
+ media: listField(MediaItem),
1400
+ }
1401
+ })
1402
+ ], Game);
1403
+ return Game;
1404
+ }(BaseModel));
1405
+
1406
+
1407
+ (function (TeamUserRole) {
1408
+ TeamUserRole[TeamUserRole["member"] = 1] = "member";
1409
+ TeamUserRole[TeamUserRole["moderator"] = 2] = "moderator";
1410
+ TeamUserRole[TeamUserRole["admin"] = 3] = "admin";
1411
+ })(exports.TeamUserRole || (exports.TeamUserRole = {}));
1412
+ var TeamUser = /** @class */ (function (_super) {
1413
+ __extends(TeamUser, _super);
1414
+ function TeamUser() {
1415
+ return _super !== null && _super.apply(this, arguments) || this;
1416
+ }
1417
+ TeamUser.toFront = function (data) { };
1418
+ TeamUser.toBack = function (teamPlayer) { };
1419
+ __decorate([
1420
+ ToFrontHook
1421
+ ], TeamUser, "toFront", null);
1422
+ __decorate([
1423
+ ToBackHook
1424
+ ], TeamUser, "toBack", null);
1425
+ TeamUser = __decorate([
1426
+ ModelInstance({
1427
+ mappingFields: {
1428
+ id: 'id',
1429
+ team_id: 'teamId',
1430
+ user: 'user',
1431
+ role: 'role',
1432
+ number: 'number',
1433
+ team: 'team',
1434
+ },
1435
+ relation: {
1436
+ user: User,
1437
+ team: Team,
1438
+ role: enumField(exports.TeamUserRole)
1439
+ }
1440
+ })
1441
+ ], TeamUser);
1442
+ return TeamUser;
1443
+ }(BaseModel));
1444
+
1445
+ var TournamentGroup = /** @class */ (function (_super) {
1446
+ __extends(TournamentGroup, _super);
1447
+ function TournamentGroup() {
1448
+ return _super !== null && _super.apply(this, arguments) || this;
1449
+ }
1450
+ TournamentGroup.toFront = function (data) { };
1451
+ TournamentGroup.toBack = function (data) { };
1452
+ __decorate([
1453
+ ToFrontHook
1454
+ ], TournamentGroup, "toFront", null);
1455
+ __decorate([
1456
+ ToBackHook
1457
+ ], TournamentGroup, "toBack", null);
1458
+ TournamentGroup = __decorate([
1459
+ ModelInstance({
1460
+ mappingFields: {
1461
+ id: 'id',
1462
+ name: 'name',
1463
+ tournament_stage_id: 'tournamentStageId'
1464
+ }
1465
+ })
1466
+ ], TournamentGroup);
1467
+ return TournamentGroup;
1468
+ }(BaseModel));
1469
+
1470
+ var TournamentTeam = /** @class */ (function (_super) {
1471
+ __extends(TournamentTeam, _super);
1472
+ function TournamentTeam() {
1473
+ return _super !== null && _super.apply(this, arguments) || this;
1474
+ }
1475
+ Object.defineProperty(TournamentTeam.prototype, "gamesWonPercent", {
1476
+ get: function () {
1477
+ if (!this.gamesCount) {
1478
+ return 0;
1479
+ }
1480
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
1481
+ },
1482
+ enumerable: true,
1483
+ configurable: true
1484
+ });
1485
+ TournamentTeam.toFront = function (data) { };
1486
+ TournamentTeam.toBack = function (data) { };
1487
+ __decorate([
1488
+ ToFrontHook
1489
+ ], TournamentTeam, "toFront", null);
1490
+ __decorate([
1491
+ ToBackHook
1492
+ ], TournamentTeam, "toBack", null);
1493
+ TournamentTeam = __decorate([
1494
+ ModelInstance({
1495
+ mappingFields: {
1496
+ id: 'id',
1497
+ team_id: 'teamId',
1498
+ tournament_id: 'tournamentId',
1499
+ tournament: 'tournament',
1500
+ team: 'team',
1501
+ group: 'group',
1502
+ games_count: 'gamesCount',
1503
+ won_games_count: 'wonGamesCount',
1504
+ last_games_count: 'lastGamesCount',
1505
+ last_games_won: 'lastGamesWon',
1506
+ score_sum: 'scoreSum',
1507
+ missed_sum: 'missedSum',
1508
+ score_points_sum: 'scorePointsSum',
1509
+ missed_points_sum: 'missedPointsSum',
1510
+ points: 'points',
1511
+ users_count: 'usersCount',
1512
+ games: 'games',
1513
+ notifications_count: 'notificationsCount',
1514
+ },
1515
+ relation: {
1516
+ tournament: Tournament,
1517
+ team: Team,
1518
+ group: TournamentGroup,
1519
+ games: Game,
1520
+ }
1521
+ })
1522
+ ], TournamentTeam);
1523
+ return TournamentTeam;
1524
+ }(BaseModel));
1525
+
1526
+ var TournamentDisqualification = /** @class */ (function (_super) {
1527
+ __extends(TournamentDisqualification, _super);
1528
+ function TournamentDisqualification() {
1529
+ return _super !== null && _super.apply(this, arguments) || this;
1530
+ }
1531
+ TournamentDisqualification.toFront = function (data) { };
1532
+ TournamentDisqualification.toBack = function (data) { };
1533
+ __decorate([
1534
+ ToFrontHook
1535
+ ], TournamentDisqualification, "toFront", null);
1536
+ __decorate([
1537
+ ToBackHook
1538
+ ], TournamentDisqualification, "toBack", null);
1539
+ TournamentDisqualification = __decorate([
1540
+ ModelInstance({
1541
+ mappingFields: {
1542
+ id: 'id',
1543
+ tournament_team_user_id: 'tournamentTeamUserId',
1544
+ date_from: 'dateFrom',
1545
+ date_to: 'dateTo',
1546
+ matches_count: 'matchesCount',
1547
+ },
1548
+ relation: {
1549
+ dateFrom: DateField,
1550
+ dateTo: DateField,
1551
+ }
1552
+ })
1553
+ ], TournamentDisqualification);
1554
+ return TournamentDisqualification;
1555
+ }(BaseModel));
1556
+
1557
+ var TournamentTeamUser = /** @class */ (function (_super) {
1558
+ __extends(TournamentTeamUser, _super);
1559
+ function TournamentTeamUser() {
1560
+ return _super !== null && _super.apply(this, arguments) || this;
1561
+ }
1562
+ Object.defineProperty(TournamentTeamUser.prototype, "fullName", {
1563
+ get: function () {
1564
+ return [this.lastName, this.firstName, this.middleName].filter(function (s) { return s; }).join(' ');
1565
+ },
1566
+ enumerable: true,
1567
+ configurable: true
1568
+ });
1569
+ Object.defineProperty(TournamentTeamUser.prototype, "shortName", {
1570
+ get: function () {
1571
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).join(' ');
1572
+ },
1573
+ enumerable: true,
1574
+ configurable: true
1575
+ });
1576
+ Object.defineProperty(TournamentTeamUser.prototype, "initials", {
1577
+ get: function () {
1578
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).map(function (s) { return s.substr(0, 1); }).join('');
1579
+ },
1580
+ enumerable: true,
1581
+ configurable: true
1582
+ });
1583
+ TournamentTeamUser.toFront = function (data) { };
1584
+ TournamentTeamUser.toBack = function (data) { };
1585
+ __decorate([
1586
+ ToFrontHook
1587
+ ], TournamentTeamUser, "toFront", null);
1588
+ __decorate([
1589
+ ToBackHook
1590
+ ], TournamentTeamUser, "toBack", null);
1591
+ TournamentTeamUser = __decorate([
1592
+ ModelInstance({
1593
+ mappingFields: {
1594
+ id: 'id',
1595
+ tournament_team: 'tournamentTeam',
1596
+ team_user: 'teamUser',
1597
+ disqualified: 'disqualified',
1598
+ first_name: 'firstName',
1599
+ last_name: 'lastName',
1600
+ middle_name: 'middleName',
1601
+ photo: 'photo',
1602
+ disqualification: 'disqualification',
1603
+ has_changes: 'hasChanges',
1604
+ },
1605
+ relation: {
1606
+ tournamentTeam: TournamentTeam,
1607
+ teamUser: TeamUser,
1608
+ photo: File,
1609
+ disqualification: TournamentDisqualification,
1610
+ }
1611
+ })
1612
+ ], TournamentTeamUser);
1613
+ return TournamentTeamUser;
1614
+ }(BaseModel));
1615
+
1616
+ var GameUser = /** @class */ (function (_super) {
1617
+ __extends(GameUser, _super);
1618
+ function GameUser() {
1619
+ return _super !== null && _super.apply(this, arguments) || this;
1620
+ }
1621
+ GameUser.toFront = function (data) { };
1622
+ GameUser.toBack = function (data) { };
1623
+ __decorate([
1624
+ ToFrontHook
1625
+ ], GameUser, "toFront", null);
1626
+ __decorate([
1627
+ ToBackHook
1628
+ ], GameUser, "toBack", null);
1629
+ GameUser = __decorate([
1630
+ ModelInstance({
1631
+ mappingFields: {
1632
+ id: 'id',
1633
+ game_id: 'gameId',
1634
+ team_user: 'teamUser',
1635
+ tournament_team_user: 'tournamentTeamUser',
1636
+ updated_at: 'updatedAt'
1637
+ },
1638
+ relation: {
1639
+ teamUser: TeamUser,
1640
+ tournamentTeamUser: TournamentTeamUser,
1641
+ updatedAt: DateTimeField,
1642
+ }
1643
+ })
1644
+ ], GameUser);
1645
+ return GameUser;
1646
+ }(BaseModel));
1647
+
1648
+ function updateItemInArray(data, item, force, checkFunction) {
1649
+ if (force === void 0) { force = false; }
1650
+ if (!Array.isArray(data)) {
1651
+ return data;
1652
+ }
1653
+ return data.map(function (v) {
1654
+ if (checkFunction && isFunction(checkFunction)) {
1655
+ if (!checkFunction(v)) {
1656
+ return v;
1657
+ }
1658
+ }
1659
+ else if (v.id !== item.id) {
1660
+ return v;
1661
+ }
1662
+ if (v.updatedAt && item.updatedAt && !force) {
1663
+ return v.updatedAt > item.updatedAt ? v : item;
1664
+ }
1665
+ return item;
1666
+ });
1667
+ }
1668
+ function updateItemsInArray(data, items, force, checkFunction) {
1669
+ if (force === void 0) { force = false; }
1670
+ items.forEach(function (item) {
1671
+ data = updateItemInArray(data, item, force, checkFunction);
1672
+ });
1673
+ return data;
1674
+ }
1675
+ function patchItemInArray(data, item, checkFunction) {
1676
+ if (!Array.isArray(data)) {
1677
+ return data;
1678
+ }
1679
+ return data.map(function (v) {
1680
+ if (checkFunction && isFunction(checkFunction)) {
1681
+ if (!checkFunction(v)) {
1682
+ return v;
1683
+ }
1684
+ }
1685
+ else if (v.id !== item.id) {
1686
+ return v;
1687
+ }
1688
+ return Object.assign(v, item);
1689
+ });
1690
+ }
1691
+ function addItemInArray(data, item, atEnd, checkFunction) {
1692
+ if (atEnd === void 0) { atEnd = false; }
1693
+ if (!Array.isArray(data)) {
1694
+ return [item];
1695
+ }
1696
+ if (data.find(function (i) { return isFunction(checkFunction) ? checkFunction(i) : i.id === item.id; })) {
1697
+ return data;
1698
+ }
1699
+ return atEnd
1700
+ ? __spread(data, [item]) : __spread([item], data);
1701
+ }
1702
+ function addItemsInArray(data, items, atEnd, checkFunction) {
1703
+ if (atEnd === void 0) { atEnd = false; }
1704
+ (!atEnd
1705
+ ? Object.assign([], items).reverse()
1706
+ : items).forEach(function (item) {
1707
+ data = addItemInArray(data, item, atEnd, checkFunction);
1708
+ });
1709
+ return data;
1710
+ }
1711
+ function deleteItemFromArray(data, item) {
1712
+ if (!Array.isArray(data)) {
1713
+ return [];
1714
+ }
1715
+ if (isFunction(item)) {
1716
+ return data.filter(function (i) { return !item(i); });
1717
+ }
1718
+ else {
1719
+ return data.filter(function (v) { return v.id !== item.id; });
1720
+ }
1721
+ }
1722
+ function isFunction(functionToCheck) {
1723
+ return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
1724
+ }
1725
+
1726
+ var Store = /** @class */ (function () {
1727
+ function Store(engine) {
1728
+ this.engine = engine;
1729
+ this.data = {};
1730
+ }
1731
+ Store.prototype.get = function (key) {
1732
+ return this.getSubject(key).pipe(operators.filter(function (item) { return item !== undefined; }));
1733
+ };
1734
+ Store.prototype.value = function (key) {
1735
+ return this.getSubject(key).value;
1736
+ };
1737
+ Store.prototype.save = function (key, value) {
1738
+ this.getSubject(key).next(value);
1739
+ if (this.engine) {
1740
+ this.engine.save(key, value);
1741
+ }
1742
+ };
1743
+ Store.prototype.appendItem = function (key, value, checkFunction) {
1744
+ this.save(key, addItemInArray(this.value(key) || [], value, true, checkFunction));
1745
+ };
1746
+ Store.prototype.appendItems = function (key, value, checkFunction) {
1747
+ this.save(key, addItemsInArray(this.value(key) || [], value, true));
1748
+ };
1749
+ Store.prototype.prependItem = function (key, value, checkFunction) {
1750
+ this.save(key, addItemInArray(this.value(key) || [], value, false, checkFunction));
1751
+ };
1752
+ Store.prototype.prependItems = function (key, value, checkFunction) {
1753
+ this.save(key, addItemsInArray(this.value(key) || [], value, false, checkFunction));
1754
+ };
1755
+ Store.prototype.updateItem = function (key, value, force, checkFunction) {
1756
+ this.save(key, updateItemInArray(this.value(key) || [], value, force, checkFunction));
1757
+ };
1758
+ Store.prototype.updateItems = function (key, value, force, checkFunction) {
1759
+ this.save(key, updateItemsInArray(this.value(key) || [], value, force, checkFunction));
1760
+ };
1761
+ Store.prototype.deleteItem = function (key, value) {
1762
+ this.save(key, deleteItemFromArray(this.value(key) || [], value));
1763
+ };
1764
+ Store.prototype.dispose = function () {
1765
+ var e_1, _a;
1766
+ try {
1767
+ for (var _b = __values(Object.keys(this.data)), _c = _b.next(); !_c.done; _c = _b.next()) {
1768
+ var key = _c.value;
1769
+ this.data[key].complete();
1770
+ delete this.data[key];
1771
+ }
1772
+ }
1773
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1774
+ finally {
1775
+ try {
1776
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1777
+ }
1778
+ finally { if (e_1) throw e_1.error; }
1779
+ }
1780
+ };
1781
+ Store.prototype.clearStorageData = function () {
1782
+ if (this.engine) {
1783
+ this.engine.clear();
1784
+ }
1785
+ };
1786
+ Store.prototype.getEngine = function () {
1787
+ return this.engine;
1788
+ };
1789
+ Store.prototype.getSubject = function (key) {
1790
+ if (!this.data[key]) {
1791
+ this.data[key] = new rxjs.BehaviorSubject(this.engine ? this.engine.get(key) : undefined);
1792
+ }
1793
+ return this.data[key];
1794
+ };
1795
+ return Store;
1796
+ }());
1797
+
1798
+ var BaseService = /** @class */ (function () {
1799
+ function BaseService() {
1800
+ this.store = new Store();
1801
+ }
1802
+ BaseService.prototype.dispose = function () {
1803
+ this.store.dispose();
1804
+ };
1805
+ BaseService.ɵprov = core.ɵɵdefineInjectable({ factory: function BaseService_Factory() { return new BaseService(); }, token: BaseService, providedIn: "root" });
1806
+ BaseService = __decorate([
1807
+ core.Injectable({ providedIn: 'root' })
1808
+ ], BaseService);
1809
+ return BaseService;
1810
+ }());
1811
+
1812
+ var CONFIG_STORE_KEY = 'config';
1813
+ var CONFIG_DATA = 'mtg-core-config-data';
1814
+ var ConfigService = /** @class */ (function (_super) {
1815
+ __extends(ConfigService, _super);
1816
+ function ConfigService(configData) {
1817
+ var _this = _super.call(this) || this;
1818
+ _this.configData = configData;
1819
+ if (configData) {
1820
+ _this.initialize(configData);
1821
+ }
1822
+ return _this;
1823
+ }
1824
+ Object.defineProperty(ConfigService.prototype, "config$", {
1825
+ get: function () {
1826
+ return this.store.get(CONFIG_STORE_KEY);
1827
+ },
1828
+ enumerable: true,
1829
+ configurable: true
1830
+ });
1831
+ Object.defineProperty(ConfigService.prototype, "config", {
1832
+ get: function () {
1833
+ return this.store.value(CONFIG_STORE_KEY) || {};
1834
+ },
1835
+ enumerable: true,
1836
+ configurable: true
1837
+ });
1838
+ ConfigService.prototype.initialize = function (data) {
1839
+ this.store.save(CONFIG_STORE_KEY, data);
1840
+ };
1841
+ ConfigService.prototype.set = function (key, value) {
1842
+ var _a;
1843
+ this.store.save(CONFIG_STORE_KEY, __assign(__assign({}, this.config), (_a = {}, _a[key] = value, _a)));
1844
+ };
1845
+ ConfigService.prototype.get = function (key) {
1846
+ return this.store.value(CONFIG_STORE_KEY) && this.store.value(CONFIG_STORE_KEY)[key];
1847
+ };
1848
+ ConfigService.ctorParameters = function () { return [
1849
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [CONFIG_DATA,] }] }
1850
+ ]; };
1851
+ ConfigService.ɵprov = core.ɵɵdefineInjectable({ factory: function ConfigService_Factory() { return new ConfigService(core.ɵɵinject("mtg-core-config-data", 8)); }, token: ConfigService, providedIn: "root" });
1852
+ ConfigService = __decorate([
1853
+ core.Injectable({ providedIn: 'root' }),
1854
+ __param(0, core.Optional()), __param(0, core.Inject(CONFIG_DATA))
1855
+ ], ConfigService);
1856
+ return ConfigService;
1857
+ }(BaseService));
1858
+
1859
+ var BasketballStatistic = /** @class */ (function (_super) {
1860
+ __extends(BasketballStatistic, _super);
1861
+ function BasketballStatistic() {
1862
+ return _super !== null && _super.apply(this, arguments) || this;
1863
+ }
1864
+ Object.defineProperty(BasketballStatistic.prototype, "totalFouls", {
1865
+ get: function () {
1866
+ return this.personalFouls + this.technicalFouls + this.unsportsmanlikeFouls;
1867
+ },
1868
+ enumerable: true,
1869
+ configurable: true
1870
+ });
1871
+ BasketballStatistic.toFront = function (data) { };
1872
+ BasketballStatistic.toBack = function (data) { };
1873
+ __decorate([
1874
+ ToFrontHook
1875
+ ], BasketballStatistic, "toFront", null);
1876
+ __decorate([
1877
+ ToBackHook
1878
+ ], BasketballStatistic, "toBack", null);
1879
+ BasketballStatistic = __decorate([
1880
+ ModelInstance({
1881
+ mappingFields: {
1882
+ tournament_team_user: 'tournamentTeamUser',
1883
+ team: 'team',
1884
+ team_user: 'teamUser',
1885
+ user: 'user',
1886
+ tournament_team: 'tournamentTeam',
1887
+ month: 'month',
1888
+ win_lose: 'winLose',
1889
+ games_count: 'gamesCount',
1890
+ won_games_count: 'wonGamesCount',
1891
+ points: 'points',
1892
+ two_points_made: 'twoPointsMade',
1893
+ three_points_made: 'threePointsMade',
1894
+ free_throws_made: 'freeThrowsMade',
1895
+ one_points_made: 'onePointsMade',
1896
+ two_point_attempts: 'twoPointAttempts',
1897
+ three_point_attempts: 'threePointAttempts',
1898
+ free_throw_attempts: 'freeThrowAttempts',
1899
+ one_point_attempts: 'onePointAttempts',
1900
+ two_point_percent: 'twoPointPercent',
1901
+ three_point_percent: 'threePointPercent',
1902
+ free_throw_percent: 'freeThrowPercent',
1903
+ one_point_percent: 'onePointPercent',
1904
+ assists: 'assists',
1905
+ blocks: 'blocks',
1906
+ rebounds: 'rebounds',
1907
+ offensive_rebounds: 'offensiveRebounds',
1908
+ defensive_rebounds: 'defensiveRebounds',
1909
+ steals: 'steals',
1910
+ turnovers: 'turnovers',
1911
+ personal_fouls: 'personalFouls',
1912
+ technical_fouls: 'technicalFouls',
1913
+ unsportsmanlike_fouls: 'unsportsmanlikeFouls',
1914
+ newbie: 'newbie',
1915
+ },
1916
+ relation: {
1917
+ tournamentTeamUser: TournamentTeamUser,
1918
+ team: Team,
1919
+ teamUser: TeamUser,
1920
+ user: User,
1921
+ tournamentTeam: TournamentTeam,
1922
+ month: DateField
1923
+ }
1924
+ })
1925
+ ], BasketballStatistic);
1926
+ return BasketballStatistic;
1927
+ }(BaseModel));
1928
+
1929
+ var BasketballGameTeamStatistic = /** @class */ (function (_super) {
1930
+ __extends(BasketballGameTeamStatistic, _super);
1931
+ function BasketballGameTeamStatistic() {
1932
+ return _super !== null && _super.apply(this, arguments) || this;
1933
+ }
1934
+ BasketballGameTeamStatistic.toFront = function (data) { };
1935
+ BasketballGameTeamStatistic.toBack = function (data) { };
1936
+ __decorate([
1937
+ ToFrontHook
1938
+ ], BasketballGameTeamStatistic, "toFront", null);
1939
+ __decorate([
1940
+ ToBackHook
1941
+ ], BasketballGameTeamStatistic, "toBack", null);
1942
+ BasketballGameTeamStatistic = __decorate([
1943
+ ModelInstance({
1944
+ mappingFields: {
1945
+ team: 'team',
1946
+ competitor_team: 'competitorTeam'
1947
+ },
1948
+ relation: {
1949
+ team: BasketballStatistic,
1950
+ competitorTeam: BasketballStatistic
1951
+ }
1952
+ })
1953
+ ], BasketballGameTeamStatistic);
1954
+ return BasketballGameTeamStatistic;
1955
+ }(BaseModel));
1956
+
1957
+ var BasketballGameStatistic = /** @class */ (function (_super) {
1958
+ __extends(BasketballGameStatistic, _super);
1959
+ function BasketballGameStatistic() {
1960
+ return _super !== null && _super.apply(this, arguments) || this;
1961
+ }
1962
+ Object.defineProperty(BasketballGameStatistic.prototype, "id", {
1963
+ get: function () {
1964
+ return this.gameUserId;
1965
+ },
1966
+ enumerable: true,
1967
+ configurable: true
1968
+ });
1969
+ BasketballGameStatistic.toFront = function (data) { };
1970
+ BasketballGameStatistic.toBack = function (data) { };
1971
+ Object.defineProperty(BasketballGameStatistic.prototype, "totalFouls", {
1972
+ get: function () {
1973
+ return (this.personalFouls || 0) + (this.technicalFouls || 0) + (this.unsportsmanlikeFouls || 0);
1974
+ },
1975
+ enumerable: true,
1976
+ configurable: true
1977
+ });
1978
+ __decorate([
1979
+ ToFrontHook
1980
+ ], BasketballGameStatistic, "toFront", null);
1981
+ __decorate([
1982
+ ToBackHook
1983
+ ], BasketballGameStatistic, "toBack", null);
1984
+ BasketballGameStatistic = __decorate([
1985
+ ModelInstance({
1986
+ mappingFields: {
1987
+ game_user_id: 'gameUserId',
1988
+ points: 'points',
1989
+ free_throws_made: 'freeThrowsMade',
1990
+ two_points_made: 'twoPointsMade',
1991
+ three_points_made: 'threePointsMade',
1992
+ one_points_made: 'onePointsMade',
1993
+ two_point_attempts: 'twoPointAttempts',
1994
+ three_point_attempts: 'threePointAttempts',
1995
+ free_throw_attempts: 'freeThrowAttempts',
1996
+ one_point_attempts: 'onePointAttempts',
1997
+ assists: 'assists',
1998
+ blocks: 'blocks',
1999
+ rebounds: 'rebounds',
2000
+ offensive_rebounds: 'offensiveRebounds',
2001
+ defensive_rebounds: 'defensiveRebounds',
2002
+ steals: 'steals',
2003
+ turnovers: 'turnovers',
2004
+ personal_fouls: 'personalFouls',
2005
+ technical_fouls: 'technicalFouls',
2006
+ unsportsmanlike_fouls: 'unsportsmanlikeFouls',
2007
+ updated_at: 'updatedAt',
2008
+ },
2009
+ relation: {
2010
+ updatedAt: DateTimeField,
2011
+ }
2012
+ })
2013
+ ], BasketballGameStatistic);
2014
+ return BasketballGameStatistic;
2015
+ }(BaseModel));
2016
+
2017
+
2018
+ (function (BasketballGameLogTypes) {
2019
+ BasketballGameLogTypes[BasketballGameLogTypes["enter_game"] = 1] = "enter_game";
2020
+ BasketballGameLogTypes[BasketballGameLogTypes["exit_game"] = 2] = "exit_game";
2021
+ BasketballGameLogTypes[BasketballGameLogTypes["remove_game"] = 3] = "remove_game";
2022
+ BasketballGameLogTypes[BasketballGameLogTypes["two_point_made"] = 4] = "two_point_made";
2023
+ BasketballGameLogTypes[BasketballGameLogTypes["three_point_made"] = 5] = "three_point_made";
2024
+ BasketballGameLogTypes[BasketballGameLogTypes["free_throw_made"] = 6] = "free_throw_made";
2025
+ BasketballGameLogTypes[BasketballGameLogTypes["two_point_attempt"] = 7] = "two_point_attempt";
2026
+ BasketballGameLogTypes[BasketballGameLogTypes["three_point_attempt"] = 8] = "three_point_attempt";
2027
+ BasketballGameLogTypes[BasketballGameLogTypes["free_throw_attempt"] = 9] = "free_throw_attempt";
2028
+ BasketballGameLogTypes[BasketballGameLogTypes["assist"] = 10] = "assist";
2029
+ BasketballGameLogTypes[BasketballGameLogTypes["block"] = 11] = "block";
2030
+ BasketballGameLogTypes[BasketballGameLogTypes["rebound"] = 12] = "rebound";
2031
+ BasketballGameLogTypes[BasketballGameLogTypes["offensive_rebound"] = 13] = "offensive_rebound";
2032
+ BasketballGameLogTypes[BasketballGameLogTypes["defensive_rebound"] = 14] = "defensive_rebound";
2033
+ BasketballGameLogTypes[BasketballGameLogTypes["steal"] = 15] = "steal";
2034
+ BasketballGameLogTypes[BasketballGameLogTypes["turnover"] = 16] = "turnover";
2035
+ BasketballGameLogTypes[BasketballGameLogTypes["personal_foul"] = 17] = "personal_foul";
2036
+ BasketballGameLogTypes[BasketballGameLogTypes["technical_foul"] = 18] = "technical_foul";
2037
+ BasketballGameLogTypes[BasketballGameLogTypes["unsportsmanlike_foul"] = 19] = "unsportsmanlike_foul";
2038
+ BasketballGameLogTypes[BasketballGameLogTypes["one_point_attempt"] = 20] = "one_point_attempt";
2039
+ BasketballGameLogTypes[BasketballGameLogTypes["one_point_made"] = 21] = "one_point_made";
2040
+ BasketballGameLogTypes[BasketballGameLogTypes["timeout"] = 22] = "timeout";
2041
+ })(exports.BasketballGameLogTypes || (exports.BasketballGameLogTypes = {}));
2042
+ var BasketballGameLog = /** @class */ (function (_super) {
2043
+ __extends(BasketballGameLog, _super);
2044
+ function BasketballGameLog() {
2045
+ var _this = _super !== null && _super.apply(this, arguments) || this;
2046
+ _this.active = true;
2047
+ return _this;
2048
+ }
2049
+ BasketballGameLog.prototype.isPointsType = function () {
2050
+ return [
2051
+ exports.BasketballGameLogTypes.two_point_made,
2052
+ exports.BasketballGameLogTypes.three_point_made,
2053
+ exports.BasketballGameLogTypes.free_throw_made,
2054
+ exports.BasketballGameLogTypes.one_point_made,
2055
+ ].indexOf(this.logType) > -1;
2056
+ };
2057
+ BasketballGameLog.prototype.isReboundType = function () {
2058
+ return [
2059
+ exports.BasketballGameLogTypes.rebound,
2060
+ exports.BasketballGameLogTypes.offensive_rebound,
2061
+ exports.BasketballGameLogTypes.defensive_rebound
2062
+ ].indexOf(this.logType) > -1;
2063
+ };
2064
+ BasketballGameLog.prototype.isFoulType = function () {
2065
+ return [
2066
+ exports.BasketballGameLogTypes.personal_foul,
2067
+ exports.BasketballGameLogTypes.technical_foul,
2068
+ exports.BasketballGameLogTypes.unsportsmanlike_foul
2069
+ ].indexOf(this.logType) > -1;
2070
+ };
2071
+ BasketballGameLog.prototype.getScore = function () {
2072
+ var _a;
2073
+ var scoreMapping = (_a = {},
2074
+ _a[exports.BasketballGameLogTypes.one_point_made] = 1,
2075
+ _a[exports.BasketballGameLogTypes.free_throw_made] = 1,
2076
+ _a[exports.BasketballGameLogTypes.two_point_made] = 2,
2077
+ _a[exports.BasketballGameLogTypes.three_point_made] = 3,
2078
+ _a);
2079
+ return scoreMapping[this.logType];
2080
+ };
2081
+ BasketballGameLog.prototype.compare = function (model) {
2082
+ if (this.time === model.time && this.period === model.period) {
2083
+ return this.datetime.getTime() < model.datetime.getTime() ? 1 : -1;
2084
+ }
2085
+ if (this.period === model.period) {
2086
+ return this.time < model.time ? 1 : -1;
2087
+ }
2088
+ return this.period < model.period ? 1 : -1;
2089
+ };
2090
+ Object.defineProperty(BasketballGameLog.prototype, "timeFormatted", {
2091
+ get: function () {
2092
+ var minutes = Math.floor(this.time / 60);
2093
+ var seconds = this.time - minutes * 60;
2094
+ return "" + (minutes < 10 ? '0' : '') + minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
2095
+ },
2096
+ enumerable: true,
2097
+ configurable: true
2098
+ });
2099
+ BasketballGameLog.toFront = function (value) { };
2100
+ BasketballGameLog.toBack = function (value) { };
2101
+ __decorate([
2102
+ ToFrontHook
2103
+ ], BasketballGameLog, "toFront", null);
2104
+ __decorate([
2105
+ ToBackHook
2106
+ ], BasketballGameLog, "toBack", null);
2107
+ BasketballGameLog = __decorate([
2108
+ ModelInstance({
2109
+ mappingFields: {
2110
+ id: 'id',
2111
+ unique_id: 'uniqueId',
2112
+ game_id: 'gameId',
2113
+ game_user_id: 'gameUserId',
2114
+ team_id: 'teamId',
2115
+ log_type: 'logType',
2116
+ datetime: 'datetime',
2117
+ time: 'time',
2118
+ period: 'period',
2119
+ active: 'active',
2120
+ is_highlight: 'isHighlight',
2121
+ },
2122
+ relation: {
2123
+ datetime: DateTimeField,
2124
+ logType: enumField(exports.BasketballGameLogTypes),
2125
+ }
2126
+ })
2127
+ ], BasketballGameLog);
2128
+ return BasketballGameLog;
2129
+ }(BaseModel));
2130
+
2131
+ var BasketballGameApi = /** @class */ (function () {
2132
+ function BasketballGameApi(httpClient, configService) {
2133
+ this.httpClient = httpClient;
2134
+ this.configService = configService;
2135
+ }
2136
+ BasketballGameApi.prototype.getById = function (gameId) {
2137
+ return __awaiter(this, void 0, void 0, function () {
2138
+ return __generator(this, function (_a) {
2139
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
2140
+ });
2141
+ });
2142
+ };
2143
+ BasketballGameApi.prototype.getUsers = function (gameId) {
2144
+ return __awaiter(this, void 0, void 0, function () {
2145
+ return __generator(this, function (_a) {
2146
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
2147
+ });
2148
+ });
2149
+ };
2150
+ BasketballGameApi.prototype.getTeamStatistic = function (gameId) {
2151
+ return __awaiter(this, void 0, void 0, function () {
2152
+ return __generator(this, function (_a) {
2153
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/team_statistic/").pipe(operators.map(function (result) { return BasketballGameTeamStatistic.toFront(result); })).toPromise()];
2154
+ });
2155
+ });
2156
+ };
2157
+ BasketballGameApi.prototype.getUserStatistic = function (gameId) {
2158
+ return __awaiter(this, void 0, void 0, function () {
2159
+ return __generator(this, function (_a) {
2160
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/user_statistic/").pipe(operators.map(function (result) { return BasketballGameStatistic.toFront(result); })).toPromise()];
2161
+ });
2162
+ });
2163
+ };
2164
+ BasketballGameApi.prototype.getLogs = function (gameId) {
2165
+ return __awaiter(this, void 0, void 0, function () {
2166
+ return __generator(this, function (_a) {
2167
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/logs/").pipe(operators.map(function (result) { return BasketballGameLog.toFront(result); })).toPromise()];
2168
+ });
2169
+ });
2170
+ };
2171
+ BasketballGameApi.ctorParameters = function () { return [
2172
+ { type: http.HttpClient },
2173
+ { type: ConfigService }
2174
+ ]; };
2175
+ BasketballGameApi.ɵprov = core.ɵɵdefineInjectable({ factory: function BasketballGameApi_Factory() { return new BasketballGameApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: BasketballGameApi, providedIn: "root" });
2176
+ BasketballGameApi = __decorate([
2177
+ core.Injectable({ providedIn: 'root' })
2178
+ ], BasketballGameApi);
2179
+ return BasketballGameApi;
2180
+ }());
2181
+
2182
+
2183
+ (function (TournamentEventTypes) {
2184
+ TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
2185
+ TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
2186
+ })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
2187
+ var TournamentEvent = /** @class */ (function (_super) {
2188
+ __extends(TournamentEvent, _super);
2189
+ function TournamentEvent() {
2190
+ return _super !== null && _super.apply(this, arguments) || this;
2191
+ }
2192
+ TournamentEvent.toFront = function (data) { };
2193
+ TournamentEvent.toBack = function (data) { };
2194
+ __decorate([
2195
+ ToFrontHook
2196
+ ], TournamentEvent, "toFront", null);
2197
+ __decorate([
2198
+ ToBackHook
2199
+ ], TournamentEvent, "toBack", null);
2200
+ TournamentEvent = __decorate([
2201
+ ModelInstance({
2202
+ mappingFields: {
2203
+ id: 'id',
2204
+ game: 'game',
2205
+ tournament: 'tournament',
2206
+ event: 'event',
2207
+ datetime: 'datetime'
2208
+ },
2209
+ relation: {
2210
+ game: Game,
2211
+ tournament: Tournament,
2212
+ datetime: DateField,
2213
+ event: enumField(exports.TournamentEventTypes)
2214
+ }
2215
+ })
2216
+ ], TournamentEvent);
2217
+ return TournamentEvent;
2218
+ }(BaseModel));
2219
+
2220
+ var LeagueApi = /** @class */ (function () {
2221
+ function LeagueApi(httpClient, configService) {
2222
+ this.httpClient = httpClient;
2223
+ this.configService = configService;
2224
+ }
2225
+ LeagueApi.prototype.getByAlias = function (alias) {
2226
+ return __awaiter(this, void 0, void 0, function () {
2227
+ return __generator(this, function (_a) {
2228
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + alias + "/").pipe(operators.map(function (result) { return League.toFront(result); })).toPromise()];
2229
+ });
2230
+ });
2231
+ };
2232
+ LeagueApi.prototype.getByDomain = function (domain) {
2233
+ return __awaiter(this, void 0, void 0, function () {
2234
+ return __generator(this, function (_a) {
2235
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/by_domain/" + domain + "/").pipe(operators.map(function (result) { return League.toFront(result); })).toPromise()];
2236
+ });
2237
+ });
2238
+ };
2239
+ LeagueApi.prototype.getTournaments = function (leagueId) {
2240
+ return __awaiter(this, void 0, void 0, function () {
2241
+ return __generator(this, function (_a) {
2242
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
2243
+ });
2244
+ });
2245
+ };
2246
+ LeagueApi.prototype.getEvents = function (leagueId, page, size, filters) {
2247
+ return __awaiter(this, void 0, void 0, function () {
2248
+ var params;
2249
+ return __generator(this, function (_a) {
2250
+ params = new http.HttpParams().set('page', page.toString())
2251
+ .set('size', size.toString());
2252
+ if (filters) {
2253
+ if (filters.event) {
2254
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
2255
+ }
2256
+ if (filters.search) {
2257
+ params = params.set('search', filters.search);
2258
+ }
2259
+ }
2260
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/events/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
2261
+ total: +result.headers.get('X-Page-Count'),
2262
+ data: TournamentEvent.toFront(result.body)
2263
+ }); })).toPromise()];
2264
+ });
2265
+ });
2266
+ };
2267
+ LeagueApi.ctorParameters = function () { return [
2268
+ { type: http.HttpClient },
2269
+ { type: ConfigService }
2270
+ ]; };
2271
+ LeagueApi.ɵprov = core.ɵɵdefineInjectable({ factory: function LeagueApi_Factory() { return new LeagueApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: LeagueApi, providedIn: "root" });
2272
+ LeagueApi = __decorate([
2273
+ core.Injectable({ providedIn: 'root' })
2274
+ ], LeagueApi);
2275
+ return LeagueApi;
2276
+ }());
2277
+
2278
+ var MediaApi = /** @class */ (function () {
2279
+ function MediaApi(httpClient, configService) {
2280
+ this.httpClient = httpClient;
2281
+ this.configService = configService;
2282
+ }
2283
+ MediaApi.prototype.getMedia = function (mediaId) {
2284
+ return __awaiter(this, void 0, void 0, function () {
2285
+ return __generator(this, function (_a) {
2286
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/media/" + mediaId + "/").pipe(operators.map(function (result) { return MediaItem.toFront(result); })).toPromise()];
2287
+ });
2288
+ });
2289
+ };
2290
+ MediaApi.prototype.getTournamentGameMedia = function (tournamentId, page, size, filters) {
2291
+ return __awaiter(this, void 0, void 0, function () {
2292
+ var params;
2293
+ return __generator(this, function (_a) {
2294
+ params = new http.HttpParams().set('page', page.toString()).set('size', size.toString());
2295
+ if (filters) {
2296
+ if (filters.tournamentTour) {
2297
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
2298
+ }
2299
+ if (filters.teamId) {
2300
+ params = params.set('team_id', filters.teamId.toString());
2301
+ }
2302
+ if (filters.tournamentStageId) {
2303
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
2304
+ }
2305
+ if (filters.playoffId) {
2306
+ params = params.set('playoff_id', filters.playoffId.toString());
2307
+ }
2308
+ if (filters.playoffStage) {
2309
+ params = params.set('playoff_stage', filters.playoffStage.toString());
2310
+ }
2311
+ if (filters.status) {
2312
+ params = params.set('status', exports.GameStatuses[filters.status]);
2313
+ }
2314
+ }
2315
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/game_media/", { observe: 'response', params: params }).pipe(operators.map(function (response) {
2316
+ return {
2317
+ total: +response.headers.get('X-Page-Count'),
2318
+ data: Game.toFront(response.body)
2319
+ };
2320
+ })).toPromise()];
2321
+ });
2322
+ });
2323
+ };
2324
+ MediaApi.prototype.getLeagueGameMedia = function (leagueId, page, size, filters) {
2325
+ return __awaiter(this, void 0, void 0, function () {
2326
+ var params;
2327
+ return __generator(this, function (_a) {
2328
+ params = new http.HttpParams().set('page', page.toString()).set('size', size.toString());
2329
+ if (filters) {
2330
+ if (filters.tournamentTour) {
2331
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
2332
+ }
2333
+ if (filters.teamId) {
2334
+ params = params.set('team_id', filters.teamId.toString());
2335
+ }
2336
+ if (filters.tournamentStageId) {
2337
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
2338
+ }
2339
+ if (filters.playoffId) {
2340
+ params = params.set('playoff_id', filters.playoffId.toString());
2341
+ }
2342
+ if (filters.playoffStage) {
2343
+ params = params.set('playoff_stage', filters.playoffStage.toString());
2344
+ }
2345
+ if (filters.status) {
2346
+ params = params.set('status', exports.GameStatuses[filters.status]);
2347
+ }
2348
+ }
2349
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/game_media/", { observe: 'response', params: params }).pipe(operators.map(function (response) {
2350
+ return {
2351
+ total: +response.headers.get('X-Page-Count'),
2352
+ data: Game.toFront(response.body)
2353
+ };
2354
+ })).toPromise()];
2355
+ });
2356
+ });
2357
+ };
2358
+ MediaApi.prototype.getGameMediaById = function (gameId) {
2359
+ return __awaiter(this, void 0, void 0, function () {
2360
+ return __generator(this, function (_a) {
2361
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/game_media/" + gameId + "/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
2362
+ });
2363
+ });
2364
+ };
2365
+ MediaApi.prototype.getGameMedia = function (gameId) {
2366
+ return __awaiter(this, void 0, void 0, function () {
2367
+ return __generator(this, function (_a) {
2368
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/media/").pipe(operators.map(function (result) { return MediaItem.toFront(result); })).toPromise()];
2369
+ });
2370
+ });
2371
+ };
2372
+ MediaApi.prototype.createZip = function (mediaIds) {
2373
+ return __awaiter(this, void 0, void 0, function () {
2374
+ return __generator(this, function (_a) {
2375
+ return [2 /*return*/, this.httpClient
2376
+ .post(this.configService.get('apiUrl') + "/api/v1/media/zip/", mediaIds, { responseType: 'blob' })
2377
+ .toPromise()];
2378
+ });
2379
+ });
2380
+ };
2381
+ MediaApi.ctorParameters = function () { return [
2382
+ { type: http.HttpClient },
2383
+ { type: ConfigService }
2384
+ ]; };
2385
+ MediaApi.ɵprov = core.ɵɵdefineInjectable({ factory: function MediaApi_Factory() { return new MediaApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: MediaApi, providedIn: "root" });
2386
+ MediaApi = __decorate([
2387
+ core.Injectable({ providedIn: 'root' })
2388
+ ], MediaApi);
2389
+ return MediaApi;
2390
+ }());
2391
+
2392
+
2393
+ (function (PollStatuses) {
2394
+ PollStatuses[PollStatuses["open"] = 1] = "open";
2395
+ PollStatuses[PollStatuses["closed"] = 2] = "closed";
2396
+ PollStatuses[PollStatuses["archived"] = 3] = "archived";
2397
+ })(exports.PollStatuses || (exports.PollStatuses = {}));
2398
+ var PollVariant = /** @class */ (function (_super) {
2399
+ __extends(PollVariant, _super);
2400
+ function PollVariant() {
2401
+ return _super !== null && _super.apply(this, arguments) || this;
2402
+ }
2403
+ PollVariant.toFront = function (data) { };
2404
+ PollVariant.toBack = function (data) { };
2405
+ __decorate([
2406
+ ToFrontHook
2407
+ ], PollVariant, "toFront", null);
2408
+ __decorate([
2409
+ ToBackHook
2410
+ ], PollVariant, "toBack", null);
2411
+ PollVariant = __decorate([
2412
+ ModelInstance({
2413
+ mappingFields: {
2414
+ uuid: 'uuid',
2415
+ name: 'name'
2416
+ }
2417
+ })
2418
+ ], PollVariant);
2419
+ return PollVariant;
2420
+ }(BaseModel));
2421
+ var PollAnswer = /** @class */ (function (_super) {
2422
+ __extends(PollAnswer, _super);
2423
+ function PollAnswer() {
2424
+ return _super !== null && _super.apply(this, arguments) || this;
2425
+ }
2426
+ PollAnswer.toFront = function (data) { };
2427
+ PollAnswer.toBack = function (data) { };
2428
+ __decorate([
2429
+ ToFrontHook
2430
+ ], PollAnswer, "toFront", null);
2431
+ __decorate([
2432
+ ToBackHook
2433
+ ], PollAnswer, "toBack", null);
2434
+ PollAnswer = __decorate([
2435
+ ModelInstance({
2436
+ mappingFields: {
2437
+ id: 'id',
2438
+ answer_uuid: 'answerUuid',
2439
+ user: 'user',
2440
+ poll_id: 'pollId',
2441
+ },
2442
+ relation: {
2443
+ user: User
2444
+ }
2445
+ })
2446
+ ], PollAnswer);
2447
+ return PollAnswer;
2448
+ }(BaseModel));
2449
+ var Poll = /** @class */ (function (_super) {
2450
+ __extends(Poll, _super);
2451
+ function Poll() {
2452
+ var _this = _super !== null && _super.apply(this, arguments) || this;
2453
+ _this.variantsWithAnswers = [];
2454
+ return _this;
2455
+ }
2456
+ Object.defineProperty(Poll.prototype, "variants", {
2457
+ get: function () {
2458
+ return this._variants;
2459
+ },
2460
+ set: function (value) {
2461
+ this._variants = value || [];
2462
+ if (this._answers) {
2463
+ this.calculateAnswersPercentage();
2464
+ }
2465
+ },
2466
+ enumerable: true,
2467
+ configurable: true
2468
+ });
2469
+ Object.defineProperty(Poll.prototype, "answers", {
2470
+ get: function () {
2471
+ return this._answers;
2472
+ },
2473
+ set: function (value) {
2474
+ this._answers = value || [];
2475
+ if (this._variants) {
2476
+ this.calculateAnswersPercentage();
2477
+ }
2478
+ },
2479
+ enumerable: true,
2480
+ configurable: true
2481
+ });
2482
+ Poll.prototype.calculateAnswersPercentage = function () {
2483
+ var _this = this;
2484
+ if (!this._answers.length) {
2485
+ return;
2486
+ }
2487
+ var variants = this._variants.map(function (v) { return v.uuid; });
2488
+ var answersByVariant = this._answers.reduce(function (acc, item) {
2489
+ if (variants.indexOf(item.answerUuid) < 0) {
2490
+ return acc;
2491
+ }
2492
+ if (!acc[item.answerUuid]) {
2493
+ acc[item.answerUuid] = 0;
2494
+ }
2495
+ acc[item.answerUuid]++;
2496
+ return acc;
2497
+ }, {});
2498
+ this.variantsWithAnswers = this._variants.map(function (item) { return ({
2499
+ variant: item,
2500
+ percent: answersByVariant[item.uuid] ? Math.round(100 * answersByVariant[item.uuid] / _this._answers.length) : 0
2501
+ }); })
2502
+ .sort(function (a, b) { return a.percent > b.percent ? -1 : 1; });
2503
+ };
2504
+ Poll.toFront = function (data) { };
2505
+ Poll.toBack = function (data) { };
2506
+ __decorate([
2507
+ ToFrontHook
2508
+ ], Poll, "toFront", null);
2509
+ __decorate([
2510
+ ToBackHook
2511
+ ], Poll, "toBack", null);
2512
+ Poll = __decorate([
2513
+ ModelInstance({
2514
+ mappingFields: {
2515
+ id: 'id',
2516
+ active: 'active',
2517
+ status: 'status',
2518
+ team_id: 'teamId',
2519
+ name: 'name',
2520
+ description: 'description',
2521
+ variants: 'variants',
2522
+ author: 'author',
2523
+ answers: 'answers',
2524
+ multiple_answer: 'multipleAnswer',
2525
+ anonymous: 'anonymous',
2526
+ created_at: 'createdAt'
2527
+ },
2528
+ relation: {
2529
+ status: enumField(exports.PollStatuses),
2530
+ variants: PollVariant,
2531
+ author: User,
2532
+ answers: PollAnswer,
2533
+ createdAt: DateTimeField,
2534
+ }
2535
+ })
2536
+ ], Poll);
2537
+ return Poll;
2538
+ }(BaseModel));
2539
+
2540
+ var TeamInvite = /** @class */ (function (_super) {
2541
+ __extends(TeamInvite, _super);
2542
+ function TeamInvite() {
2543
+ return _super !== null && _super.apply(this, arguments) || this;
2544
+ }
2545
+ TeamInvite.toFront = function (data) { };
2546
+ TeamInvite.toBack = function (data) { };
2547
+ __decorate([
2548
+ ToFrontHook
2549
+ ], TeamInvite, "toFront", null);
2550
+ __decorate([
2551
+ ToBackHook
2552
+ ], TeamInvite, "toBack", null);
2553
+ TeamInvite = __decorate([
2554
+ ModelInstance({
2555
+ mappingFields: {
2556
+ id: 'id',
2557
+ user_id: 'userId',
2558
+ user: 'user',
2559
+ team: 'team',
2560
+ team_id: 'teamId',
2561
+ user_accept: 'userAccept',
2562
+ team_accept: 'teamAccept',
2563
+ users_count: 'usersCount',
2564
+ games_count: 'gamesCount',
2565
+ won_games_count: 'wonGamesCount',
2566
+ score_sum: 'scoreSum',
2567
+ created_at: 'createdAt',
2568
+ updated_at: 'updatedAt',
2569
+ },
2570
+ relation: {
2571
+ user: User,
2572
+ team: Team,
2573
+ createdAt: DateTimeField,
2574
+ updateAt: DateTimeField,
2575
+ }
2576
+ })
2577
+ ], TeamInvite);
2578
+ return TeamInvite;
2579
+ }(BaseModel));
2580
+
2581
+
2582
+ (function (GameInviteStatus) {
2583
+ GameInviteStatus[GameInviteStatus["accepted"] = 1] = "accepted";
2584
+ GameInviteStatus[GameInviteStatus["declined"] = 2] = "declined";
2585
+ })(exports.GameInviteStatus || (exports.GameInviteStatus = {}));
2586
+ var GameInvite = /** @class */ (function (_super) {
2587
+ __extends(GameInvite, _super);
2588
+ function GameInvite() {
2589
+ return _super !== null && _super.apply(this, arguments) || this;
2590
+ }
2591
+ GameInvite.toFront = function (data) { };
2592
+ GameInvite.toBack = function (data) { };
2593
+ __decorate([
2594
+ ToFrontHook
2595
+ ], GameInvite, "toFront", null);
2596
+ __decorate([
2597
+ ToBackHook
2598
+ ], GameInvite, "toBack", null);
2599
+ GameInvite = __decorate([
2600
+ ModelInstance({
2601
+ mappingFields: {
2602
+ id: 'id',
2603
+ team_user: 'teamUser',
2604
+ game_id: 'gameId',
2605
+ game: 'game',
2606
+ status: 'status',
2607
+ },
2608
+ relation: {
2609
+ game: Game,
2610
+ teamUser: TeamUser,
2611
+ status: enumField(exports.GameInviteStatus),
2612
+ }
2613
+ })
2614
+ ], GameInvite);
2615
+ return GameInvite;
2616
+ }(BaseModel));
2617
+
2618
+
2619
+ (function (TeamEventTypes) {
2620
+ TeamEventTypes[TeamEventTypes["training"] = 1] = "training";
2621
+ TeamEventTypes[TeamEventTypes["other"] = 2] = "other";
2622
+ })(exports.TeamEventTypes || (exports.TeamEventTypes = {}));
2623
+
2624
+ var _a;
2625
+ var TeamEventTypeLocalization = (_a = {},
2626
+ _a[exports.TeamEventTypes.training] = 'Тренировка',
2627
+ _a[exports.TeamEventTypes.other] = 'Другое',
2628
+ _a);
2629
+
2630
+ var TeamEvent = /** @class */ (function (_super) {
2631
+ __extends(TeamEvent, _super);
2632
+ function TeamEvent() {
2633
+ return _super !== null && _super.apply(this, arguments) || this;
2634
+ }
2635
+ Object.defineProperty(TeamEvent.prototype, "name", {
2636
+ get: function () {
2637
+ if (this.eventType === exports.TeamEventTypes.other) {
2638
+ return this.eventCustomName;
2639
+ }
2640
+ return TeamEventTypeLocalization[this.eventType];
2641
+ },
2642
+ enumerable: true,
2643
+ configurable: true
2644
+ });
2645
+ Object.defineProperty(TeamEvent.prototype, "isClosed", {
2646
+ get: function () {
2647
+ return this.datetime.getTime() < new Date().getTime();
2648
+ },
2649
+ enumerable: true,
2650
+ configurable: true
2651
+ });
2652
+ TeamEvent.toFront = function (data) { };
2653
+ TeamEvent.toBack = function (data) { };
2654
+ __decorate([
2655
+ ToFrontHook
2656
+ ], TeamEvent, "toFront", null);
2657
+ __decorate([
2658
+ ToBackHook
2659
+ ], TeamEvent, "toBack", null);
2660
+ TeamEvent = __decorate([
2661
+ ModelInstance({
2662
+ mappingFields: {
2663
+ id: 'id',
2664
+ team_id: 'teamId',
2665
+ team: 'team',
2666
+ event_type: 'eventType',
2667
+ event_custom_name: 'eventCustomName',
2668
+ description: 'description',
2669
+ datetime: 'datetime',
2670
+ location: 'location',
2671
+ },
2672
+ relation: {
2673
+ eventType: enumField(exports.TeamEventTypes),
2674
+ team: Team,
2675
+ datetime: DateTimeField,
2676
+ }
2677
+ })
2678
+ ], TeamEvent);
2679
+ return TeamEvent;
2680
+ }(BaseModel));
2681
+
2682
+
2683
+ (function (TeamEventInviteStatuses) {
2684
+ TeamEventInviteStatuses[TeamEventInviteStatuses["accepted"] = 1] = "accepted";
2685
+ TeamEventInviteStatuses[TeamEventInviteStatuses["declined"] = 2] = "declined";
2686
+ })(exports.TeamEventInviteStatuses || (exports.TeamEventInviteStatuses = {}));
2687
+ var TeamEventInvite = /** @class */ (function () {
2688
+ function TeamEventInvite() {
2689
+ }
2690
+ TeamEventInvite.toFront = function (data) { };
2691
+ TeamEventInvite.toBack = function (data) { };
2692
+ __decorate([
2693
+ ToFrontHook
2694
+ ], TeamEventInvite, "toFront", null);
2695
+ __decorate([
2696
+ ToBackHook
2697
+ ], TeamEventInvite, "toBack", null);
2698
+ TeamEventInvite = __decorate([
2699
+ ModelInstance({
2700
+ mappingFields: {
2701
+ id: 'id',
2702
+ team_event_id: 'teamEventId',
2703
+ team_user_id: 'teamUserId',
2704
+ status: 'status',
2705
+ },
2706
+ relation: {
2707
+ status: enumField(exports.TeamEventInviteStatuses)
2708
+ }
2709
+ })
2710
+ ], TeamEventInvite);
2711
+ return TeamEventInvite;
2712
+ }());
2713
+
2714
+ var TournamentTeamUserInvite = /** @class */ (function (_super) {
2715
+ __extends(TournamentTeamUserInvite, _super);
2716
+ function TournamentTeamUserInvite() {
2717
+ return _super !== null && _super.apply(this, arguments) || this;
2718
+ }
2719
+ TournamentTeamUserInvite.toFront = function (data) { };
2720
+ TournamentTeamUserInvite.toBack = function (data) { };
2721
+ __decorate([
2722
+ ToFrontHook
2723
+ ], TournamentTeamUserInvite, "toFront", null);
2724
+ __decorate([
2725
+ ToBackHook
2726
+ ], TournamentTeamUserInvite, "toBack", null);
2727
+ TournamentTeamUserInvite = __decorate([
2728
+ ModelInstance({
2729
+ mappingFields: {
2730
+ id: 'id',
2731
+ tournament_team_invite_id: 'tournamentTeamInviteId',
2732
+ tournament_team_id: 'tournamentTeamId',
2733
+ team_user: 'teamUser',
2734
+ accepted: 'accepted'
2735
+ },
2736
+ relation: {
2737
+ teamUser: TeamUser
2738
+ }
2739
+ })
2740
+ ], TournamentTeamUserInvite);
2741
+ return TournamentTeamUserInvite;
2742
+ }(BaseModel));
2743
+
2744
+ var TournamentInvite = /** @class */ (function (_super) {
2745
+ __extends(TournamentInvite, _super);
2746
+ function TournamentInvite() {
2747
+ return _super !== null && _super.apply(this, arguments) || this;
2748
+ }
2749
+ Object.defineProperty(TournamentInvite.prototype, "isOpen", {
2750
+ get: function () {
2751
+ return (this.teamAccept === null || this.organizationAccept === null) && this.teamAccept !== false && this.organizationAccept !== false;
2752
+ },
2753
+ enumerable: true,
2754
+ configurable: true
2755
+ });
2756
+ TournamentInvite.toFront = function (data) { };
2757
+ TournamentInvite.toBack = function (data) { };
2758
+ __decorate([
2759
+ ToFrontHook
2760
+ ], TournamentInvite, "toFront", null);
2761
+ __decorate([
2762
+ ToBackHook
2763
+ ], TournamentInvite, "toBack", null);
2764
+ TournamentInvite = __decorate([
2765
+ ModelInstance({
2766
+ mappingFields: {
2767
+ id: 'id',
2768
+ team: 'team',
2769
+ tournament: 'tournament',
2770
+ team_accept: 'teamAccept',
2771
+ organization_accept: 'organizationAccept',
2772
+ user_invites_count: 'userInvitesCount',
2773
+ user_invites: 'userInvites',
2774
+ notifications_count: 'notificationsCount',
2775
+ },
2776
+ relation: {
2777
+ team: Team,
2778
+ tournament: Tournament,
2779
+ userInvites: TournamentTeamUserInvite,
2780
+ }
2781
+ })
2782
+ ], TournamentInvite);
2783
+ return TournamentInvite;
2784
+ }(BaseModel));
2785
+
2786
+
2787
+ (function (NotificationType) {
2788
+ NotificationType[NotificationType["team_updated"] = 1] = "team_updated";
2789
+ NotificationType[NotificationType["team_invited"] = 2] = "team_invited";
2790
+ NotificationType[NotificationType["team_join_request"] = 3] = "team_join_request";
2791
+ NotificationType[NotificationType["team_join_declined_by_team"] = 4] = "team_join_declined_by_team";
2792
+ NotificationType[NotificationType["team_join_declined_by_user"] = 5] = "team_join_declined_by_user";
2793
+ NotificationType[NotificationType["team_join_canceled_by_team"] = 6] = "team_join_canceled_by_team";
2794
+ NotificationType[NotificationType["team_join_canceled_by_user"] = 7] = "team_join_canceled_by_user";
2795
+ NotificationType[NotificationType["team_joined_for_user"] = 8] = "team_joined_for_user";
2796
+ NotificationType[NotificationType["team_joined_for_team"] = 9] = "team_joined_for_team";
2797
+ NotificationType[NotificationType["team_user_role_changed_for_user"] = 10] = "team_user_role_changed_for_user";
2798
+ NotificationType[NotificationType["team_user_role_changed_for_team"] = 11] = "team_user_role_changed_for_team";
2799
+ NotificationType[NotificationType["team_user_number_changed"] = 12] = "team_user_number_changed";
2800
+ NotificationType[NotificationType["team_user_deleted_for_user"] = 13] = "team_user_deleted_for_user";
2801
+ NotificationType[NotificationType["team_user_deleted_for_team"] = 14] = "team_user_deleted_for_team";
2802
+ NotificationType[NotificationType["team_user_left"] = 15] = "team_user_left";
2803
+ NotificationType[NotificationType["game_updated"] = 16] = "game_updated";
2804
+ NotificationType[NotificationType["game_invited"] = 17] = "game_invited";
2805
+ NotificationType[NotificationType["game_invite_accepted"] = 18] = "game_invite_accepted";
2806
+ NotificationType[NotificationType["game_invite_declined"] = 19] = "game_invite_declined";
2807
+ NotificationType[NotificationType["game_remind"] = 20] = "game_remind";
2808
+ NotificationType[NotificationType["game_won"] = 21] = "game_won";
2809
+ NotificationType[NotificationType["game_losing"] = 22] = "game_losing";
2810
+ NotificationType[NotificationType["game_tech_defeat"] = 23] = "game_tech_defeat";
2811
+ NotificationType[NotificationType["game_tech_victory"] = 24] = "game_tech_victory";
2812
+ NotificationType[NotificationType["poll_created"] = 25] = "poll_created";
2813
+ NotificationType[NotificationType["poll_closed"] = 26] = "poll_closed";
2814
+ NotificationType[NotificationType["team_event_invited"] = 27] = "team_event_invited";
2815
+ NotificationType[NotificationType["team_event_accepted"] = 28] = "team_event_accepted";
2816
+ NotificationType[NotificationType["team_event_declined"] = 29] = "team_event_declined";
2817
+ NotificationType[NotificationType["team_event_remind"] = 30] = "team_event_remind";
2818
+ NotificationType[NotificationType["tournament_invited"] = 31] = "tournament_invited";
2819
+ NotificationType[NotificationType["tournament_joined"] = 32] = "tournament_joined";
2820
+ NotificationType[NotificationType["tournament_join_declined"] = 33] = "tournament_join_declined";
2821
+ NotificationType[NotificationType["tournament_join_canceled"] = 34] = "tournament_join_canceled";
2822
+ NotificationType[NotificationType["tournament_user_invited"] = 35] = "tournament_user_invited";
2823
+ NotificationType[NotificationType["tournament_user_accepted_for_team"] = 36] = "tournament_user_accepted_for_team";
2824
+ NotificationType[NotificationType["tournament_user_accepted_for_user"] = 37] = "tournament_user_accepted_for_user";
2825
+ NotificationType[NotificationType["tournament_user_added"] = 38] = "tournament_user_added";
2826
+ NotificationType[NotificationType["tournament_user_declined_for_team"] = 39] = "tournament_user_declined_for_team";
2827
+ NotificationType[NotificationType["tournament_user_declined_for_user"] = 40] = "tournament_user_declined_for_user";
2828
+ NotificationType[NotificationType["tournament_user_invite_deleted"] = 41] = "tournament_user_invite_deleted";
2829
+ NotificationType[NotificationType["tournament_user_deleted"] = 42] = "tournament_user_deleted";
2830
+ NotificationType[NotificationType["tournament_user_disqualified_for_team"] = 43] = "tournament_user_disqualified_for_team";
2831
+ NotificationType[NotificationType["tournament_user_disqualified_for_user"] = 44] = "tournament_user_disqualified_for_user";
2832
+ NotificationType[NotificationType["tournament_user_disqualification_updated_for_team"] = 45] = "tournament_user_disqualification_updated_for_team";
2833
+ NotificationType[NotificationType["tournament_user_disqualification_updated_for_user"] = 46] = "tournament_user_disqualification_updated_for_user";
2834
+ NotificationType[NotificationType["tournament_team_deleted"] = 47] = "tournament_team_deleted";
2835
+ NotificationType[NotificationType["org_tournament_invite_created"] = 48] = "org_tournament_invite_created";
2836
+ NotificationType[NotificationType["org_tournament_invite_declined"] = 49] = "org_tournament_invite_declined";
2837
+ NotificationType[NotificationType["org_tournament_invite_deleted"] = 50] = "org_tournament_invite_deleted";
2838
+ NotificationType[NotificationType["org_tournament_invite_changed"] = 51] = "org_tournament_invite_changed";
2839
+ NotificationType[NotificationType["org_tournament_user_deleted"] = 52] = "org_tournament_user_deleted";
2840
+ NotificationType[NotificationType["org_tournament_user_invited"] = 53] = "org_tournament_user_invited";
2841
+ NotificationType[NotificationType["org_tournament_user_has_changes"] = 54] = "org_tournament_user_has_changes";
2842
+ NotificationType[NotificationType["org_tournament_team_leave"] = 55] = "org_tournament_team_leave";
2843
+ })(exports.NotificationType || (exports.NotificationType = {}));
2844
+
2845
+ (function (NotificationServiceEnum) {
2846
+ NotificationServiceEnum[NotificationServiceEnum["public"] = 1] = "public";
2847
+ NotificationServiceEnum[NotificationServiceEnum["org"] = 2] = "org";
2848
+ })(exports.NotificationServiceEnum || (exports.NotificationServiceEnum = {}));
2849
+ var Notification = /** @class */ (function (_super) {
2850
+ __extends(Notification, _super);
2851
+ function Notification() {
2852
+ return _super !== null && _super.apply(this, arguments) || this;
2853
+ }
2854
+ Object.defineProperty(Notification.prototype, "important", {
2855
+ get: function () {
2856
+ return true;
2857
+ },
2858
+ enumerable: true,
2859
+ configurable: true
2860
+ });
2861
+ Notification.toFront = function (value) { };
2862
+ Notification.toBack = function (value) { };
2863
+ __decorate([
2864
+ ToFrontHook
2865
+ ], Notification, "toFront", null);
2866
+ __decorate([
2867
+ ToBackHook
2868
+ ], Notification, "toBack", null);
2869
+ Notification = __decorate([
2870
+ ModelInstance({
2871
+ mappingFields: {
2872
+ id: 'id',
2873
+ event_type: 'event',
2874
+ data: 'data',
2875
+ initiator: 'initiator',
2876
+ team: 'team',
2877
+ team_invite: 'teamInvite',
2878
+ team_user: 'teamUser',
2879
+ poll: 'poll',
2880
+ game: 'game',
2881
+ game_invite: 'gameInvite',
2882
+ team_event: 'teamEvent',
2883
+ team_event_invite: 'teamEventInvite',
2884
+ tournament: 'tournament',
2885
+ tournament_invite: 'tournamentInvite',
2886
+ tournament_team: 'tournamentTeam',
2887
+ viewed: 'viewed',
2888
+ protected: 'protected',
2889
+ service: 'service',
2890
+ created_at: 'createdAt',
2891
+ },
2892
+ relation: {
2893
+ event: enumField(exports.NotificationType),
2894
+ initiator: User,
2895
+ team: Team,
2896
+ teamInvite: TeamInvite,
2897
+ teamUser: TeamUser,
2898
+ poll: Poll,
2899
+ game: Game,
2900
+ gameInvite: GameInvite,
2901
+ teamEvent: TeamEvent,
2902
+ teamEventInvite: TeamEventInvite,
2903
+ tournament: Tournament,
2904
+ tournamentInvite: TournamentInvite,
2905
+ tournamentTeam: TournamentTeam,
2906
+ service: enumField(exports.NotificationServiceEnum),
2907
+ createdAt: DateTimeField,
2908
+ }
2909
+ })
2910
+ ], Notification);
2911
+ return Notification;
2912
+ }(BaseModel));
2913
+
2914
+
2915
+ (function (NotificationAllowTypes) {
2916
+ NotificationAllowTypes[NotificationAllowTypes["all"] = 1] = "all";
2917
+ NotificationAllowTypes[NotificationAllowTypes["important"] = 2] = "important";
2918
+ NotificationAllowTypes[NotificationAllowTypes["none"] = 3] = "none";
2919
+ })(exports.NotificationAllowTypes || (exports.NotificationAllowTypes = {}));
2920
+ var NotificationSettings = /** @class */ (function (_super) {
2921
+ __extends(NotificationSettings, _super);
2922
+ function NotificationSettings() {
2923
+ return _super !== null && _super.apply(this, arguments) || this;
2924
+ }
2925
+ NotificationSettings.toFront = function (data) { };
2926
+ NotificationSettings.toBack = function (data) { };
2927
+ __decorate([
2928
+ ToFrontHook
2929
+ ], NotificationSettings, "toFront", null);
2930
+ __decorate([
2931
+ ToBackHook
2932
+ ], NotificationSettings, "toBack", null);
2933
+ NotificationSettings = __decorate([
2934
+ ModelInstance({
2935
+ mappingFields: {
2936
+ user_id: 'userId',
2937
+ popup: 'popup',
2938
+ sound: 'sound',
2939
+ browser: 'browser',
2940
+ email: 'email'
2941
+ },
2942
+ relation: {
2943
+ sound: enumField(exports.NotificationAllowTypes),
2944
+ browser: enumField(exports.NotificationAllowTypes),
2945
+ }
2946
+ })
2947
+ ], NotificationSettings);
2948
+ return NotificationSettings;
2949
+ }(BaseModel));
2950
+
2951
+ var NotificationBaseApi = /** @class */ (function () {
2952
+ function NotificationBaseApi(httpClient, configService) {
2953
+ this.httpClient = httpClient;
2954
+ this.configService = configService;
2955
+ }
2956
+ NotificationBaseApi.prototype.getCount = function () {
2957
+ return __awaiter(this, void 0, void 0, function () {
2958
+ return __generator(this, function (_a) {
2959
+ return [2 /*return*/, this.httpClient
2960
+ .get("" + this.configService.get('apiUrl') + this.apiUrl + "/notification/count/")
2961
+ .pipe(operators.map(function (data) { return +data; }))
2962
+ .toPromise()];
2963
+ });
2964
+ });
2965
+ };
2966
+ NotificationBaseApi.prototype.getList = function (page, size, filters) {
2967
+ if (filters === void 0) { filters = {}; }
2968
+ return __awaiter(this, void 0, void 0, function () {
2969
+ var params, _a, _b, key;
2970
+ var e_1, _c;
2971
+ return __generator(this, function (_d) {
2972
+ params = new http.HttpParams()
2973
+ .set('page', page.toString())
2974
+ .set('size', size.toString());
2975
+ try {
2976
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
2977
+ key = _b.value;
2978
+ params = params.set(key, filters[key]);
2979
+ }
2980
+ }
2981
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2982
+ finally {
2983
+ try {
2984
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
2985
+ }
2986
+ finally { if (e_1) throw e_1.error; }
2987
+ }
2988
+ return [2 /*return*/, this.httpClient
2989
+ .get("" + this.configService.get('apiUrl') + this.apiUrl + "/notification/", { params: params, observe: 'response' })
2990
+ .pipe(operators.map(function (response) {
2991
+ var data = Notification.toFront(response.body);
2992
+ return {
2993
+ total: +response.headers.get('x-page-count'),
2994
+ data: data
2995
+ };
2996
+ })).toPromise()];
2997
+ });
2998
+ });
2999
+ };
3000
+ NotificationBaseApi.prototype.markViewed = function (notificationId, viewed) {
3001
+ return __awaiter(this, void 0, void 0, function () {
3002
+ return __generator(this, function (_a) {
3003
+ return [2 /*return*/, this.httpClient
3004
+ .post("" + this.configService.get('apiUrl') + this.apiUrl + "/notification/" + notificationId + "/viewed/", { viewed: viewed })
3005
+ .pipe(operators.map(function (data) { return Notification.toFront(data); }))
3006
+ .toPromise()];
3007
+ });
3008
+ });
3009
+ };
3010
+ NotificationBaseApi.prototype.markAllViewed = function () {
3011
+ return __awaiter(this, void 0, void 0, function () {
3012
+ return __generator(this, function (_a) {
3013
+ return [2 /*return*/, this.httpClient
3014
+ .post("" + this.configService.get('apiUrl') + this.apiUrl + "/notification/viewed/", {})
3015
+ .pipe(operators.map(function (data) { return Notification.toFront(data); }))
3016
+ .toPromise()];
3017
+ });
3018
+ });
3019
+ };
3020
+ NotificationBaseApi.prototype.getNotificationSettings = function () {
3021
+ return __awaiter(this, void 0, void 0, function () {
3022
+ return __generator(this, function (_a) {
3023
+ return [2 /*return*/, this.httpClient.get("" + this.configService.get('apiUrl') + this.apiUrl + "/notification_settings/")
3024
+ .pipe(operators.map(function (data) { return NotificationSettings.toFront(data); }))
3025
+ .toPromise()];
3026
+ });
3027
+ });
3028
+ };
3029
+ NotificationBaseApi.prototype.updateNotificationSettings = function (data) {
3030
+ return __awaiter(this, void 0, void 0, function () {
3031
+ return __generator(this, function (_a) {
3032
+ return [2 /*return*/, this.httpClient.post("" + this.configService.get('apiUrl') + this.apiUrl + "/notification_settings/", NotificationSettings.toBack(data))
3033
+ .pipe(operators.map(function (result) { return NotificationSettings.toFront(result); }))
3034
+ .toPromise()];
3035
+ });
3036
+ });
3037
+ };
3038
+ NotificationBaseApi.ctorParameters = function () { return [
3039
+ { type: http.HttpClient },
3040
+ { type: ConfigService }
3041
+ ]; };
3042
+ NotificationBaseApi.ɵprov = core.ɵɵdefineInjectable({ factory: function NotificationBaseApi_Factory() { return new NotificationBaseApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: NotificationBaseApi, providedIn: "root" });
3043
+ NotificationBaseApi = __decorate([
3044
+ core.Injectable({ providedIn: 'root' })
3045
+ ], NotificationBaseApi);
3046
+ return NotificationBaseApi;
3047
+ }());
3048
+
3049
+ var NotificationApi = /** @class */ (function (_super) {
3050
+ __extends(NotificationApi, _super);
3051
+ function NotificationApi() {
3052
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3053
+ _this.apiUrl = '/api/v1';
3054
+ return _this;
3055
+ }
3056
+ NotificationApi.ɵprov = core.ɵɵdefineInjectable({ factory: function NotificationApi_Factory() { return new NotificationApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: NotificationApi, providedIn: "root" });
3057
+ NotificationApi = __decorate([
3058
+ core.Injectable({ providedIn: 'root' })
3059
+ ], NotificationApi);
3060
+ return NotificationApi;
3061
+ }(NotificationBaseApi));
3062
+
3063
+ var OrgNotificationApi = /** @class */ (function (_super) {
3064
+ __extends(OrgNotificationApi, _super);
3065
+ function OrgNotificationApi() {
3066
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3067
+ _this.apiUrl = '/org/api/v1';
3068
+ return _this;
3069
+ }
3070
+ OrgNotificationApi.ɵprov = core.ɵɵdefineInjectable({ factory: function OrgNotificationApi_Factory() { return new OrgNotificationApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: OrgNotificationApi, providedIn: "root" });
3071
+ OrgNotificationApi = __decorate([
3072
+ core.Injectable({ providedIn: 'root' })
3073
+ ], OrgNotificationApi);
3074
+ return OrgNotificationApi;
3075
+ }(NotificationBaseApi));
3076
+
3077
+ var ReferenceApi = /** @class */ (function () {
3078
+ function ReferenceApi(httpClient, configService) {
3079
+ this.httpClient = httpClient;
3080
+ this.configService = configService;
3081
+ }
3082
+ ReferenceApi.prototype.getCities = function () {
3083
+ return __awaiter(this, void 0, void 0, function () {
3084
+ return __generator(this, function (_a) {
3085
+ return [2 /*return*/, this.httpClient
3086
+ .get(this.configService.get('apiUrl') + "/api/v1/reference/cities/")
3087
+ .pipe(operators.map(function (data) { return City.toFront(data); })).toPromise()];
3088
+ });
3089
+ });
3090
+ };
3091
+ ReferenceApi.prototype.getSports = function () {
3092
+ return __awaiter(this, void 0, void 0, function () {
3093
+ return __generator(this, function (_a) {
3094
+ return [2 /*return*/, this.httpClient
3095
+ .get(this.configService.get('apiUrl') + "/api/v1/sport/")
3096
+ .pipe(operators.map(function (data) { return Sport.toFront(data); })).toPromise()];
3097
+ });
3098
+ });
3099
+ };
3100
+ ReferenceApi.ctorParameters = function () { return [
3101
+ { type: http.HttpClient },
3102
+ { type: ConfigService }
3103
+ ]; };
3104
+ ReferenceApi.ɵprov = core.ɵɵdefineInjectable({ factory: function ReferenceApi_Factory() { return new ReferenceApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: ReferenceApi, providedIn: "root" });
3105
+ ReferenceApi = __decorate([
3106
+ core.Injectable({ providedIn: 'root' })
3107
+ ], ReferenceApi);
3108
+ return ReferenceApi;
3109
+ }());
3110
+
3111
+ var TournamentNews = /** @class */ (function (_super) {
3112
+ __extends(TournamentNews, _super);
3113
+ function TournamentNews() {
3114
+ return _super !== null && _super.apply(this, arguments) || this;
3115
+ }
3116
+ TournamentNews.toFront = function (data) { };
3117
+ TournamentNews.toBack = function (data) { };
3118
+ __decorate([
3119
+ ToFrontHook
3120
+ ], TournamentNews, "toFront", null);
3121
+ __decorate([
3122
+ ToBackHook
3123
+ ], TournamentNews, "toBack", null);
3124
+ TournamentNews = __decorate([
3125
+ ModelInstance({
3126
+ mappingFields: {
3127
+ id: 'id',
3128
+ title: 'title',
3129
+ picture: 'picture',
3130
+ text: 'text',
3131
+ author: 'author',
3132
+ created_at: 'createdAt',
3133
+ },
3134
+ relation: {
3135
+ picture: File,
3136
+ author: User,
3137
+ createdAt: DateTimeField,
3138
+ }
3139
+ })
3140
+ ], TournamentNews);
3141
+ return TournamentNews;
3142
+ }(BaseModel));
3143
+
3144
+ var GameTimelineStageItem = /** @class */ (function () {
3145
+ function GameTimelineStageItem() {
3146
+ }
3147
+ GameTimelineStageItem.toFront = function (data) { };
3148
+ GameTimelineStageItem.toBack = function (data) { };
3149
+ __decorate([
3150
+ ToFrontHook
3151
+ ], GameTimelineStageItem, "toFront", null);
3152
+ __decorate([
3153
+ ToBackHook
3154
+ ], GameTimelineStageItem, "toBack", null);
3155
+ GameTimelineStageItem = __decorate([
3156
+ ModelInstance({
3157
+ mappingFields: {
3158
+ stage_id: 'stageId',
3159
+ tours_count: 'toursCount',
3160
+ playoff_stages_count: 'playoffStagesCount',
3161
+ }
3162
+ })
3163
+ ], GameTimelineStageItem);
3164
+ return GameTimelineStageItem;
3165
+ }());
3166
+ var GameTimelineStages = /** @class */ (function (_super) {
3167
+ __extends(GameTimelineStages, _super);
3168
+ function GameTimelineStages() {
3169
+ return _super !== null && _super.apply(this, arguments) || this;
3170
+ }
3171
+ GameTimelineStages.toFront = function (data) { };
3172
+ GameTimelineStages.toBack = function (data) { };
3173
+ __decorate([
3174
+ ToFrontHook
3175
+ ], GameTimelineStages, "toFront", null);
3176
+ __decorate([
3177
+ ToBackHook
3178
+ ], GameTimelineStages, "toBack", null);
3179
+ GameTimelineStages = __decorate([
3180
+ ModelInstance({
3181
+ mappingFields: {
3182
+ tours_count: 'toursCount',
3183
+ playoff_stages_count: 'playoffStagesCount',
3184
+ current_tour: 'currentTour',
3185
+ current_playoff_stage: 'currentPlayoffStage',
3186
+ stages: 'stages',
3187
+ tournament_stage_id: 'tournamentStageId',
3188
+ },
3189
+ relation: {
3190
+ stages: listField(GameTimelineStageItem)
3191
+ }
3192
+ })
3193
+ ], GameTimelineStages);
3194
+ return GameTimelineStages;
3195
+ }(BaseModel));
3196
+
3197
+
3198
+ (function (TournamentStageStatuses) {
3199
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3200
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3201
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3202
+ })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
3203
+ var TournamentStage = /** @class */ (function (_super) {
3204
+ __extends(TournamentStage, _super);
3205
+ function TournamentStage() {
3206
+ return _super !== null && _super.apply(this, arguments) || this;
3207
+ }
3208
+ TournamentStage.toFront = function (data) { };
3209
+ TournamentStage.toBack = function (data) { };
3210
+ __decorate([
3211
+ ToFrontHook
3212
+ ], TournamentStage, "toFront", null);
3213
+ __decorate([
3214
+ ToBackHook
3215
+ ], TournamentStage, "toBack", null);
3216
+ TournamentStage = __decorate([
3217
+ ModelInstance({
3218
+ mappingFields: {
3219
+ id: 'id',
3220
+ name: 'name',
3221
+ date: 'date',
3222
+ tournament_id: 'tournamentId',
3223
+ status: 'status',
3224
+ },
3225
+ relation: {
3226
+ date: DateField,
3227
+ status: enumField(exports.TournamentStageStatuses)
3228
+ }
3229
+ })
3230
+ ], TournamentStage);
3231
+ return TournamentStage;
3232
+ }(BaseModel));
3233
+
3234
+ function generateArray(length) {
3235
+ if (length <= 0) {
3236
+ return [];
3237
+ }
3238
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3239
+ }
3240
+ function getArrayChunks(array, length) {
3241
+ var chunks = [];
3242
+ var chunkLength = Math.ceil(array.length / length);
3243
+ if (chunkLength === 0) {
3244
+ return [array];
3245
+ }
3246
+ for (var i = 0; i < chunkLength; i++) {
3247
+ chunks.push(array.slice(i * length, (i + 1) * length));
3248
+ }
3249
+ return chunks;
3250
+ }
3251
+
3252
+ var PlayoffSettings = /** @class */ (function (_super) {
3253
+ __extends(PlayoffSettings, _super);
3254
+ function PlayoffSettings() {
3255
+ return _super !== null && _super.apply(this, arguments) || this;
3256
+ }
3257
+ PlayoffSettings.toFront = function (data) { };
3258
+ PlayoffSettings.toBack = function (data) { };
3259
+ __decorate([
3260
+ ToFrontHook
3261
+ ], PlayoffSettings, "toFront", null);
3262
+ __decorate([
3263
+ ToBackHook
3264
+ ], PlayoffSettings, "toBack", null);
3265
+ PlayoffSettings = __decorate([
3266
+ ModelInstance({
3267
+ mappingFields: {
3268
+ rounds: 'rounds',
3269
+ final_rounds: 'finalRounds',
3270
+ third_place_rounds: 'thirdPlaceRounds',
3271
+ teams_count: 'teamsCount'
3272
+ }
3273
+ })
3274
+ ], PlayoffSettings);
3275
+ return PlayoffSettings;
3276
+ }(BaseModel));
3277
+ var Playoff = /** @class */ (function (_super) {
3278
+ __extends(Playoff, _super);
3279
+ function Playoff() {
3280
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3281
+ _this.stages = [];
3282
+ return _this;
3283
+ }
3284
+ Playoff.toFront = function (data) { };
3285
+ Playoff.toBack = function (data) { };
3286
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
3287
+ get: function () {
3288
+ return Math.log(this.settings.teamsCount) / Math.log(2);
3289
+ },
3290
+ enumerable: true,
3291
+ configurable: true
3292
+ });
3293
+ Playoff.prototype.getPlayoffStages = function () {
3294
+ var _this = this;
3295
+ if (this.stages.length === 0 && this.settings.teamsCount) {
3296
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3297
+ this.stages = generateArray(stagesCount).map(function (stage) {
3298
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3299
+ var title = '';
3300
+ if (playoffStage === 1) {
3301
+ title = 'Финал';
3302
+ }
3303
+ else {
3304
+ title = "1 / " + playoffStage;
3305
+ }
3306
+ return {
3307
+ value: stage,
3308
+ title: title
3309
+ };
3310
+ });
3311
+ }
3312
+ return this.stages;
3313
+ };
3314
+ __decorate([
3315
+ ToFrontHook
3316
+ ], Playoff, "toFront", null);
3317
+ __decorate([
3318
+ ToBackHook
3319
+ ], Playoff, "toBack", null);
3320
+ Playoff = __decorate([
3321
+ ModelInstance({
3322
+ mappingFields: {
3323
+ id: 'id',
3324
+ name: 'name',
3325
+ settings: 'settings',
3326
+ tournament_id: 'tournamentId',
3327
+ tournament_stage_id: 'tournamentStageId',
3328
+ is_official: 'isOfficial'
3329
+ },
3330
+ relation: {
3331
+ settings: PlayoffSettings
3332
+ }
3333
+ })
3334
+ ], Playoff);
3335
+ return Playoff;
3336
+ }(BaseModel));
3337
+
3338
+ var VolleyballStatistic = /** @class */ (function (_super) {
3339
+ __extends(VolleyballStatistic, _super);
3340
+ function VolleyballStatistic() {
3341
+ return _super !== null && _super.apply(this, arguments) || this;
3342
+ }
3343
+ VolleyballStatistic.toFront = function (data) { };
3344
+ VolleyballStatistic.toBack = function (data) { };
3345
+ __decorate([
3346
+ ToFrontHook
3347
+ ], VolleyballStatistic, "toFront", null);
3348
+ __decorate([
3349
+ ToBackHook
3350
+ ], VolleyballStatistic, "toBack", null);
3351
+ VolleyballStatistic = __decorate([
3352
+ ModelInstance({
3353
+ mappingFields: {
3354
+ team: 'team',
3355
+ team_user: 'teamUser',
3356
+ tournament_team_user: 'tournamentTeamUser',
3357
+ tournament_team: 'tournamentTeam',
3358
+ user: 'user',
3359
+ month: 'month',
3360
+ win_lose: 'winLose',
3361
+ games_count: 'gamesCount',
3362
+ won_games_count: 'wonGamesCount',
3363
+ serve_hits: 'serveHits',
3364
+ serve_faults: 'serveFaults',
3365
+ serve_aces: 'serveAces',
3366
+ serve_percent: 'servePercent',
3367
+ ace_percent: 'acePercent',
3368
+ stuff_blocks: 'stuffBlocks',
3369
+ block_faults: 'blockFaults',
3370
+ block_rebounds: 'blockRebounds',
3371
+ block_percent: 'blockPercent',
3372
+ attack_spikes: 'attackSpikes',
3373
+ attack_faults: 'attackFaults',
3374
+ attack_shots: 'attackShots',
3375
+ attack_percent: 'attackPercent',
3376
+ receives: 'receives',
3377
+ receive_faults: 'receiveFaults',
3378
+ excellent_receives: 'excellentReceives',
3379
+ receive_percent: 'receivePercent',
3380
+ serve_receives: 'serveReceives',
3381
+ serve_receive_faults: 'serveReceiveFaults',
3382
+ excellent_serve_receives: 'excellentServeReceives',
3383
+ serve_receive_percent: 'serveReceivePercent',
3384
+ points: 'points',
3385
+ faults: 'faults',
3386
+ newbie: 'newbie',
3387
+ },
3388
+ relation: {
3389
+ team: Team,
3390
+ teamUser: TeamUser,
3391
+ tournamentTeamUser: TournamentTeamUser,
3392
+ tournamentTeam: TournamentTeam,
3393
+ user: User,
3394
+ month: DateField,
3395
+ }
3396
+ })
3397
+ ], VolleyballStatistic);
3398
+ return VolleyballStatistic;
3399
+ }(BaseModel));
3400
+
3401
+ var TournamentStageTeam = /** @class */ (function (_super) {
3402
+ __extends(TournamentStageTeam, _super);
3403
+ function TournamentStageTeam() {
3404
+ return _super !== null && _super.apply(this, arguments) || this;
3405
+ }
3406
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
3407
+ get: function () {
3408
+ if (!this.gamesCount) {
3409
+ return 0;
3410
+ }
3411
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
3412
+ },
3413
+ enumerable: true,
3414
+ configurable: true
3415
+ });
3416
+ TournamentStageTeam.toFront = function (data) { };
3417
+ TournamentStageTeam.toBack = function (data) { };
3418
+ __decorate([
3419
+ ToFrontHook
3420
+ ], TournamentStageTeam, "toFront", null);
3421
+ __decorate([
3422
+ ToBackHook
3423
+ ], TournamentStageTeam, "toBack", null);
3424
+ TournamentStageTeam = __decorate([
3425
+ ModelInstance({
3426
+ mappingFields: {
3427
+ id: 'id',
3428
+ tournament_team: 'tournamentTeam',
3429
+ group: 'group',
3430
+ tournament_stage_id: 'tournamentStageId',
3431
+ games_count: 'gamesCount',
3432
+ won_games_count: 'wonGamesCount',
3433
+ score_sum: 'scoreSum',
3434
+ missed_sum: 'missedSum',
3435
+ last_games_count: 'lastGamesCount',
3436
+ last_games_won: 'lastGamesWon',
3437
+ points: 'points',
3438
+ final_standing: 'finalStanding',
3439
+ received_points: 'receivedPoints',
3440
+ },
3441
+ relation: {
3442
+ tournamentTeam: TournamentTeam,
3443
+ group: TournamentGroup
3444
+ }
3445
+ })
3446
+ ], TournamentStageTeam);
3447
+ return TournamentStageTeam;
3448
+ }(BaseModel));
3449
+
3450
+ var TournamentApi = /** @class */ (function () {
3451
+ function TournamentApi(httpClient, configService) {
3452
+ this.httpClient = httpClient;
3453
+ this.configService = configService;
3454
+ }
3455
+ TournamentApi.prototype.getByAlias = function (alias) {
3456
+ return __awaiter(this, void 0, void 0, function () {
3457
+ return __generator(this, function (_a) {
3458
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
3459
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
3460
+ .toPromise()];
3461
+ });
3462
+ });
3463
+ };
3464
+ TournamentApi.prototype.getNews = function (tournamentId) {
3465
+ return __awaiter(this, void 0, void 0, function () {
3466
+ return __generator(this, function (_a) {
3467
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
3468
+ .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
3469
+ .toPromise()];
3470
+ });
3471
+ });
3472
+ };
3473
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
3474
+ return __awaiter(this, void 0, void 0, function () {
3475
+ var params;
3476
+ return __generator(this, function (_a) {
3477
+ params = new http.HttpParams().set('page', page.toString())
3478
+ .set('size', size.toString());
3479
+ if (filters) {
3480
+ if (filters.event) {
3481
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
3482
+ }
3483
+ if (filters.search) {
3484
+ params = params.set('search', filters.search);
3485
+ }
3486
+ }
3487
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
3488
+ .pipe(operators.map(function (result) { return ({
3489
+ total: +result.headers.get('X-Page-Count'),
3490
+ data: TournamentEvent.toFront(result.body)
3491
+ }); }))
3492
+ .toPromise()];
3493
+ });
3494
+ });
3495
+ };
3496
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
3497
+ return __awaiter(this, void 0, void 0, function () {
3498
+ return __generator(this, function (_a) {
3499
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
3500
+ });
3501
+ });
3502
+ };
3503
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
3504
+ return __awaiter(this, void 0, void 0, function () {
3505
+ return __generator(this, function (_a) {
3506
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
3507
+ });
3508
+ });
3509
+ };
3510
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
3511
+ return __awaiter(this, void 0, void 0, function () {
3512
+ return __generator(this, function (_a) {
3513
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
3514
+ });
3515
+ });
3516
+ };
3517
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
3518
+ return __awaiter(this, void 0, void 0, function () {
3519
+ return __generator(this, function (_a) {
3520
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
3521
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
3522
+ .toPromise()];
3523
+ });
3524
+ });
3525
+ };
3526
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
3527
+ if (filters === void 0) { filters = {}; }
3528
+ return __awaiter(this, void 0, void 0, function () {
3529
+ var params;
3530
+ return __generator(this, function (_a) {
3531
+ params = new http.HttpParams().set('page', page.toString());
3532
+ if (size) {
3533
+ params = params.set('size', size.toString());
3534
+ }
3535
+ if (filters.tournamentStageId) {
3536
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3537
+ }
3538
+ if (filters.tournamentTour) {
3539
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3540
+ }
3541
+ if (filters.playoffStage) {
3542
+ params = params.set('playoff_stage', filters.playoffStage.toString());
3543
+ }
3544
+ if (filters.teamId) {
3545
+ params = params.set('team_id', filters.teamId.toString());
3546
+ }
3547
+ if (filters.status) {
3548
+ params = params.set('status', exports.GameStatuses[filters.status]);
3549
+ }
3550
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
3551
+ .pipe(operators.map(function (result) { return ({
3552
+ total: +result.headers.get('X-Page-Count'),
3553
+ data: Game.toFront(result.body)
3554
+ }); })).toPromise()];
3555
+ });
3556
+ });
3557
+ };
3558
+ TournamentApi.prototype.getTeams = function (tournamentId) {
3559
+ return __awaiter(this, void 0, void 0, function () {
3560
+ return __generator(this, function (_a) {
3561
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
3562
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
3563
+ .toPromise()];
3564
+ });
3565
+ });
3566
+ };
3567
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
3568
+ return __awaiter(this, void 0, void 0, function () {
3569
+ return __generator(this, function (_a) {
3570
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
3571
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
3572
+ .toPromise()];
3573
+ });
3574
+ });
3575
+ };
3576
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
3577
+ return __awaiter(this, void 0, void 0, function () {
3578
+ return __generator(this, function (_a) {
3579
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
3580
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
3581
+ .toPromise()];
3582
+ });
3583
+ });
3584
+ };
3585
+ TournamentApi.prototype.getUserById = function (userId) {
3586
+ return __awaiter(this, void 0, void 0, function () {
3587
+ return __generator(this, function (_a) {
3588
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
3589
+ .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
3590
+ .toPromise()];
3591
+ });
3592
+ });
3593
+ };
3594
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
3595
+ return __awaiter(this, void 0, void 0, function () {
3596
+ return __generator(this, function (_a) {
3597
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
3598
+ .pipe(operators.map(function (result) { return Game.toFront(result); }))
3599
+ .toPromise()];
3600
+ });
3601
+ });
3602
+ };
3603
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
3604
+ return __awaiter(this, void 0, void 0, function () {
3605
+ var params, _a, _b, key;
3606
+ var e_1, _c;
3607
+ return __generator(this, function (_d) {
3608
+ params = new http.HttpParams();
3609
+ if (filters) {
3610
+ try {
3611
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3612
+ key = _b.value;
3613
+ if (filters[key]) {
3614
+ params = params.set(key, filters[key]);
3615
+ }
3616
+ }
3617
+ }
3618
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3619
+ finally {
3620
+ try {
3621
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3622
+ }
3623
+ finally { if (e_1) throw e_1.error; }
3624
+ }
3625
+ if (filters.per_game !== undefined) {
3626
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3627
+ }
3628
+ }
3629
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
3630
+ });
3631
+ });
3632
+ };
3633
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
3634
+ return __awaiter(this, void 0, void 0, function () {
3635
+ var params, _a, _b, key;
3636
+ var e_2, _c;
3637
+ return __generator(this, function (_d) {
3638
+ params = new http.HttpParams();
3639
+ if (filters) {
3640
+ try {
3641
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3642
+ key = _b.value;
3643
+ if (filters[key]) {
3644
+ params = params.set(key, filters[key]);
3645
+ }
3646
+ }
3647
+ }
3648
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3649
+ finally {
3650
+ try {
3651
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3652
+ }
3653
+ finally { if (e_2) throw e_2.error; }
3654
+ }
3655
+ if (filters.per_game !== undefined) {
3656
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3657
+ }
3658
+ }
3659
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
3660
+ });
3661
+ });
3662
+ };
3663
+ TournamentApi.ctorParameters = function () { return [
3664
+ { type: http.HttpClient },
3665
+ { type: ConfigService }
3666
+ ]; };
3667
+ TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
3668
+ TournamentApi = __decorate([
3669
+ core.Injectable({ providedIn: 'root' })
3670
+ ], TournamentApi);
3671
+ return TournamentApi;
3672
+ }());
3673
+
3674
+ var TournamentJoinData = /** @class */ (function (_super) {
3675
+ __extends(TournamentJoinData, _super);
3676
+ function TournamentJoinData() {
3677
+ return _super !== null && _super.apply(this, arguments) || this;
3678
+ }
3679
+ Object.defineProperty(TournamentJoinData.prototype, "usersCount", {
3680
+ get: function () {
3681
+ return this.validUsersCount + this.invalidUsersCount;
3682
+ },
3683
+ enumerable: true,
3684
+ configurable: true
3685
+ });
3686
+ Object.defineProperty(TournamentJoinData.prototype, "valid", {
3687
+ get: function () {
3688
+ return this.hasAccess && !this.inviteSent && !this.alreadyInTournament;
3689
+ },
3690
+ enumerable: true,
3691
+ configurable: true
3692
+ });
3693
+ TournamentJoinData.toFront = function (data) { };
3694
+ TournamentJoinData.toBack = function (data) { };
3695
+ __decorate([
3696
+ ToFrontHook
3697
+ ], TournamentJoinData, "toFront", null);
3698
+ __decorate([
3699
+ ToBackHook
3700
+ ], TournamentJoinData, "toBack", null);
3701
+ TournamentJoinData = __decorate([
3702
+ ModelInstance({
3703
+ mappingFields: {
3704
+ valid_users_count: 'validUsersCount',
3705
+ invalid_users_count: 'invalidUsersCount',
3706
+ has_access: 'hasAccess',
3707
+ invite_sent: 'inviteSent',
3708
+ already_in_tournament: 'alreadyInTournament'
3709
+ }
3710
+ })
3711
+ ], TournamentJoinData);
3712
+ return TournamentJoinData;
3713
+ }(BaseModel));
3714
+ var TournamentJoinTeam = /** @class */ (function (_super) {
3715
+ __extends(TournamentJoinTeam, _super);
3716
+ function TournamentJoinTeam() {
3717
+ return _super !== null && _super.apply(this, arguments) || this;
3718
+ }
3719
+ TournamentJoinTeam.toFront = function (data) { };
3720
+ TournamentJoinTeam.toBack = function (data) { };
3721
+ __decorate([
3722
+ ToFrontHook
3723
+ ], TournamentJoinTeam, "toFront", null);
3724
+ __decorate([
3725
+ ToBackHook
3726
+ ], TournamentJoinTeam, "toBack", null);
3727
+ TournamentJoinTeam = __decorate([
3728
+ ModelInstance({
3729
+ mappingFields: {
3730
+ team: 'team',
3731
+ join_data: 'joinData'
3732
+ },
3733
+ relation: {
3734
+ team: Team,
3735
+ joinData: TournamentJoinData
3736
+ }
3737
+ })
3738
+ ], TournamentJoinTeam);
3739
+ return TournamentJoinTeam;
3740
+ }(BaseModel));
3741
+
3742
+ var TournamentJoinApi = /** @class */ (function () {
3743
+ function TournamentJoinApi(httpClient, configService) {
3744
+ this.httpClient = httpClient;
3745
+ this.configService = configService;
3746
+ }
3747
+ TournamentJoinApi.prototype.getTeamsForJoin = function (tournamentId) {
3748
+ return __awaiter(this, void 0, void 0, function () {
3749
+ return __generator(this, function (_a) {
3750
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams_for_join/").pipe(operators.map(function (response) { return TournamentJoinTeam.toFront(response); })).toPromise()];
3751
+ });
3752
+ });
3753
+ };
3754
+ TournamentJoinApi.prototype.getTeamUsers = function (teamId) {
3755
+ return __awaiter(this, void 0, void 0, function () {
3756
+ return __generator(this, function (_a) {
3757
+ return [2 /*return*/, this.httpClient
3758
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/")
3759
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); })).toPromise()];
3760
+ });
3761
+ });
3762
+ };
3763
+ TournamentJoinApi.prototype.joinTournament = function (tournamentId, teamId, invites) {
3764
+ return __awaiter(this, void 0, void 0, function () {
3765
+ var body;
3766
+ return __generator(this, function (_a) {
3767
+ body = {
3768
+ team: { id: teamId },
3769
+ user_invites: TournamentTeamUserInvite.toBack(invites)
3770
+ };
3771
+ return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/join/", body)
3772
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
3773
+ .toPromise()];
3774
+ });
3775
+ });
3776
+ };
3777
+ TournamentJoinApi.ctorParameters = function () { return [
3778
+ { type: http.HttpClient },
3779
+ { type: ConfigService }
3780
+ ]; };
3781
+ TournamentJoinApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentJoinApi_Factory() { return new TournamentJoinApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentJoinApi, providedIn: "root" });
3782
+ TournamentJoinApi = __decorate([
3783
+ core.Injectable({ providedIn: 'root' })
3784
+ ], TournamentJoinApi);
3785
+ return TournamentJoinApi;
3786
+ }());
3787
+
3788
+ var TournamentStageApi = /** @class */ (function () {
3789
+ function TournamentStageApi(httpClient, configService) {
3790
+ this.httpClient = httpClient;
3791
+ this.configService = configService;
3792
+ }
3793
+ TournamentStageApi.prototype.getById = function (id) {
3794
+ return __awaiter(this, void 0, void 0, function () {
3795
+ return __generator(this, function (_a) {
3796
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + id + "/")
3797
+ .pipe(operators.map(function (result) { return TournamentStage.toFront(result); }))
3798
+ .toPromise()];
3799
+ });
3800
+ });
3801
+ };
3802
+ TournamentStageApi.prototype.getGroups = function (stageId) {
3803
+ return __awaiter(this, void 0, void 0, function () {
3804
+ return __generator(this, function (_a) {
3805
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/groups/")
3806
+ .pipe(operators.map(function (result) { return TournamentGroup.toFront(result); }))
3807
+ .toPromise()];
3808
+ });
3809
+ });
3810
+ };
3811
+ TournamentStageApi.prototype.getPlayoffs = function (stageId) {
3812
+ return __awaiter(this, void 0, void 0, function () {
3813
+ return __generator(this, function (_a) {
3814
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/playoff/")
3815
+ .pipe(operators.map(function (result) { return Playoff.toFront(result); }))
3816
+ .toPromise()];
3817
+ });
3818
+ });
3819
+ };
3820
+ TournamentStageApi.prototype.getTeams = function (stageId) {
3821
+ return __awaiter(this, void 0, void 0, function () {
3822
+ return __generator(this, function (_a) {
3823
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/teams/")
3824
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
3825
+ .toPromise()];
3826
+ });
3827
+ });
3828
+ };
3829
+ TournamentStageApi.ctorParameters = function () { return [
3830
+ { type: http.HttpClient },
3831
+ { type: ConfigService }
3832
+ ]; };
3833
+ TournamentStageApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentStageApi_Factory() { return new TournamentStageApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentStageApi, providedIn: "root" });
3834
+ TournamentStageApi = __decorate([
3835
+ core.Injectable({ providedIn: 'root' })
3836
+ ], TournamentStageApi);
3837
+ return TournamentStageApi;
3838
+ }());
3839
+
3840
+ var VolleyballGameTeamStatistic = /** @class */ (function (_super) {
3841
+ __extends(VolleyballGameTeamStatistic, _super);
3842
+ function VolleyballGameTeamStatistic() {
3843
+ return _super !== null && _super.apply(this, arguments) || this;
3844
+ }
3845
+ VolleyballGameTeamStatistic.toFront = function (data) { };
3846
+ VolleyballGameTeamStatistic.toBack = function (data) { };
3847
+ __decorate([
3848
+ ToFrontHook
3849
+ ], VolleyballGameTeamStatistic, "toFront", null);
3850
+ __decorate([
3851
+ ToBackHook
3852
+ ], VolleyballGameTeamStatistic, "toBack", null);
3853
+ VolleyballGameTeamStatistic = __decorate([
3854
+ ModelInstance({
3855
+ mappingFields: {
3856
+ team: 'team',
3857
+ competitor_team: 'competitorTeam',
3858
+ },
3859
+ relation: {
3860
+ team: VolleyballStatistic,
3861
+ competitorTeam: VolleyballStatistic,
3862
+ }
3863
+ })
3864
+ ], VolleyballGameTeamStatistic);
3865
+ return VolleyballGameTeamStatistic;
3866
+ }(BaseModel));
3867
+
3868
+ var VolleyballGameStatistic = /** @class */ (function (_super) {
3869
+ __extends(VolleyballGameStatistic, _super);
3870
+ function VolleyballGameStatistic() {
3871
+ return _super !== null && _super.apply(this, arguments) || this;
3872
+ }
3873
+ Object.defineProperty(VolleyballGameStatistic.prototype, "id", {
3874
+ get: function () {
3875
+ return this.gameUserId;
3876
+ },
3877
+ enumerable: true,
3878
+ configurable: true
3879
+ });
3880
+ Object.defineProperty(VolleyballGameStatistic.prototype, "attacks", {
3881
+ get: function () {
3882
+ return this.attackSpikes + this.attackShots;
3883
+ },
3884
+ enumerable: true,
3885
+ configurable: true
3886
+ });
3887
+ Object.defineProperty(VolleyballGameStatistic.prototype, "blocks", {
3888
+ get: function () {
3889
+ return this.stuffBlocks + this.blockRebounds;
3890
+ },
3891
+ enumerable: true,
3892
+ configurable: true
3893
+ });
3894
+ Object.defineProperty(VolleyballGameStatistic.prototype, "totalReceives", {
3895
+ get: function () {
3896
+ return this.receives + this.excellentReceives;
3897
+ },
3898
+ enumerable: true,
3899
+ configurable: true
3900
+ });
3901
+ VolleyballGameStatistic.toFront = function (data) { };
3902
+ VolleyballGameStatistic.toBack = function (data) { };
3903
+ __decorate([
3904
+ ToFrontHook
3905
+ ], VolleyballGameStatistic, "toFront", null);
3906
+ __decorate([
3907
+ ToBackHook
3908
+ ], VolleyballGameStatistic, "toBack", null);
3909
+ VolleyballGameStatistic = __decorate([
3910
+ ModelInstance({
3911
+ mappingFields: {
3912
+ game_user_id: 'gameUserId',
3913
+ serve_hits: 'serveHits',
3914
+ serve_faults: 'serveFaults',
3915
+ serve_aces: 'serveAces',
3916
+ stuff_blocks: 'stuffBlocks',
3917
+ block_faults: 'blockFaults',
3918
+ block_rebounds: 'blockRebounds',
3919
+ attack_spikes: 'attackSpikes',
3920
+ attack_faults: 'attackFaults',
3921
+ attack_shots: 'attackShots',
3922
+ receives: 'receives',
3923
+ receive_faults: 'receiveFaults',
3924
+ excellent_receives: 'excellentReceives',
3925
+ serve_receives: 'serveReceives',
3926
+ serve_receive_faults: 'serveReceiveFaults',
3927
+ excellent_serve_receives: 'excellentServeReceives',
3928
+ points: 'points',
3929
+ faults: 'faults',
3930
+ }
3931
+ })
3932
+ ], VolleyballGameStatistic);
3933
+ return VolleyballGameStatistic;
3934
+ }(BaseModel));
3935
+
3936
+
3937
+ (function (VolleyballGameLogType) {
3938
+ VolleyballGameLogType[VolleyballGameLogType["enter_game"] = 1] = "enter_game";
3939
+ VolleyballGameLogType[VolleyballGameLogType["exit_game"] = 2] = "exit_game";
3940
+ VolleyballGameLogType[VolleyballGameLogType["remove_game"] = 3] = "remove_game";
3941
+ VolleyballGameLogType[VolleyballGameLogType["serve_hit"] = 4] = "serve_hit";
3942
+ VolleyballGameLogType[VolleyballGameLogType["serve_fault"] = 5] = "serve_fault";
3943
+ VolleyballGameLogType[VolleyballGameLogType["serve_ace"] = 6] = "serve_ace";
3944
+ VolleyballGameLogType[VolleyballGameLogType["stuff_block"] = 7] = "stuff_block";
3945
+ VolleyballGameLogType[VolleyballGameLogType["block_fault"] = 8] = "block_fault";
3946
+ VolleyballGameLogType[VolleyballGameLogType["block_rebound"] = 9] = "block_rebound";
3947
+ VolleyballGameLogType[VolleyballGameLogType["attack_spike"] = 10] = "attack_spike";
3948
+ VolleyballGameLogType[VolleyballGameLogType["attack_fault"] = 11] = "attack_fault";
3949
+ VolleyballGameLogType[VolleyballGameLogType["attack_shot"] = 12] = "attack_shot";
3950
+ VolleyballGameLogType[VolleyballGameLogType["receive"] = 13] = "receive";
3951
+ VolleyballGameLogType[VolleyballGameLogType["receive_fault"] = 14] = "receive_fault";
3952
+ VolleyballGameLogType[VolleyballGameLogType["excellent_receive"] = 15] = "excellent_receive";
3953
+ VolleyballGameLogType[VolleyballGameLogType["point"] = 16] = "point";
3954
+ VolleyballGameLogType[VolleyballGameLogType["fault"] = 17] = "fault";
3955
+ VolleyballGameLogType[VolleyballGameLogType["serve_receive"] = 18] = "serve_receive";
3956
+ VolleyballGameLogType[VolleyballGameLogType["serve_receive_fault"] = 19] = "serve_receive_fault";
3957
+ VolleyballGameLogType[VolleyballGameLogType["excellent_serve_receive"] = 20] = "excellent_serve_receive";
3958
+ VolleyballGameLogType[VolleyballGameLogType["timeout"] = 21] = "timeout";
3959
+ })(exports.VolleyballGameLogType || (exports.VolleyballGameLogType = {}));
3960
+ var SCORE_LOG_TYPES = [
3961
+ exports.VolleyballGameLogType.serve_ace, exports.VolleyballGameLogType.stuff_block,
3962
+ exports.VolleyballGameLogType.attack_spike, exports.VolleyballGameLogType.point
3963
+ ];
3964
+ var FAULT_LOG_TYPES = [
3965
+ exports.VolleyballGameLogType.serve_fault, exports.VolleyballGameLogType.attack_fault,
3966
+ exports.VolleyballGameLogType.block_fault, exports.VolleyballGameLogType.receive_fault,
3967
+ exports.VolleyballGameLogType.fault, exports.VolleyballGameLogType.serve_receive_fault
3968
+ ];
3969
+ var VolleyballGameLog = /** @class */ (function (_super) {
3970
+ __extends(VolleyballGameLog, _super);
3971
+ function VolleyballGameLog() {
3972
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3973
+ _this.active = true;
3974
+ return _this;
3975
+ }
3976
+ VolleyballGameLog.prototype.compare = function (model) {
3977
+ if (this.rally === model.rally && this.set === model.set) {
3978
+ if (this.datetime && model.datetime) {
3979
+ return this.datetime.getTime() < model.datetime.getTime() ? 1 : -1;
3980
+ }
3981
+ else {
3982
+ return this.id < model.id ? 1 : -1;
3983
+ }
3984
+ }
3985
+ if (this.set === model.set) {
3986
+ return this.rally < model.rally ? 1 : -1;
3987
+ }
3988
+ return this.set < model.set ? 1 : -1;
3989
+ };
3990
+ VolleyballGameLog.prototype.isScoreType = function () {
3991
+ return SCORE_LOG_TYPES.includes(this.logType);
3992
+ };
3993
+ VolleyballGameLog.prototype.isFaultType = function () {
3994
+ return FAULT_LOG_TYPES.includes(this.logType);
3995
+ };
3996
+ VolleyballGameLog.prototype.isServe = function () {
3997
+ return [
3998
+ exports.VolleyballGameLogType.serve_hit,
3999
+ exports.VolleyballGameLogType.serve_ace,
4000
+ exports.VolleyballGameLogType.serve_fault
4001
+ ].includes(this.logType);
4002
+ };
4003
+ VolleyballGameLog.prototype.isAttack = function () {
4004
+ return [
4005
+ exports.VolleyballGameLogType.attack_fault,
4006
+ exports.VolleyballGameLogType.attack_spike,
4007
+ exports.VolleyballGameLogType.attack_shot
4008
+ ].includes(this.logType);
4009
+ };
4010
+ VolleyballGameLog.prototype.isReceive = function () {
4011
+ return [
4012
+ exports.VolleyballGameLogType.receive_fault,
4013
+ exports.VolleyballGameLogType.receive,
4014
+ exports.VolleyballGameLogType.excellent_receive
4015
+ ].includes(this.logType);
4016
+ };
4017
+ VolleyballGameLog.prototype.isServeReceive = function () {
4018
+ return [
4019
+ exports.VolleyballGameLogType.serve_receive_fault,
4020
+ exports.VolleyballGameLogType.serve_receive,
4021
+ exports.VolleyballGameLogType.excellent_serve_receive
4022
+ ].includes(this.logType);
4023
+ };
4024
+ VolleyballGameLog.prototype.isBlock = function () {
4025
+ return [
4026
+ exports.VolleyballGameLogType.block_fault,
4027
+ exports.VolleyballGameLogType.block_rebound,
4028
+ exports.VolleyballGameLogType.stuff_block
4029
+ ].includes(this.logType);
4030
+ };
4031
+ VolleyballGameLog.prototype.isEnterExit = function () {
4032
+ return [
4033
+ exports.VolleyballGameLogType.enter_game,
4034
+ exports.VolleyballGameLogType.exit_game,
4035
+ exports.VolleyballGameLogType.timeout
4036
+ ].includes(this.logType);
4037
+ };
4038
+ VolleyballGameLog.prototype.isComboType = function () {
4039
+ return ![
4040
+ exports.VolleyballGameLogType.receive,
4041
+ exports.VolleyballGameLogType.serve_receive
4042
+ ].includes(this.logType);
4043
+ };
4044
+ VolleyballGameLog.toFront = function (data) { };
4045
+ VolleyballGameLog.toBack = function (data) { };
4046
+ __decorate([
4047
+ ToFrontHook
4048
+ ], VolleyballGameLog, "toFront", null);
4049
+ __decorate([
4050
+ ToBackHook
4051
+ ], VolleyballGameLog, "toBack", null);
4052
+ VolleyballGameLog = __decorate([
4053
+ ModelInstance({
4054
+ mappingFields: {
4055
+ id: 'id',
4056
+ unique_id: 'uniqueId',
4057
+ game_id: 'gameId',
4058
+ game_user_id: 'gameUserId',
4059
+ log_type: 'logType',
4060
+ set: 'set',
4061
+ rally: 'rally',
4062
+ position: 'position',
4063
+ team_id: 'teamId',
4064
+ datetime: 'datetime',
4065
+ },
4066
+ relation: {
4067
+ logType: enumField(exports.VolleyballGameLogType),
4068
+ datetime: DateTimeField
4069
+ }
4070
+ })
4071
+ ], VolleyballGameLog);
4072
+ return VolleyballGameLog;
4073
+ }(BaseModel));
4074
+
4075
+ var VolleyballGameApi = /** @class */ (function () {
4076
+ function VolleyballGameApi(httpClient, configService) {
4077
+ this.httpClient = httpClient;
4078
+ this.configService = configService;
4079
+ }
4080
+ VolleyballGameApi.prototype.getById = function (gameId) {
4081
+ return __awaiter(this, void 0, void 0, function () {
4082
+ return __generator(this, function (_a) {
4083
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_volleyball_game/" + gameId + "/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
4084
+ });
4085
+ });
4086
+ };
4087
+ VolleyballGameApi.prototype.getUsers = function (gameId) {
4088
+ return __awaiter(this, void 0, void 0, function () {
4089
+ return __generator(this, function (_a) {
4090
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
4091
+ });
4092
+ });
4093
+ };
4094
+ VolleyballGameApi.prototype.getTeamStatistic = function (gameId) {
4095
+ return __awaiter(this, void 0, void 0, function () {
4096
+ return __generator(this, function (_a) {
4097
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_volleyball_game/" + gameId + "/team_statistic/").pipe(operators.map(function (result) { return VolleyballGameTeamStatistic.toFront(result); })).toPromise()];
4098
+ });
4099
+ });
4100
+ };
4101
+ VolleyballGameApi.prototype.getUserStatistic = function (gameId) {
4102
+ return __awaiter(this, void 0, void 0, function () {
4103
+ return __generator(this, function (_a) {
4104
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_volleyball_game/" + gameId + "/user_statistic/").pipe(operators.map(function (result) { return VolleyballGameStatistic.toFront(result); })).toPromise()];
4105
+ });
4106
+ });
4107
+ };
4108
+ VolleyballGameApi.prototype.getLogs = function (gameId) {
4109
+ return __awaiter(this, void 0, void 0, function () {
4110
+ return __generator(this, function (_a) {
4111
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_volleyball_game/" + gameId + "/logs/").pipe(operators.map(function (result) { return VolleyballGameLog.toFront(result); })).toPromise()];
4112
+ });
4113
+ });
4114
+ };
4115
+ VolleyballGameApi.ctorParameters = function () { return [
4116
+ { type: http.HttpClient },
4117
+ { type: ConfigService }
4118
+ ]; };
4119
+ VolleyballGameApi.ɵprov = core.ɵɵdefineInjectable({ factory: function VolleyballGameApi_Factory() { return new VolleyballGameApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: VolleyballGameApi, providedIn: "root" });
4120
+ VolleyballGameApi = __decorate([
4121
+ core.Injectable({ providedIn: 'root' })
4122
+ ], VolleyballGameApi);
4123
+ return VolleyballGameApi;
4124
+ }());
4125
+
4126
+ var _a$1;
4127
+ var BasketballGameLogTypeLocalization = (_a$1 = {},
4128
+ _a$1[exports.BasketballGameLogTypes.enter_game] = 'Выход на площадку',
4129
+ _a$1[exports.BasketballGameLogTypes.exit_game] = 'Ушел с площадки',
4130
+ _a$1[exports.BasketballGameLogTypes.remove_game] = 'Удаление с площадки',
4131
+ _a$1[exports.BasketballGameLogTypes.two_point_attempt] = 'Бросок 2 очка',
4132
+ _a$1[exports.BasketballGameLogTypes.three_point_attempt] = 'Бросок 3 очка',
4133
+ _a$1[exports.BasketballGameLogTypes.free_throw_attempt] = 'Штрафной бросок',
4134
+ _a$1[exports.BasketballGameLogTypes.one_point_attempt] = 'Бросок 1 очко',
4135
+ _a$1[exports.BasketballGameLogTypes.two_point_made] = '2 очка',
4136
+ _a$1[exports.BasketballGameLogTypes.three_point_made] = '3 очка',
4137
+ _a$1[exports.BasketballGameLogTypes.free_throw_made] = '1 очко, штрафной',
4138
+ _a$1[exports.BasketballGameLogTypes.one_point_made] = '1 очко',
4139
+ _a$1[exports.BasketballGameLogTypes.assist] = 'Передача',
4140
+ _a$1[exports.BasketballGameLogTypes.block] = 'Блокшот',
4141
+ _a$1[exports.BasketballGameLogTypes.rebound] = 'Подбор',
4142
+ _a$1[exports.BasketballGameLogTypes.offensive_rebound] = 'Подбор в нападении',
4143
+ _a$1[exports.BasketballGameLogTypes.defensive_rebound] = 'Подбор в защите',
4144
+ _a$1[exports.BasketballGameLogTypes.steal] = 'Перехват',
4145
+ _a$1[exports.BasketballGameLogTypes.turnover] = 'Потеря',
4146
+ _a$1[exports.BasketballGameLogTypes.personal_foul] = 'Фол',
4147
+ _a$1[exports.BasketballGameLogTypes.technical_foul] = 'Технический фол',
4148
+ _a$1[exports.BasketballGameLogTypes.unsportsmanlike_foul] = 'Неспортиный фол',
4149
+ _a$1[exports.BasketballGameLogTypes.timeout] = 'Таймаут',
4150
+ _a$1);
4151
+
4152
+ var _a$2;
4153
+ var OvertimeTypeLocalization = (_a$2 = {},
4154
+ _a$2[exports.OvertimeTypes.to_score_diff] = 'До разницы в N мячей',
4155
+ _a$2[exports.OvertimeTypes.to_score_total] = 'До N очков',
4156
+ _a$2[exports.OvertimeTypes.time] = 'По времени',
4157
+ _a$2);
4158
+
4159
+ var _a$3;
4160
+ var TeamUserRoleLocalization = (_a$3 = {},
4161
+ _a$3[exports.TeamUserRole.moderator] = 'Модератор',
4162
+ _a$3[exports.TeamUserRole.member] = 'Пользователь',
4163
+ _a$3[exports.TeamUserRole.admin] = 'Владелец',
4164
+ _a$3);
4165
+
4166
+ var _a$4, _b, _c, _d, _e, _f, _g;
4167
+ var GameBasketballPositionLocalization = (_a$4 = {},
4168
+ _a$4[exports.GameBasketballPosition.point_guard] = 'Разыгрывающий защитник',
4169
+ _a$4[exports.GameBasketballPosition.shooting_guard] = 'Атакующий защитник',
4170
+ _a$4[exports.GameBasketballPosition.small_forward] = 'Легкий форвард',
4171
+ _a$4[exports.GameBasketballPosition.power_forward] = 'Мощный форвард',
4172
+ _a$4[exports.GameBasketballPosition.center] = 'Центровой',
4173
+ _a$4);
4174
+ var GameBasketballPositionShortLocalization = (_b = {},
4175
+ _b[exports.GameBasketballPosition.point_guard] = 'PG',
4176
+ _b[exports.GameBasketballPosition.shooting_guard] = 'SG',
4177
+ _b[exports.GameBasketballPosition.small_forward] = 'SF',
4178
+ _b[exports.GameBasketballPosition.power_forward] = 'PF',
4179
+ _b[exports.GameBasketballPosition.center] = 'C',
4180
+ _b);
4181
+ var WorkHandLocalization = (_c = {},
4182
+ _c[exports.WorkHand.left] = 'Левая',
4183
+ _c[exports.WorkHand.right] = 'Правая',
4184
+ _c);
4185
+ var GameVolleyballPositionLocalization = (_d = {},
4186
+ _d[exports.GameVolleyballPosition.setter] = 'Связующий',
4187
+ _d[exports.GameVolleyballPosition.libero] = 'Либеро',
4188
+ _d[exports.GameVolleyballPosition.middle_player] = 'Центральный блокирующий',
4189
+ _d[exports.GameVolleyballPosition.receiver_attacker] = 'Доигровщик',
4190
+ _d[exports.GameVolleyballPosition.dioganal] = 'Диагональный',
4191
+ _d);
4192
+ var GameVolleyballPositionShortLocalization = (_e = {},
4193
+ _e[exports.GameVolleyballPosition.setter] = 'S',
4194
+ _e[exports.GameVolleyballPosition.libero] = 'L',
4195
+ _e[exports.GameVolleyballPosition.middle_player] = 'MP',
4196
+ _e[exports.GameVolleyballPosition.receiver_attacker] = 'RA',
4197
+ _e[exports.GameVolleyballPosition.dioganal] = 'D',
4198
+ _e);
4199
+ var GameVolleyballPositionShortRuLocalization = (_f = {},
4200
+ _f[exports.GameVolleyballPosition.setter] = 'связ.',
4201
+ _f[exports.GameVolleyballPosition.libero] = 'либеро',
4202
+ _f[exports.GameVolleyballPosition.middle_player] = 'блок.',
4203
+ _f[exports.GameVolleyballPosition.receiver_attacker] = 'доигр.',
4204
+ _f[exports.GameVolleyballPosition.dioganal] = 'диаг.',
4205
+ _f);
4206
+ var VolleyballWorkHandLocalization = (_g = {},
4207
+ _g[exports.VolleyballWorkHand.left] = 'Левая',
4208
+ _g[exports.VolleyballWorkHand.right] = 'Правая',
4209
+ _g);
4210
+
4211
+ var _a$5;
4212
+ var VolleyballGameLogTypeLocalization = (_a$5 = {},
4213
+ _a$5[exports.VolleyballGameLogType.enter_game] = 'Выход на площадку',
4214
+ _a$5[exports.VolleyballGameLogType.exit_game] = 'Уход с площадки',
4215
+ _a$5[exports.VolleyballGameLogType.remove_game] = 'Удаление с площадки',
4216
+ _a$5[exports.VolleyballGameLogType.serve_ace] = 'Эйс',
4217
+ _a$5[exports.VolleyballGameLogType.serve_hit] = 'Подача',
4218
+ _a$5[exports.VolleyballGameLogType.serve_fault] = 'Ошибка на подаче',
4219
+ _a$5[exports.VolleyballGameLogType.attack_spike] = 'Результативная атака',
4220
+ _a$5[exports.VolleyballGameLogType.attack_shot] = 'Успешная атака',
4221
+ _a$5[exports.VolleyballGameLogType.attack_fault] = 'Ошибка атаки',
4222
+ _a$5[exports.VolleyballGameLogType.stuff_block] = 'Результативный блок',
4223
+ _a$5[exports.VolleyballGameLogType.block_rebound] = 'Успешный блок',
4224
+ _a$5[exports.VolleyballGameLogType.block_fault] = 'Ошибка на блоке',
4225
+ _a$5[exports.VolleyballGameLogType.excellent_receive] = 'Отличный прием',
4226
+ _a$5[exports.VolleyballGameLogType.receive] = 'Прием',
4227
+ _a$5[exports.VolleyballGameLogType.receive_fault] = 'Ошибка на приеме',
4228
+ _a$5[exports.VolleyballGameLogType.serve_receive] = 'Прием подачи',
4229
+ _a$5[exports.VolleyballGameLogType.excellent_serve_receive] = 'Отличный прием подачи',
4230
+ _a$5[exports.VolleyballGameLogType.serve_receive_fault] = 'Ошибка приема подачи',
4231
+ _a$5[exports.VolleyballGameLogType.point] = 'Очко',
4232
+ _a$5[exports.VolleyballGameLogType.fault] = 'Ошибка',
4233
+ _a$5[exports.VolleyballGameLogType.timeout] = 'Таймаут',
4234
+ _a$5);
4235
+
4236
+ var TeamInviteExternal = /** @class */ (function (_super) {
4237
+ __extends(TeamInviteExternal, _super);
4238
+ function TeamInviteExternal() {
4239
+ return _super !== null && _super.apply(this, arguments) || this;
4240
+ }
4241
+ TeamInviteExternal.toFront = function (data) { };
4242
+ TeamInviteExternal.toBack = function (data) { };
4243
+ __decorate([
4244
+ ToFrontHook
4245
+ ], TeamInviteExternal, "toFront", null);
4246
+ __decorate([
4247
+ ToBackHook
4248
+ ], TeamInviteExternal, "toBack", null);
4249
+ TeamInviteExternal = __decorate([
4250
+ ModelInstance({
4251
+ mappingFields: {
4252
+ id: 'id',
4253
+ team_id: 'teamId',
4254
+ email: 'email',
4255
+ first_name: 'firstName',
4256
+ last_name: 'lastName',
4257
+ },
4258
+ })
4259
+ ], TeamInviteExternal);
4260
+ return TeamInviteExternal;
4261
+ }(BaseModel));
4262
+
4263
+ var CentrifugoService = /** @class */ (function () {
4264
+ function CentrifugoService(httpClient, configService) {
4265
+ this.httpClient = httpClient;
4266
+ this.configService = configService;
4267
+ this.channels$ = {};
4268
+ this.subscriptions = {};
4269
+ }
4270
+ CentrifugoService.prototype.listen = function (channel) {
4271
+ var _this = this;
4272
+ if (channel in this.channels$) {
4273
+ return this.channels$[channel];
4274
+ }
4275
+ this.channels$[channel] = new Subject.Subject();
4276
+ var subscription = this.connect().subscribe(function (connected) {
4277
+ _this.subscriptions[channel] = _this.addEngineSubscription(channel);
4278
+ setTimeout(function () {
4279
+ subscription.unsubscribe();
4280
+ });
4281
+ });
4282
+ return this.channels$[channel];
4283
+ };
4284
+ CentrifugoService.prototype.unsubscribe = function (channel) {
4285
+ if (this.subscriptions[channel]) {
4286
+ this.subscriptions[channel].unsubscribe();
4287
+ delete this.subscriptions[channel];
4288
+ }
4289
+ if (this.channels$[channel]) {
4290
+ this.channels$[channel].complete();
4291
+ delete this.channels$[channel];
4292
+ }
4293
+ };
4294
+ CentrifugoService.prototype.connect = function () {
4295
+ var _this = this;
4296
+ if (!this.initializeEngineSubject) {
4297
+ this.initializeEngineSubject = new ReplaySubject.ReplaySubject(1);
4298
+ this.httpClient.get('/api/v1/centrifugo/')
4299
+ .subscribe(function (config) {
4300
+ _this.initializeEngine({
4301
+ url: _this.configService.get('centrifugoUrl'),
4302
+ user: config.user,
4303
+ timestamp: config.timestamp,
4304
+ token: config.token,
4305
+ transports: ['websocket']
4306
+ });
4307
+ _this.centrifuge.connect();
4308
+ _this.centrifuge.on('connect', function () {
4309
+ _this.initializeEngineSubject.next(true);
4310
+ });
4311
+ });
4312
+ }
4313
+ return this.initializeEngineSubject;
4314
+ };
4315
+ CentrifugoService.prototype.publish = function (channel, message) {
4316
+ var _this = this;
4317
+ return new rxjs.Observable(function (observer) {
4318
+ _this.connect().subscribe(function () {
4319
+ if (!_this.subscriptions[channel]) {
4320
+ _this.subscriptions[channel] = _this.addEngineSubscription(channel);
4321
+ }
4322
+ _this.subscriptions[channel].publish(message).then(function (res) {
4323
+ observer.next(res);
4324
+ observer.complete();
4325
+ }, function (error) {
4326
+ throw error;
4327
+ });
4328
+ });
4329
+ });
4330
+ };
4331
+ CentrifugoService.prototype.disconnect = function () {
4332
+ this.centrifuge.disconnect();
4333
+ this.initializeEngineSubject = undefined;
4334
+ this.channels$ = {};
4335
+ this.subscriptions = {};
4336
+ };
4337
+ CentrifugoService.prototype.initializeEngine = function (config) {
4338
+ console.log(config);
4339
+ this.centrifuge = new Centrifuge(config);
4340
+ };
4341
+ CentrifugoService.prototype.addEngineSubscription = function (channel) {
4342
+ return this.centrifuge.subscribe(channel, this.resolveMessage.bind(this));
4343
+ };
4344
+ CentrifugoService.prototype.resolveMessage = function (response) {
4345
+ var channel = response.channel;
4346
+ if (!this.channels$[channel]) {
4347
+ return;
4348
+ }
4349
+ this.channels$[channel].next(response.data);
4350
+ };
4351
+ CentrifugoService.ctorParameters = function () { return [
4352
+ { type: http.HttpClient },
4353
+ { type: ConfigService }
4354
+ ]; };
4355
+ CentrifugoService.ɵprov = core.ɵɵdefineInjectable({ factory: function CentrifugoService_Factory() { return new CentrifugoService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: CentrifugoService, providedIn: "root" });
4356
+ CentrifugoService = __decorate([
4357
+ core.Injectable({ providedIn: 'root' })
4358
+ ], CentrifugoService);
4359
+ return CentrifugoService;
4360
+ }());
4361
+
4362
+ var StorageEngineField = /** @class */ (function () {
4363
+ function StorageEngineField(defaultValue, modelClass) {
4364
+ this.modelClass = modelClass;
4365
+ this.defaultValue = defaultValue;
4366
+ }
4367
+ StorageEngineField.prototype.toFront = function (value) {
4368
+ if (this.modelClass) {
4369
+ return this.modelClass.toFront(value);
4370
+ }
4371
+ return value;
4372
+ };
4373
+ StorageEngineField.prototype.toBack = function (value) {
4374
+ if (this.modelClass) {
4375
+ return this.modelClass.toBack(value);
4376
+ }
4377
+ return value;
4378
+ };
4379
+ return StorageEngineField;
4380
+ }());
4381
+ var StorageEngine = /** @class */ (function () {
4382
+ function StorageEngine(name, fields) {
4383
+ this.name = name;
4384
+ this.fields = fields;
4385
+ }
4386
+ StorageEngine.prototype.addField = function (key, field) {
4387
+ this.fields[key] = field;
4388
+ };
4389
+ StorageEngine.prototype.save = function (key, value) {
4390
+ if (!this.fields[key]) {
4391
+ return;
4392
+ }
4393
+ this.setItem(this.name + "_" + key, this.fields[key].toBack(value));
4394
+ };
4395
+ StorageEngine.prototype.get = function (key) {
4396
+ if (!this.fields[key]) {
4397
+ return;
4398
+ }
4399
+ var value = this.getItem(this.name + "_" + key);
4400
+ if (value === null) {
4401
+ value = this.fields[key].defaultValue;
4402
+ }
4403
+ if (value === null || value === undefined) {
4404
+ return value;
4405
+ }
4406
+ return this.fields[key].toFront(value);
4407
+ };
4408
+ StorageEngine.prototype.clear = function () {
4409
+ var e_1, _a;
4410
+ try {
4411
+ for (var _b = __values(Object.keys(this.fields)), _c = _b.next(); !_c.done; _c = _b.next()) {
4412
+ var field = _c.value;
4413
+ this.removeItem(field);
4414
+ }
4415
+ }
4416
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4417
+ finally {
4418
+ try {
4419
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4420
+ }
4421
+ finally { if (e_1) throw e_1.error; }
4422
+ }
4423
+ };
4424
+ StorageEngine.prototype.getItem = function (key) {
4425
+ throw new Error("Function getItem for store engine " + typeof this + " not implemented");
4426
+ };
4427
+ StorageEngine.prototype.setItem = function (key, value) {
4428
+ throw new Error("Function setItem for store engine " + typeof this + " not implemented");
4429
+ };
4430
+ StorageEngine.prototype.removeItem = function (key) {
4431
+ throw new Error("Function deleteItem for store engine " + typeof this + " not implemented");
4432
+ };
4433
+ return StorageEngine;
4434
+ }());
4435
+
4436
+ var LocalStorageEngine = /** @class */ (function (_super) {
4437
+ __extends(LocalStorageEngine, _super);
4438
+ function LocalStorageEngine() {
4439
+ return _super !== null && _super.apply(this, arguments) || this;
4440
+ }
4441
+ LocalStorageEngine.prototype.setItem = function (key, value) {
4442
+ localStorage.setItem(key, JSON.stringify(value));
4443
+ };
4444
+ LocalStorageEngine.prototype.getItem = function (key) {
4445
+ try {
4446
+ return JSON.parse(localStorage.getItem(key));
4447
+ }
4448
+ catch (e) {
4449
+ return;
4450
+ }
4451
+ };
4452
+ LocalStorageEngine.prototype.removeItem = function (key) {
4453
+ localStorage.removeItem(key);
4454
+ };
4455
+ return LocalStorageEngine;
4456
+ }(StorageEngine));
4457
+
4458
+ function componentDestroyed(component) {
4459
+ if (component.constructor.__componentDestroyed$) {
4460
+ return component.constructor.__componentDestroyed$;
4461
+ }
4462
+ throw new Error('Use @UntilDestroy decorator in class');
4463
+ }
4464
+ function UntilDestroy(cmpType) {
4465
+ var def = getDef(cmpType);
4466
+ var original = def.onDestroy;
4467
+ cmpType.__componentDestroyed$ = new Subject.Subject();
4468
+ def.onDestroy = function () {
4469
+ cmpType.__componentDestroyed$.next();
4470
+ cmpType.__componentDestroyed$.complete();
4471
+ original.apply(this);
4472
+ };
4473
+ }
4474
+ function getDef(type) {
4475
+ return type.ɵcmp || type.ɵdir;
4476
+ }
4477
+
4478
+ function getCookie(name) {
4479
+ var value = "; " + document.cookie;
4480
+ var parts = value.split("; " + name + "=");
4481
+ if (parts.length === 2) {
4482
+ return parts.pop().split(';').shift();
4483
+ }
4484
+ return null;
4485
+ }
4486
+
4487
+ function isTouchDevice() {
4488
+ var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
4489
+ var mq = function (q) {
4490
+ return window.matchMedia(q).matches;
4491
+ };
4492
+ if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
4493
+ return true;
4494
+ }
4495
+ // include the 'heartz' as a way to have a non matching MQ to help terminate the join
4496
+ // https://git.io/vznFH
4497
+ var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
4498
+ return mq(query);
4499
+ }
4500
+
4501
+ function getEnumOptions(enumClass) {
4502
+ return Object.keys(enumClass)
4503
+ .map(function (v) { return enumClass[v]; })
4504
+ .filter(function (v) { return isNaN(+v) === false; })
4505
+ .map(function (v) { return +v; });
4506
+ }
4507
+
4508
+ function handleError(error, force, production) {
4509
+ if (force === void 0) { force = false; }
4510
+ if (production === void 0) { production = true; }
4511
+ if (!(error && (error.status === 0 || error.status === 404)) || (force && error.status !== 0)) {
4512
+ browser.captureException(error);
4513
+ }
4514
+ if (!production) {
4515
+ console.error(error);
4516
+ }
4517
+ }
4518
+
4519
+ function getIconsData(folder) {
4520
+ return [
4521
+ { rel: 'apple-touch-icon', sizes: '180x180', href: "/assets/favicon/" + folder + "apple-touch-icon.png" },
4522
+ { rel: 'icon', type: 'image/png', sizes: '32x32', href: "/assets/favicon/" + folder + "favicon-32x32.png" },
4523
+ { rel: 'icon', type: 'image/png', sizes: '16x16', href: "/assets/favicon/" + folder + "favicon-16x16.png" },
4524
+ { rel: 'shortcut icon', href: "/assets/favicon/" + folder + "favicon.ico" },
4525
+ { rel: 'manifest', href: "/assets/favicon/" + folder + "site.webmanifest" },
4526
+ { rel: 'mask-icon', href: "/assets/favicon/" + folder + "safari-pinned-tab.svg", color: '#ff0000' }
4527
+ ];
4528
+ }
4529
+ function changeFavicons(document, leagueAlias) {
4530
+ var e_1, _a, e_2, _b;
4531
+ var folder = '';
4532
+ if (leagueAlias === 'ablmoscow') {
4533
+ folder = 'abl/';
4534
+ }
4535
+ var data = getIconsData(folder);
4536
+ try {
4537
+ for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
4538
+ var item = data_1_1.value;
4539
+ var link = document.createElement('link');
4540
+ try {
4541
+ for (var _c = (e_2 = void 0, __values(Object.keys(item))), _d = _c.next(); !_d.done; _d = _c.next()) {
4542
+ var key = _d.value;
4543
+ link.setAttribute(key, item[key]);
4544
+ }
4545
+ }
4546
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4547
+ finally {
4548
+ try {
4549
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
4550
+ }
4551
+ finally { if (e_2) throw e_2.error; }
4552
+ }
4553
+ document.head.appendChild(link);
4554
+ }
4555
+ }
4556
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4557
+ finally {
4558
+ try {
4559
+ if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
4560
+ }
4561
+ finally { if (e_1) throw e_1.error; }
4562
+ }
4563
+ }
4564
+
4565
+ function markFormGroupTouched(formGroup) {
4566
+ Object.values(formGroup.controls).forEach(function (control) {
4567
+ control.markAsTouched();
4568
+ control.markAsDirty();
4569
+ if (control instanceof forms.FormGroup) {
4570
+ markFormGroupTouched(control);
4571
+ }
4572
+ else if (control.controls) {
4573
+ control.controls.forEach(function (c) {
4574
+ if (c instanceof forms.FormGroup) {
4575
+ markFormGroupTouched(c);
4576
+ }
4577
+ else {
4578
+ c.markAsTouched();
4579
+ c.markAsDirty();
4580
+ }
4581
+ });
4582
+ }
4583
+ });
4584
+ }
4585
+
4586
+ var minLengthArrayValidator = function (minLength) {
4587
+ return function (c) {
4588
+ return c.value.length < minLength
4589
+ ? { minLengthArray: { valid: false } }
4590
+ : null;
4591
+ };
4592
+ };
4593
+ var validatePhone = function (control) {
4594
+ if (!control.value) {
4595
+ return null;
4596
+ }
4597
+ var value = ("" + control.value).replace(/\D/gi, '');
4598
+ return value.length === 11 ? null : { invalidPhone: { valid: false } };
4599
+ };
4600
+ var validateDate = function (control) {
4601
+ var re = /\d{2}\.\d{2}\.\d{4}/gi;
4602
+ if (!control.value || re.test(control.value)) {
4603
+ return null;
4604
+ }
4605
+ return { invalidDate: { valid: false } };
4606
+ };
4607
+ var validateEmail = function (authService, selfCheck, ignore) {
4608
+ if (selfCheck === void 0) { selfCheck = true; }
4609
+ if (ignore === void 0) { ignore = []; }
4610
+ var subject = rxjs.of(null).pipe(operators.delay(500));
4611
+ return function (control) {
4612
+ if (ignore.indexOf(control.value) > -1) {
4613
+ return rxjs.of(null);
4614
+ }
4615
+ return subject.pipe(operators.switchMap(function () { return authService.checkEmail(control.value, selfCheck).pipe(operators.map(function (valid) { return valid ? null : { emailTaken: true }; })); }));
4616
+ };
4617
+ };
4618
+ var validateUrl = function (control) {
4619
+ var re = /^(?:http(s)?:\/\/)[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/;
4620
+ if (!control.value || re.test(control.value)) {
4621
+ return null;
4622
+ }
4623
+ return { invalidUrl: true };
4624
+ };
4625
+ function fileSizeValidator(maxFileSize) {
4626
+ return function (control) {
4627
+ if (!control.value) {
4628
+ return null;
4629
+ }
4630
+ };
4631
+ }
4632
+
4633
+ var HttpCookieInterceptor = /** @class */ (function () {
4634
+ function HttpCookieInterceptor(injector, platformId) {
4635
+ this.injector = injector;
4636
+ this.platformId = platformId;
4637
+ this.isBrowser = common.isPlatformBrowser(this.platformId);
4638
+ }
4639
+ HttpCookieInterceptor.prototype.intercept = function (req, next) {
4640
+ if (!this.isBrowser) {
4641
+ return next.handle(req);
4642
+ }
4643
+ req = req.clone({ withCredentials: true });
4644
+ var csrf = getCookie('csrftoken');
4645
+ if (csrf) {
4646
+ req = req.clone({
4647
+ setHeaders: { 'X-CSRFToken': csrf }
4648
+ });
4649
+ }
4650
+ return next.handle(req);
4651
+ };
4652
+ HttpCookieInterceptor.ctorParameters = function () { return [
4653
+ { type: core.Injector },
4654
+ { type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
4655
+ ]; };
4656
+ HttpCookieInterceptor = __decorate([
4657
+ core.Injectable(),
4658
+ __param(1, core.Inject(core.PLATFORM_ID))
4659
+ ], HttpCookieInterceptor);
4660
+ return HttpCookieInterceptor;
4661
+ }());
4662
+
4663
+ exports.BaseModel = BaseModel;
4664
+ exports.BaseService = BaseService;
4665
+ exports.BasketballGameApi = BasketballGameApi;
4666
+ exports.BasketballGameConfig = BasketballGameConfig;
4667
+ exports.BasketballGameLog = BasketballGameLog;
4668
+ exports.BasketballGameLogTypeLocalization = BasketballGameLogTypeLocalization;
4669
+ exports.BasketballGameStatistic = BasketballGameStatistic;
4670
+ exports.BasketballGameTeamStatistic = BasketballGameTeamStatistic;
4671
+ exports.BasketballProfile = BasketballProfile;
4672
+ exports.BasketballStatistic = BasketballStatistic;
4673
+ exports.CONFIG_DATA = CONFIG_DATA;
4674
+ exports.CentrifugoService = CentrifugoService;
4675
+ exports.City = City;
4676
+ exports.ConfigService = ConfigService;
4677
+ exports.DateField = DateField;
4678
+ exports.DateTimeField = DateTimeField;
4679
+ exports.FAULT_LOG_TYPES = FAULT_LOG_TYPES;
4680
+ exports.File = File;
4681
+ exports.Game = Game;
4682
+ exports.GameBasketballPositionLocalization = GameBasketballPositionLocalization;
4683
+ exports.GameBasketballPositionShortLocalization = GameBasketballPositionShortLocalization;
4684
+ exports.GameInvite = GameInvite;
4685
+ exports.GameTimelineStageItem = GameTimelineStageItem;
4686
+ exports.GameTimelineStages = GameTimelineStages;
4687
+ exports.GameUser = GameUser;
4688
+ exports.GameVolleyballPositionLocalization = GameVolleyballPositionLocalization;
4689
+ exports.GameVolleyballPositionShortLocalization = GameVolleyballPositionShortLocalization;
4690
+ exports.GameVolleyballPositionShortRuLocalization = GameVolleyballPositionShortRuLocalization;
4691
+ exports.HttpCookieInterceptor = HttpCookieInterceptor;
4692
+ exports.League = League;
4693
+ exports.LeagueApi = LeagueApi;
4694
+ exports.LeagueCourt = LeagueCourt;
4695
+ exports.LocalStorageEngine = LocalStorageEngine;
4696
+ exports.MediaApi = MediaApi;
4697
+ exports.MediaItem = MediaItem;
4698
+ exports.ModelInstance = ModelInstance;
4699
+ exports.Notification = Notification;
4700
+ exports.NotificationApi = NotificationApi;
4701
+ exports.NotificationBaseApi = NotificationBaseApi;
4702
+ exports.NotificationSettings = NotificationSettings;
4703
+ exports.OrgNotificationApi = OrgNotificationApi;
4704
+ exports.Organization = Organization;
4705
+ exports.OvertimeTypeLocalization = OvertimeTypeLocalization;
4706
+ exports.Playoff = Playoff;
4707
+ exports.PlayoffSettings = PlayoffSettings;
4708
+ exports.Poll = Poll;
4709
+ exports.PollAnswer = PollAnswer;
4710
+ exports.PollVariant = PollVariant;
4711
+ exports.ReferenceApi = ReferenceApi;
4712
+ exports.SCORE_LOG_TYPES = SCORE_LOG_TYPES;
4713
+ exports.Sport = Sport;
4714
+ exports.StorageEngine = StorageEngine;
4715
+ exports.StorageEngineField = StorageEngineField;
4716
+ exports.Store = Store;
4717
+ exports.Team = Team;
4718
+ exports.TeamEvent = TeamEvent;
4719
+ exports.TeamEventInvite = TeamEventInvite;
4720
+ exports.TeamEventTypeLocalization = TeamEventTypeLocalization;
4721
+ exports.TeamInvite = TeamInvite;
4722
+ exports.TeamInviteExternal = TeamInviteExternal;
4723
+ exports.TeamUser = TeamUser;
4724
+ exports.TeamUserRoleLocalization = TeamUserRoleLocalization;
4725
+ exports.ToBackHook = ToBackHook;
4726
+ exports.ToFrontHook = ToFrontHook;
4727
+ exports.Tournament = Tournament;
4728
+ exports.TournamentApi = TournamentApi;
4729
+ exports.TournamentDisqualification = TournamentDisqualification;
4730
+ exports.TournamentEvent = TournamentEvent;
4731
+ exports.TournamentGroup = TournamentGroup;
4732
+ exports.TournamentInvite = TournamentInvite;
4733
+ exports.TournamentJoinApi = TournamentJoinApi;
4734
+ exports.TournamentJoinData = TournamentJoinData;
4735
+ exports.TournamentJoinTeam = TournamentJoinTeam;
4736
+ exports.TournamentNews = TournamentNews;
4737
+ exports.TournamentSettings = TournamentSettings;
4738
+ exports.TournamentStage = TournamentStage;
4739
+ exports.TournamentStageApi = TournamentStageApi;
4740
+ exports.TournamentStageTeam = TournamentStageTeam;
4741
+ exports.TournamentTeam = TournamentTeam;
4742
+ exports.TournamentTeamUser = TournamentTeamUser;
4743
+ exports.TournamentTeamUserInvite = TournamentTeamUserInvite;
4744
+ exports.TournamentTeamWinner = TournamentTeamWinner;
4745
+ exports.UntilDestroy = UntilDestroy;
4746
+ exports.User = User;
4747
+ exports.UserProfile = UserProfile;
4748
+ exports.VolleyballGameApi = VolleyballGameApi;
4749
+ exports.VolleyballGameConfig = VolleyballGameConfig;
4750
+ exports.VolleyballGameLog = VolleyballGameLog;
4751
+ exports.VolleyballGameLogTypeLocalization = VolleyballGameLogTypeLocalization;
4752
+ exports.VolleyballGameStatistic = VolleyballGameStatistic;
4753
+ exports.VolleyballGameTeamStatistic = VolleyballGameTeamStatistic;
4754
+ exports.VolleyballProfile = VolleyballProfile;
4755
+ exports.VolleyballStatistic = VolleyballStatistic;
4756
+ exports.VolleyballWorkHandLocalization = VolleyballWorkHandLocalization;
4757
+ exports.WorkHandLocalization = WorkHandLocalization;
4758
+ exports.addItemInArray = addItemInArray;
4759
+ exports.changeFavicons = changeFavicons;
4760
+ exports.componentDestroyed = componentDestroyed;
4761
+ exports.deleteItemFromArray = deleteItemFromArray;
4762
+ exports.enumField = enumField;
4763
+ exports.fileSizeValidator = fileSizeValidator;
4764
+ exports.generateArray = generateArray;
4765
+ exports.getArrayChunks = getArrayChunks;
4766
+ exports.getCookie = getCookie;
4767
+ exports.getEnumOptions = getEnumOptions;
4768
+ exports.getIconsData = getIconsData;
4769
+ exports.handleError = handleError;
4770
+ exports.isTouchDevice = isTouchDevice;
4771
+ exports.listField = listField;
4772
+ exports.markFormGroupTouched = markFormGroupTouched;
4773
+ exports.minLengthArrayValidator = minLengthArrayValidator;
4774
+ exports.patchItemInArray = patchItemInArray;
4775
+ exports.updateItemInArray = updateItemInArray;
4776
+ exports.updateItemsInArray = updateItemsInArray;
4777
+ exports.validateDate = validateDate;
4778
+ exports.validateEmail = validateEmail;
4779
+ exports.validatePhone = validatePhone;
4780
+ exports.validateUrl = validateUrl;
4781
+
4782
+ Object.defineProperty(exports, '__esModule', { value: true });
4783
+
4784
+ })));
4785
+ //# sourceMappingURL=mtgame-core.umd.js.map