@mui-toolpad-extended-tuni/users 3.0.0

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.
@@ -0,0 +1,874 @@
1
+ import { convertObjectKeysToUnderscore as we, axios as W, convertObjectKeysToCamelCase as te, useSyncNavigationFilters as Ae, userBus as U } from "mui-toolpad-extended-tuni";
2
+ import { userBus as at } from "mui-toolpad-extended-tuni";
3
+ import j, { useRef as Ce, useEffect as ue } from "react";
4
+ function Ne(t) {
5
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
6
+ }
7
+ var k = { exports: {} }, z = {}, x = { exports: {} }, B = {};
8
+ /**
9
+ * @license React
10
+ * use-sync-external-store-shim.production.js
11
+ *
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var ce;
18
+ function De() {
19
+ if (ce) return B;
20
+ ce = 1;
21
+ var t = j;
22
+ function r(l, f) {
23
+ return l === f && (l !== 0 || 1 / l === 1 / f) || l !== l && f !== f;
24
+ }
25
+ var n = typeof Object.is == "function" ? Object.is : r, a = t.useState, s = t.useEffect, d = t.useLayoutEffect, v = t.useDebugValue;
26
+ function O(l, f) {
27
+ var o = f(), u = a({ inst: { value: o, getSnapshot: f } }), c = u[0].inst, S = u[1];
28
+ return d(
29
+ function() {
30
+ c.value = o, c.getSnapshot = f, T(c) && S({ inst: c });
31
+ },
32
+ [l, o, f]
33
+ ), s(
34
+ function() {
35
+ return T(c) && S({ inst: c }), l(function() {
36
+ T(c) && S({ inst: c });
37
+ });
38
+ },
39
+ [l]
40
+ ), v(o), o;
41
+ }
42
+ function T(l) {
43
+ var f = l.getSnapshot;
44
+ l = l.value;
45
+ try {
46
+ var o = f();
47
+ return !n(l, o);
48
+ } catch {
49
+ return !0;
50
+ }
51
+ }
52
+ function m(l, f) {
53
+ return f();
54
+ }
55
+ var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? m : O;
56
+ return B.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : p, B;
57
+ }
58
+ var q = {};
59
+ /**
60
+ * @license React
61
+ * use-sync-external-store-shim.development.js
62
+ *
63
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
64
+ *
65
+ * This source code is licensed under the MIT license found in the
66
+ * LICENSE file in the root directory of this source tree.
67
+ */
68
+ var le;
69
+ function je() {
70
+ return le || (le = 1, process.env.NODE_ENV !== "production" && function() {
71
+ function t(o, u) {
72
+ return o === u && (o !== 0 || 1 / o === 1 / u) || o !== o && u !== u;
73
+ }
74
+ function r(o, u) {
75
+ p || s.startTransition === void 0 || (p = !0, console.error(
76
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
77
+ ));
78
+ var c = u();
79
+ if (!l) {
80
+ var S = u();
81
+ d(c, S) || (console.error(
82
+ "The result of getSnapshot should be cached to avoid an infinite loop"
83
+ ), l = !0);
84
+ }
85
+ S = v({
86
+ inst: { value: c, getSnapshot: u }
87
+ });
88
+ var h = S[0].inst, R = S[1];
89
+ return T(
90
+ function() {
91
+ h.value = c, h.getSnapshot = u, n(h) && R({ inst: h });
92
+ },
93
+ [o, c, u]
94
+ ), O(
95
+ function() {
96
+ return n(h) && R({ inst: h }), o(function() {
97
+ n(h) && R({ inst: h });
98
+ });
99
+ },
100
+ [o]
101
+ ), m(c), c;
102
+ }
103
+ function n(o) {
104
+ var u = o.getSnapshot;
105
+ o = o.value;
106
+ try {
107
+ var c = u();
108
+ return !d(o, c);
109
+ } catch {
110
+ return !0;
111
+ }
112
+ }
113
+ function a(o, u) {
114
+ return u();
115
+ }
116
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
117
+ var s = j, d = typeof Object.is == "function" ? Object.is : t, v = s.useState, O = s.useEffect, T = s.useLayoutEffect, m = s.useDebugValue, p = !1, l = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? a : r;
118
+ q.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
119
+ }()), q;
120
+ }
121
+ var fe;
122
+ function Oe() {
123
+ return fe || (fe = 1, process.env.NODE_ENV === "production" ? x.exports = De() : x.exports = je()), x.exports;
124
+ }
125
+ /**
126
+ * @license React
127
+ * use-sync-external-store-shim/with-selector.production.js
128
+ *
129
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
130
+ *
131
+ * This source code is licensed under the MIT license found in the
132
+ * LICENSE file in the root directory of this source tree.
133
+ */
134
+ var de;
135
+ function Ue() {
136
+ if (de) return z;
137
+ de = 1;
138
+ var t = j, r = Oe();
139
+ function n(m, p) {
140
+ return m === p && (m !== 0 || 1 / m === 1 / p) || m !== m && p !== p;
141
+ }
142
+ var a = typeof Object.is == "function" ? Object.is : n, s = r.useSyncExternalStore, d = t.useRef, v = t.useEffect, O = t.useMemo, T = t.useDebugValue;
143
+ return z.useSyncExternalStoreWithSelector = function(m, p, l, f, o) {
144
+ var u = d(null);
145
+ if (u.current === null) {
146
+ var c = { hasValue: !1, value: null };
147
+ u.current = c;
148
+ } else c = u.current;
149
+ u = O(
150
+ function() {
151
+ function h(g) {
152
+ if (!R) {
153
+ if (R = !0, w = g, g = f(g), o !== void 0 && c.hasValue) {
154
+ var b = c.value;
155
+ if (o(b, g))
156
+ return A = b;
157
+ }
158
+ return A = g;
159
+ }
160
+ if (b = A, a(w, g)) return b;
161
+ var N = f(g);
162
+ return o !== void 0 && o(b, N) ? (w = g, b) : (w = g, A = N);
163
+ }
164
+ var R = !1, w, A, C = l === void 0 ? null : l;
165
+ return [
166
+ function() {
167
+ return h(p());
168
+ },
169
+ C === null ? void 0 : function() {
170
+ return h(C());
171
+ }
172
+ ];
173
+ },
174
+ [p, l, f, o]
175
+ );
176
+ var S = s(m, u[0], u[1]);
177
+ return v(
178
+ function() {
179
+ c.hasValue = !0, c.value = S;
180
+ },
181
+ [S]
182
+ ), T(S), S;
183
+ }, z;
184
+ }
185
+ var H = {};
186
+ /**
187
+ * @license React
188
+ * use-sync-external-store-shim/with-selector.development.js
189
+ *
190
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
191
+ *
192
+ * This source code is licensed under the MIT license found in the
193
+ * LICENSE file in the root directory of this source tree.
194
+ */
195
+ var pe;
196
+ function Le() {
197
+ return pe || (pe = 1, process.env.NODE_ENV !== "production" && function() {
198
+ function t(m, p) {
199
+ return m === p && (m !== 0 || 1 / m === 1 / p) || m !== m && p !== p;
200
+ }
201
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
202
+ var r = j, n = Oe(), a = typeof Object.is == "function" ? Object.is : t, s = n.useSyncExternalStore, d = r.useRef, v = r.useEffect, O = r.useMemo, T = r.useDebugValue;
203
+ H.useSyncExternalStoreWithSelector = function(m, p, l, f, o) {
204
+ var u = d(null);
205
+ if (u.current === null) {
206
+ var c = { hasValue: !1, value: null };
207
+ u.current = c;
208
+ } else c = u.current;
209
+ u = O(
210
+ function() {
211
+ function h(g) {
212
+ if (!R) {
213
+ if (R = !0, w = g, g = f(g), o !== void 0 && c.hasValue) {
214
+ var b = c.value;
215
+ if (o(b, g))
216
+ return A = b;
217
+ }
218
+ return A = g;
219
+ }
220
+ if (b = A, a(w, g))
221
+ return b;
222
+ var N = f(g);
223
+ return o !== void 0 && o(b, N) ? (w = g, b) : (w = g, A = N);
224
+ }
225
+ var R = !1, w, A, C = l === void 0 ? null : l;
226
+ return [
227
+ function() {
228
+ return h(p());
229
+ },
230
+ C === null ? void 0 : function() {
231
+ return h(C());
232
+ }
233
+ ];
234
+ },
235
+ [p, l, f, o]
236
+ );
237
+ var S = s(m, u[0], u[1]);
238
+ return v(
239
+ function() {
240
+ c.hasValue = !0, c.value = S;
241
+ },
242
+ [S]
243
+ ), T(S), S;
244
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
245
+ }()), H;
246
+ }
247
+ var me;
248
+ function Ie() {
249
+ return me || (me = 1, process.env.NODE_ENV === "production" ? k.exports = Ue() : k.exports = Le()), k.exports;
250
+ }
251
+ var Pe = Ie();
252
+ const ke = /* @__PURE__ */ Ne(Pe), xe = {}, Se = (t) => {
253
+ let r;
254
+ const n = /* @__PURE__ */ new Set(), a = (p, l) => {
255
+ const f = typeof p == "function" ? p(r) : p;
256
+ if (!Object.is(f, r)) {
257
+ const o = r;
258
+ r = l ?? (typeof f != "object" || f === null) ? f : Object.assign({}, r, f), n.forEach((u) => u(r, o));
259
+ }
260
+ }, s = () => r, T = { setState: a, getState: s, getInitialState: () => m, subscribe: (p) => (n.add(p), () => n.delete(p)), destroy: () => {
261
+ (xe ? "production" : void 0) !== "production" && console.warn(
262
+ "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
263
+ ), n.clear();
264
+ } }, m = r = t(a, s, T);
265
+ return T;
266
+ }, Ve = (t) => t ? Se(t) : Se, { useDebugValue: Me } = j, { useSyncExternalStoreWithSelector: We } = ke, Ge = (t) => t;
267
+ function Je(t, r = Ge, n) {
268
+ const a = We(
269
+ t.subscribe,
270
+ t.getState,
271
+ t.getServerState || t.getInitialState,
272
+ r,
273
+ n
274
+ );
275
+ return Me(a), a;
276
+ }
277
+ const ve = (t, r) => {
278
+ const n = Ve(t), a = (s, d = r) => Je(n, s, d);
279
+ return Object.assign(a, n), a;
280
+ }, $e = (t, r) => t ? ve(t, r) : ve, Fe = async () => {
281
+ try {
282
+ const t = await W.get("api/users/current/");
283
+ return te(t.data);
284
+ } catch (t) {
285
+ throw console.error("Error getting current user", t), t;
286
+ }
287
+ }, _e = async (t) => {
288
+ try {
289
+ const r = await W.get(
290
+ `api/users/${t ? `?course_id=${t}` : ""}`
291
+ );
292
+ if (!Array.isArray(r.data))
293
+ throw new Error("Invalid response data");
294
+ return r.data.map(
295
+ (n) => te(n)
296
+ );
297
+ } catch (r) {
298
+ throw console.error("Error getting users", r), r;
299
+ }
300
+ }, Ye = async (t) => {
301
+ var r, n;
302
+ try {
303
+ if (!(t != null && t.id))
304
+ throw new Error("Cannot update user: user.id is undefined");
305
+ const a = we(t), s = await W.put(
306
+ `api/users/${t.id}/`,
307
+ a
308
+ );
309
+ if (!s.data)
310
+ throw new Error("No data received from server");
311
+ const d = te(s.data);
312
+ return (n = (r = t.image) == null ? void 0 : r.large) != null && n.startsWith("data:image") && (d.image = { ...t.image, ...d.image }), d;
313
+ } catch (a) {
314
+ throw console.error("Error updating user:", a), a;
315
+ }
316
+ }, ze = async () => {
317
+ try {
318
+ await W.post("/auth/lti_logout/");
319
+ } catch (t) {
320
+ throw console.error("Error logging out user", t), t;
321
+ }
322
+ }, K = "/static/images/student.png", X = "/static/images/teacher.png", Z = "/static/images/guest.png", Q = "/static/images/admin.png", ee = [
323
+ {
324
+ id: "1",
325
+ name: "Teacher User",
326
+ email: "teacher@edu.com",
327
+ image: {
328
+ large: X,
329
+ medium: X,
330
+ thumbnail: X
331
+ },
332
+ privacySettings: {
333
+ allowAnalytics: !1,
334
+ allowPersonalization: !1,
335
+ allowCommunications: !1,
336
+ allowThirdPartySharing: !1
337
+ },
338
+ gdprConsent: {
339
+ accepted: !0,
340
+ acceptedDate: (/* @__PURE__ */ new Date()).toISOString(),
341
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
342
+ },
343
+ dataRetention: {
344
+ deleteAccountAfterInactivity: 365,
345
+ deleteDataAfterAccountDeletion: 30
346
+ },
347
+ preferences: {
348
+ navigationType: "direct",
349
+ visibleCourseLists: {
350
+ isStudent: !0,
351
+ isStudentOld: !0,
352
+ isTeacher: !0,
353
+ isTeacherOld: !0,
354
+ available: !0
355
+ },
356
+ lastVisitedCourses: [],
357
+ visibleNavigation: ["Courses"]
358
+ },
359
+ platformRoles: ["creator", "moderator"]
360
+ },
361
+ {
362
+ id: "2",
363
+ name: "Student User",
364
+ email: "student@edu.com",
365
+ image: {
366
+ large: K,
367
+ medium: K,
368
+ thumbnail: K
369
+ },
370
+ privacySettings: {
371
+ allowAnalytics: !1,
372
+ allowPersonalization: !1,
373
+ allowCommunications: !1,
374
+ allowThirdPartySharing: !1
375
+ },
376
+ gdprConsent: {
377
+ accepted: !0,
378
+ acceptedDate: (/* @__PURE__ */ new Date()).toISOString(),
379
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
380
+ },
381
+ dataRetention: {
382
+ deleteAccountAfterInactivity: 365,
383
+ deleteDataAfterAccountDeletion: 30
384
+ },
385
+ preferences: {
386
+ navigationType: "direct",
387
+ visibleCourseLists: {
388
+ isStudent: !0,
389
+ isStudentOld: !0,
390
+ isTeacher: !0,
391
+ isTeacherOld: !0,
392
+ available: !0
393
+ },
394
+ lastVisitedCourses: [],
395
+ visibleNavigation: ["Courses"]
396
+ },
397
+ platformRoles: ["user"]
398
+ },
399
+ {
400
+ id: "3",
401
+ name: "Guest User",
402
+ email: "",
403
+ image: {
404
+ large: Z,
405
+ medium: Z,
406
+ thumbnail: Z
407
+ },
408
+ privacySettings: {
409
+ allowAnalytics: !1,
410
+ allowPersonalization: !1,
411
+ allowCommunications: !1,
412
+ allowThirdPartySharing: !1
413
+ },
414
+ gdprConsent: {
415
+ accepted: !0,
416
+ acceptedDate: (/* @__PURE__ */ new Date()).toISOString(),
417
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
418
+ },
419
+ dataRetention: {
420
+ deleteAccountAfterInactivity: 365,
421
+ deleteDataAfterAccountDeletion: 30
422
+ },
423
+ preferences: {
424
+ navigationType: "direct",
425
+ visibleCourseLists: {
426
+ isStudent: !0,
427
+ isStudentOld: !0,
428
+ isTeacher: !0,
429
+ isTeacherOld: !0,
430
+ available: !0
431
+ },
432
+ lastVisitedCourses: [],
433
+ visibleNavigation: ["Courses"]
434
+ },
435
+ platformRoles: ["user"]
436
+ },
437
+ {
438
+ id: "4",
439
+ name: "Admin User",
440
+ email: "admin@edu.com",
441
+ image: {
442
+ large: Q,
443
+ medium: Q,
444
+ thumbnail: Q
445
+ },
446
+ privacySettings: {
447
+ allowAnalytics: !1,
448
+ allowPersonalization: !1,
449
+ allowCommunications: !1,
450
+ allowThirdPartySharing: !1
451
+ },
452
+ gdprConsent: {
453
+ accepted: !0,
454
+ acceptedDate: (/* @__PURE__ */ new Date()).toISOString(),
455
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
456
+ },
457
+ dataRetention: {
458
+ deleteAccountAfterInactivity: 365,
459
+ deleteDataAfterAccountDeletion: 30
460
+ },
461
+ preferences: {
462
+ navigationType: "direct",
463
+ visibleCourseLists: {
464
+ isStudent: !0,
465
+ isStudentOld: !0,
466
+ isTeacher: !0,
467
+ isTeacherOld: !0,
468
+ available: !0
469
+ },
470
+ lastVisitedCourses: [],
471
+ visibleNavigation: ["Courses"]
472
+ },
473
+ platformRoles: ["creator", "moderator"]
474
+ }
475
+ ], Be = $e((t) => ({
476
+ fetchState: "idle",
477
+ user: null,
478
+ userToUpdate: null,
479
+ testUsers: ee,
480
+ users: [],
481
+ courseUsers: [],
482
+ setUserToUpdate: (r) => t({ userToUpdate: r }),
483
+ setTestUsers: (r) => t({ testUsers: r }),
484
+ setUser: (r) => t({ user: r }),
485
+ getUser: async () => {
486
+ try {
487
+ t({ fetchState: "loading" }), t({ testUsers: ee });
488
+ const r = await Fe();
489
+ r && t({
490
+ user: { ...r },
491
+ fetchState: "idle",
492
+ testUsers: ee.filter((n) => n.id !== r.id)
493
+ });
494
+ } catch (r) {
495
+ console.error("Error getting user", r), t({ fetchState: "error" });
496
+ }
497
+ },
498
+ getUsers: async () => {
499
+ try {
500
+ t({ fetchState: "loading" });
501
+ const r = await _e();
502
+ t(r ? { users: r, fetchState: "idle" } : { fetchState: "error" });
503
+ } catch {
504
+ t({ fetchState: "error" });
505
+ }
506
+ },
507
+ fetchCourseUsers: async (r) => {
508
+ try {
509
+ t({ fetchState: "loading" });
510
+ const n = await _e(r);
511
+ t({ courseUsers: n, fetchState: "idle" });
512
+ } catch {
513
+ t({ fetchState: "error" });
514
+ }
515
+ },
516
+ clearUser: () => t({ user: null }),
517
+ logout: async () => {
518
+ try {
519
+ return await ze(), t({ user: null }), Promise.resolve();
520
+ } catch (r) {
521
+ return Promise.reject(r);
522
+ }
523
+ },
524
+ updateUser: async (r) => {
525
+ try {
526
+ t({ fetchState: "loading" });
527
+ const n = await Ye(r);
528
+ return t((a) => {
529
+ var d;
530
+ return {
531
+ fetchState: "idle",
532
+ userToUpdate: n,
533
+ // If this is the current user, update that too
534
+ user: ((d = a.user) == null ? void 0 : d.id) === n.id ? n : a.user
535
+ };
536
+ }), Promise.resolve(n);
537
+ } catch (n) {
538
+ return console.error("Failed to update user:", n), t({ fetchState: "error" }), Promise.reject(n);
539
+ }
540
+ }
541
+ }));
542
+ var V = { exports: {} }, L = {};
543
+ /**
544
+ * @license React
545
+ * react-jsx-runtime.production.js
546
+ *
547
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
548
+ *
549
+ * This source code is licensed under the MIT license found in the
550
+ * LICENSE file in the root directory of this source tree.
551
+ */
552
+ var ge;
553
+ function qe() {
554
+ if (ge) return L;
555
+ ge = 1;
556
+ var t = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
557
+ function n(a, s, d) {
558
+ var v = null;
559
+ if (d !== void 0 && (v = "" + d), s.key !== void 0 && (v = "" + s.key), "key" in s) {
560
+ d = {};
561
+ for (var O in s)
562
+ O !== "key" && (d[O] = s[O]);
563
+ } else d = s;
564
+ return s = d.ref, {
565
+ $$typeof: t,
566
+ type: a,
567
+ key: v,
568
+ ref: s !== void 0 ? s : null,
569
+ props: d
570
+ };
571
+ }
572
+ return L.Fragment = r, L.jsx = n, L.jsxs = n, L;
573
+ }
574
+ var I = {};
575
+ /**
576
+ * @license React
577
+ * react-jsx-runtime.development.js
578
+ *
579
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
580
+ *
581
+ * This source code is licensed under the MIT license found in the
582
+ * LICENSE file in the root directory of this source tree.
583
+ */
584
+ var Ee;
585
+ function He() {
586
+ return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
587
+ function t(e) {
588
+ if (e == null) return null;
589
+ if (typeof e == "function")
590
+ return e.$$typeof === be ? null : e.displayName || e.name || null;
591
+ if (typeof e == "string") return e;
592
+ switch (e) {
593
+ case S:
594
+ return "Fragment";
595
+ case R:
596
+ return "Profiler";
597
+ case h:
598
+ return "StrictMode";
599
+ case g:
600
+ return "Suspense";
601
+ case b:
602
+ return "SuspenseList";
603
+ case he:
604
+ return "Activity";
605
+ }
606
+ if (typeof e == "object")
607
+ switch (typeof e.tag == "number" && console.error(
608
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
609
+ ), e.$$typeof) {
610
+ case c:
611
+ return "Portal";
612
+ case A:
613
+ return e.displayName || "Context";
614
+ case w:
615
+ return (e._context.displayName || "Context") + ".Consumer";
616
+ case C:
617
+ var i = e.render;
618
+ return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
619
+ case N:
620
+ return i = e.displayName || null, i !== null ? i : t(e.type) || "Memo";
621
+ case G:
622
+ i = e._payload, e = e._init;
623
+ try {
624
+ return t(e(i));
625
+ } catch {
626
+ }
627
+ }
628
+ return null;
629
+ }
630
+ function r(e) {
631
+ return "" + e;
632
+ }
633
+ function n(e) {
634
+ try {
635
+ r(e);
636
+ var i = !1;
637
+ } catch {
638
+ i = !0;
639
+ }
640
+ if (i) {
641
+ i = console;
642
+ var _ = i.error, E = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
643
+ return _.call(
644
+ i,
645
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
646
+ E
647
+ ), r(e);
648
+ }
649
+ }
650
+ function a(e) {
651
+ if (e === S) return "<>";
652
+ if (typeof e == "object" && e !== null && e.$$typeof === G)
653
+ return "<...>";
654
+ try {
655
+ var i = t(e);
656
+ return i ? "<" + i + ">" : "<...>";
657
+ } catch {
658
+ return "<...>";
659
+ }
660
+ }
661
+ function s() {
662
+ var e = J.A;
663
+ return e === null ? null : e.getOwner();
664
+ }
665
+ function d() {
666
+ return Error("react-stack-top-frame");
667
+ }
668
+ function v(e) {
669
+ if (re.call(e, "key")) {
670
+ var i = Object.getOwnPropertyDescriptor(e, "key").get;
671
+ if (i && i.isReactWarning) return !1;
672
+ }
673
+ return e.key !== void 0;
674
+ }
675
+ function O(e, i) {
676
+ function _() {
677
+ ne || (ne = !0, console.error(
678
+ "%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://react.dev/link/special-props)",
679
+ i
680
+ ));
681
+ }
682
+ _.isReactWarning = !0, Object.defineProperty(e, "key", {
683
+ get: _,
684
+ configurable: !0
685
+ });
686
+ }
687
+ function T() {
688
+ var e = t(this.type);
689
+ return ae[e] || (ae[e] = !0, console.error(
690
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
691
+ )), e = this.props.ref, e !== void 0 ? e : null;
692
+ }
693
+ function m(e, i, _, E, P, F) {
694
+ var y = _.ref;
695
+ return e = {
696
+ $$typeof: u,
697
+ type: e,
698
+ key: i,
699
+ props: _,
700
+ _owner: E
701
+ }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
702
+ enumerable: !1,
703
+ get: T
704
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
705
+ configurable: !1,
706
+ enumerable: !1,
707
+ writable: !0,
708
+ value: 0
709
+ }), Object.defineProperty(e, "_debugInfo", {
710
+ configurable: !1,
711
+ enumerable: !1,
712
+ writable: !0,
713
+ value: null
714
+ }), Object.defineProperty(e, "_debugStack", {
715
+ configurable: !1,
716
+ enumerable: !1,
717
+ writable: !0,
718
+ value: P
719
+ }), Object.defineProperty(e, "_debugTask", {
720
+ configurable: !1,
721
+ enumerable: !1,
722
+ writable: !0,
723
+ value: F
724
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
725
+ }
726
+ function p(e, i, _, E, P, F) {
727
+ var y = i.children;
728
+ if (y !== void 0)
729
+ if (E)
730
+ if (Te(y)) {
731
+ for (E = 0; E < y.length; E++)
732
+ l(y[E]);
733
+ Object.freeze && Object.freeze(y);
734
+ } else
735
+ console.error(
736
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
737
+ );
738
+ else l(y);
739
+ if (re.call(i, "key")) {
740
+ y = t(e);
741
+ var D = Object.keys(i).filter(function(Re) {
742
+ return Re !== "key";
743
+ });
744
+ E = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", ie[y + E] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
745
+ `A props object containing a "key" prop is being spread into JSX:
746
+ let props = %s;
747
+ <%s {...props} />
748
+ React keys must be passed directly to JSX without using spread:
749
+ let props = %s;
750
+ <%s key={someKey} {...props} />`,
751
+ E,
752
+ y,
753
+ D,
754
+ y
755
+ ), ie[y + E] = !0);
756
+ }
757
+ if (y = null, _ !== void 0 && (n(_), y = "" + _), v(i) && (n(i.key), y = "" + i.key), "key" in i) {
758
+ _ = {};
759
+ for (var Y in i)
760
+ Y !== "key" && (_[Y] = i[Y]);
761
+ } else _ = i;
762
+ return y && O(
763
+ _,
764
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
765
+ ), m(
766
+ e,
767
+ y,
768
+ _,
769
+ s(),
770
+ P,
771
+ F
772
+ );
773
+ }
774
+ function l(e) {
775
+ f(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === G && (e._payload.status === "fulfilled" ? f(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
776
+ }
777
+ function f(e) {
778
+ return typeof e == "object" && e !== null && e.$$typeof === u;
779
+ }
780
+ var o = j, u = Symbol.for("react.transitional.element"), c = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), A = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), he = Symbol.for("react.activity"), be = Symbol.for("react.client.reference"), J = o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, Te = Array.isArray, $ = console.createTask ? console.createTask : function() {
781
+ return null;
782
+ };
783
+ o = {
784
+ react_stack_bottom_frame: function(e) {
785
+ return e();
786
+ }
787
+ };
788
+ var ne, ae = {}, oe = o.react_stack_bottom_frame.bind(
789
+ o,
790
+ d
791
+ )(), se = $(a(d)), ie = {};
792
+ I.Fragment = S, I.jsx = function(e, i, _) {
793
+ var E = 1e4 > J.recentlyCreatedOwnerStacks++;
794
+ return p(
795
+ e,
796
+ i,
797
+ _,
798
+ !1,
799
+ E ? Error("react-stack-top-frame") : oe,
800
+ E ? $(a(e)) : se
801
+ );
802
+ }, I.jsxs = function(e, i, _) {
803
+ var E = 1e4 > J.recentlyCreatedOwnerStacks++;
804
+ return p(
805
+ e,
806
+ i,
807
+ _,
808
+ !0,
809
+ E ? Error("react-stack-top-frame") : oe,
810
+ E ? $(a(e)) : se
811
+ );
812
+ };
813
+ }()), I;
814
+ }
815
+ var ye;
816
+ function Ke() {
817
+ return ye || (ye = 1, process.env.NODE_ENV === "production" ? V.exports = qe() : V.exports = He()), V.exports;
818
+ }
819
+ var M = Ke();
820
+ const Xe = () => (Ae(), null), Ze = () => {
821
+ const { user: t } = Be(), r = Ce(null);
822
+ return ue(() => {
823
+ U.initializeFromStore();
824
+ }, []), ue(() => {
825
+ const n = t, a = r.current;
826
+ if (n && !a) {
827
+ const s = {
828
+ type: "user:loggedIn",
829
+ user: n,
830
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
831
+ };
832
+ U.publish(s);
833
+ } else if (!n && a) {
834
+ const s = {
835
+ type: "user:loggedOut",
836
+ user: null,
837
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
838
+ };
839
+ U.publish(s);
840
+ } else if (n && a && n.id === a.id) {
841
+ const s = JSON.stringify(n.preferences) !== JSON.stringify(a.preferences);
842
+ if (s) {
843
+ const v = [];
844
+ n.preferences.navigationType !== a.preferences.navigationType && v.push("navigationType"), JSON.stringify(n.preferences.visibleCourseLists) !== JSON.stringify(a.preferences.visibleCourseLists) && v.push("visibleCourseLists"), JSON.stringify(n.preferences.visibleNavigation) !== JSON.stringify(a.preferences.visibleNavigation) && v.push("visibleNavigation"), JSON.stringify(n.preferences.lastVisitedCourses) !== JSON.stringify(a.preferences.lastVisitedCourses) && v.push("lastVisitedCourses");
845
+ const O = {
846
+ type: "user:preferencesChanged",
847
+ user: n,
848
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
849
+ metadata: { changedPreferences: v }
850
+ };
851
+ U.publish(O);
852
+ }
853
+ if ((n.name !== a.name || n.email !== a.email || JSON.stringify(n.privacySettings) !== JSON.stringify(a.privacySettings) || JSON.stringify(n.gdprConsent) !== JSON.stringify(a.gdprConsent) || JSON.stringify(n.dataRetention) !== JSON.stringify(a.dataRetention) || JSON.stringify(n.platformRoles) !== JSON.stringify(a.platformRoles)) && !s) {
854
+ const v = {
855
+ type: "user:updated",
856
+ user: n,
857
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
858
+ metadata: { previousUser: a }
859
+ };
860
+ U.publish(v);
861
+ }
862
+ }
863
+ r.current = n;
864
+ }, [t]), null;
865
+ }, tt = ({ children: t }) => /* @__PURE__ */ M.jsxs(M.Fragment, { children: [
866
+ /* @__PURE__ */ M.jsx(Xe, {}),
867
+ /* @__PURE__ */ M.jsx(Ze, {}),
868
+ t
869
+ ] });
870
+ export {
871
+ tt as UserMicroservice,
872
+ Be as useUserStore,
873
+ at as userBus
874
+ };