@obb871001/api-integration-sdk 1.0.37 → 1.0.38
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.
- package/dist/index.cjs +6 -22
- package/dist/index.js +545 -545
- package/package.json +17 -7
package/dist/index.js
CHANGED
|
@@ -1,87 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import ye, {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import it from "
|
|
6
|
-
|
|
7
|
-
const r = ot(Ar);
|
|
8
|
-
if (!r)
|
|
9
|
-
throw new Error("useApiContext must be used within ApiProvider");
|
|
10
|
-
return r;
|
|
11
|
-
};
|
|
12
|
-
function st({
|
|
13
|
-
baseURL: r,
|
|
14
|
-
getToken: g,
|
|
15
|
-
timeoutMs: O = 15e3,
|
|
16
|
-
currency: h = "TWD",
|
|
17
|
-
lng: v = "tw",
|
|
18
|
-
onError: _
|
|
19
|
-
} = {}) {
|
|
20
|
-
const S = ct.create({
|
|
21
|
-
baseURL: r,
|
|
22
|
-
timeout: O,
|
|
23
|
-
headers: { "Content-Type": "application/json" }
|
|
24
|
-
});
|
|
25
|
-
return S.interceptors.request.use(async (d) => {
|
|
26
|
-
if (d.headers = d.headers || {}, g) {
|
|
27
|
-
const c = await g();
|
|
28
|
-
c && (d.headers.Authorization = `Bearer ${c}`);
|
|
29
|
-
}
|
|
30
|
-
return d.headers.Currency = h, d.headers["currency-code"] = h, d.headers.lang = v, d;
|
|
31
|
-
}), S.interceptors.response.use(
|
|
32
|
-
(d) => d.data,
|
|
33
|
-
(d) => _ ? _(d, { instance: S }) : Promise.reject(d)
|
|
34
|
-
), S;
|
|
35
|
-
}
|
|
36
|
-
const lt = () => {
|
|
37
|
-
const { client: r } = Pr(), g = de(
|
|
38
|
-
async (S) => {
|
|
39
|
-
const { mac_address: d = "", app_version: c = "", anydesk_id: l = "" } = S, { data: u } = await r.post("/cash-register/login", {
|
|
40
|
-
mac_address: d,
|
|
41
|
-
app_version: c,
|
|
42
|
-
anydesk_id: l
|
|
43
|
-
});
|
|
44
|
-
return u;
|
|
45
|
-
},
|
|
46
|
-
[r]
|
|
47
|
-
), O = de(async () => r.get("/member/getMemberInfo"), [r]), h = de(async () => {
|
|
48
|
-
const { data: S } = await r.get("/getGameList");
|
|
49
|
-
return S;
|
|
50
|
-
}, [r]), v = de(async () => {
|
|
51
|
-
const { data: S } = await r.get("/getNowCurrencyExchange");
|
|
52
|
-
return S;
|
|
53
|
-
}, [r]), _ = de(async () => {
|
|
54
|
-
const { data: S } = await r.get("/getFavoriteGame");
|
|
55
|
-
return S;
|
|
56
|
-
}, [r]);
|
|
57
|
-
return {
|
|
58
|
-
machineLoginApi: g,
|
|
59
|
-
userInfoApi: O,
|
|
60
|
-
userGameListApi: h,
|
|
61
|
-
userFavoriteGameApi: _,
|
|
62
|
-
userCurrencyExchangeApi: v
|
|
63
|
-
};
|
|
64
|
-
}, kt = () => {
|
|
65
|
-
const { getToken: r } = Pr(), { userInfoApi: g } = lt(), O = tt({
|
|
66
|
-
queries: [
|
|
67
|
-
{
|
|
68
|
-
queryKey: ["getMemberInfo"],
|
|
69
|
-
queryFn: async () => await g(),
|
|
70
|
-
refetchInterval: 5e4
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
enabled: !!r
|
|
74
|
-
}), { data: h, isFetching: v, error: _ } = O[0] || {};
|
|
75
|
-
return { data: h, isFetching: v, error: _ };
|
|
76
|
-
};
|
|
77
|
-
function ft(r) {
|
|
1
|
+
import { get as Ce } from "lodash";
|
|
2
|
+
import ye, { useRef as ir, useMemo as Ge, useEffect as we, createContext as tt, useContext as nt, useCallback as de } from "react";
|
|
3
|
+
import at from "react-dom";
|
|
4
|
+
import { useQueries as ot, QueryClient as ut, QueryClientProvider as ct } from "@tanstack/react-query";
|
|
5
|
+
import it from "axios";
|
|
6
|
+
function st(r) {
|
|
78
7
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
79
8
|
}
|
|
80
9
|
var je = {}, F = {}, Ue = {}, sr;
|
|
81
|
-
function
|
|
10
|
+
function V() {
|
|
82
11
|
return sr || (sr = 1, (function(r) {
|
|
83
12
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.isEventSourceSupported = r.isReactNative = r.ReadyState = r.DEFAULT_HEARTBEAT = r.UNPARSABLE_JSON_OBJECT = r.DEFAULT_RECONNECT_INTERVAL_MS = r.DEFAULT_RECONNECT_LIMIT = r.SOCKET_IO_PING_CODE = r.SOCKET_IO_PATH = r.SOCKET_IO_PING_INTERVAL = r.DEFAULT_EVENT_SOURCE_OPTIONS = r.EMPTY_EVENT_HANDLERS = r.DEFAULT_OPTIONS = void 0;
|
|
84
|
-
var
|
|
13
|
+
var b = 1, O = 1e3 * b;
|
|
85
14
|
r.DEFAULT_OPTIONS = {}, r.EMPTY_EVENT_HANDLERS = {}, r.DEFAULT_EVENT_SOURCE_OPTIONS = {
|
|
86
15
|
withCredentials: !1,
|
|
87
16
|
events: r.EMPTY_EVENT_HANDLERS
|
|
@@ -90,123 +19,123 @@ function H() {
|
|
|
90
19
|
timeout: 6e4,
|
|
91
20
|
interval: 25e3
|
|
92
21
|
};
|
|
93
|
-
var
|
|
94
|
-
(function(
|
|
95
|
-
|
|
96
|
-
})(
|
|
97
|
-
var
|
|
22
|
+
var _;
|
|
23
|
+
(function(E) {
|
|
24
|
+
E[E.UNINSTANTIATED = -1] = "UNINSTANTIATED", E[E.CONNECTING = 0] = "CONNECTING", E[E.OPEN = 1] = "OPEN", E[E.CLOSING = 2] = "CLOSING", E[E.CLOSED = 3] = "CLOSED";
|
|
25
|
+
})(_ || (r.ReadyState = _ = {}));
|
|
26
|
+
var f = function() {
|
|
98
27
|
try {
|
|
99
28
|
return "EventSource" in globalThis;
|
|
100
29
|
} catch {
|
|
101
30
|
return !1;
|
|
102
31
|
}
|
|
103
32
|
};
|
|
104
|
-
r.isReactNative = typeof navigator < "u" && navigator.product === "ReactNative", r.isEventSourceSupported = !r.isReactNative &&
|
|
33
|
+
r.isReactNative = typeof navigator < "u" && navigator.product === "ReactNative", r.isEventSourceSupported = !r.isReactNative && f();
|
|
105
34
|
})(Ue)), Ue;
|
|
106
35
|
}
|
|
107
36
|
var _e = {}, We = {}, lr;
|
|
108
37
|
function Je() {
|
|
109
38
|
return lr || (lr = 1, (function(r) {
|
|
110
39
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetWebSockets = r.sharedWebSockets = void 0, r.sharedWebSockets = {};
|
|
111
|
-
var
|
|
40
|
+
var b = function(O) {
|
|
112
41
|
if (O && r.sharedWebSockets.hasOwnProperty(O))
|
|
113
42
|
delete r.sharedWebSockets[O];
|
|
114
43
|
else
|
|
115
|
-
for (var
|
|
116
|
-
r.sharedWebSockets.hasOwnProperty(
|
|
44
|
+
for (var _ in r.sharedWebSockets)
|
|
45
|
+
r.sharedWebSockets.hasOwnProperty(_) && delete r.sharedWebSockets[_];
|
|
117
46
|
};
|
|
118
|
-
r.resetWebSockets =
|
|
47
|
+
r.resetWebSockets = b;
|
|
119
48
|
})(We)), We;
|
|
120
49
|
}
|
|
121
50
|
var te = {}, K = {}, fr;
|
|
122
|
-
function
|
|
51
|
+
function He() {
|
|
123
52
|
if (fr) return K;
|
|
124
53
|
fr = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.setUpSocketIOPing = K.appendQueryParams = K.parseSocketIOUrl = void 0;
|
|
125
|
-
var r =
|
|
126
|
-
if (
|
|
127
|
-
var
|
|
54
|
+
var r = V(), b = function(f) {
|
|
55
|
+
if (f) {
|
|
56
|
+
var E = /^https|wss/.test(f), S = f.replace(/^(https?|wss?)(:\/\/)?/, ""), d = S.replace(/\/$/, ""), c = E ? "wss" : "ws";
|
|
128
57
|
return "".concat(c, "://").concat(d).concat(r.SOCKET_IO_PATH);
|
|
129
|
-
} else if (
|
|
130
|
-
var
|
|
58
|
+
} else if (f === "") {
|
|
59
|
+
var E = /^https/.test(window.location.protocol), c = E ? "wss" : "ws", l = window.location.port ? ":".concat(window.location.port) : "";
|
|
131
60
|
return "".concat(c, "://").concat(window.location.hostname).concat(l).concat(r.SOCKET_IO_PATH);
|
|
132
61
|
}
|
|
133
|
-
return
|
|
62
|
+
return f;
|
|
134
63
|
};
|
|
135
|
-
K.parseSocketIOUrl =
|
|
136
|
-
var O = function(
|
|
137
|
-
|
|
138
|
-
var S = /\?([\w]+=[\w]+)/, d = S.test(
|
|
139
|
-
var a =
|
|
64
|
+
K.parseSocketIOUrl = b;
|
|
65
|
+
var O = function(f, E) {
|
|
66
|
+
E === void 0 && (E = {});
|
|
67
|
+
var S = /\?([\w]+=[\w]+)/, d = S.test(f), c = "".concat(Object.entries(E).reduce(function(l, o) {
|
|
68
|
+
var a = o[0], i = o[1];
|
|
140
69
|
return l + "".concat(a, "=").concat(i, "&");
|
|
141
70
|
}, "").slice(0, -1));
|
|
142
|
-
return "".concat(
|
|
71
|
+
return "".concat(f).concat(d ? "&" : "?").concat(c);
|
|
143
72
|
};
|
|
144
73
|
K.appendQueryParams = O;
|
|
145
|
-
var
|
|
146
|
-
|
|
74
|
+
var _ = function(f, E) {
|
|
75
|
+
E === void 0 && (E = r.SOCKET_IO_PING_INTERVAL);
|
|
147
76
|
var S = function() {
|
|
148
|
-
return
|
|
77
|
+
return f(r.SOCKET_IO_PING_CODE);
|
|
149
78
|
};
|
|
150
|
-
return window.setInterval(S,
|
|
79
|
+
return window.setInterval(S, E);
|
|
151
80
|
};
|
|
152
|
-
return K.setUpSocketIOPing =
|
|
81
|
+
return K.setUpSocketIOPing = _, K;
|
|
153
82
|
}
|
|
154
83
|
var Ae = {}, vr;
|
|
155
|
-
function
|
|
84
|
+
function Ar() {
|
|
156
85
|
if (vr) return Ae;
|
|
157
86
|
vr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 }), Ae.heartbeat = O;
|
|
158
|
-
var r =
|
|
159
|
-
function
|
|
160
|
-
return Array.isArray(
|
|
161
|
-
return
|
|
162
|
-
}).current :
|
|
87
|
+
var r = V();
|
|
88
|
+
function b(_) {
|
|
89
|
+
return Array.isArray(_) ? _.reduce(function(f, E) {
|
|
90
|
+
return f.current > E.current ? f : E;
|
|
91
|
+
}).current : _.current;
|
|
163
92
|
}
|
|
164
|
-
function O(
|
|
165
|
-
var S =
|
|
166
|
-
var
|
|
167
|
-
if (
|
|
168
|
-
console.warn("Heartbeat timed out, closing connection, last message received ".concat(
|
|
169
|
-
else if (
|
|
93
|
+
function O(_, f, E) {
|
|
94
|
+
var S = E || {}, d = S.interval, c = d === void 0 ? r.DEFAULT_HEARTBEAT.interval : d, l = S.timeout, o = l === void 0 ? r.DEFAULT_HEARTBEAT.timeout : l, a = S.message, i = a === void 0 ? r.DEFAULT_HEARTBEAT.message : a, t = Math.max(100, c / 10), n = Date.now(), v = setInterval(function() {
|
|
95
|
+
var h = Date.now(), u = b(f);
|
|
96
|
+
if (u + o <= h)
|
|
97
|
+
console.warn("Heartbeat timed out, closing connection, last message received ".concat(h - u, "ms ago, last ping sent ").concat(h - n, "ms ago")), _.close();
|
|
98
|
+
else if (u + c <= h && n + c <= h)
|
|
170
99
|
try {
|
|
171
|
-
typeof i == "function" ?
|
|
100
|
+
typeof i == "function" ? _.send(i()) : _.send(i), n = h;
|
|
172
101
|
} catch (y) {
|
|
173
|
-
console.error("Heartbeat failed, closing connection", y instanceof Error ? y.message : y),
|
|
102
|
+
console.error("Heartbeat failed, closing connection", y instanceof Error ? y.message : y), _.close();
|
|
174
103
|
}
|
|
175
104
|
}, t);
|
|
176
|
-
return
|
|
177
|
-
clearInterval(
|
|
105
|
+
return _.addEventListener("close", function() {
|
|
106
|
+
clearInterval(v);
|
|
178
107
|
}), function() {
|
|
179
108
|
};
|
|
180
109
|
}
|
|
181
110
|
return Ae;
|
|
182
111
|
}
|
|
183
112
|
var Ee = {}, Fe = {}, dr;
|
|
184
|
-
function
|
|
113
|
+
function Ve() {
|
|
185
114
|
return dr || (dr = 1, (function(r) {
|
|
186
115
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetSubscribers = r.removeSubscriber = r.addSubscriber = r.hasSubscribers = r.getSubscribers = void 0;
|
|
187
|
-
var
|
|
188
|
-
return (0, r.hasSubscribers)(c) ? Array.from(
|
|
116
|
+
var b = {}, O = [], _ = function(c) {
|
|
117
|
+
return (0, r.hasSubscribers)(c) ? Array.from(b[c]) : O;
|
|
189
118
|
};
|
|
190
|
-
r.getSubscribers =
|
|
191
|
-
var
|
|
119
|
+
r.getSubscribers = _;
|
|
120
|
+
var f = function(c) {
|
|
192
121
|
var l;
|
|
193
|
-
return ((l =
|
|
122
|
+
return ((l = b[c]) === null || l === void 0 ? void 0 : l.size) > 0;
|
|
194
123
|
};
|
|
195
|
-
r.hasSubscribers =
|
|
196
|
-
var
|
|
197
|
-
|
|
124
|
+
r.hasSubscribers = f;
|
|
125
|
+
var E = function(c, l) {
|
|
126
|
+
b[c] = b[c] || /* @__PURE__ */ new Set(), b[c].add(l);
|
|
198
127
|
};
|
|
199
|
-
r.addSubscriber =
|
|
128
|
+
r.addSubscriber = E;
|
|
200
129
|
var S = function(c, l) {
|
|
201
|
-
|
|
130
|
+
b[c].delete(l);
|
|
202
131
|
};
|
|
203
132
|
r.removeSubscriber = S;
|
|
204
133
|
var d = function(c) {
|
|
205
|
-
if (c &&
|
|
206
|
-
delete
|
|
134
|
+
if (c && b.hasOwnProperty(c))
|
|
135
|
+
delete b[c];
|
|
207
136
|
else
|
|
208
|
-
for (var l in
|
|
209
|
-
|
|
137
|
+
for (var l in b)
|
|
138
|
+
b.hasOwnProperty(l) && delete b[l];
|
|
210
139
|
};
|
|
211
140
|
r.resetSubscribers = d;
|
|
212
141
|
})(Fe)), Fe;
|
|
@@ -214,295 +143,295 @@ function He() {
|
|
|
214
143
|
var _r;
|
|
215
144
|
function $e() {
|
|
216
145
|
if (_r) return Ee;
|
|
217
|
-
_r = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.assertIsWebSocket = O, Ee.resetGlobalState =
|
|
218
|
-
var r = Je(),
|
|
219
|
-
function O(
|
|
220
|
-
if (!
|
|
146
|
+
_r = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.assertIsWebSocket = O, Ee.resetGlobalState = _;
|
|
147
|
+
var r = Je(), b = Ve();
|
|
148
|
+
function O(f, E) {
|
|
149
|
+
if (!E && !(f instanceof WebSocket))
|
|
221
150
|
throw new Error("");
|
|
222
151
|
}
|
|
223
|
-
function
|
|
224
|
-
(0,
|
|
152
|
+
function _(f) {
|
|
153
|
+
(0, b.resetSubscribers)(f), (0, r.resetWebSockets)(f);
|
|
225
154
|
}
|
|
226
155
|
return Ee;
|
|
227
156
|
}
|
|
228
157
|
var Er;
|
|
229
|
-
function
|
|
158
|
+
function lt() {
|
|
230
159
|
if (Er) return te;
|
|
231
160
|
Er = 1;
|
|
232
161
|
var r = te && te.__assign || function() {
|
|
233
|
-
return r = Object.assign || function(
|
|
162
|
+
return r = Object.assign || function(o) {
|
|
234
163
|
for (var a, i = 1, t = arguments.length; i < t; i++) {
|
|
235
164
|
a = arguments[i];
|
|
236
|
-
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (
|
|
165
|
+
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (o[n] = a[n]);
|
|
237
166
|
}
|
|
238
|
-
return
|
|
167
|
+
return o;
|
|
239
168
|
}, r.apply(this, arguments);
|
|
240
169
|
};
|
|
241
170
|
Object.defineProperty(te, "__esModule", { value: !0 }), te.attachListeners = void 0;
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
var
|
|
245
|
-
a.current.onMessage && a.current.onMessage(n), typeof t?.current == "number" && (t.current = Date.now()), !(typeof a.current.filter == "function" && a.current.filter(n) !== !0) && (a.current.heartbeat && typeof a.current.heartbeat != "boolean" && ((
|
|
171
|
+
var b = He(), O = Ar(), _ = V(), f = $e(), E = function(o, a, i, t) {
|
|
172
|
+
o.onmessage = function(n) {
|
|
173
|
+
var v;
|
|
174
|
+
a.current.onMessage && a.current.onMessage(n), typeof t?.current == "number" && (t.current = Date.now()), !(typeof a.current.filter == "function" && a.current.filter(n) !== !0) && (a.current.heartbeat && typeof a.current.heartbeat != "boolean" && ((v = a.current.heartbeat) === null || v === void 0 ? void 0 : v.returnMessage) === n.data || i(n));
|
|
246
175
|
};
|
|
247
|
-
}, S = function(
|
|
248
|
-
|
|
249
|
-
if (a.current.onOpen && a.current.onOpen(
|
|
250
|
-
var
|
|
251
|
-
n.current = Date.now(), (0, O.heartbeat)(
|
|
176
|
+
}, S = function(o, a, i, t, n) {
|
|
177
|
+
o.onopen = function(v) {
|
|
178
|
+
if (a.current.onOpen && a.current.onOpen(v), t.current = 0, i(_.ReadyState.OPEN), a.current.heartbeat && o instanceof WebSocket) {
|
|
179
|
+
var h = typeof a.current.heartbeat == "boolean" ? void 0 : a.current.heartbeat;
|
|
180
|
+
n.current = Date.now(), (0, O.heartbeat)(o, n, h);
|
|
252
181
|
}
|
|
253
182
|
};
|
|
254
|
-
}, d = function(
|
|
255
|
-
if (
|
|
183
|
+
}, d = function(o, a, i, t, n) {
|
|
184
|
+
if (_.isEventSourceSupported && o instanceof EventSource)
|
|
256
185
|
return function() {
|
|
257
186
|
};
|
|
258
|
-
(0,
|
|
259
|
-
var
|
|
260
|
-
return
|
|
261
|
-
var
|
|
262
|
-
if (a.current.onClose && a.current.onClose(
|
|
263
|
-
var y = (
|
|
187
|
+
(0, f.assertIsWebSocket)(o, a.current.skipAssert);
|
|
188
|
+
var v;
|
|
189
|
+
return o.onclose = function(h) {
|
|
190
|
+
var u;
|
|
191
|
+
if (a.current.onClose && a.current.onClose(h), i(_.ReadyState.CLOSED), a.current.shouldReconnect && a.current.shouldReconnect(h)) {
|
|
192
|
+
var y = (u = a.current.reconnectAttempts) !== null && u !== void 0 ? u : _.DEFAULT_RECONNECT_LIMIT;
|
|
264
193
|
if (n.current < y) {
|
|
265
194
|
var C = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
|
|
266
|
-
|
|
195
|
+
v = window.setTimeout(function() {
|
|
267
196
|
n.current++, t();
|
|
268
|
-
}, C ??
|
|
197
|
+
}, C ?? _.DEFAULT_RECONNECT_INTERVAL_MS);
|
|
269
198
|
} else
|
|
270
199
|
a.current.onReconnectStop && a.current.onReconnectStop(y), console.warn("Max reconnect attempts of ".concat(y, " exceeded"));
|
|
271
200
|
}
|
|
272
201
|
}, function() {
|
|
273
|
-
return
|
|
202
|
+
return v && window.clearTimeout(v);
|
|
274
203
|
};
|
|
275
|
-
}, c = function(
|
|
276
|
-
var
|
|
277
|
-
return
|
|
278
|
-
var
|
|
279
|
-
if (a.current.onError && a.current.onError(
|
|
280
|
-
if (n.current < ((
|
|
204
|
+
}, c = function(o, a, i, t, n) {
|
|
205
|
+
var v;
|
|
206
|
+
return o.onerror = function(h) {
|
|
207
|
+
var u;
|
|
208
|
+
if (a.current.onError && a.current.onError(h), _.isEventSourceSupported && o instanceof EventSource && (a.current.onClose && a.current.onClose(r(r({}, h), { code: 1006, reason: "An error occurred with the EventSource: ".concat(h), wasClean: !1 })), i(_.ReadyState.CLOSED), o.close()), a.current.retryOnError)
|
|
209
|
+
if (n.current < ((u = a.current.reconnectAttempts) !== null && u !== void 0 ? u : _.DEFAULT_RECONNECT_LIMIT)) {
|
|
281
210
|
var y = typeof a.current.reconnectInterval == "function" ? a.current.reconnectInterval(n.current) : a.current.reconnectInterval;
|
|
282
|
-
|
|
211
|
+
v = window.setTimeout(function() {
|
|
283
212
|
n.current++, t();
|
|
284
|
-
}, y ??
|
|
213
|
+
}, y ?? _.DEFAULT_RECONNECT_INTERVAL_MS);
|
|
285
214
|
} else
|
|
286
215
|
a.current.onReconnectStop && a.current.onReconnectStop(a.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts, " exceeded"));
|
|
287
216
|
}, function() {
|
|
288
|
-
return
|
|
217
|
+
return v && window.clearTimeout(v);
|
|
289
218
|
};
|
|
290
|
-
}, l = function(
|
|
291
|
-
var
|
|
292
|
-
return i.current.fromSocketIO && (C = (0,
|
|
293
|
-
y(
|
|
219
|
+
}, l = function(o, a, i, t, n, v, h) {
|
|
220
|
+
var u = a.setLastMessage, y = a.setReadyState, C, P, T;
|
|
221
|
+
return i.current.fromSocketIO && (C = (0, b.setUpSocketIOPing)(h)), E(o, i, u, v), S(o, i, y, n, v), P = d(o, i, y, t, n), T = c(o, i, y, t, n), function() {
|
|
222
|
+
y(_.ReadyState.CLOSING), P(), T(), o.close(), C && clearInterval(C);
|
|
294
223
|
};
|
|
295
224
|
};
|
|
296
225
|
return te.attachListeners = l, te;
|
|
297
226
|
}
|
|
298
227
|
var ne = {}, Sr;
|
|
299
|
-
function
|
|
228
|
+
function ft() {
|
|
300
229
|
if (Sr) return ne;
|
|
301
230
|
Sr = 1;
|
|
302
231
|
var r = ne && ne.__assign || function() {
|
|
303
232
|
return r = Object.assign || function(a) {
|
|
304
233
|
for (var i, t = 1, n = arguments.length; t < n; t++) {
|
|
305
234
|
i = arguments[t];
|
|
306
|
-
for (var
|
|
235
|
+
for (var v in i) Object.prototype.hasOwnProperty.call(i, v) && (a[v] = i[v]);
|
|
307
236
|
}
|
|
308
237
|
return a;
|
|
309
238
|
}, r.apply(this, arguments);
|
|
310
239
|
};
|
|
311
240
|
Object.defineProperty(ne, "__esModule", { value: !0 }), ne.attachSharedListeners = void 0;
|
|
312
|
-
var
|
|
241
|
+
var b = Je(), O = V(), _ = Ve(), f = He(), E = Ar(), S = function(a, i, t) {
|
|
313
242
|
a.onmessage = function(n) {
|
|
314
|
-
(0,
|
|
315
|
-
var
|
|
316
|
-
|
|
243
|
+
(0, _.getSubscribers)(i).forEach(function(v) {
|
|
244
|
+
var h;
|
|
245
|
+
v.optionsRef.current.onMessage && v.optionsRef.current.onMessage(n), typeof ((h = v?.lastMessageTime) === null || h === void 0 ? void 0 : h.current) == "number" && (v.lastMessageTime.current = Date.now()), !(typeof v.optionsRef.current.filter == "function" && v.optionsRef.current.filter(n) !== !0) && (t && typeof t != "boolean" && t?.returnMessage === n.data || v.setLastMessage(n));
|
|
317
246
|
});
|
|
318
247
|
};
|
|
319
248
|
}, d = function(a, i, t) {
|
|
320
249
|
a.onopen = function(n) {
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}), t && a instanceof WebSocket && (0,
|
|
325
|
-
return
|
|
250
|
+
var v = (0, _.getSubscribers)(i);
|
|
251
|
+
v.forEach(function(h) {
|
|
252
|
+
h.reconnectCount.current = 0, h.optionsRef.current.onOpen && h.optionsRef.current.onOpen(n), h.setReadyState(O.ReadyState.OPEN), t && a instanceof WebSocket && (h.lastMessageTime.current = Date.now());
|
|
253
|
+
}), t && a instanceof WebSocket && (0, E.heartbeat)(a, v.map(function(h) {
|
|
254
|
+
return h.lastMessageTime;
|
|
326
255
|
}), typeof t == "boolean" ? void 0 : t);
|
|
327
256
|
};
|
|
328
257
|
}, c = function(a, i) {
|
|
329
258
|
a instanceof WebSocket && (a.onclose = function(t) {
|
|
330
|
-
(0,
|
|
259
|
+
(0, _.getSubscribers)(i).forEach(function(n) {
|
|
331
260
|
n.optionsRef.current.onClose && n.optionsRef.current.onClose(t), n.setReadyState(O.ReadyState.CLOSED);
|
|
332
|
-
}), delete
|
|
333
|
-
var
|
|
261
|
+
}), delete b.sharedWebSockets[i], (0, _.getSubscribers)(i).forEach(function(n) {
|
|
262
|
+
var v;
|
|
334
263
|
if (n.optionsRef.current.shouldReconnect && n.optionsRef.current.shouldReconnect(t)) {
|
|
335
|
-
var
|
|
336
|
-
if (n.reconnectCount.current <
|
|
337
|
-
var
|
|
264
|
+
var h = (v = n.optionsRef.current.reconnectAttempts) !== null && v !== void 0 ? v : O.DEFAULT_RECONNECT_LIMIT;
|
|
265
|
+
if (n.reconnectCount.current < h) {
|
|
266
|
+
var u = typeof n.optionsRef.current.reconnectInterval == "function" ? n.optionsRef.current.reconnectInterval(n.reconnectCount.current) : n.optionsRef.current.reconnectInterval;
|
|
338
267
|
setTimeout(function() {
|
|
339
268
|
n.reconnectCount.current++, n.reconnect.current();
|
|
340
|
-
},
|
|
269
|
+
}, u ?? O.DEFAULT_RECONNECT_INTERVAL_MS);
|
|
341
270
|
} else
|
|
342
|
-
n.optionsRef.current.onReconnectStop && n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(
|
|
271
|
+
n.optionsRef.current.onReconnectStop && n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts), console.warn("Max reconnect attempts of ".concat(h, " exceeded"));
|
|
343
272
|
}
|
|
344
273
|
});
|
|
345
274
|
});
|
|
346
275
|
}, l = function(a, i) {
|
|
347
276
|
a.onerror = function(t) {
|
|
348
|
-
(0,
|
|
277
|
+
(0, _.getSubscribers)(i).forEach(function(n) {
|
|
349
278
|
n.optionsRef.current.onError && n.optionsRef.current.onError(t), O.isEventSourceSupported && a instanceof EventSource && (n.optionsRef.current.onClose && n.optionsRef.current.onClose(r(r({}, t), { code: 1006, reason: "An error occurred with the EventSource: ".concat(t), wasClean: !1 })), n.setReadyState(O.ReadyState.CLOSED));
|
|
350
279
|
}), O.isEventSourceSupported && a instanceof EventSource && a.close();
|
|
351
280
|
};
|
|
352
|
-
},
|
|
353
|
-
var
|
|
354
|
-
return t.current.fromSocketIO && (
|
|
355
|
-
|
|
281
|
+
}, o = function(a, i, t, n) {
|
|
282
|
+
var v;
|
|
283
|
+
return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), d(a, i, t.current.heartbeat), l(a, i), function() {
|
|
284
|
+
v && clearInterval(v);
|
|
356
285
|
};
|
|
357
286
|
};
|
|
358
|
-
return ne.attachSharedListeners =
|
|
287
|
+
return ne.attachSharedListeners = o, ne;
|
|
359
288
|
}
|
|
360
289
|
var hr;
|
|
361
|
-
function
|
|
290
|
+
function vt() {
|
|
362
291
|
if (hr) return _e;
|
|
363
292
|
hr = 1, Object.defineProperty(_e, "__esModule", { value: !0 }), _e.createOrJoinSocket = void 0;
|
|
364
|
-
var r = Je(),
|
|
293
|
+
var r = Je(), b = V(), O = lt(), _ = ft(), f = Ve(), E = function(d, c, l, o, a) {
|
|
365
294
|
return function() {
|
|
366
|
-
if ((0,
|
|
295
|
+
if ((0, f.removeSubscriber)(d, c), !(0, f.hasSubscribers)(d)) {
|
|
367
296
|
try {
|
|
368
297
|
var i = r.sharedWebSockets[d];
|
|
369
298
|
i instanceof WebSocket && (i.onclose = function(t) {
|
|
370
|
-
l.current.onClose && l.current.onClose(t),
|
|
299
|
+
l.current.onClose && l.current.onClose(t), o(b.ReadyState.CLOSED);
|
|
371
300
|
}), i.close();
|
|
372
301
|
} catch {
|
|
373
302
|
}
|
|
374
303
|
a && a(), delete r.sharedWebSockets[d];
|
|
375
304
|
}
|
|
376
305
|
};
|
|
377
|
-
}, S = function(d, c, l,
|
|
378
|
-
if (!
|
|
379
|
-
throw
|
|
380
|
-
if (
|
|
381
|
-
var
|
|
382
|
-
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] =
|
|
383
|
-
var
|
|
306
|
+
}, S = function(d, c, l, o, a, i, t, n, v) {
|
|
307
|
+
if (!b.isEventSourceSupported && o.current.eventSourceOptions)
|
|
308
|
+
throw b.isReactNative ? new Error("EventSource is not supported in ReactNative") : new Error("EventSource is not supported");
|
|
309
|
+
if (o.current.share) {
|
|
310
|
+
var h = null;
|
|
311
|
+
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), d.current = r.sharedWebSockets[c], l(b.ReadyState.CONNECTING), h = (0, _.attachSharedListeners)(r.sharedWebSockets[c], c, o, v)) : (d.current = r.sharedWebSockets[c], l(r.sharedWebSockets[c].readyState));
|
|
312
|
+
var u = {
|
|
384
313
|
setLastMessage: a,
|
|
385
314
|
setReadyState: l,
|
|
386
|
-
optionsRef:
|
|
315
|
+
optionsRef: o,
|
|
387
316
|
reconnectCount: t,
|
|
388
317
|
lastMessageTime: n,
|
|
389
318
|
reconnect: i
|
|
390
319
|
};
|
|
391
|
-
return (0,
|
|
320
|
+
return (0, f.addSubscriber)(c, u), E(c, u, o, l, h);
|
|
392
321
|
} else {
|
|
393
|
-
if (d.current =
|
|
322
|
+
if (d.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), l(b.ReadyState.CONNECTING), !d.current)
|
|
394
323
|
throw new Error("WebSocket failed to be created");
|
|
395
324
|
return (0, O.attachListeners)(d.current, {
|
|
396
325
|
setLastMessage: a,
|
|
397
326
|
setReadyState: l
|
|
398
|
-
},
|
|
327
|
+
}, o, i.current, t, n, v);
|
|
399
328
|
}
|
|
400
329
|
};
|
|
401
330
|
return _e.createOrJoinSocket = S, _e;
|
|
402
331
|
}
|
|
403
332
|
var x = {}, yr;
|
|
404
|
-
function
|
|
333
|
+
function dt() {
|
|
405
334
|
return yr || (yr = 1, (function(r) {
|
|
406
|
-
var
|
|
335
|
+
var b = x && x.__awaiter || function(c, l, o, a) {
|
|
407
336
|
function i(t) {
|
|
408
|
-
return t instanceof
|
|
337
|
+
return t instanceof o ? t : new o(function(n) {
|
|
409
338
|
n(t);
|
|
410
339
|
});
|
|
411
340
|
}
|
|
412
|
-
return new (
|
|
413
|
-
function
|
|
341
|
+
return new (o || (o = Promise))(function(t, n) {
|
|
342
|
+
function v(y) {
|
|
414
343
|
try {
|
|
415
|
-
|
|
344
|
+
u(a.next(y));
|
|
416
345
|
} catch (C) {
|
|
417
346
|
n(C);
|
|
418
347
|
}
|
|
419
348
|
}
|
|
420
|
-
function
|
|
349
|
+
function h(y) {
|
|
421
350
|
try {
|
|
422
|
-
|
|
351
|
+
u(a.throw(y));
|
|
423
352
|
} catch (C) {
|
|
424
353
|
n(C);
|
|
425
354
|
}
|
|
426
355
|
}
|
|
427
|
-
function
|
|
428
|
-
y.done ? t(y.value) : i(y.value).then(
|
|
356
|
+
function u(y) {
|
|
357
|
+
y.done ? t(y.value) : i(y.value).then(v, h);
|
|
429
358
|
}
|
|
430
|
-
|
|
359
|
+
u((a = a.apply(c, l || [])).next());
|
|
431
360
|
});
|
|
432
361
|
}, O = x && x.__generator || function(c, l) {
|
|
433
|
-
var
|
|
362
|
+
var o = { label: 0, sent: function() {
|
|
434
363
|
if (t[0] & 1) throw t[1];
|
|
435
364
|
return t[1];
|
|
436
365
|
}, trys: [], ops: [] }, a, i, t, n = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
437
|
-
return n.next =
|
|
366
|
+
return n.next = v(0), n.throw = v(1), n.return = v(2), typeof Symbol == "function" && (n[Symbol.iterator] = function() {
|
|
438
367
|
return this;
|
|
439
368
|
}), n;
|
|
440
|
-
function
|
|
369
|
+
function v(u) {
|
|
441
370
|
return function(y) {
|
|
442
|
-
return
|
|
371
|
+
return h([u, y]);
|
|
443
372
|
};
|
|
444
373
|
}
|
|
445
|
-
function
|
|
374
|
+
function h(u) {
|
|
446
375
|
if (a) throw new TypeError("Generator is already executing.");
|
|
447
|
-
for (; n && (n = 0,
|
|
448
|
-
if (a = 1, i && (t =
|
|
449
|
-
switch (i = 0, t && (
|
|
376
|
+
for (; n && (n = 0, u[0] && (o = 0)), o; ) try {
|
|
377
|
+
if (a = 1, i && (t = u[0] & 2 ? i.return : u[0] ? i.throw || ((t = i.return) && t.call(i), 0) : i.next) && !(t = t.call(i, u[1])).done) return t;
|
|
378
|
+
switch (i = 0, t && (u = [u[0] & 2, t.value]), u[0]) {
|
|
450
379
|
case 0:
|
|
451
380
|
case 1:
|
|
452
|
-
t =
|
|
381
|
+
t = u;
|
|
453
382
|
break;
|
|
454
383
|
case 4:
|
|
455
|
-
return
|
|
384
|
+
return o.label++, { value: u[1], done: !1 };
|
|
456
385
|
case 5:
|
|
457
|
-
|
|
386
|
+
o.label++, i = u[1], u = [0];
|
|
458
387
|
continue;
|
|
459
388
|
case 7:
|
|
460
|
-
|
|
389
|
+
u = o.ops.pop(), o.trys.pop();
|
|
461
390
|
continue;
|
|
462
391
|
default:
|
|
463
|
-
if (t =
|
|
464
|
-
|
|
392
|
+
if (t = o.trys, !(t = t.length > 0 && t[t.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
393
|
+
o = 0;
|
|
465
394
|
continue;
|
|
466
395
|
}
|
|
467
|
-
if (
|
|
468
|
-
|
|
396
|
+
if (u[0] === 3 && (!t || u[1] > t[0] && u[1] < t[3])) {
|
|
397
|
+
o.label = u[1];
|
|
469
398
|
break;
|
|
470
399
|
}
|
|
471
|
-
if (
|
|
472
|
-
|
|
400
|
+
if (u[0] === 6 && o.label < t[1]) {
|
|
401
|
+
o.label = t[1], t = u;
|
|
473
402
|
break;
|
|
474
403
|
}
|
|
475
|
-
if (t &&
|
|
476
|
-
|
|
404
|
+
if (t && o.label < t[2]) {
|
|
405
|
+
o.label = t[2], o.ops.push(u);
|
|
477
406
|
break;
|
|
478
407
|
}
|
|
479
|
-
t[2] &&
|
|
408
|
+
t[2] && o.ops.pop(), o.trys.pop();
|
|
480
409
|
continue;
|
|
481
410
|
}
|
|
482
|
-
|
|
411
|
+
u = l.call(c, o);
|
|
483
412
|
} catch (y) {
|
|
484
|
-
|
|
413
|
+
u = [6, y], i = 0;
|
|
485
414
|
} finally {
|
|
486
415
|
a = t = 0;
|
|
487
416
|
}
|
|
488
|
-
if (
|
|
489
|
-
return { value:
|
|
417
|
+
if (u[0] & 5) throw u[1];
|
|
418
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
490
419
|
}
|
|
491
|
-
},
|
|
492
|
-
if (
|
|
420
|
+
}, _ = x && x.__spreadArray || function(c, l, o) {
|
|
421
|
+
if (o || arguments.length === 2) for (var a = 0, i = l.length, t; a < i; a++)
|
|
493
422
|
(t || !(a in l)) && (t || (t = Array.prototype.slice.call(l, 0, a)), t[a] = l[a]);
|
|
494
423
|
return c.concat(t || Array.prototype.slice.call(l));
|
|
495
424
|
};
|
|
496
425
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.getUrl = void 0;
|
|
497
|
-
var
|
|
426
|
+
var f = He(), E = V(), S = function(c) {
|
|
498
427
|
return new Promise(function(l) {
|
|
499
428
|
return window.setTimeout(l, c);
|
|
500
429
|
});
|
|
501
430
|
}, d = function(c, l) {
|
|
502
|
-
for (var
|
|
503
|
-
|
|
504
|
-
return
|
|
505
|
-
var
|
|
431
|
+
for (var o = [], a = 2; a < arguments.length; a++)
|
|
432
|
+
o[a - 2] = arguments[a];
|
|
433
|
+
return b(void 0, _([c, l], o, !0), void 0, function(i, t, n) {
|
|
434
|
+
var v, h, u, y, C, P, T, A;
|
|
506
435
|
return n === void 0 && (n = 0), O(this, function(k) {
|
|
507
436
|
switch (k.label) {
|
|
508
437
|
case 0:
|
|
@@ -511,9 +440,9 @@ function Et() {
|
|
|
511
440
|
case 1:
|
|
512
441
|
return k.trys.push([1, 3, , 9]), [4, i()];
|
|
513
442
|
case 2:
|
|
514
|
-
return
|
|
443
|
+
return v = k.sent(), [3, 9];
|
|
515
444
|
case 3:
|
|
516
|
-
return k.sent(), t.current.retryOnError ? (
|
|
445
|
+
return k.sent(), t.current.retryOnError ? (h = (P = t.current.reconnectAttempts) !== null && P !== void 0 ? P : E.DEFAULT_RECONNECT_LIMIT, n < h ? (u = typeof t.current.reconnectInterval == "function" ? t.current.reconnectInterval(n) : t.current.reconnectInterval, [4, S(u ?? E.DEFAULT_RECONNECT_INTERVAL_MS)]) : [3, 5]) : [3, 7];
|
|
517
446
|
case 4:
|
|
518
447
|
return k.sent(), [2, (0, r.getUrl)(i, t, n + 1)];
|
|
519
448
|
case 5:
|
|
@@ -527,9 +456,9 @@ function Et() {
|
|
|
527
456
|
case 9:
|
|
528
457
|
return [3, 11];
|
|
529
458
|
case 10:
|
|
530
|
-
|
|
459
|
+
v = i, k.label = 11;
|
|
531
460
|
case 11:
|
|
532
|
-
return y = t.current.fromSocketIO ? (0,
|
|
461
|
+
return y = t.current.fromSocketIO ? (0, f.parseSocketIOUrl)(v) : v, C = t.current.queryParams ? (0, f.appendQueryParams)(y, t.current.queryParams) : y, [2, C];
|
|
533
462
|
}
|
|
534
463
|
});
|
|
535
464
|
});
|
|
@@ -538,22 +467,22 @@ function Et() {
|
|
|
538
467
|
})(x)), x;
|
|
539
468
|
}
|
|
540
469
|
var qe = {}, br;
|
|
541
|
-
function
|
|
470
|
+
function _t() {
|
|
542
471
|
return br || (br = 1, (function(r) {
|
|
543
472
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.websocketWrapper = void 0;
|
|
544
|
-
var
|
|
473
|
+
var b = function(O, _) {
|
|
545
474
|
return new Proxy(O, {
|
|
546
|
-
get: function(
|
|
547
|
-
var S =
|
|
548
|
-
return
|
|
475
|
+
get: function(f, E) {
|
|
476
|
+
var S = f[E];
|
|
477
|
+
return E === "reconnect" ? _ : typeof S == "function" ? (console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."), function() {
|
|
549
478
|
}) : S;
|
|
550
479
|
},
|
|
551
|
-
set: function(
|
|
552
|
-
return /^on/.test(
|
|
480
|
+
set: function(f, E, S) {
|
|
481
|
+
return /^on/.test(E) ? (console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."), !1) : (f[E] = S, !0);
|
|
553
482
|
}
|
|
554
483
|
});
|
|
555
484
|
};
|
|
556
|
-
r.websocketWrapper =
|
|
485
|
+
r.websocketWrapper = b, r.default = r.websocketWrapper;
|
|
557
486
|
})(qe)), qe;
|
|
558
487
|
}
|
|
559
488
|
var gr;
|
|
@@ -562,43 +491,43 @@ function Ye() {
|
|
|
562
491
|
gr = 1;
|
|
563
492
|
var r = F && F.__assign || function() {
|
|
564
493
|
return r = Object.assign || function(i) {
|
|
565
|
-
for (var t, n = 1,
|
|
494
|
+
for (var t, n = 1, v = arguments.length; n < v; n++) {
|
|
566
495
|
t = arguments[n];
|
|
567
|
-
for (var
|
|
496
|
+
for (var h in t) Object.prototype.hasOwnProperty.call(t, h) && (i[h] = t[h]);
|
|
568
497
|
}
|
|
569
498
|
return i;
|
|
570
499
|
}, r.apply(this, arguments);
|
|
571
|
-
},
|
|
572
|
-
function
|
|
573
|
-
return
|
|
574
|
-
y(
|
|
500
|
+
}, b = F && F.__awaiter || function(i, t, n, v) {
|
|
501
|
+
function h(u) {
|
|
502
|
+
return u instanceof n ? u : new n(function(y) {
|
|
503
|
+
y(u);
|
|
575
504
|
});
|
|
576
505
|
}
|
|
577
|
-
return new (n || (n = Promise))(function(
|
|
506
|
+
return new (n || (n = Promise))(function(u, y) {
|
|
578
507
|
function C(A) {
|
|
579
508
|
try {
|
|
580
|
-
T(
|
|
509
|
+
T(v.next(A));
|
|
581
510
|
} catch (k) {
|
|
582
511
|
y(k);
|
|
583
512
|
}
|
|
584
513
|
}
|
|
585
514
|
function P(A) {
|
|
586
515
|
try {
|
|
587
|
-
T(
|
|
516
|
+
T(v.throw(A));
|
|
588
517
|
} catch (k) {
|
|
589
518
|
y(k);
|
|
590
519
|
}
|
|
591
520
|
}
|
|
592
521
|
function T(A) {
|
|
593
|
-
A.done ?
|
|
522
|
+
A.done ? u(A.value) : h(A.value).then(C, P);
|
|
594
523
|
}
|
|
595
|
-
T((
|
|
524
|
+
T((v = v.apply(i, t || [])).next());
|
|
596
525
|
});
|
|
597
526
|
}, O = F && F.__generator || function(i, t) {
|
|
598
527
|
var n = { label: 0, sent: function() {
|
|
599
|
-
if (
|
|
600
|
-
return
|
|
601
|
-
}, trys: [], ops: [] },
|
|
528
|
+
if (u[0] & 1) throw u[1];
|
|
529
|
+
return u[1];
|
|
530
|
+
}, trys: [], ops: [] }, v, h, u, y = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
602
531
|
return y.next = C(0), y.throw = C(1), y.return = C(2), typeof Symbol == "function" && (y[Symbol.iterator] = function() {
|
|
603
532
|
return this;
|
|
604
533
|
}), y;
|
|
@@ -608,91 +537,91 @@ function Ye() {
|
|
|
608
537
|
};
|
|
609
538
|
}
|
|
610
539
|
function P(T) {
|
|
611
|
-
if (
|
|
540
|
+
if (v) throw new TypeError("Generator is already executing.");
|
|
612
541
|
for (; y && (y = 0, T[0] && (n = 0)), n; ) try {
|
|
613
|
-
if (
|
|
614
|
-
switch (
|
|
542
|
+
if (v = 1, h && (u = T[0] & 2 ? h.return : T[0] ? h.throw || ((u = h.return) && u.call(h), 0) : h.next) && !(u = u.call(h, T[1])).done) return u;
|
|
543
|
+
switch (h = 0, u && (T = [T[0] & 2, u.value]), T[0]) {
|
|
615
544
|
case 0:
|
|
616
545
|
case 1:
|
|
617
|
-
|
|
546
|
+
u = T;
|
|
618
547
|
break;
|
|
619
548
|
case 4:
|
|
620
549
|
return n.label++, { value: T[1], done: !1 };
|
|
621
550
|
case 5:
|
|
622
|
-
n.label++,
|
|
551
|
+
n.label++, h = T[1], T = [0];
|
|
623
552
|
continue;
|
|
624
553
|
case 7:
|
|
625
554
|
T = n.ops.pop(), n.trys.pop();
|
|
626
555
|
continue;
|
|
627
556
|
default:
|
|
628
|
-
if (
|
|
557
|
+
if (u = n.trys, !(u = u.length > 0 && u[u.length - 1]) && (T[0] === 6 || T[0] === 2)) {
|
|
629
558
|
n = 0;
|
|
630
559
|
continue;
|
|
631
560
|
}
|
|
632
|
-
if (T[0] === 3 && (!
|
|
561
|
+
if (T[0] === 3 && (!u || T[1] > u[0] && T[1] < u[3])) {
|
|
633
562
|
n.label = T[1];
|
|
634
563
|
break;
|
|
635
564
|
}
|
|
636
|
-
if (T[0] === 6 && n.label <
|
|
637
|
-
n.label =
|
|
565
|
+
if (T[0] === 6 && n.label < u[1]) {
|
|
566
|
+
n.label = u[1], u = T;
|
|
638
567
|
break;
|
|
639
568
|
}
|
|
640
|
-
if (
|
|
641
|
-
n.label =
|
|
569
|
+
if (u && n.label < u[2]) {
|
|
570
|
+
n.label = u[2], n.ops.push(T);
|
|
642
571
|
break;
|
|
643
572
|
}
|
|
644
|
-
|
|
573
|
+
u[2] && n.ops.pop(), n.trys.pop();
|
|
645
574
|
continue;
|
|
646
575
|
}
|
|
647
576
|
T = t.call(i, n);
|
|
648
577
|
} catch (A) {
|
|
649
|
-
T = [6, A],
|
|
578
|
+
T = [6, A], h = 0;
|
|
650
579
|
} finally {
|
|
651
|
-
|
|
580
|
+
v = u = 0;
|
|
652
581
|
}
|
|
653
582
|
if (T[0] & 5) throw T[1];
|
|
654
583
|
return { value: T[0] ? T[1] : void 0, done: !0 };
|
|
655
584
|
}
|
|
656
|
-
},
|
|
585
|
+
}, _ = F && F.__importDefault || function(i) {
|
|
657
586
|
return i && i.__esModule ? i : { default: i };
|
|
658
587
|
};
|
|
659
588
|
Object.defineProperty(F, "__esModule", { value: !0 }), F.useWebSocket = void 0;
|
|
660
|
-
var
|
|
589
|
+
var f = ye, E = at, S = V(), d = vt(), c = dt(), l = _(_t()), o = $e(), a = function(i, t, n) {
|
|
661
590
|
t === void 0 && (t = S.DEFAULT_OPTIONS), n === void 0 && (n = !0);
|
|
662
|
-
var
|
|
663
|
-
if (!t.disableJson &&
|
|
591
|
+
var v = (0, f.useState)(null), h = v[0], u = v[1], y = (0, f.useState)({}), C = y[0], P = y[1], T = (0, f.useMemo)(function() {
|
|
592
|
+
if (!t.disableJson && h)
|
|
664
593
|
try {
|
|
665
|
-
return JSON.parse(
|
|
594
|
+
return JSON.parse(h.data);
|
|
666
595
|
} catch {
|
|
667
596
|
return S.UNPARSABLE_JSON_OBJECT;
|
|
668
597
|
}
|
|
669
598
|
return null;
|
|
670
|
-
}, [
|
|
671
|
-
}), le = (0,
|
|
599
|
+
}, [h, t.disableJson]), A = (0, f.useRef)(null), k = (0, f.useRef)(null), se = (0, f.useRef)(function() {
|
|
600
|
+
}), le = (0, f.useRef)(0), Ie = (0, f.useRef)(Date.now()), be = (0, f.useRef)([]), J = (0, f.useRef)(null), L = (0, f.useRef)(t);
|
|
672
601
|
L.current = t;
|
|
673
|
-
var G = A.current && C[A.current] !== void 0 ? C[A.current] : i !== null && n === !0 ? S.ReadyState.CONNECTING : S.ReadyState.UNINSTANTIATED, X = t.queryParams ? JSON.stringify(t.queryParams) : null, $ = (0,
|
|
602
|
+
var G = A.current && C[A.current] !== void 0 ? C[A.current] : i !== null && n === !0 ? S.ReadyState.CONNECTING : S.ReadyState.UNINSTANTIATED, X = t.queryParams ? JSON.stringify(t.queryParams) : null, $ = (0, f.useCallback)(function(D, j) {
|
|
674
603
|
var Y;
|
|
675
604
|
if (j === void 0 && (j = !0), S.isEventSourceSupported && k.current instanceof EventSource) {
|
|
676
605
|
console.warn("Unable to send a message from an eventSource");
|
|
677
606
|
return;
|
|
678
607
|
}
|
|
679
|
-
((Y = k.current) === null || Y === void 0 ? void 0 : Y.readyState) === S.ReadyState.OPEN ? ((0,
|
|
680
|
-
}, []), ge = (0,
|
|
608
|
+
((Y = k.current) === null || Y === void 0 ? void 0 : Y.readyState) === S.ReadyState.OPEN ? ((0, o.assertIsWebSocket)(k.current, L.current.skipAssert), k.current.send(D)) : j && be.current.push(D);
|
|
609
|
+
}, []), ge = (0, f.useCallback)(function(D, j) {
|
|
681
610
|
j === void 0 && (j = !0), $(JSON.stringify(D), j);
|
|
682
|
-
}, [$]), Oe = (0,
|
|
683
|
-
return L.current.share !== !0 || S.isEventSourceSupported && k.current instanceof EventSource ? k.current : (J.current === null && k.current && ((0,
|
|
611
|
+
}, [$]), Oe = (0, f.useCallback)(function() {
|
|
612
|
+
return L.current.share !== !0 || S.isEventSourceSupported && k.current instanceof EventSource ? k.current : (J.current === null && k.current && ((0, o.assertIsWebSocket)(k.current, L.current.skipAssert), J.current = (0, l.default)(k.current, se)), J.current);
|
|
684
613
|
}, []);
|
|
685
|
-
return (0,
|
|
614
|
+
return (0, f.useEffect)(function() {
|
|
686
615
|
if (i !== null && n === !0) {
|
|
687
616
|
var D, j = !1, Y = !0, fe = function() {
|
|
688
|
-
return
|
|
617
|
+
return b(void 0, void 0, void 0, function() {
|
|
689
618
|
var Z, z, pe;
|
|
690
|
-
return O(this, function(
|
|
691
|
-
switch (
|
|
619
|
+
return O(this, function(oe) {
|
|
620
|
+
switch (oe.label) {
|
|
692
621
|
case 0:
|
|
693
622
|
return Z = A, [4, (0, c.getUrl)(i, L)];
|
|
694
623
|
case 1:
|
|
695
|
-
return Z.current =
|
|
624
|
+
return Z.current = oe.sent(), A.current === null ? (console.error("Failed to get a valid URL. WebSocket connection aborted."), A.current = "ABORTED", (0, E.flushSync)(function() {
|
|
696
625
|
return P(function(B) {
|
|
697
626
|
return r(r({}, B), { ABORTED: S.ReadyState.CLOSED });
|
|
698
627
|
});
|
|
@@ -700,14 +629,14 @@ function Ye() {
|
|
|
700
629
|
2
|
|
701
630
|
/*return*/
|
|
702
631
|
]) : (z = function(B) {
|
|
703
|
-
j || (0,
|
|
704
|
-
return
|
|
632
|
+
j || (0, E.flushSync)(function() {
|
|
633
|
+
return u(B);
|
|
705
634
|
});
|
|
706
635
|
}, pe = function(B) {
|
|
707
|
-
j || (0,
|
|
708
|
-
return P(function(
|
|
636
|
+
j || (0, E.flushSync)(function() {
|
|
637
|
+
return P(function(ue) {
|
|
709
638
|
var ee;
|
|
710
|
-
return r(r({},
|
|
639
|
+
return r(r({}, ue), A.current && (ee = {}, ee[A.current] = B, ee));
|
|
711
640
|
});
|
|
712
641
|
});
|
|
713
642
|
}, Y && (D = (0, d.createOrJoinSocket)(k, A.current, pe, L, z, se, le, Ie, $)), [
|
|
@@ -721,20 +650,20 @@ function Ye() {
|
|
|
721
650
|
return se.current = function() {
|
|
722
651
|
j || (J.current && (J.current = null), D?.(), fe());
|
|
723
652
|
}, fe(), function() {
|
|
724
|
-
j = !0, Y = !1, J.current && (J.current = null), D?.(),
|
|
653
|
+
j = !0, Y = !1, J.current && (J.current = null), D?.(), u(null);
|
|
725
654
|
};
|
|
726
655
|
} else (i === null || n === !1) && (le.current = 0, P(function(Z) {
|
|
727
656
|
var z;
|
|
728
657
|
return r(r({}, Z), A.current && (z = {}, z[A.current] = S.ReadyState.CLOSED, z));
|
|
729
658
|
}));
|
|
730
|
-
}, [i, n, X, $]), (0,
|
|
659
|
+
}, [i, n, X, $]), (0, f.useEffect)(function() {
|
|
731
660
|
G === S.ReadyState.OPEN && be.current.splice(0).forEach(function(D) {
|
|
732
661
|
$(D);
|
|
733
662
|
});
|
|
734
663
|
}, [G]), {
|
|
735
664
|
sendMessage: $,
|
|
736
665
|
sendJsonMessage: ge,
|
|
737
|
-
lastMessage:
|
|
666
|
+
lastMessage: h,
|
|
738
667
|
lastJsonMessage: T,
|
|
739
668
|
readyState: G,
|
|
740
669
|
getWebSocket: Oe
|
|
@@ -743,12 +672,12 @@ function Ye() {
|
|
|
743
672
|
return F.useWebSocket = a, F;
|
|
744
673
|
}
|
|
745
674
|
var ae = {}, Or;
|
|
746
|
-
function
|
|
675
|
+
function Et() {
|
|
747
676
|
if (Or) return ae;
|
|
748
677
|
Or = 1;
|
|
749
678
|
var r = ae && ae.__assign || function() {
|
|
750
679
|
return r = Object.assign || function(d) {
|
|
751
|
-
for (var c, l = 1,
|
|
680
|
+
for (var c, l = 1, o = arguments.length; l < o; l++) {
|
|
752
681
|
c = arguments[l];
|
|
753
682
|
for (var a in c) Object.prototype.hasOwnProperty.call(c, a) && (d[a] = c[a]);
|
|
754
683
|
}
|
|
@@ -756,109 +685,109 @@ function ht() {
|
|
|
756
685
|
}, r.apply(this, arguments);
|
|
757
686
|
};
|
|
758
687
|
Object.defineProperty(ae, "__esModule", { value: !0 }), ae.useSocketIO = void 0;
|
|
759
|
-
var
|
|
688
|
+
var b = ye, O = Ye(), _ = V(), f = {
|
|
760
689
|
type: "empty",
|
|
761
690
|
payload: null
|
|
762
|
-
},
|
|
691
|
+
}, E = function(d) {
|
|
763
692
|
if (!d || !d.data)
|
|
764
|
-
return
|
|
693
|
+
return f;
|
|
765
694
|
var c = d.data.match(/\[.*]/);
|
|
766
695
|
if (!c)
|
|
767
|
-
return
|
|
696
|
+
return f;
|
|
768
697
|
var l = JSON.parse(c);
|
|
769
|
-
return !Array.isArray(l) || !l[1] ?
|
|
698
|
+
return !Array.isArray(l) || !l[1] ? f : {
|
|
770
699
|
type: l[0],
|
|
771
700
|
payload: l[1]
|
|
772
701
|
};
|
|
773
702
|
}, S = function(d, c, l) {
|
|
774
|
-
c === void 0 && (c =
|
|
775
|
-
var
|
|
703
|
+
c === void 0 && (c = _.DEFAULT_OPTIONS), l === void 0 && (l = !0);
|
|
704
|
+
var o = (0, b.useMemo)(function() {
|
|
776
705
|
return r(r({}, c), { fromSocketIO: !0 });
|
|
777
|
-
}, []), a = (0, O.useWebSocket)(d,
|
|
778
|
-
return
|
|
706
|
+
}, []), a = (0, O.useWebSocket)(d, o, l), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, v = a.readyState, h = a.getWebSocket, u = (0, b.useMemo)(function() {
|
|
707
|
+
return E(n);
|
|
779
708
|
}, [n]);
|
|
780
709
|
return {
|
|
781
710
|
sendMessage: i,
|
|
782
711
|
sendJsonMessage: t,
|
|
783
|
-
lastMessage:
|
|
784
|
-
lastJsonMessage:
|
|
785
|
-
readyState:
|
|
786
|
-
getWebSocket:
|
|
712
|
+
lastMessage: u,
|
|
713
|
+
lastJsonMessage: u,
|
|
714
|
+
readyState: v,
|
|
715
|
+
getWebSocket: h
|
|
787
716
|
};
|
|
788
717
|
};
|
|
789
718
|
return ae.useSocketIO = S, ae;
|
|
790
719
|
}
|
|
791
720
|
var Q = {}, pr;
|
|
792
|
-
function
|
|
721
|
+
function St() {
|
|
793
722
|
if (pr) return Q;
|
|
794
723
|
pr = 1;
|
|
795
724
|
var r = Q && Q.__assign || function() {
|
|
796
725
|
return r = Object.assign || function(S) {
|
|
797
726
|
for (var d, c = 1, l = arguments.length; c < l; c++) {
|
|
798
727
|
d = arguments[c];
|
|
799
|
-
for (var
|
|
728
|
+
for (var o in d) Object.prototype.hasOwnProperty.call(d, o) && (S[o] = d[o]);
|
|
800
729
|
}
|
|
801
730
|
return S;
|
|
802
731
|
}, r.apply(this, arguments);
|
|
803
|
-
},
|
|
732
|
+
}, b = Q && Q.__rest || function(S, d) {
|
|
804
733
|
var c = {};
|
|
805
734
|
for (var l in S) Object.prototype.hasOwnProperty.call(S, l) && d.indexOf(l) < 0 && (c[l] = S[l]);
|
|
806
735
|
if (S != null && typeof Object.getOwnPropertySymbols == "function")
|
|
807
|
-
for (var
|
|
808
|
-
d.indexOf(l[
|
|
736
|
+
for (var o = 0, l = Object.getOwnPropertySymbols(S); o < l.length; o++)
|
|
737
|
+
d.indexOf(l[o]) < 0 && Object.prototype.propertyIsEnumerable.call(S, l[o]) && (c[l[o]] = S[l[o]]);
|
|
809
738
|
return c;
|
|
810
739
|
};
|
|
811
740
|
Object.defineProperty(Q, "__esModule", { value: !0 }), Q.useEventSource = void 0;
|
|
812
|
-
var O = ye,
|
|
813
|
-
d === void 0 && (d =
|
|
814
|
-
var l = d.withCredentials,
|
|
741
|
+
var O = ye, _ = Ye(), f = V(), E = function(S, d, c) {
|
|
742
|
+
d === void 0 && (d = f.DEFAULT_EVENT_SOURCE_OPTIONS);
|
|
743
|
+
var l = d.withCredentials, o = d.events, a = b(d, ["withCredentials", "events"]);
|
|
815
744
|
c === void 0 && (c = !0);
|
|
816
745
|
var i = r(r({}, a), { eventSourceOptions: {
|
|
817
746
|
withCredentials: l
|
|
818
|
-
} }), t = (0, O.useRef)(
|
|
819
|
-
|
|
820
|
-
var n = (0,
|
|
747
|
+
} }), t = (0, O.useRef)(f.EMPTY_EVENT_HANDLERS);
|
|
748
|
+
o && (t.current = o);
|
|
749
|
+
var n = (0, _.useWebSocket)(S, i, c), v = n.lastMessage, h = n.readyState, u = n.getWebSocket;
|
|
821
750
|
return (0, O.useEffect)(function() {
|
|
822
|
-
|
|
751
|
+
v?.type && Object.entries(t.current).forEach(function(y) {
|
|
823
752
|
var C = y[0], P = y[1];
|
|
824
|
-
C ===
|
|
753
|
+
C === v.type && P(v);
|
|
825
754
|
});
|
|
826
|
-
}, [
|
|
827
|
-
lastEvent:
|
|
828
|
-
readyState:
|
|
829
|
-
getEventSource:
|
|
755
|
+
}, [v]), {
|
|
756
|
+
lastEvent: v,
|
|
757
|
+
readyState: h,
|
|
758
|
+
getEventSource: u
|
|
830
759
|
};
|
|
831
760
|
};
|
|
832
|
-
return Q.useEventSource =
|
|
761
|
+
return Q.useEventSource = E, Q;
|
|
833
762
|
}
|
|
834
763
|
var Tr;
|
|
835
|
-
function
|
|
764
|
+
function ht() {
|
|
836
765
|
return Tr || (Tr = 1, (function(r) {
|
|
837
766
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetGlobalState = r.useEventSource = r.ReadyState = r.useSocketIO = r.default = void 0;
|
|
838
|
-
var
|
|
767
|
+
var b = Ye();
|
|
839
768
|
Object.defineProperty(r, "default", { enumerable: !0, get: function() {
|
|
840
|
-
return
|
|
769
|
+
return b.useWebSocket;
|
|
841
770
|
} });
|
|
842
|
-
var O =
|
|
771
|
+
var O = Et();
|
|
843
772
|
Object.defineProperty(r, "useSocketIO", { enumerable: !0, get: function() {
|
|
844
773
|
return O.useSocketIO;
|
|
845
774
|
} });
|
|
846
|
-
var
|
|
775
|
+
var _ = V();
|
|
847
776
|
Object.defineProperty(r, "ReadyState", { enumerable: !0, get: function() {
|
|
848
|
-
return
|
|
777
|
+
return _.ReadyState;
|
|
849
778
|
} });
|
|
850
|
-
var
|
|
779
|
+
var f = St();
|
|
851
780
|
Object.defineProperty(r, "useEventSource", { enumerable: !0, get: function() {
|
|
852
|
-
return
|
|
781
|
+
return f.useEventSource;
|
|
853
782
|
} });
|
|
854
|
-
var
|
|
783
|
+
var E = $e();
|
|
855
784
|
Object.defineProperty(r, "resetGlobalState", { enumerable: !0, get: function() {
|
|
856
|
-
return
|
|
785
|
+
return E.resetGlobalState;
|
|
857
786
|
} });
|
|
858
787
|
})(je)), je;
|
|
859
788
|
}
|
|
860
|
-
var
|
|
861
|
-
const
|
|
789
|
+
var yt = ht();
|
|
790
|
+
const bt = /* @__PURE__ */ st(yt), H = {
|
|
862
791
|
DEPOSIT: "deposit",
|
|
863
792
|
TRANS_CODE: "transCode",
|
|
864
793
|
ERROR: "error",
|
|
@@ -869,13 +798,13 @@ const Ot = /* @__PURE__ */ ft(gt), V = {
|
|
|
869
798
|
TRANSFER_IN_GAME: "transfer_in_game",
|
|
870
799
|
CHECK_REQUEST: "CHECK_RREQUEST",
|
|
871
800
|
CASH_REGISTER_LIMIT: "cash_register_limit"
|
|
872
|
-
},
|
|
801
|
+
}, gt = 3e4, kt = ({
|
|
873
802
|
socketUrl: r,
|
|
874
|
-
socketHandlers:
|
|
803
|
+
socketHandlers: b = {},
|
|
875
804
|
options: O = {}
|
|
876
805
|
}) => {
|
|
877
|
-
const
|
|
878
|
-
sendMessage:
|
|
806
|
+
const _ = ir(!1), f = ir(b), {
|
|
807
|
+
sendMessage: E,
|
|
879
808
|
// 發送普通訊息
|
|
880
809
|
sendJsonMessage: S,
|
|
881
810
|
// 發送 JSON 訊息
|
|
@@ -885,10 +814,10 @@ const Ot = /* @__PURE__ */ ft(gt), V = {
|
|
|
885
814
|
readyState: c
|
|
886
815
|
// WebSocket 連線狀態
|
|
887
816
|
// getWebSocket, // 獲取 WebSocket 實例
|
|
888
|
-
} =
|
|
817
|
+
} = bt(r, {
|
|
889
818
|
queryParams: { key: "wsky" },
|
|
890
819
|
onOpen: () => console.log("連線成功"),
|
|
891
|
-
shouldReconnect: () =>
|
|
820
|
+
shouldReconnect: () => _.current === !1,
|
|
892
821
|
reconnectAttempts: 9999,
|
|
893
822
|
reconnectInterval: 1e3,
|
|
894
823
|
...O
|
|
@@ -899,128 +828,174 @@ const Ot = /* @__PURE__ */ ft(gt), V = {
|
|
|
899
828
|
return null;
|
|
900
829
|
}
|
|
901
830
|
}, [d?.data]);
|
|
902
|
-
return
|
|
903
|
-
const
|
|
904
|
-
() =>
|
|
905
|
-
|
|
831
|
+
return we(() => {
|
|
832
|
+
const o = setInterval(
|
|
833
|
+
() => E("ping"),
|
|
834
|
+
gt
|
|
906
835
|
);
|
|
907
|
-
return () => clearInterval(
|
|
908
|
-
}, [
|
|
909
|
-
|
|
910
|
-
}, [
|
|
836
|
+
return () => clearInterval(o);
|
|
837
|
+
}, [E]), we(() => {
|
|
838
|
+
f.current = b;
|
|
839
|
+
}, [b]), we(() => {
|
|
911
840
|
if (!l) return;
|
|
912
841
|
const {
|
|
913
|
-
onDeposit:
|
|
842
|
+
onDeposit: o,
|
|
914
843
|
onTransCode: a,
|
|
915
844
|
onError: i,
|
|
916
845
|
onUpdateMember: t,
|
|
917
846
|
onMaintainNotice: n,
|
|
918
|
-
onMaintainNoticeMember:
|
|
919
|
-
onReload:
|
|
920
|
-
onTransferInGame:
|
|
847
|
+
onMaintainNoticeMember: v,
|
|
848
|
+
onReload: h,
|
|
849
|
+
onTransferInGame: u,
|
|
921
850
|
onCashRegisterLimit: y
|
|
922
|
-
} =
|
|
923
|
-
memberInfoUid:
|
|
924
|
-
data:
|
|
925
|
-
memo:
|
|
851
|
+
} = f.current, C = Ce(l, "type", ""), P = {
|
|
852
|
+
memberInfoUid: Ce(l, "member_info_uid", null),
|
|
853
|
+
data: Ce(l, "data", null),
|
|
854
|
+
memo: Ce(l, "memo", null)
|
|
926
855
|
};
|
|
927
856
|
switch (C) {
|
|
928
|
-
case
|
|
929
|
-
|
|
857
|
+
case H.DEPOSIT:
|
|
858
|
+
o?.(P);
|
|
930
859
|
break;
|
|
931
|
-
case
|
|
860
|
+
case H.TRANS_CODE:
|
|
932
861
|
a?.(P);
|
|
933
862
|
break;
|
|
934
|
-
case
|
|
863
|
+
case H.ERROR:
|
|
935
864
|
i?.(P);
|
|
936
865
|
break;
|
|
937
|
-
case
|
|
866
|
+
case H.UPDATE_MEMBER:
|
|
938
867
|
t?.(P);
|
|
939
868
|
break;
|
|
940
|
-
case
|
|
869
|
+
case H.MAINTAIN_NOTICE:
|
|
941
870
|
n?.(P);
|
|
942
871
|
break;
|
|
943
|
-
case
|
|
944
|
-
|
|
872
|
+
case H.MAINTAIN_NOTICE_MEMBER:
|
|
873
|
+
v?.(P);
|
|
945
874
|
break;
|
|
946
|
-
case
|
|
947
|
-
|
|
875
|
+
case H.RELOAD:
|
|
876
|
+
h?.(P);
|
|
948
877
|
break;
|
|
949
|
-
case
|
|
950
|
-
case
|
|
951
|
-
|
|
878
|
+
case H.TRANSFER_IN_GAME:
|
|
879
|
+
case H.CHECK_REQUEST:
|
|
880
|
+
u?.(P);
|
|
952
881
|
break;
|
|
953
|
-
case
|
|
882
|
+
case H.CASH_REGISTER_LIMIT:
|
|
954
883
|
y?.(P);
|
|
955
884
|
break;
|
|
956
885
|
default:
|
|
957
886
|
console.warn("Unknown socket type:", C);
|
|
958
887
|
break;
|
|
959
888
|
}
|
|
960
|
-
}, [l]),
|
|
961
|
-
sendMessage:
|
|
889
|
+
}, [l]), we(() => () => _.current = !0, []), {
|
|
890
|
+
sendMessage: E,
|
|
962
891
|
sendJsonMessage: S,
|
|
963
892
|
readyState: c
|
|
964
893
|
// WebSocket 連線狀態
|
|
965
894
|
};
|
|
895
|
+
}, Pr = tt(null), Ir = () => {
|
|
896
|
+
const r = nt(Pr);
|
|
897
|
+
if (!r)
|
|
898
|
+
throw new Error("useApiContext must be used within ApiProvider");
|
|
899
|
+
return r;
|
|
900
|
+
}, Ot = () => {
|
|
901
|
+
const { client: r } = Ir(), b = de(
|
|
902
|
+
async (S) => {
|
|
903
|
+
const { mac_address: d = "", app_version: c = "", anydesk_id: l = "" } = S, { data: o } = await r.post("/cash-register/login", {
|
|
904
|
+
mac_address: d,
|
|
905
|
+
app_version: c,
|
|
906
|
+
anydesk_id: l
|
|
907
|
+
});
|
|
908
|
+
return o;
|
|
909
|
+
},
|
|
910
|
+
[r]
|
|
911
|
+
), O = de(async () => r.get("/member/getMemberInfo"), [r]), _ = de(async () => {
|
|
912
|
+
const { data: S } = await r.get("/getGameList");
|
|
913
|
+
return S;
|
|
914
|
+
}, [r]), f = de(async () => {
|
|
915
|
+
const { data: S } = await r.get("/getNowCurrencyExchange");
|
|
916
|
+
return S;
|
|
917
|
+
}, [r]), E = de(async () => {
|
|
918
|
+
const { data: S } = await r.get("/getFavoriteGame");
|
|
919
|
+
return S;
|
|
920
|
+
}, [r]);
|
|
921
|
+
return {
|
|
922
|
+
machineLoginApi: b,
|
|
923
|
+
userInfoApi: O,
|
|
924
|
+
userGameListApi: _,
|
|
925
|
+
userFavoriteGameApi: E,
|
|
926
|
+
userCurrencyExchangeApi: f
|
|
927
|
+
};
|
|
928
|
+
}, Nt = () => {
|
|
929
|
+
const { getToken: r } = Ir(), { userInfoApi: b } = Ot(), O = ot({
|
|
930
|
+
queries: [
|
|
931
|
+
{
|
|
932
|
+
queryKey: ["getMemberInfo"],
|
|
933
|
+
queryFn: async () => await b(),
|
|
934
|
+
refetchInterval: 5e4
|
|
935
|
+
}
|
|
936
|
+
],
|
|
937
|
+
enabled: !!r
|
|
938
|
+
}), { data: _, isFetching: f, error: E } = O[0] || {};
|
|
939
|
+
return { data: _, isFetching: f, error: E };
|
|
940
|
+
}, Mt = () => {
|
|
941
|
+
const r = (_, f) => !_ && !f, b = (_) => _.startsWith("pc.");
|
|
942
|
+
return {
|
|
943
|
+
executeLogout: ({
|
|
944
|
+
isCallBackInvalid: _ = !1,
|
|
945
|
+
hostname: f = "",
|
|
946
|
+
shouldRedirect: E,
|
|
947
|
+
onShowError: S,
|
|
948
|
+
onCleanup: d,
|
|
949
|
+
onRemoveToken: c,
|
|
950
|
+
onRedirect: l,
|
|
951
|
+
onGoogleLogout: o
|
|
952
|
+
}) => {
|
|
953
|
+
const a = b(f);
|
|
954
|
+
r(_, a) && S?.(), d?.(), c?.(), E && l?.("/"), o?.();
|
|
955
|
+
},
|
|
956
|
+
shouldShowErrorNotice: r,
|
|
957
|
+
isMachineDomain: b
|
|
958
|
+
};
|
|
966
959
|
};
|
|
967
960
|
var Pe = { exports: {} }, Se = {};
|
|
968
|
-
/**
|
|
969
|
-
* @license React
|
|
970
|
-
* react-jsx-runtime.production.min.js
|
|
971
|
-
*
|
|
972
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
973
|
-
*
|
|
974
|
-
* This source code is licensed under the MIT license found in the
|
|
975
|
-
* LICENSE file in the root directory of this source tree.
|
|
976
|
-
*/
|
|
977
961
|
var mr;
|
|
978
|
-
function
|
|
962
|
+
function pt() {
|
|
979
963
|
if (mr) return Se;
|
|
980
964
|
mr = 1;
|
|
981
|
-
var r = ye,
|
|
965
|
+
var r = ye, b = Symbol.for("react.element"), O = Symbol.for("react.fragment"), _ = Object.prototype.hasOwnProperty, f = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, E = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
982
966
|
function S(d, c, l) {
|
|
983
|
-
var
|
|
967
|
+
var o, a = {}, i = null, t = null;
|
|
984
968
|
l !== void 0 && (i = "" + l), c.key !== void 0 && (i = "" + c.key), c.ref !== void 0 && (t = c.ref);
|
|
985
|
-
for (
|
|
986
|
-
if (d && d.defaultProps) for (
|
|
987
|
-
return { $$typeof:
|
|
969
|
+
for (o in c) _.call(c, o) && !E.hasOwnProperty(o) && (a[o] = c[o]);
|
|
970
|
+
if (d && d.defaultProps) for (o in c = d.defaultProps, c) a[o] === void 0 && (a[o] = c[o]);
|
|
971
|
+
return { $$typeof: b, type: d, key: i, ref: t, props: a, _owner: f.current };
|
|
988
972
|
}
|
|
989
973
|
return Se.Fragment = O, Se.jsx = S, Se.jsxs = S, Se;
|
|
990
974
|
}
|
|
991
975
|
var he = {};
|
|
992
|
-
/**
|
|
993
|
-
* @license React
|
|
994
|
-
* react-jsx-runtime.development.js
|
|
995
|
-
*
|
|
996
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
997
|
-
*
|
|
998
|
-
* This source code is licensed under the MIT license found in the
|
|
999
|
-
* LICENSE file in the root directory of this source tree.
|
|
1000
|
-
*/
|
|
1001
976
|
var Rr;
|
|
1002
|
-
function
|
|
977
|
+
function Tt() {
|
|
1003
978
|
return Rr || (Rr = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
1004
|
-
var r = ye,
|
|
1005
|
-
function
|
|
979
|
+
var r = ye, b = Symbol.for("react.element"), O = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), n = Symbol.iterator, v = "@@iterator";
|
|
980
|
+
function h(e) {
|
|
1006
981
|
if (e === null || typeof e != "object")
|
|
1007
982
|
return null;
|
|
1008
|
-
var s = n && e[n] || e[
|
|
983
|
+
var s = n && e[n] || e[v];
|
|
1009
984
|
return typeof s == "function" ? s : null;
|
|
1010
985
|
}
|
|
1011
|
-
var
|
|
986
|
+
var u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1012
987
|
function y(e) {
|
|
1013
988
|
{
|
|
1014
|
-
for (var s = arguments.length,
|
|
1015
|
-
|
|
1016
|
-
C("error", e,
|
|
989
|
+
for (var s = arguments.length, g = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
|
|
990
|
+
g[p - 1] = arguments[p];
|
|
991
|
+
C("error", e, g);
|
|
1017
992
|
}
|
|
1018
993
|
}
|
|
1019
|
-
function C(e, s,
|
|
994
|
+
function C(e, s, g) {
|
|
1020
995
|
{
|
|
1021
|
-
var p =
|
|
1022
|
-
w !== "" && (s += "%s",
|
|
1023
|
-
var I =
|
|
996
|
+
var p = u.ReactDebugCurrentFrame, w = p.getStackAddendum();
|
|
997
|
+
w !== "" && (s += "%s", g = g.concat([w]));
|
|
998
|
+
var I = g.map(function(R) {
|
|
1024
999
|
return String(R);
|
|
1025
1000
|
});
|
|
1026
1001
|
I.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, I);
|
|
@@ -1029,18 +1004,18 @@ function mt() {
|
|
|
1029
1004
|
var P = !1, T = !1, A = !1, k = !1, se = !1, le;
|
|
1030
1005
|
le = Symbol.for("react.module.reference");
|
|
1031
1006
|
function Ie(e) {
|
|
1032
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
1007
|
+
return !!(typeof e == "string" || typeof e == "function" || e === _ || e === E || se || e === f || e === l || e === o || k || e === t || P || T || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof === S || e.$$typeof === d || e.$$typeof === c || // This needs to include all possible module reference object
|
|
1033
1008
|
// types supported by any Flight configuration anywhere since
|
|
1034
1009
|
// we don't know which Flight build this will end up being used
|
|
1035
1010
|
// with.
|
|
1036
1011
|
e.$$typeof === le || e.getModuleId !== void 0));
|
|
1037
1012
|
}
|
|
1038
|
-
function be(e, s,
|
|
1013
|
+
function be(e, s, g) {
|
|
1039
1014
|
var p = e.displayName;
|
|
1040
1015
|
if (p)
|
|
1041
1016
|
return p;
|
|
1042
1017
|
var w = s.displayName || s.name || "";
|
|
1043
|
-
return w !== "" ?
|
|
1018
|
+
return w !== "" ? g + "(" + w + ")" : g;
|
|
1044
1019
|
}
|
|
1045
1020
|
function J(e) {
|
|
1046
1021
|
return e.displayName || "Context";
|
|
@@ -1053,17 +1028,17 @@ function mt() {
|
|
|
1053
1028
|
if (typeof e == "string")
|
|
1054
1029
|
return e;
|
|
1055
1030
|
switch (e) {
|
|
1056
|
-
case
|
|
1031
|
+
case _:
|
|
1057
1032
|
return "Fragment";
|
|
1058
1033
|
case O:
|
|
1059
1034
|
return "Portal";
|
|
1060
|
-
case
|
|
1035
|
+
case E:
|
|
1061
1036
|
return "Profiler";
|
|
1062
|
-
case
|
|
1037
|
+
case f:
|
|
1063
1038
|
return "StrictMode";
|
|
1064
1039
|
case l:
|
|
1065
1040
|
return "Suspense";
|
|
1066
|
-
case
|
|
1041
|
+
case o:
|
|
1067
1042
|
return "SuspenseList";
|
|
1068
1043
|
}
|
|
1069
1044
|
if (typeof e == "object")
|
|
@@ -1072,8 +1047,8 @@ function mt() {
|
|
|
1072
1047
|
var s = e;
|
|
1073
1048
|
return J(s) + ".Consumer";
|
|
1074
1049
|
case S:
|
|
1075
|
-
var
|
|
1076
|
-
return J(
|
|
1050
|
+
var g = e;
|
|
1051
|
+
return J(g._context) + ".Provider";
|
|
1077
1052
|
case c:
|
|
1078
1053
|
return be(e, e.render, "ForwardRef");
|
|
1079
1054
|
case a:
|
|
@@ -1152,8 +1127,8 @@ function mt() {
|
|
|
1152
1127
|
X < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
1153
1128
|
}
|
|
1154
1129
|
}
|
|
1155
|
-
var
|
|
1156
|
-
function
|
|
1130
|
+
var oe = u.ReactCurrentDispatcher, B;
|
|
1131
|
+
function ue(e, s, g) {
|
|
1157
1132
|
{
|
|
1158
1133
|
if (B === void 0)
|
|
1159
1134
|
try {
|
|
@@ -1175,16 +1150,16 @@ function mt() {
|
|
|
1175
1150
|
if (!e || ee)
|
|
1176
1151
|
return "";
|
|
1177
1152
|
{
|
|
1178
|
-
var
|
|
1179
|
-
if (
|
|
1180
|
-
return
|
|
1153
|
+
var g = Te.get(e);
|
|
1154
|
+
if (g !== void 0)
|
|
1155
|
+
return g;
|
|
1181
1156
|
}
|
|
1182
1157
|
var p;
|
|
1183
1158
|
ee = !0;
|
|
1184
1159
|
var w = Error.prepareStackTrace;
|
|
1185
1160
|
Error.prepareStackTrace = void 0;
|
|
1186
1161
|
var I;
|
|
1187
|
-
I =
|
|
1162
|
+
I = oe.current, oe.current = null, z();
|
|
1188
1163
|
try {
|
|
1189
1164
|
if (s) {
|
|
1190
1165
|
var R = function() {
|
|
@@ -1237,56 +1212,56 @@ function mt() {
|
|
|
1237
1212
|
}
|
|
1238
1213
|
}
|
|
1239
1214
|
} finally {
|
|
1240
|
-
ee = !1,
|
|
1215
|
+
ee = !1, oe.current = I, pe(), Error.prepareStackTrace = w;
|
|
1241
1216
|
}
|
|
1242
|
-
var ie = e ? e.displayName || e.name : "", re = ie ?
|
|
1217
|
+
var ie = e ? e.displayName || e.name : "", re = ie ? ue(ie) : "";
|
|
1243
1218
|
return typeof e == "function" && Te.set(e, re), re;
|
|
1244
1219
|
}
|
|
1245
|
-
function Nr(e, s,
|
|
1220
|
+
function Nr(e, s, g) {
|
|
1246
1221
|
return Be(e, !1);
|
|
1247
1222
|
}
|
|
1248
1223
|
function Mr(e) {
|
|
1249
1224
|
var s = e.prototype;
|
|
1250
1225
|
return !!(s && s.isReactComponent);
|
|
1251
1226
|
}
|
|
1252
|
-
function me(e, s,
|
|
1227
|
+
function me(e, s, g) {
|
|
1253
1228
|
if (e == null)
|
|
1254
1229
|
return "";
|
|
1255
1230
|
if (typeof e == "function")
|
|
1256
1231
|
return Be(e, Mr(e));
|
|
1257
1232
|
if (typeof e == "string")
|
|
1258
|
-
return
|
|
1233
|
+
return ue(e);
|
|
1259
1234
|
switch (e) {
|
|
1260
1235
|
case l:
|
|
1261
|
-
return
|
|
1262
|
-
case
|
|
1263
|
-
return
|
|
1236
|
+
return ue("Suspense");
|
|
1237
|
+
case o:
|
|
1238
|
+
return ue("SuspenseList");
|
|
1264
1239
|
}
|
|
1265
1240
|
if (typeof e == "object")
|
|
1266
1241
|
switch (e.$$typeof) {
|
|
1267
1242
|
case c:
|
|
1268
1243
|
return Nr(e.render);
|
|
1269
1244
|
case a:
|
|
1270
|
-
return me(e.type, s,
|
|
1245
|
+
return me(e.type, s, g);
|
|
1271
1246
|
case i: {
|
|
1272
1247
|
var p = e, w = p._payload, I = p._init;
|
|
1273
1248
|
try {
|
|
1274
|
-
return me(I(w), s,
|
|
1249
|
+
return me(I(w), s, g);
|
|
1275
1250
|
} catch {
|
|
1276
1251
|
}
|
|
1277
1252
|
}
|
|
1278
1253
|
}
|
|
1279
1254
|
return "";
|
|
1280
1255
|
}
|
|
1281
|
-
var ve = Object.prototype.hasOwnProperty, Ke = {}, xe =
|
|
1256
|
+
var ve = Object.prototype.hasOwnProperty, Ke = {}, xe = u.ReactDebugCurrentFrame;
|
|
1282
1257
|
function Re(e) {
|
|
1283
1258
|
if (e) {
|
|
1284
|
-
var s = e._owner,
|
|
1285
|
-
xe.setExtraStackFrame(
|
|
1259
|
+
var s = e._owner, g = me(e.type, e._source, s ? s.type : null);
|
|
1260
|
+
xe.setExtraStackFrame(g);
|
|
1286
1261
|
} else
|
|
1287
1262
|
xe.setExtraStackFrame(null);
|
|
1288
1263
|
}
|
|
1289
|
-
function Dr(e, s,
|
|
1264
|
+
function Dr(e, s, g, p, w) {
|
|
1290
1265
|
{
|
|
1291
1266
|
var I = Function.call.bind(ve);
|
|
1292
1267
|
for (var R in e)
|
|
@@ -1294,14 +1269,14 @@ function mt() {
|
|
|
1294
1269
|
var m = void 0;
|
|
1295
1270
|
try {
|
|
1296
1271
|
if (typeof e[R] != "function") {
|
|
1297
|
-
var U = Error((p || "React class") + ": " +
|
|
1272
|
+
var U = Error((p || "React class") + ": " + g + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
1298
1273
|
throw U.name = "Invariant Violation", U;
|
|
1299
1274
|
}
|
|
1300
|
-
m = e[R](s, R, p,
|
|
1275
|
+
m = e[R](s, R, p, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1301
1276
|
} catch (N) {
|
|
1302
1277
|
m = N;
|
|
1303
1278
|
}
|
|
1304
|
-
m && !(m instanceof Error) && (Re(w), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class",
|
|
1279
|
+
m && !(m instanceof Error) && (Re(w), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", g, R, typeof m), Re(null)), m instanceof Error && !(m.message in Ke) && (Ke[m.message] = !0, Re(w), y("Failed %s type: %s", g, m.message), Re(null));
|
|
1305
1280
|
}
|
|
1306
1281
|
}
|
|
1307
1282
|
}
|
|
@@ -1311,8 +1286,8 @@ function mt() {
|
|
|
1311
1286
|
}
|
|
1312
1287
|
function jr(e) {
|
|
1313
1288
|
{
|
|
1314
|
-
var s = typeof Symbol == "function" && Symbol.toStringTag,
|
|
1315
|
-
return
|
|
1289
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, g = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
1290
|
+
return g;
|
|
1316
1291
|
}
|
|
1317
1292
|
}
|
|
1318
1293
|
function Ur(e) {
|
|
@@ -1329,7 +1304,7 @@ function mt() {
|
|
|
1329
1304
|
if (Ur(e))
|
|
1330
1305
|
return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", jr(e)), Qe(e);
|
|
1331
1306
|
}
|
|
1332
|
-
var Xe =
|
|
1307
|
+
var Xe = u.ReactCurrentOwner, Wr = {
|
|
1333
1308
|
key: !0,
|
|
1334
1309
|
ref: !0,
|
|
1335
1310
|
__self: !0,
|
|
@@ -1356,34 +1331,34 @@ function mt() {
|
|
|
1356
1331
|
}
|
|
1357
1332
|
function Jr(e, s) {
|
|
1358
1333
|
{
|
|
1359
|
-
var
|
|
1334
|
+
var g = function() {
|
|
1360
1335
|
Ze || (Ze = !0, y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
1361
1336
|
};
|
|
1362
|
-
|
|
1363
|
-
get:
|
|
1337
|
+
g.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1338
|
+
get: g,
|
|
1364
1339
|
configurable: !0
|
|
1365
1340
|
});
|
|
1366
1341
|
}
|
|
1367
1342
|
}
|
|
1368
|
-
function
|
|
1343
|
+
function Hr(e, s) {
|
|
1369
1344
|
{
|
|
1370
|
-
var
|
|
1345
|
+
var g = function() {
|
|
1371
1346
|
er || (er = !0, y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
1372
1347
|
};
|
|
1373
|
-
|
|
1374
|
-
get:
|
|
1348
|
+
g.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
1349
|
+
get: g,
|
|
1375
1350
|
configurable: !0
|
|
1376
1351
|
});
|
|
1377
1352
|
}
|
|
1378
1353
|
}
|
|
1379
|
-
var
|
|
1354
|
+
var Vr = function(e, s, g, p, w, I, R) {
|
|
1380
1355
|
var m = {
|
|
1381
1356
|
// This tag allows us to uniquely identify this as a React Element
|
|
1382
|
-
$$typeof:
|
|
1357
|
+
$$typeof: b,
|
|
1383
1358
|
// Built-in properties that belong on the element
|
|
1384
1359
|
type: e,
|
|
1385
1360
|
key: s,
|
|
1386
|
-
ref:
|
|
1361
|
+
ref: g,
|
|
1387
1362
|
props: R,
|
|
1388
1363
|
// Record the component responsible for creating this element.
|
|
1389
1364
|
_owner: I
|
|
@@ -1405,10 +1380,10 @@ function mt() {
|
|
|
1405
1380
|
value: w
|
|
1406
1381
|
}), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
|
|
1407
1382
|
};
|
|
1408
|
-
function $r(e, s,
|
|
1383
|
+
function $r(e, s, g, p, w) {
|
|
1409
1384
|
{
|
|
1410
1385
|
var I, R = {}, m = null, U = null;
|
|
1411
|
-
|
|
1386
|
+
g !== void 0 && (ze(g), m = "" + g), qr(s) && (ze(s.key), m = "" + s.key), Fr(s) && (U = s.ref, Gr(s, w));
|
|
1412
1387
|
for (I in s)
|
|
1413
1388
|
ve.call(s, I) && !Wr.hasOwnProperty(I) && (R[I] = s[I]);
|
|
1414
1389
|
if (e && e.defaultProps) {
|
|
@@ -1418,23 +1393,23 @@ function mt() {
|
|
|
1418
1393
|
}
|
|
1419
1394
|
if (m || U) {
|
|
1420
1395
|
var M = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
1421
|
-
m && Jr(R, M), U &&
|
|
1396
|
+
m && Jr(R, M), U && Hr(R, M);
|
|
1422
1397
|
}
|
|
1423
|
-
return
|
|
1398
|
+
return Vr(e, m, U, w, p, Xe.current, R);
|
|
1424
1399
|
}
|
|
1425
1400
|
}
|
|
1426
|
-
var Ne =
|
|
1401
|
+
var Ne = u.ReactCurrentOwner, rr = u.ReactDebugCurrentFrame;
|
|
1427
1402
|
function ce(e) {
|
|
1428
1403
|
if (e) {
|
|
1429
|
-
var s = e._owner,
|
|
1430
|
-
rr.setExtraStackFrame(
|
|
1404
|
+
var s = e._owner, g = me(e.type, e._source, s ? s.type : null);
|
|
1405
|
+
rr.setExtraStackFrame(g);
|
|
1431
1406
|
} else
|
|
1432
1407
|
rr.setExtraStackFrame(null);
|
|
1433
1408
|
}
|
|
1434
1409
|
var Me;
|
|
1435
1410
|
Me = !1;
|
|
1436
1411
|
function De(e) {
|
|
1437
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
1412
|
+
return typeof e == "object" && e !== null && e.$$typeof === b;
|
|
1438
1413
|
}
|
|
1439
1414
|
function tr() {
|
|
1440
1415
|
{
|
|
@@ -1456,10 +1431,10 @@ Check the render method of \`` + e + "`.";
|
|
|
1456
1431
|
{
|
|
1457
1432
|
var s = tr();
|
|
1458
1433
|
if (!s) {
|
|
1459
|
-
var
|
|
1460
|
-
|
|
1434
|
+
var g = typeof e == "string" ? e : e.displayName || e.name;
|
|
1435
|
+
g && (s = `
|
|
1461
1436
|
|
|
1462
|
-
Check the top-level render call using <` +
|
|
1437
|
+
Check the top-level render call using <` + g + ">.");
|
|
1463
1438
|
}
|
|
1464
1439
|
return s;
|
|
1465
1440
|
}
|
|
@@ -1469,27 +1444,27 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1469
1444
|
if (!e._store || e._store.validated || e.key != null)
|
|
1470
1445
|
return;
|
|
1471
1446
|
e._store.validated = !0;
|
|
1472
|
-
var
|
|
1473
|
-
if (nr[
|
|
1447
|
+
var g = Br(s);
|
|
1448
|
+
if (nr[g])
|
|
1474
1449
|
return;
|
|
1475
|
-
nr[
|
|
1450
|
+
nr[g] = !0;
|
|
1476
1451
|
var p = "";
|
|
1477
|
-
e && e._owner && e._owner !== Ne.current && (p = " It was passed a child from " + L(e._owner.type) + "."), ce(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',
|
|
1452
|
+
e && e._owner && e._owner !== Ne.current && (p = " It was passed a child from " + L(e._owner.type) + "."), ce(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, p), ce(null);
|
|
1478
1453
|
}
|
|
1479
1454
|
}
|
|
1480
|
-
function
|
|
1455
|
+
function or(e, s) {
|
|
1481
1456
|
{
|
|
1482
1457
|
if (typeof e != "object")
|
|
1483
1458
|
return;
|
|
1484
1459
|
if (ke(e))
|
|
1485
|
-
for (var
|
|
1486
|
-
var p = e[
|
|
1460
|
+
for (var g = 0; g < e.length; g++) {
|
|
1461
|
+
var p = e[g];
|
|
1487
1462
|
De(p) && ar(p, s);
|
|
1488
1463
|
}
|
|
1489
1464
|
else if (De(e))
|
|
1490
1465
|
e._store && (e._store.validated = !0);
|
|
1491
1466
|
else if (e) {
|
|
1492
|
-
var w =
|
|
1467
|
+
var w = h(e);
|
|
1493
1468
|
if (typeof w == "function" && w !== e.entries)
|
|
1494
1469
|
for (var I = w.call(e), R; !(R = I.next()).done; )
|
|
1495
1470
|
De(R.value) && ar(R.value, s);
|
|
@@ -1501,18 +1476,18 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1501
1476
|
var s = e.type;
|
|
1502
1477
|
if (s == null || typeof s == "string")
|
|
1503
1478
|
return;
|
|
1504
|
-
var
|
|
1479
|
+
var g;
|
|
1505
1480
|
if (typeof s == "function")
|
|
1506
|
-
|
|
1481
|
+
g = s.propTypes;
|
|
1507
1482
|
else if (typeof s == "object" && (s.$$typeof === c || // Note: Memo only checks outer props here.
|
|
1508
1483
|
// Inner props are checked in the reconciler.
|
|
1509
1484
|
s.$$typeof === a))
|
|
1510
|
-
|
|
1485
|
+
g = s.propTypes;
|
|
1511
1486
|
else
|
|
1512
1487
|
return;
|
|
1513
|
-
if (
|
|
1488
|
+
if (g) {
|
|
1514
1489
|
var p = L(s);
|
|
1515
|
-
Dr(
|
|
1490
|
+
Dr(g, e.props, "prop", p, e);
|
|
1516
1491
|
} else if (s.PropTypes !== void 0 && !Me) {
|
|
1517
1492
|
Me = !0;
|
|
1518
1493
|
var w = L(s);
|
|
@@ -1523,8 +1498,8 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1523
1498
|
}
|
|
1524
1499
|
function xr(e) {
|
|
1525
1500
|
{
|
|
1526
|
-
for (var s = Object.keys(e.props),
|
|
1527
|
-
var p = s[
|
|
1501
|
+
for (var s = Object.keys(e.props), g = 0; g < s.length; g++) {
|
|
1502
|
+
var p = s[g];
|
|
1528
1503
|
if (p !== "children" && p !== "key") {
|
|
1529
1504
|
ce(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), ce(null);
|
|
1530
1505
|
break;
|
|
@@ -1533,8 +1508,8 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1533
1508
|
e.ref !== null && (ce(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
|
|
1534
1509
|
}
|
|
1535
1510
|
}
|
|
1536
|
-
var
|
|
1537
|
-
function cr(e, s,
|
|
1511
|
+
var ur = {};
|
|
1512
|
+
function cr(e, s, g, p, w, I) {
|
|
1538
1513
|
{
|
|
1539
1514
|
var R = Ie(e);
|
|
1540
1515
|
if (!R) {
|
|
@@ -1543,9 +1518,9 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1543
1518
|
var U = Yr();
|
|
1544
1519
|
U ? m += U : m += tr();
|
|
1545
1520
|
var N;
|
|
1546
|
-
e === null ? N = "null" : ke(e) ? N = "array" : e !== void 0 && e.$$typeof ===
|
|
1521
|
+
e === null ? N = "null" : ke(e) ? N = "array" : e !== void 0 && e.$$typeof === b ? (N = "<" + (L(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, m);
|
|
1547
1522
|
}
|
|
1548
|
-
var M = $r(e, s,
|
|
1523
|
+
var M = $r(e, s, g, w, I);
|
|
1549
1524
|
if (M == null)
|
|
1550
1525
|
return M;
|
|
1551
1526
|
if (R) {
|
|
@@ -1554,48 +1529,72 @@ Check the top-level render call using <` + b + ">.");
|
|
|
1554
1529
|
if (p)
|
|
1555
1530
|
if (ke(q)) {
|
|
1556
1531
|
for (var ie = 0; ie < q.length; ie++)
|
|
1557
|
-
|
|
1532
|
+
or(q[ie], e);
|
|
1558
1533
|
Object.freeze && Object.freeze(q);
|
|
1559
1534
|
} else
|
|
1560
1535
|
y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
1561
1536
|
else
|
|
1562
|
-
|
|
1537
|
+
or(q, e);
|
|
1563
1538
|
}
|
|
1564
1539
|
if (ve.call(s, "key")) {
|
|
1565
1540
|
var re = L(e), W = Object.keys(s).filter(function(rt) {
|
|
1566
1541
|
return rt !== "key";
|
|
1567
1542
|
}), Le = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1568
|
-
if (!
|
|
1543
|
+
if (!ur[re + Le]) {
|
|
1569
1544
|
var et = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
1570
1545
|
y(`A props object containing a "key" prop is being spread into JSX:
|
|
1571
1546
|
let props = %s;
|
|
1572
1547
|
<%s {...props} />
|
|
1573
1548
|
React keys must be passed directly to JSX without using spread:
|
|
1574
1549
|
let props = %s;
|
|
1575
|
-
<%s key={someKey} {...props} />`, Le, re, et, re),
|
|
1550
|
+
<%s key={someKey} {...props} />`, Le, re, et, re), ur[re + Le] = !0;
|
|
1576
1551
|
}
|
|
1577
1552
|
}
|
|
1578
|
-
return e ===
|
|
1553
|
+
return e === _ ? xr(M) : Kr(M), M;
|
|
1579
1554
|
}
|
|
1580
1555
|
}
|
|
1581
|
-
function Qr(e, s,
|
|
1582
|
-
return cr(e, s,
|
|
1556
|
+
function Qr(e, s, g) {
|
|
1557
|
+
return cr(e, s, g, !0);
|
|
1583
1558
|
}
|
|
1584
|
-
function zr(e, s,
|
|
1585
|
-
return cr(e, s,
|
|
1559
|
+
function zr(e, s, g) {
|
|
1560
|
+
return cr(e, s, g, !1);
|
|
1586
1561
|
}
|
|
1587
1562
|
var Xr = zr, Zr = Qr;
|
|
1588
|
-
he.Fragment =
|
|
1563
|
+
he.Fragment = _, he.jsx = Xr, he.jsxs = Zr;
|
|
1589
1564
|
})()), he;
|
|
1590
1565
|
}
|
|
1591
1566
|
var Cr;
|
|
1592
|
-
function
|
|
1593
|
-
return Cr || (Cr = 1, process.env.NODE_ENV === "production" ? Pe.exports =
|
|
1567
|
+
function mt() {
|
|
1568
|
+
return Cr || (Cr = 1, process.env.NODE_ENV === "production" ? Pe.exports = pt() : Pe.exports = Tt()), Pe.exports;
|
|
1569
|
+
}
|
|
1570
|
+
var wr = mt();
|
|
1571
|
+
function Rt({
|
|
1572
|
+
baseURL: r,
|
|
1573
|
+
getToken: b,
|
|
1574
|
+
timeoutMs: O = 15e3,
|
|
1575
|
+
currency: _ = "TWD",
|
|
1576
|
+
lng: f = "tw",
|
|
1577
|
+
onError: E
|
|
1578
|
+
} = {}) {
|
|
1579
|
+
const S = it.create({
|
|
1580
|
+
baseURL: r,
|
|
1581
|
+
timeout: O,
|
|
1582
|
+
headers: { "Content-Type": "application/json" }
|
|
1583
|
+
});
|
|
1584
|
+
return S.interceptors.request.use(async (d) => {
|
|
1585
|
+
if (d.headers = d.headers || {}, b) {
|
|
1586
|
+
const c = await b();
|
|
1587
|
+
c && (d.headers.Authorization = `Bearer ${c}`);
|
|
1588
|
+
}
|
|
1589
|
+
return d.headers.Currency = _, d.headers["currency-code"] = _, d.headers.lang = f, d;
|
|
1590
|
+
}), S.interceptors.response.use(
|
|
1591
|
+
(d) => d.data,
|
|
1592
|
+
(d) => E ? E(d, { instance: S }) : Promise.reject(d)
|
|
1593
|
+
), S;
|
|
1594
1594
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
() => new nt({
|
|
1595
|
+
function Dt({ children: r, ...b }) {
|
|
1596
|
+
const O = Ge(() => Rt(b), [b]), f = Ge(
|
|
1597
|
+
() => new ut({
|
|
1599
1598
|
defaultOptions: {
|
|
1600
1599
|
queries: {
|
|
1601
1600
|
refetchOnWindowFocus: !1,
|
|
@@ -1605,12 +1604,13 @@ function Mt({ children: r, ...g }) {
|
|
|
1605
1604
|
}),
|
|
1606
1605
|
[]
|
|
1607
1606
|
);
|
|
1608
|
-
return /* @__PURE__ */ wr.jsx(
|
|
1607
|
+
return /* @__PURE__ */ wr.jsx(ct, { client: f, children: /* @__PURE__ */ wr.jsx(Pr.Provider, { value: { client: O, ...b }, children: r }) });
|
|
1609
1608
|
}
|
|
1610
1609
|
export {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
kt as
|
|
1610
|
+
Pr as ApiCtx,
|
|
1611
|
+
Dt as ApiProvider,
|
|
1612
|
+
Mt as createLogoutHandler,
|
|
1613
|
+
Ir as useApiContext,
|
|
1614
|
+
kt as useClientWebSocket,
|
|
1615
|
+
Nt as usePeriodicDataUpdater
|
|
1616
1616
|
};
|