touchstudy-core 0.1.0 → 0.1.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.
@@ -1,20 +1,902 @@
1
- import { createAction } from '@reduxjs/toolkit';
2
- import React from 'react';
3
- import { Row, Col } from 'reactstrap';
1
+ import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
2
+ import moment from 'moment';
3
+ import React, { useCallback, useState, useEffect, Fragment, useRef } from 'react';
4
+ import { useGoogleReCaptcha, GoogleReCaptcha, GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
5
+ import { Row, Col, Form, FormGroup, Modal, ModalHeader, ModalBody, ModalFooter, Button, Alert, Pagination, PaginationItem, PaginationLink } from 'reactstrap';
6
+ import { Formik } from 'formik';
7
+ import { object, string, boolean } from 'yup';
8
+ import GoogleLogin from '@leecheuk/react-google-login';
9
+ import axios from 'axios';
10
+ import { useDispatch, useSelector } from 'react-redux';
11
+ import { gapi } from 'gapi-script';
12
+
13
+ function _extends() {
14
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
15
+ for (var i = 1; i < arguments.length; i++) {
16
+ var source = arguments[i];
17
+ for (var key in source) {
18
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
19
+ target[key] = source[key];
20
+ }
21
+ }
22
+ }
23
+ return target;
24
+ };
25
+ return _extends.apply(this, arguments);
26
+ }
27
+
28
+ function isAbsolute(pathname) {
29
+ return pathname.charAt(0) === '/';
30
+ }
31
+
32
+ // About 1.5x faster than the two-arg version of Array#splice()
33
+ function spliceOne(list, index) {
34
+ for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
35
+ list[i] = list[k];
36
+ }
37
+
38
+ list.pop();
39
+ }
40
+
41
+ // This implementation is based heavily on node's url.parse
42
+ function resolvePathname(to, from) {
43
+ if (from === undefined) from = '';
44
+
45
+ var toParts = (to && to.split('/')) || [];
46
+ var fromParts = (from && from.split('/')) || [];
47
+
48
+ var isToAbs = to && isAbsolute(to);
49
+ var isFromAbs = from && isAbsolute(from);
50
+ var mustEndAbs = isToAbs || isFromAbs;
51
+
52
+ if (to && isAbsolute(to)) {
53
+ // to is absolute
54
+ fromParts = toParts;
55
+ } else if (toParts.length) {
56
+ // to is relative, drop the filename
57
+ fromParts.pop();
58
+ fromParts = fromParts.concat(toParts);
59
+ }
60
+
61
+ if (!fromParts.length) return '/';
62
+
63
+ var hasTrailingSlash;
64
+ if (fromParts.length) {
65
+ var last = fromParts[fromParts.length - 1];
66
+ hasTrailingSlash = last === '.' || last === '..' || last === '';
67
+ } else {
68
+ hasTrailingSlash = false;
69
+ }
70
+
71
+ var up = 0;
72
+ for (var i = fromParts.length; i >= 0; i--) {
73
+ var part = fromParts[i];
74
+
75
+ if (part === '.') {
76
+ spliceOne(fromParts, i);
77
+ } else if (part === '..') {
78
+ spliceOne(fromParts, i);
79
+ up++;
80
+ } else if (up) {
81
+ spliceOne(fromParts, i);
82
+ up--;
83
+ }
84
+ }
85
+
86
+ if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
87
+
88
+ if (
89
+ mustEndAbs &&
90
+ fromParts[0] !== '' &&
91
+ (!fromParts[0] || !isAbsolute(fromParts[0]))
92
+ )
93
+ fromParts.unshift('');
94
+
95
+ var result = fromParts.join('/');
96
+
97
+ if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
98
+
99
+ return result;
100
+ }
101
+
102
+ var isProduction = process.env.NODE_ENV === 'production';
103
+ function warning(condition, message) {
104
+ if (!isProduction) {
105
+ if (condition) {
106
+ return;
107
+ }
108
+
109
+ var text = "Warning: " + message;
110
+
111
+ if (typeof console !== 'undefined') {
112
+ console.warn(text);
113
+ }
114
+
115
+ try {
116
+ throw Error(text);
117
+ } catch (x) {}
118
+ }
119
+ }
120
+
121
+ var isProduction$1 = process.env.NODE_ENV === 'production';
122
+ var prefix = 'Invariant failed';
123
+ function invariant(condition, message) {
124
+ if (condition) {
125
+ return;
126
+ }
127
+ if (isProduction$1) {
128
+ throw new Error(prefix);
129
+ }
130
+ var provided = typeof message === 'function' ? message() : message;
131
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
132
+ throw new Error(value);
133
+ }
134
+
135
+ function addLeadingSlash(path) {
136
+ return path.charAt(0) === '/' ? path : '/' + path;
137
+ }
138
+ function hasBasename(path, prefix) {
139
+ return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
140
+ }
141
+ function stripBasename(path, prefix) {
142
+ return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
143
+ }
144
+ function stripTrailingSlash(path) {
145
+ return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
146
+ }
147
+ function parsePath(path) {
148
+ var pathname = path || '/';
149
+ var search = '';
150
+ var hash = '';
151
+ var hashIndex = pathname.indexOf('#');
152
+
153
+ if (hashIndex !== -1) {
154
+ hash = pathname.substr(hashIndex);
155
+ pathname = pathname.substr(0, hashIndex);
156
+ }
157
+
158
+ var searchIndex = pathname.indexOf('?');
159
+
160
+ if (searchIndex !== -1) {
161
+ search = pathname.substr(searchIndex);
162
+ pathname = pathname.substr(0, searchIndex);
163
+ }
164
+
165
+ return {
166
+ pathname: pathname,
167
+ search: search === '?' ? '' : search,
168
+ hash: hash === '#' ? '' : hash
169
+ };
170
+ }
171
+ function createPath(location) {
172
+ var pathname = location.pathname,
173
+ search = location.search,
174
+ hash = location.hash;
175
+ var path = pathname || '/';
176
+ if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
177
+ if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
178
+ return path;
179
+ }
180
+
181
+ function createLocation(path, state, key, currentLocation) {
182
+ var location;
183
+
184
+ if (typeof path === 'string') {
185
+ // Two-arg form: push(path, state)
186
+ location = parsePath(path);
187
+ location.state = state;
188
+ } else {
189
+ // One-arg form: push(location)
190
+ location = _extends({}, path);
191
+ if (location.pathname === undefined) location.pathname = '';
192
+
193
+ if (location.search) {
194
+ if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
195
+ } else {
196
+ location.search = '';
197
+ }
198
+
199
+ if (location.hash) {
200
+ if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
201
+ } else {
202
+ location.hash = '';
203
+ }
204
+
205
+ if (state !== undefined && location.state === undefined) location.state = state;
206
+ }
207
+
208
+ try {
209
+ location.pathname = decodeURI(location.pathname);
210
+ } catch (e) {
211
+ if (e instanceof URIError) {
212
+ throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
213
+ } else {
214
+ throw e;
215
+ }
216
+ }
217
+
218
+ if (key) location.key = key;
219
+
220
+ if (currentLocation) {
221
+ // Resolve incomplete/relative pathname relative to current location.
222
+ if (!location.pathname) {
223
+ location.pathname = currentLocation.pathname;
224
+ } else if (location.pathname.charAt(0) !== '/') {
225
+ location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
226
+ }
227
+ } else {
228
+ // When there is no prior location and pathname is empty, set it to /
229
+ if (!location.pathname) {
230
+ location.pathname = '/';
231
+ }
232
+ }
233
+
234
+ return location;
235
+ }
236
+
237
+ function createTransitionManager() {
238
+ var prompt = null;
239
+
240
+ function setPrompt(nextPrompt) {
241
+ process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
242
+ prompt = nextPrompt;
243
+ return function () {
244
+ if (prompt === nextPrompt) prompt = null;
245
+ };
246
+ }
247
+
248
+ function confirmTransitionTo(location, action, getUserConfirmation, callback) {
249
+ // TODO: If another transition starts while we're still confirming
250
+ // the previous one, we may end up in a weird state. Figure out the
251
+ // best way to handle this.
252
+ if (prompt != null) {
253
+ var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
254
+
255
+ if (typeof result === 'string') {
256
+ if (typeof getUserConfirmation === 'function') {
257
+ getUserConfirmation(result, callback);
258
+ } else {
259
+ process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
260
+ callback(true);
261
+ }
262
+ } else {
263
+ // Return false from a transition hook to cancel the transition.
264
+ callback(result !== false);
265
+ }
266
+ } else {
267
+ callback(true);
268
+ }
269
+ }
270
+
271
+ var listeners = [];
272
+
273
+ function appendListener(fn) {
274
+ var isActive = true;
275
+
276
+ function listener() {
277
+ if (isActive) fn.apply(void 0, arguments);
278
+ }
279
+
280
+ listeners.push(listener);
281
+ return function () {
282
+ isActive = false;
283
+ listeners = listeners.filter(function (item) {
284
+ return item !== listener;
285
+ });
286
+ };
287
+ }
288
+
289
+ function notifyListeners() {
290
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
291
+ args[_key] = arguments[_key];
292
+ }
293
+
294
+ listeners.forEach(function (listener) {
295
+ return listener.apply(void 0, args);
296
+ });
297
+ }
298
+
299
+ return {
300
+ setPrompt: setPrompt,
301
+ confirmTransitionTo: confirmTransitionTo,
302
+ appendListener: appendListener,
303
+ notifyListeners: notifyListeners
304
+ };
305
+ }
306
+
307
+ var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
308
+ function getConfirmation(message, callback) {
309
+ callback(window.confirm(message)); // eslint-disable-line no-alert
310
+ }
311
+ /**
312
+ * Returns true if the HTML5 history API is supported. Taken from Modernizr.
313
+ *
314
+ * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
315
+ * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
316
+ * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
317
+ */
318
+
319
+ function supportsHistory() {
320
+ var ua = window.navigator.userAgent;
321
+ if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
322
+ return window.history && 'pushState' in window.history;
323
+ }
324
+ /**
325
+ * Returns true if browser fires popstate on hash change.
326
+ * IE10 and IE11 do not.
327
+ */
328
+
329
+ function supportsPopStateOnHashChange() {
330
+ return window.navigator.userAgent.indexOf('Trident') === -1;
331
+ }
332
+ /**
333
+ * Returns true if a given popstate event is an extraneous WebKit event.
334
+ * Accounts for the fact that Chrome on iOS fires real popstate events
335
+ * containing undefined state when pressing the back button.
336
+ */
337
+
338
+ function isExtraneousPopstateEvent(event) {
339
+ return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
340
+ }
341
+
342
+ var PopStateEvent = 'popstate';
343
+ var HashChangeEvent = 'hashchange';
344
+
345
+ function getHistoryState() {
346
+ try {
347
+ return window.history.state || {};
348
+ } catch (e) {
349
+ // IE 11 sometimes throws when accessing window.history.state
350
+ // See https://github.com/ReactTraining/history/pull/289
351
+ return {};
352
+ }
353
+ }
354
+ /**
355
+ * Creates a history object that uses the HTML5 history API including
356
+ * pushState, replaceState, and the popstate event.
357
+ */
358
+
359
+
360
+ function createBrowserHistory(props) {
361
+ if (props === void 0) {
362
+ props = {};
363
+ }
364
+
365
+ !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
366
+ var globalHistory = window.history;
367
+ var canUseHistory = supportsHistory();
368
+ var needsHashChangeListener = !supportsPopStateOnHashChange();
369
+ var _props = props,
370
+ _props$forceRefresh = _props.forceRefresh,
371
+ forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
372
+ _props$getUserConfirm = _props.getUserConfirmation,
373
+ getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
374
+ _props$keyLength = _props.keyLength,
375
+ keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
376
+ var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
377
+
378
+ function getDOMLocation(historyState) {
379
+ var _ref = historyState || {},
380
+ key = _ref.key,
381
+ state = _ref.state;
382
+
383
+ var _window$location = window.location,
384
+ pathname = _window$location.pathname,
385
+ search = _window$location.search,
386
+ hash = _window$location.hash;
387
+ var path = pathname + search + hash;
388
+ process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
389
+ if (basename) path = stripBasename(path, basename);
390
+ return createLocation(path, state, key);
391
+ }
392
+
393
+ function createKey() {
394
+ return Math.random().toString(36).substr(2, keyLength);
395
+ }
396
+
397
+ var transitionManager = createTransitionManager();
398
+
399
+ function setState(nextState) {
400
+ _extends(history, nextState);
401
+
402
+ history.length = globalHistory.length;
403
+ transitionManager.notifyListeners(history.location, history.action);
404
+ }
405
+
406
+ function handlePopState(event) {
407
+ // Ignore extraneous popstate events in WebKit.
408
+ if (isExtraneousPopstateEvent(event)) return;
409
+ handlePop(getDOMLocation(event.state));
410
+ }
411
+
412
+ function handleHashChange() {
413
+ handlePop(getDOMLocation(getHistoryState()));
414
+ }
415
+
416
+ var forceNextPop = false;
417
+
418
+ function handlePop(location) {
419
+ if (forceNextPop) {
420
+ forceNextPop = false;
421
+ setState();
422
+ } else {
423
+ var action = 'POP';
424
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
425
+ if (ok) {
426
+ setState({
427
+ action: action,
428
+ location: location
429
+ });
430
+ } else {
431
+ revertPop(location);
432
+ }
433
+ });
434
+ }
435
+ }
436
+
437
+ function revertPop(fromLocation) {
438
+ var toLocation = history.location; // TODO: We could probably make this more reliable by
439
+ // keeping a list of keys we've seen in sessionStorage.
440
+ // Instead, we just default to 0 for keys we don't know.
441
+
442
+ var toIndex = allKeys.indexOf(toLocation.key);
443
+ if (toIndex === -1) toIndex = 0;
444
+ var fromIndex = allKeys.indexOf(fromLocation.key);
445
+ if (fromIndex === -1) fromIndex = 0;
446
+ var delta = toIndex - fromIndex;
447
+
448
+ if (delta) {
449
+ forceNextPop = true;
450
+ go(delta);
451
+ }
452
+ }
453
+
454
+ var initialLocation = getDOMLocation(getHistoryState());
455
+ var allKeys = [initialLocation.key]; // Public interface
456
+
457
+ function createHref(location) {
458
+ return basename + createPath(location);
459
+ }
460
+
461
+ function push(path, state) {
462
+ process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
463
+ var action = 'PUSH';
464
+ var location = createLocation(path, state, createKey(), history.location);
465
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
466
+ if (!ok) return;
467
+ var href = createHref(location);
468
+ var key = location.key,
469
+ state = location.state;
470
+
471
+ if (canUseHistory) {
472
+ globalHistory.pushState({
473
+ key: key,
474
+ state: state
475
+ }, null, href);
476
+
477
+ if (forceRefresh) {
478
+ window.location.href = href;
479
+ } else {
480
+ var prevIndex = allKeys.indexOf(history.location.key);
481
+ var nextKeys = allKeys.slice(0, prevIndex + 1);
482
+ nextKeys.push(location.key);
483
+ allKeys = nextKeys;
484
+ setState({
485
+ action: action,
486
+ location: location
487
+ });
488
+ }
489
+ } else {
490
+ process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
491
+ window.location.href = href;
492
+ }
493
+ });
494
+ }
495
+
496
+ function replace(path, state) {
497
+ process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
498
+ var action = 'REPLACE';
499
+ var location = createLocation(path, state, createKey(), history.location);
500
+ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
501
+ if (!ok) return;
502
+ var href = createHref(location);
503
+ var key = location.key,
504
+ state = location.state;
505
+
506
+ if (canUseHistory) {
507
+ globalHistory.replaceState({
508
+ key: key,
509
+ state: state
510
+ }, null, href);
511
+
512
+ if (forceRefresh) {
513
+ window.location.replace(href);
514
+ } else {
515
+ var prevIndex = allKeys.indexOf(history.location.key);
516
+ if (prevIndex !== -1) allKeys[prevIndex] = location.key;
517
+ setState({
518
+ action: action,
519
+ location: location
520
+ });
521
+ }
522
+ } else {
523
+ process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
524
+ window.location.replace(href);
525
+ }
526
+ });
527
+ }
528
+
529
+ function go(n) {
530
+ globalHistory.go(n);
531
+ }
532
+
533
+ function goBack() {
534
+ go(-1);
535
+ }
536
+
537
+ function goForward() {
538
+ go(1);
539
+ }
540
+
541
+ var listenerCount = 0;
542
+
543
+ function checkDOMListeners(delta) {
544
+ listenerCount += delta;
545
+
546
+ if (listenerCount === 1 && delta === 1) {
547
+ window.addEventListener(PopStateEvent, handlePopState);
548
+ if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
549
+ } else if (listenerCount === 0) {
550
+ window.removeEventListener(PopStateEvent, handlePopState);
551
+ if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
552
+ }
553
+ }
554
+
555
+ var isBlocked = false;
556
+
557
+ function block(prompt) {
558
+ if (prompt === void 0) {
559
+ prompt = false;
560
+ }
561
+
562
+ var unblock = transitionManager.setPrompt(prompt);
563
+
564
+ if (!isBlocked) {
565
+ checkDOMListeners(1);
566
+ isBlocked = true;
567
+ }
568
+
569
+ return function () {
570
+ if (isBlocked) {
571
+ isBlocked = false;
572
+ checkDOMListeners(-1);
573
+ }
574
+
575
+ return unblock();
576
+ };
577
+ }
578
+
579
+ function listen(listener) {
580
+ var unlisten = transitionManager.appendListener(listener);
581
+ checkDOMListeners(1);
582
+ return function () {
583
+ checkDOMListeners(-1);
584
+ unlisten();
585
+ };
586
+ }
587
+
588
+ var history = {
589
+ length: globalHistory.length,
590
+ action: 'POP',
591
+ location: initialLocation,
592
+ createHref: createHref,
593
+ push: push,
594
+ replace: replace,
595
+ go: go,
596
+ goBack: goBack,
597
+ goForward: goForward,
598
+ block: block,
599
+ listen: listen
600
+ };
601
+ return history;
602
+ }
4
603
 
5
604
  var setLoading = createAction("common/setLoading");
6
605
  var setAlert = createAction("common/setAlert");
606
+ var setUser = createAction("common/setUser");
7
607
 
608
+ var GOOGLE_CLIENT_ID = "64118819726-0qlur4qjrs9jbuu6rnoa0u91g680lmpg.apps.googleusercontent.com";
609
+ var GOOGLE_RECAPTCHA_ID = "6LfNtLUaAAAAAL24lbBV11jS-gBtt1mhtxb4NXs0";
8
610
  var ACCESS_TOKEN = "ACCESS_TOKEN";
9
- var BASE_URL = function () {
10
- var windowUrl = window.location.href;
11
- var url = windowUrl.split("//")[0] + "//" + windowUrl.split("//")[1].split("/")[0];
12
- return url;
13
- }();
611
+ var DATE_MIN_VALUE = "0001-01-01T00:00:00+00:00";
612
+ var BASE_URL = "https://ec0e-123-24-205-68.ngrok-free.app";
613
+ var getAccessToken = function getAccessToken() {
614
+ try {
615
+ return localStorage.getItem(ACCESS_TOKEN);
616
+ } catch (err) {
617
+ return null;
618
+ }
619
+ };
620
+ var encodeParams = function encodeParams(params) {
621
+ return Object.keys(params).filter(function (key) {
622
+ return params[key] || params[key] === 0 || params[key] === false;
623
+ }).map(function (key) {
624
+ if (Array.isArray(params[key])) {
625
+ return params[key].map(function (i) {
626
+ return encodeURIComponent(key) + "=" + encodeURIComponent(i);
627
+ }).join('&');
628
+ }
629
+ return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
630
+ }).join('&');
631
+ };
632
+
633
+ var utcToLocalTime = (function (time, FORMAT) {
634
+ if (time === DATE_MIN_VALUE) return "";
635
+ try {
636
+ return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
637
+ } catch (_unused) {
638
+ return "";
639
+ }
640
+ });
641
+
642
+ // A type of promise-like that resolves synchronously and supports only one observer
643
+
644
+ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
645
+
646
+ const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
647
+
648
+ // Asynchronously call a function and send errors to recovery continuation
649
+ function _catch(body, recover) {
650
+ try {
651
+ var result = body();
652
+ } catch(e) {
653
+ return recover(e);
654
+ }
655
+ if (result && result.then) {
656
+ return result.then(void 0, recover);
657
+ }
658
+ return result;
659
+ }
660
+
661
+ var styles = {"btn-login-google":"_2HqmH","block-login":"_wWIyO","box-login":"_38Lo1"};
662
+
663
+ var api = axios.create({
664
+ baseURL: BASE_URL,
665
+ timeout: 0,
666
+ headers: {
667
+ "Content-Type": "application/json"
668
+ },
669
+ paramsSerializer: function paramsSerializer(params) {
670
+ return encodeParams(params);
671
+ }
672
+ });
673
+ var apiUpload = axios.create({
674
+ baseURL: BASE_URL,
675
+ timeout: 60000,
676
+ headers: {
677
+ "Content-Type": "multipart/form-data"
678
+ }
679
+ });
680
+ [api, apiUpload].forEach(function (i) {
681
+ return i.interceptors.request.use(function (config) {
682
+ var token = getAccessToken();
683
+ if (token) {
684
+ config.headers.Authorization = "Bearer " + token;
685
+ localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
686
+ }
687
+ return config;
688
+ }, function (error) {
689
+ return Promise.reject(error);
690
+ });
691
+ });
692
+ [api, apiUpload].forEach(function (i) {
693
+ return i.interceptors.response.use(function (response) {
694
+ return response;
695
+ }, function (error) {
696
+ console.log({
697
+ error: error
698
+ });
699
+ if (error.response.status === 401) {
700
+ window.location.href = "/login";
701
+ }
702
+ if (error.response.status == 403) {
703
+ localStorage.removeItem(ACCESS_TOKEN);
704
+ localStorage.removeItem("USER_EMAIL");
705
+ window.location.href = "/login";
706
+ }
707
+ return Promise.reject(error);
708
+ });
709
+ });
710
+
711
+ var apiLoginGoogle = function apiLoginGoogle(body) {
712
+ return api.post(BASE_URL + "/api/auth/login", body);
713
+ };
714
+
715
+ var ERROR_MESSAGE = "Login fail!";
716
+ var schema = object({
717
+ email: string().email("Email is invalid").required("Email is required"),
718
+ password: string().required("Password is required"),
719
+ rememberMe: boolean()
720
+ });
721
+ var BlockLogin = function BlockLogin(_ref) {
722
+ var defaultInfo = _ref.defaultInfo,
723
+ onNavigate = _ref.onNavigate,
724
+ isTeacher = _ref.isTeacher;
725
+ var dispatch = useDispatch();
726
+ var _useGoogleReCaptcha = useGoogleReCaptcha(),
727
+ executeRecaptcha = _useGoogleReCaptcha.executeRecaptcha;
728
+ var clickHandler = useCallback(function () {
729
+ try {
730
+ if (!executeRecaptcha) {
731
+ console.log("execute recaptcha undefined");
732
+ return Promise.resolve();
733
+ }
734
+ return Promise.resolve(executeRecaptcha("login"));
735
+ } catch (e) {
736
+ return Promise.reject(e);
737
+ }
738
+ }, [executeRecaptcha]);
739
+ var handleVerify = useCallback(function () {}, []);
740
+ var onSuccessGoogle = function onSuccessGoogle(res) {
741
+ try {
742
+ var _exit = false;
743
+ console.log("success");
744
+ console.log({
745
+ res: res
746
+ });
747
+ return Promise.resolve(function () {
748
+ if (!!(res !== null && res !== void 0 && res.accessToken)) {
749
+ var _temp2 = function _temp2(_result) {
750
+ if (_exit) return _result;
751
+ dispatch(setLoading(false));
752
+ };
753
+ var _res$profileObj = res.profileObj,
754
+ email = _res$profileObj.email,
755
+ imageUrl = _res$profileObj.imageUrl,
756
+ name = _res$profileObj.name;
757
+ var accessToken = res.tokenObj.id_token;
758
+ var googleId = res.googleId;
759
+ var infoLogin = {
760
+ imageUrl: imageUrl,
761
+ fullName: name,
762
+ email: email,
763
+ token: accessToken,
764
+ googleId: googleId,
765
+ role: isTeacher ? "Teacher" : "Student"
766
+ };
767
+ console.log({
768
+ infoLogin: infoLogin
769
+ });
770
+ dispatch(setLoading(true));
771
+ var _temp = _catch(function () {
772
+ return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (res1) {
773
+ var isFirstLogin = res1.data.isFirstLogin;
774
+ var tokenJWT = res1.data.token;
775
+ localStorage.setItem("USER_INFORMATION", JSON.stringify(infoLogin));
776
+ console.log({
777
+ res1: res1
778
+ });
779
+ localStorage.setItem(ACCESS_TOKEN, tokenJWT);
780
+ if (isTeacher) {
781
+ onNavigate("/teacher/overall-status/main");
782
+ _exit = true;
783
+ return;
784
+ }
785
+ if (isFirstLogin) {
786
+ onNavigate("/register/info");
787
+ } else {
788
+ onNavigate("/student/check/main");
789
+ }
790
+ });
791
+ }, function (error) {
792
+ var _error$response;
793
+ dispatch(setAlert({
794
+ type: "danger",
795
+ message: ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || ERROR_MESSAGE
796
+ }));
797
+ });
798
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
799
+ }
800
+ }());
801
+ } catch (e) {
802
+ return Promise.reject(e);
803
+ }
804
+ };
805
+ var onFailureGoogle = function onFailureGoogle(err) {
806
+ console.log("error: login google", err);
807
+ onNavigate("/login");
808
+ };
809
+ return React.createElement(Formik, {
810
+ initialValues: defaultInfo,
811
+ validationSchema: schema,
812
+ onSubmit: function (values) {
813
+ try {
814
+ return Promise.resolve(_catch(function () {
815
+ return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
816
+ if (!clickHandlerRes) return;
817
+ values.captcha = clickHandlerRes;
818
+ });
819
+ }, function (err) {
820
+ console.error(err);
821
+ }));
822
+ } catch (e) {
823
+ return Promise.reject(e);
824
+ }
825
+ }
826
+ }, function (formikProps) {
827
+ var handleSubmit = formikProps.handleSubmit;
828
+ return React.createElement(Row, {
829
+ className: "" + styles["box-login"]
830
+ }, React.createElement(Col, {
831
+ className: "p-0 d-flex justify-content-center"
832
+ }, React.createElement(Form, {
833
+ className: "" + styles["block-login"],
834
+ onSubmit: handleSubmit
835
+ }, React.createElement("div", {
836
+ className: "" + styles["block-form"]
837
+ }, React.createElement("img", {
838
+ src: "/images/logo.jpeg",
839
+ className: "" + styles["img-login-rectangle"]
840
+ }), React.createElement(FormGroup, null, React.createElement(GoogleReCaptcha, {
841
+ action: "login",
842
+ onVerify: handleVerify
843
+ })), React.createElement(Col, {
844
+ className: "p-0 mt-1 mb-4"
845
+ }, React.createElement(GoogleLogin, {
846
+ clientId: GOOGLE_CLIENT_ID,
847
+ buttonText: "Google \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778",
848
+ onSuccess: onSuccessGoogle,
849
+ onFailure: onFailureGoogle,
850
+ cookiePolicy: "single_host_origin",
851
+ className: "" + styles["btn-login-google"]
852
+ }))))));
853
+ });
854
+ };
14
855
 
15
- var styles = {"btn-login-google":"_2HqmH","notification-count":"_2sew7","text-introduction":"_3OgWF","btn-trans-border":"_r9cAh","contact":"_NszFe","learn-more":"_MDjzH","title-quote":"_1Swkw","descriptions-quote":"_gi8vj","box-login":"_38Lo1","block-verification":"_1OzGy","block-login":"_wWIyO","title-login":"_3nuns","title-forgot-password":"_21qb6","btn-close":"_NhW9l","btn-login":"_3IL10","digital-privacy-icon":"_141p1","return-to-login":"_Ce3Kg","recover-account":"_2t6d9","link-to-login":"_3bDsd","remember":"_11FZt","term-and-conditions":"_3LXoI","descriptions-forgot-pass":"_PMcjT","content-icon":"_2rZY6","descriptions-icon":"_3SOdX","title-icon":"_y9lM2","nav-home":"_1TT1q","box-introduction":"_32V6L","icon":"_20YJX","form-user-name":"_39BJD","input":"_ozRAq","checkbox-remember":"_2K9b2","btn-rounder":"_2VvIr","btn-active":"_2A0HF","block-reset-password":"_23Sua","block-forgot-pass":"_3CWP6","page-not-login":"_3Wmco","content-quote":"_13Rk0","home-page":"_o6HKW","bg-animate":"_30npl","active":"_3oAH-","show":"_16rY4","fade-in":"_26nbh","behind":"_3A7Vv","login":"_F-hjL","login-content":"_149oA","logo-home":"_24U3W","img-box":"_2v-L_","img-login":"_3ncTL","img-login-rectangle":"_2kOvJ","c-main":"_39l0X","container-fluid":"_1BMwK","input-file-label":"_1XNpH","delete-avatar-button":"_1z5h9","header-logo":"_Gewcf","box-sidebar":"_2vcmv","sidebar-logo":"_1hXpy","sidebar-nav-links":"_3vb3s","c-active":"_36jSM","sidebar-nav-links-hover":"_DNrus","box-sidebar-header":"_3NEZj","box-logout":"_1wUDG","sidebar-btn-minimized":"_1S7Px","sidebar-minimized-logo":"_3846X","sidebar-logout":"_2P85D","nav-mobile":"_1qjbW","filter-media-file":"_1I62C","div":"_3cLcM","dropdown-menu":"_1krbH","header-avatar":"_RQaHE","dropdown-menu-flag":"_XK8oS","dropdown-content":"_3ys4W","dropdown-change":"_ToOW_","item-address":"_3sQlR","item-logout":"_3bqSM","title-address":"_1jgSI","img-avatar":"_35Ttz","item-contact":"_1wc7o","logout":"_1_9tV","content-text":"_3S4f2","dropdown-content-language":"_3ajui","dropdown-item-language":"_3Y_y4","dropdown-item-language-active":"_CzNMi","popover__sort__item":"_1ocBa","popover__sort__item--active":"_18NhM","popover__search__icon":"_2bquW","popover__search__input":"_3A4G4","popover__options":"_1MsEW","button-export":"_2rTzM","button-content":"_18y0w","button-icon":"_3cZAT","hide-in-mobile":"_1INnO","hamburger-menu":"_2yRc8","box-content-home-page":"_ABUIP","collapse-box":"_WX97m","hide-in-desktop":"_2LIqK","control-input":"_2Zz97","custom-control":"_3-yp5","item-select-role":"_1KcY7","item-role-active":"_dOVso","model-switch-roles":"_3ZqxI","title":"_g-p72"};
856
+ var defaultInfo = {
857
+ email: "",
858
+ password: "",
859
+ captcha: "",
860
+ rememberMe: false
861
+ };
862
+ var useLogin = function useLogin() {
863
+ var _useState = useState(false),
864
+ openLogin = _useState[0],
865
+ setOpenLogin = _useState[1];
866
+ var _useState2 = useState(),
867
+ infoUser = _useState2[0],
868
+ setInfoUser = _useState2[1];
869
+ var toggle = useCallback(function () {
870
+ setOpenLogin(!openLogin);
871
+ }, [openLogin]);
872
+ var _useState3 = useState(false),
873
+ isShowPassword = _useState3[0],
874
+ setIsShowPassword = _useState3[1];
875
+ useEffect(function () {
876
+ var start = function start() {
877
+ gapi.client.init({
878
+ clientId: GOOGLE_CLIENT_ID,
879
+ scope: 'email'
880
+ });
881
+ };
882
+ gapi.load('client:auth2', start);
883
+ }, []);
884
+ return {
885
+ defaultInfo: defaultInfo,
886
+ openLogin: openLogin,
887
+ toggle: toggle,
888
+ isShowPassword: isShowPassword,
889
+ setIsShowPassword: setIsShowPassword,
890
+ infoUser: infoUser,
891
+ setInfoUser: setInfoUser
892
+ };
893
+ };
16
894
 
17
- var Login = function Login(_props) {
895
+ var Login = function Login(_ref) {
896
+ var onNavigate = _ref.onNavigate,
897
+ isTeacher = _ref.isTeacher;
898
+ var _useLogin = useLogin(),
899
+ defaultInfo = _useLogin.defaultInfo;
18
900
  return React.createElement("div", {
19
901
  className: styles["login"] + " container-fluid font-family-lato"
20
902
  }, React.createElement(Row, {
@@ -24,8 +906,594 @@ var Login = function Login(_props) {
24
906
  md: 12,
25
907
  xs: 12,
26
908
  className: "d-flex justify-content-center h-100 align-items-center"
27
- }, React.createElement("h1", null, "login 123"))));
909
+ }, React.createElement(GoogleReCaptchaProvider, {
910
+ useRecaptchaNet: true,
911
+ reCaptchaKey: GOOGLE_RECAPTCHA_ID,
912
+ scriptProps: {
913
+ async: true,
914
+ defer: true,
915
+ appendTo: "body"
916
+ }
917
+ }, React.createElement(BlockLogin, {
918
+ defaultInfo: defaultInfo,
919
+ onNavigate: onNavigate,
920
+ isTeacher: isTeacher
921
+ })))));
28
922
  };
29
923
 
30
- export { ACCESS_TOKEN, BASE_URL, Login, setLoading };
924
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
925
+
926
+ function unwrapExports (x) {
927
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
928
+ }
929
+
930
+ function createCommonjsModule(fn, module) {
931
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
932
+ }
933
+
934
+ var reduxLogger = createCommonjsModule(function (module, exports) {
935
+ !function(e,t){t(exports);}(commonjsGlobal,function(e){function t(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});}function r(e,t){Object.defineProperty(this,"kind",{value:e,enumerable:!0}),t&&t.length&&Object.defineProperty(this,"path",{value:t,enumerable:!0});}function n(e,t,r){n.super_.call(this,"E",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0}),Object.defineProperty(this,"rhs",{value:r,enumerable:!0});}function o(e,t){o.super_.call(this,"N",e),Object.defineProperty(this,"rhs",{value:t,enumerable:!0});}function i(e,t){i.super_.call(this,"D",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0});}function a(e,t,r){a.super_.call(this,"A",e),Object.defineProperty(this,"index",{value:t,enumerable:!0}),Object.defineProperty(this,"item",{value:r,enumerable:!0});}function f(e,t,r){var n=e.slice((r||t)+1||e.length);return e.length=t<0?e.length+t:t,e.push.apply(e,n),e}function u(e){var t="undefined"==typeof e?"undefined":N(e);return "object"!==t?t:e===Math?"math":null===e?"null":Array.isArray(e)?"array":"[object Date]"===Object.prototype.toString.call(e)?"date":"function"==typeof e.toString&&/^\/.*\//.test(e.toString())?"regexp":"object"}function l(e,t,r,c,s,d,p){s=s||[],p=p||[];var g=s.slice(0);if("undefined"!=typeof d){if(c){if("function"==typeof c&&c(g,d))return;if("object"===("undefined"==typeof c?"undefined":N(c))){if(c.prefilter&&c.prefilter(g,d))return;if(c.normalize){var h=c.normalize(g,d,e,t);h&&(e=h[0],t=h[1]);}}}g.push(d);}"regexp"===u(e)&&"regexp"===u(t)&&(e=e.toString(),t=t.toString());var y="undefined"==typeof e?"undefined":N(e),v="undefined"==typeof t?"undefined":N(t),b="undefined"!==y||p&&p[p.length-1].lhs&&p[p.length-1].lhs.hasOwnProperty(d),m="undefined"!==v||p&&p[p.length-1].rhs&&p[p.length-1].rhs.hasOwnProperty(d);if(!b&&m)r(new o(g,t));else if(!m&&b)r(new i(g,e));else if(u(e)!==u(t))r(new n(g,e,t));else if("date"===u(e)&&e-t!==0)r(new n(g,e,t));else if("object"===y&&null!==e&&null!==t)if(p.filter(function(t){return t.lhs===e}).length)e!==t&&r(new n(g,e,t));else {if(p.push({lhs:e,rhs:t}),Array.isArray(e)){var w;for(w=0;w<e.length;w++)w>=t.length?r(new a(g,w,new i(void 0,e[w]))):l(e[w],t[w],r,c,g,w,p);for(;w<t.length;)r(new a(g,w,new o(void 0,t[w++])));}else {var x=Object.keys(e),S=Object.keys(t);x.forEach(function(n,o){var i=S.indexOf(n);i>=0?(l(e[n],t[n],r,c,g,n,p),S=f(S,i)):l(e[n],void 0,r,c,g,n,p);}),S.forEach(function(e){l(void 0,t[e],r,c,g,e,p);});}p.length=p.length-1;}else e!==t&&("number"===y&&isNaN(e)&&isNaN(t)||r(new n(g,e,t)));}function c(e,t,r,n){return n=n||[],l(e,t,function(e){e&&n.push(e);},r),n.length?n:void 0}function s(e,t,r){if(r.path&&r.path.length){var n,o=e[t],i=r.path.length-1;for(n=0;n<i;n++)o=o[r.path[n]];switch(r.kind){case"A":s(o[r.path[n]],r.index,r.item);break;case"D":delete o[r.path[n]];break;case"E":case"N":o[r.path[n]]=r.rhs;}}else switch(r.kind){case"A":s(e[t],r.index,r.item);break;case"D":e=f(e,t);break;case"E":case"N":e[t]=r.rhs;}return e}function d(e,t,r){if(e&&t&&r&&r.kind){for(var n=e,o=-1,i=r.path?r.path.length-1:0;++o<i;)"undefined"==typeof n[r.path[o]]&&(n[r.path[o]]="number"==typeof r.path[o]?[]:{}),n=n[r.path[o]];switch(r.kind){case"A":s(r.path?n[r.path[o]]:n,r.index,r.item);break;case"D":delete n[r.path[o]];break;case"E":case"N":n[r.path[o]]=r.rhs;}}}function p(e,t,r){if(r.path&&r.path.length){var n,o=e[t],i=r.path.length-1;for(n=0;n<i;n++)o=o[r.path[n]];switch(r.kind){case"A":p(o[r.path[n]],r.index,r.item);break;case"D":o[r.path[n]]=r.lhs;break;case"E":o[r.path[n]]=r.lhs;break;case"N":delete o[r.path[n]];}}else switch(r.kind){case"A":p(e[t],r.index,r.item);break;case"D":e[t]=r.lhs;break;case"E":e[t]=r.lhs;break;case"N":e=f(e,t);}return e}function g(e,t,r){if(e&&t&&r&&r.kind){var n,o,i=e;for(o=r.path.length-1,n=0;n<o;n++)"undefined"==typeof i[r.path[n]]&&(i[r.path[n]]={}),i=i[r.path[n]];switch(r.kind){case"A":p(i[r.path[n]],r.index,r.item);break;case"D":i[r.path[n]]=r.lhs;break;case"E":i[r.path[n]]=r.lhs;break;case"N":delete i[r.path[n]];}}}function h(e,t,r){if(e&&t){var n=function(n){r&&!r(e,t,n)||d(e,t,n);};l(e,t,n);}}function y(e){return "color: "+F[e].color+"; font-weight: bold"}function v(e){var t=e.kind,r=e.path,n=e.lhs,o=e.rhs,i=e.index,a=e.item;switch(t){case"E":return [r.join("."),n,"→",o];case"N":return [r.join("."),o];case"D":return [r.join(".")];case"A":return [r.join(".")+"["+i+"]",a];default:return []}}function b(e,t,r,n){var o=c(e,t);try{n?r.groupCollapsed("diff"):r.group("diff");}catch(e){r.log("diff");}o?o.forEach(function(e){var t=e.kind,n=v(e);r.log.apply(r,["%c "+F[t].text,y(t)].concat(P(n)));}):r.log("—— no diff ——");try{r.groupEnd();}catch(e){r.log("—— diff end —— ");}}function m(e,t,r,n){switch("undefined"==typeof e?"undefined":N(e)){case"object":return "function"==typeof e[n]?e[n].apply(e,P(r)):e[n];case"function":return e(t);default:return e}}function w(e){var t=e.timestamp,r=e.duration;return function(e,n,o){var i=["action"];return i.push("%c"+String(e.type)),t&&i.push("%c@ "+n),r&&i.push("%c(in "+o.toFixed(2)+" ms)"),i.join(" ")}}function x(e,t){var r=t.logger,n=t.actionTransformer,o=t.titleFormatter,i=void 0===o?w(t):o,a=t.collapsed,f=t.colors,u=t.level,l=t.diff,c="undefined"==typeof t.titleFormatter;e.forEach(function(o,s){var d=o.started,p=o.startedTime,g=o.action,h=o.prevState,y=o.error,v=o.took,w=o.nextState,x=e[s+1];x&&(w=x.prevState,v=x.started-d);var S=n(g),k="function"==typeof a?a(function(){return w},g,o):a,j=D(p),E=f.title?"color: "+f.title(S)+";":"",A=["color: gray; font-weight: lighter;"];A.push(E),t.timestamp&&A.push("color: gray; font-weight: lighter;"),t.duration&&A.push("color: gray; font-weight: lighter;");var O=i(S,j,v);try{k?f.title&&c?r.groupCollapsed.apply(r,["%c "+O].concat(A)):r.groupCollapsed(O):f.title&&c?r.group.apply(r,["%c "+O].concat(A)):r.group(O);}catch(e){r.log(O);}var N=m(u,S,[h],"prevState"),P=m(u,S,[S],"action"),C=m(u,S,[y,h],"error"),F=m(u,S,[w],"nextState");if(N)if(f.prevState){var L="color: "+f.prevState(h)+"; font-weight: bold";r[N]("%c prev state",L,h);}else r[N]("prev state",h);if(P)if(f.action){var T="color: "+f.action(S)+"; font-weight: bold";r[P]("%c action ",T,S);}else r[P]("action ",S);if(y&&C)if(f.error){var M="color: "+f.error(y,h)+"; font-weight: bold;";r[C]("%c error ",M,y);}else r[C]("error ",y);if(F)if(f.nextState){var _="color: "+f.nextState(w)+"; font-weight: bold";r[F]("%c next state",_,w);}else r[F]("next state",w);l&&b(h,w,r,k);try{r.groupEnd();}catch(e){r.log("—— log end ——");}});}function S(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},L,e),r=t.logger,n=t.stateTransformer,o=t.errorTransformer,i=t.predicate,a=t.logErrors,f=t.diffPredicate;if("undefined"==typeof r)return function(){return function(e){return function(t){return e(t)}}};if(e.getState&&e.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n // ...options\n});\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n"),function(){return function(e){return function(t){return e(t)}}};var u=[];return function(e){var r=e.getState;return function(e){return function(l){if("function"==typeof i&&!i(r,l))return e(l);var c={};u.push(c),c.started=O.now(),c.startedTime=new Date,c.prevState=n(r()),c.action=l;var s=void 0;if(a)try{s=e(l);}catch(e){c.error=o(e);}else s=e(l);c.took=O.now()-c.started,c.nextState=n(r());var d=t.diff&&"function"==typeof f?f(r,l):t.diff;if(x(u,Object.assign({},t,{diff:d})),u.length=0,c.error)throw c.error;return s}}}}var k,j,E=function(e,t){return new Array(t+1).join(e)},A=function(e,t){return E("0",t-e.toString().length)+e},D=function(e){return A(e.getHours(),2)+":"+A(e.getMinutes(),2)+":"+A(e.getSeconds(),2)+"."+A(e.getMilliseconds(),3)},O="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},C=[];k="object"===("undefined"==typeof commonjsGlobal?"undefined":N(commonjsGlobal))&&commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:{},j=k.DeepDiff,j&&C.push(function(){"undefined"!=typeof j&&k.DeepDiff===c&&(k.DeepDiff=j,j=void 0);}),t(n,r),t(o,r),t(i,r),t(a,r),Object.defineProperties(c,{diff:{value:c,enumerable:!0},observableDiff:{value:l,enumerable:!0},applyDiff:{value:h,enumerable:!0},applyChange:{value:d,enumerable:!0},revertChange:{value:g,enumerable:!0},isConflict:{value:function(){return "undefined"!=typeof j},enumerable:!0},noConflict:{value:function(){return C&&(C.forEach(function(e){e();}),C=null),c},enumerable:!0}});var F={E:{color:"#2196F3",text:"CHANGED:"},N:{color:"#4CAF50",text:"ADDED:"},D:{color:"#F44336",text:"DELETED:"},A:{color:"#2196F3",text:"ARRAY:"}},L={level:"log",logger:console,logErrors:!0,collapsed:void 0,predicate:void 0,duration:!1,timestamp:!0,stateTransformer:function(e){return e},actionTransformer:function(e){return e},errorTransformer:function(e){return e},colors:{title:function(){return "inherit"},prevState:function(){return "#9E9E9E"},action:function(){return "#03A9F4"},nextState:function(){return "#4CAF50"},error:function(){return "#F20404"}},diff:!1,diffPredicate:void 0,transformer:void 0},T=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.dispatch,r=e.getState;return "function"==typeof t||"function"==typeof r?S()({dispatch:t,getState:r}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};e.defaults=L,e.createLogger=S,e.logger=T,e.default=T,Object.defineProperty(e,"__esModule",{value:!0});});
936
+ });
937
+
938
+ var logger = unwrapExports(reduxLogger);
939
+
940
+ // src/utils/formatProdErrorMessage.ts
941
+ function formatProdErrorMessage(code) {
942
+ return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
943
+ }
944
+
945
+ // src/utils/actionTypes.ts
946
+ var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
947
+ var ActionTypes = {
948
+ INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
949
+ REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
950
+ PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
951
+ };
952
+ var actionTypes_default = ActionTypes;
953
+
954
+ // src/utils/isPlainObject.ts
955
+ function isPlainObject(obj) {
956
+ if (typeof obj !== "object" || obj === null)
957
+ return false;
958
+ let proto = obj;
959
+ while (Object.getPrototypeOf(proto) !== null) {
960
+ proto = Object.getPrototypeOf(proto);
961
+ }
962
+ return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
963
+ }
964
+
965
+ // src/utils/kindOf.ts
966
+ function miniKindOf(val) {
967
+ if (val === void 0)
968
+ return "undefined";
969
+ if (val === null)
970
+ return "null";
971
+ const type = typeof val;
972
+ switch (type) {
973
+ case "boolean":
974
+ case "string":
975
+ case "number":
976
+ case "symbol":
977
+ case "function": {
978
+ return type;
979
+ }
980
+ }
981
+ if (Array.isArray(val))
982
+ return "array";
983
+ if (isDate(val))
984
+ return "date";
985
+ if (isError(val))
986
+ return "error";
987
+ const constructorName = ctorName(val);
988
+ switch (constructorName) {
989
+ case "Symbol":
990
+ case "Promise":
991
+ case "WeakMap":
992
+ case "WeakSet":
993
+ case "Map":
994
+ case "Set":
995
+ return constructorName;
996
+ }
997
+ return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
998
+ }
999
+ function ctorName(val) {
1000
+ return typeof val.constructor === "function" ? val.constructor.name : null;
1001
+ }
1002
+ function isError(val) {
1003
+ return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
1004
+ }
1005
+ function isDate(val) {
1006
+ if (val instanceof Date)
1007
+ return true;
1008
+ return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
1009
+ }
1010
+ function kindOf(val) {
1011
+ let typeOfVal = typeof val;
1012
+ if (process.env.NODE_ENV !== "production") {
1013
+ typeOfVal = miniKindOf(val);
1014
+ }
1015
+ return typeOfVal;
1016
+ }
1017
+
1018
+ // src/utils/warning.ts
1019
+ function warning$1(message) {
1020
+ if (typeof console !== "undefined" && typeof console.error === "function") {
1021
+ console.error(message);
1022
+ }
1023
+ try {
1024
+ throw new Error(message);
1025
+ } catch (e) {
1026
+ }
1027
+ }
1028
+
1029
+ // src/combineReducers.ts
1030
+ function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
1031
+ const reducerKeys = Object.keys(reducers);
1032
+ const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
1033
+ if (reducerKeys.length === 0) {
1034
+ return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
1035
+ }
1036
+ if (!isPlainObject(inputState)) {
1037
+ return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
1038
+ }
1039
+ const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
1040
+ unexpectedKeys.forEach((key) => {
1041
+ unexpectedKeyCache[key] = true;
1042
+ });
1043
+ if (action && action.type === actionTypes_default.REPLACE)
1044
+ return;
1045
+ if (unexpectedKeys.length > 0) {
1046
+ return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
1047
+ }
1048
+ }
1049
+ function assertReducerShape(reducers) {
1050
+ Object.keys(reducers).forEach((key) => {
1051
+ const reducer = reducers[key];
1052
+ const initialState = reducer(void 0, {
1053
+ type: actionTypes_default.INIT
1054
+ });
1055
+ if (typeof initialState === "undefined") {
1056
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
1057
+ }
1058
+ if (typeof reducer(void 0, {
1059
+ type: actionTypes_default.PROBE_UNKNOWN_ACTION()
1060
+ }) === "undefined") {
1061
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
1062
+ }
1063
+ });
1064
+ }
1065
+ function combineReducers(reducers) {
1066
+ const reducerKeys = Object.keys(reducers);
1067
+ const finalReducers = {};
1068
+ for (let i = 0; i < reducerKeys.length; i++) {
1069
+ const key = reducerKeys[i];
1070
+ if (process.env.NODE_ENV !== "production") {
1071
+ if (typeof reducers[key] === "undefined") {
1072
+ warning$1(`No reducer provided for key "${key}"`);
1073
+ }
1074
+ }
1075
+ if (typeof reducers[key] === "function") {
1076
+ finalReducers[key] = reducers[key];
1077
+ }
1078
+ }
1079
+ const finalReducerKeys = Object.keys(finalReducers);
1080
+ let unexpectedKeyCache;
1081
+ if (process.env.NODE_ENV !== "production") {
1082
+ unexpectedKeyCache = {};
1083
+ }
1084
+ let shapeAssertionError;
1085
+ try {
1086
+ assertReducerShape(finalReducers);
1087
+ } catch (e) {
1088
+ shapeAssertionError = e;
1089
+ }
1090
+ return function combination(state = {}, action) {
1091
+ if (shapeAssertionError) {
1092
+ throw shapeAssertionError;
1093
+ }
1094
+ if (process.env.NODE_ENV !== "production") {
1095
+ const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
1096
+ if (warningMessage) {
1097
+ warning$1(warningMessage);
1098
+ }
1099
+ }
1100
+ let hasChanged = false;
1101
+ const nextState = {};
1102
+ for (let i = 0; i < finalReducerKeys.length; i++) {
1103
+ const key = finalReducerKeys[i];
1104
+ const reducer = finalReducers[key];
1105
+ const previousStateForKey = state[key];
1106
+ const nextStateForKey = reducer(previousStateForKey, action);
1107
+ if (typeof nextStateForKey === "undefined") {
1108
+ const actionType = action && action.type;
1109
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
1110
+ }
1111
+ nextState[key] = nextStateForKey;
1112
+ hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
1113
+ }
1114
+ hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
1115
+ return hasChanged ? nextState : state;
1116
+ };
1117
+ }
1118
+ //# sourceMappingURL=redux.mjs.map
1119
+
1120
+ var initialState = {
1121
+ isLoading: false,
1122
+ alert: {
1123
+ type: "",
1124
+ message: ""
1125
+ },
1126
+ user: null
1127
+ };
1128
+ var commonReducer = createReducer(initialState, function (builder) {
1129
+ builder.addCase(setLoading, function (state, action) {
1130
+ state.isLoading = action.payload;
1131
+ }).addCase(setAlert, function (state, action) {
1132
+ state.alert = action.payload;
1133
+ }).addCase(setUser, function (state, action) {
1134
+ state.user = action.payload;
1135
+ });
1136
+ });
1137
+
1138
+ var rootReducer = combineReducers({
1139
+ common: commonReducer
1140
+ });
1141
+
1142
+ var store = configureStore({
1143
+ reducer: rootReducer,
1144
+ middleware: function middleware(getDefaultMiddleware) {
1145
+ return getDefaultMiddleware({
1146
+ serializableCheck: false
1147
+ }).concat(logger);
1148
+ }
1149
+ });
1150
+
1151
+ var TITLE = "Not found";
1152
+ var NotFound = function NotFound() {
1153
+ useEffect(function () {
1154
+ document.title = TITLE;
1155
+ });
1156
+ return React.createElement("div", {
1157
+ className: "not-found"
1158
+ }, React.createElement("div", {
1159
+ className: "clearfix"
1160
+ }, React.createElement("h1", {
1161
+ className: "float-left display-3 mr-4"
1162
+ }, "404"), React.createElement("div", {
1163
+ className: "float-left"
1164
+ }, React.createElement("h4", {
1165
+ className: "pt-3"
1166
+ }, "Oops! You are lost."), React.createElement("p", {
1167
+ className: "text-muted mb-2"
1168
+ }, "The page you are looking for was not found."), React.createElement("div", null))));
1169
+ };
1170
+
1171
+ var loadingStyle = {
1172
+ minWidth: "100vw",
1173
+ minHeight: "100vh",
1174
+ position: "fixed",
1175
+ top: 0,
1176
+ left: 0,
1177
+ zIndex: 999999999,
1178
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
1179
+ display: "flex",
1180
+ justifyContent: "center",
1181
+ alignItems: "center"
1182
+ };
1183
+ var Loading = function Loading() {
1184
+ var isLoading = useSelector(function (state) {
1185
+ return state.common.isLoading;
1186
+ });
1187
+ localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
1188
+ return isLoading ? React.createElement("div", {
1189
+ style: loadingStyle
1190
+ }, React.createElement("div", {
1191
+ className: "spinner-border text-secondary",
1192
+ role: "status"
1193
+ }, React.createElement("span", {
1194
+ className: "sr-only"
1195
+ }))) : null;
1196
+ };
1197
+
1198
+ var encodeParams$1 = (function (params) {
1199
+ return Object.keys(params).filter(function (key) {
1200
+ return params[key] || params[key] === 0 || params[key] === false;
1201
+ }).map(function (key) {
1202
+ if (Array.isArray(params[key])) {
1203
+ return params[key].map(function (i) {
1204
+ return encodeURIComponent(key) + "=" + encodeURIComponent(i);
1205
+ }).join('&');
1206
+ }
1207
+ return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
1208
+ }).join('&');
1209
+ });
1210
+
1211
+ var getAccessToken$1 = (function () {
1212
+ try {
1213
+ return localStorage.getItem(ACCESS_TOKEN);
1214
+ } catch (err) {
1215
+ return null;
1216
+ }
1217
+ });
1218
+
1219
+ var api$1 = axios.create({
1220
+ baseURL: BASE_URL,
1221
+ timeout: 0,
1222
+ headers: {
1223
+ "Content-Type": "application/json"
1224
+ },
1225
+ paramsSerializer: function paramsSerializer(params) {
1226
+ return encodeParams$1(params);
1227
+ }
1228
+ });
1229
+ var apiUpload$1 = axios.create({
1230
+ baseURL: BASE_URL,
1231
+ timeout: 60000,
1232
+ headers: {
1233
+ "Content-Type": "multipart/form-data"
1234
+ }
1235
+ });
1236
+ [api$1, apiUpload$1].forEach(function (i) {
1237
+ return i.interceptors.request.use(function (config) {
1238
+ var token = getAccessToken$1();
1239
+ if (token) {
1240
+ config.headers.Authorization = "Bearer " + token;
1241
+ }
1242
+ return config;
1243
+ }, function (error) {
1244
+ return Promise.reject(error);
1245
+ });
1246
+ });
1247
+ [api$1, apiUpload$1].forEach(function (i) {
1248
+ return i.interceptors.response.use(function (response) {
1249
+ return response;
1250
+ }, function (error) {
1251
+ if (error.response.status === 401) {
1252
+ window.location.href = "/login";
1253
+ }
1254
+ if (error.response.status == 403) {
1255
+ localStorage.removeItem(ACCESS_TOKEN);
1256
+ localStorage.removeItem("USER_EMAIL");
1257
+ window.location.href = "/login";
1258
+ }
1259
+ return Promise.reject(error);
1260
+ });
1261
+ });
1262
+
1263
+ var AUTH_URL = BASE_URL + "/api/auth";
1264
+ var getInfo = function getInfo() {
1265
+ return api$1.get(AUTH_URL + "/info");
1266
+ };
1267
+
1268
+ var LayoutContext = function LayoutContext(_ref) {
1269
+ var children = _ref.children,
1270
+ onNavigate = _ref.onNavigate;
1271
+ var dispatch = useDispatch();
1272
+ var resetAuth = function resetAuth() {
1273
+ localStorage.removeItem(ACCESS_TOKEN);
1274
+ onNavigate("/login");
1275
+ };
1276
+ var loadInfo = function loadInfo() {
1277
+ try {
1278
+ var _temp2 = function _temp2() {
1279
+ dispatch(setLoading(false));
1280
+ };
1281
+ var token = getAccessToken();
1282
+ if (!token) {
1283
+ resetAuth();
1284
+ return Promise.resolve();
1285
+ }
1286
+ dispatch(setLoading(true));
1287
+ var _temp = _catch(function () {
1288
+ return Promise.resolve(getInfo()).then(function (info) {
1289
+ if (!info) {
1290
+ resetAuth();
1291
+ }
1292
+ dispatch(setUser(info.data));
1293
+ });
1294
+ }, function () {
1295
+ resetAuth();
1296
+ });
1297
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1298
+ } catch (e) {
1299
+ return Promise.reject(e);
1300
+ }
1301
+ };
1302
+ useEffect(function () {
1303
+ loadInfo();
1304
+ }, []);
1305
+ return React.createElement(Fragment, null, children);
1306
+ };
1307
+
1308
+ var ConfirmDialog = function ConfirmDialog(_ref) {
1309
+ var open = _ref.open,
1310
+ text = _ref.text,
1311
+ _ref$cancelText = _ref.cancelText,
1312
+ cancelText = _ref$cancelText === void 0 ? "No" : _ref$cancelText,
1313
+ _ref$okText = _ref.okText,
1314
+ okText = _ref$okText === void 0 ? "Yes" : _ref$okText,
1315
+ isDelete = _ref.isDelete,
1316
+ toggle = _ref.toggle,
1317
+ onConfirm = _ref.onConfirm;
1318
+ return React.createElement(Modal, {
1319
+ isOpen: open,
1320
+ toggle: toggle,
1321
+ centered: true
1322
+ }, React.createElement(ModalHeader, {
1323
+ toggle: toggle
1324
+ }, "Confirmation"), React.createElement(ModalBody, null, text), React.createElement(ModalFooter, null, React.createElement(Button, {
1325
+ color: "secondary",
1326
+ onClick: toggle
1327
+ }, cancelText), React.createElement(Button, {
1328
+ color: isDelete ? "danger" : "primary",
1329
+ onClick: onConfirm
1330
+ }, okText)));
1331
+ };
1332
+
1333
+ var CommonDialog = function CommonDialog(_ref) {
1334
+ var open = _ref.open,
1335
+ children = _ref.children,
1336
+ centered = _ref.centered,
1337
+ title = _ref.title,
1338
+ _ref$size = _ref.size,
1339
+ size = _ref$size === void 0 ? "xs" : _ref$size,
1340
+ onClose = _ref.onClose;
1341
+ return React.createElement(Modal, {
1342
+ isOpen: open,
1343
+ toggle: onClose,
1344
+ centered: centered,
1345
+ size: size
1346
+ }, React.createElement(ModalHeader, {
1347
+ toggle: onClose
1348
+ }, title), children);
1349
+ };
1350
+
1351
+ var CommonAlert = function CommonAlert() {
1352
+ var _alert$message2;
1353
+ var dispatch = useDispatch();
1354
+ var alert = useSelector(function (state) {
1355
+ return state.common.alert;
1356
+ });
1357
+ var timeout = useRef();
1358
+ var onDismiss = function onDismiss() {
1359
+ dispatch(setAlert({
1360
+ message: ""
1361
+ }));
1362
+ timeout && timeout.current && clearTimeout(timeout.current);
1363
+ };
1364
+ useEffect(function () {
1365
+ var _alert$message;
1366
+ if (!!((_alert$message = alert.message) !== null && _alert$message !== void 0 && _alert$message.length)) {
1367
+ timeout && timeout.current && clearTimeout(timeout.current);
1368
+ timeout.current = setTimeout(function () {
1369
+ dispatch(setAlert({
1370
+ message: ""
1371
+ }));
1372
+ }, 3000);
1373
+ }
1374
+ }, [alert]);
1375
+ return ((_alert$message2 = alert.message) === null || _alert$message2 === void 0 ? void 0 : _alert$message2.length) > 0 ? React.createElement("div", {
1376
+ className: "app-alert"
1377
+ }, React.createElement(Alert, {
1378
+ color: alert.type,
1379
+ isOpen: alert.message.length > 0,
1380
+ toggle: onDismiss
1381
+ }, alert.message)) : null;
1382
+ };
1383
+
1384
+ var formatTime = (function (time, ORIGINAL_FORMAT, FORMAT) {
1385
+ if (time === DATE_MIN_VALUE) return "";
1386
+ try {
1387
+ return moment(time, ORIGINAL_FORMAT).format(FORMAT || "yyyy-MM-DD");
1388
+ } catch (_unused) {
1389
+ return "";
1390
+ }
1391
+ });
1392
+
1393
+ var diffFromNow = (function (time, unitOfTime) {
1394
+ if (time === DATE_MIN_VALUE) return 0;
1395
+ try {
1396
+ return moment().diff(moment.utc(time).local(), unitOfTime);
1397
+ } catch (_unused) {
1398
+ return "";
1399
+ }
1400
+ });
1401
+
1402
+ var CustomPagination = function CustomPagination(_ref) {
1403
+ var currentPage = _ref.currentPage,
1404
+ totalPage = _ref.totalPage,
1405
+ onChangePage = _ref.onChangePage;
1406
+ return React.createElement(Pagination, {
1407
+ className: "w-fit"
1408
+ }, React.createElement(PaginationItem, {
1409
+ disabled: currentPage <= 1
1410
+ }, React.createElement(PaginationLink, {
1411
+ onClick: function onClick(e) {
1412
+ e.preventDefault();
1413
+ onChangePage(currentPage - 1);
1414
+ },
1415
+ previous: true,
1416
+ href: "#"
1417
+ })), React.createElement(PaginationItem, {
1418
+ active: 1 === currentPage,
1419
+ key: 1
1420
+ }, React.createElement(PaginationLink, {
1421
+ onClick: function onClick(e) {
1422
+ e.preventDefault();
1423
+ onChangePage(1);
1424
+ },
1425
+ href: "#"
1426
+ }, 1)), totalPage > 2 && React.createElement(PaginationItem, {
1427
+ active: 2 === currentPage,
1428
+ key: 1
1429
+ }, React.createElement(PaginationLink, {
1430
+ onClick: function onClick(e) {
1431
+ e.preventDefault();
1432
+ onChangePage(2);
1433
+ },
1434
+ href: "#"
1435
+ }, 2)), currentPage > 4 && currentPage !== totalPage && totalPage !== 5 && React.createElement(PaginationItem, {
1436
+ disabled: true,
1437
+ key: "first"
1438
+ }, React.createElement(PaginationLink, {
1439
+ href: "#"
1440
+ }, "...")), (currentPage === 1 || currentPage === totalPage) && totalPage === 5 && React.createElement(PaginationItem, {
1441
+ key: 3
1442
+ }, React.createElement(PaginationLink, {
1443
+ onClick: function onClick(e) {
1444
+ e.preventDefault();
1445
+ onChangePage(3);
1446
+ },
1447
+ href: "#"
1448
+ }, "3")), [currentPage - 1, currentPage, currentPage + 1].filter(function (page) {
1449
+ return page > 2 && page < totalPage - 1;
1450
+ }).map(function (page) {
1451
+ return React.createElement(PaginationItem, {
1452
+ active: page === currentPage,
1453
+ key: page
1454
+ }, React.createElement(PaginationLink, {
1455
+ onClick: function onClick(e) {
1456
+ e.preventDefault();
1457
+ onChangePage(page);
1458
+ },
1459
+ href: "#"
1460
+ }, page));
1461
+ }), totalPage - currentPage > 4 && React.createElement(PaginationItem, {
1462
+ disabled: true,
1463
+ key: "last"
1464
+ }, React.createElement(PaginationLink, {
1465
+ href: "#"
1466
+ }, "...")), totalPage > 3 && React.createElement(PaginationItem, {
1467
+ active: totalPage - 1 === currentPage,
1468
+ key: totalPage - 1
1469
+ }, React.createElement(PaginationLink, {
1470
+ onClick: function onClick(e) {
1471
+ e.preventDefault();
1472
+ onChangePage(totalPage - 1);
1473
+ },
1474
+ href: "#"
1475
+ }, totalPage - 1)), totalPage > 1 && React.createElement(PaginationItem, {
1476
+ active: totalPage === currentPage,
1477
+ key: totalPage
1478
+ }, React.createElement(PaginationLink, {
1479
+ onClick: function onClick(e) {
1480
+ e.preventDefault();
1481
+ onChangePage(totalPage);
1482
+ },
1483
+ href: "#"
1484
+ }, totalPage)), React.createElement(PaginationItem, {
1485
+ disabled: currentPage >= totalPage
1486
+ }, React.createElement(PaginationLink, {
1487
+ onClick: function onClick(e) {
1488
+ e.preventDefault();
1489
+ onChangePage(currentPage + 1);
1490
+ },
1491
+ next: true,
1492
+ href: "#"
1493
+ })));
1494
+ };
1495
+
1496
+ var historyCore = createBrowserHistory();
1497
+
1498
+ export { ACCESS_TOKEN, BASE_URL, CommonAlert, CommonDialog, ConfirmDialog, CustomPagination, LayoutContext, Loading, Login, NotFound, api$1 as api, diffFromNow, formatTime, historyCore, setAlert, setLoading, setUser, store, utcToLocalTime };
31
1499
  //# sourceMappingURL=index.modern.js.map