hive-react-kit 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +105 -0
  2. package/dist/App.d.ts +2 -0
  3. package/dist/components/VideoCard.d.ts +9 -0
  4. package/dist/components/VideoDetail.d.ts +2 -0
  5. package/dist/components/VideoFeed.d.ts +11 -0
  6. package/dist/components/VideoInfo.d.ts +19 -0
  7. package/dist/components/Wallet.d.ts +7 -0
  8. package/dist/components/common/FavouriteWidget.d.ts +10 -0
  9. package/dist/components/community/CommunitiesList.d.ts +5 -0
  10. package/dist/components/community/CommunityAbout.d.ts +5 -0
  11. package/dist/components/community/CommunityDetail.d.ts +16 -0
  12. package/dist/components/community/CommunityMembers.d.ts +6 -0
  13. package/dist/components/community/CommunityTeam.d.ts +6 -0
  14. package/dist/components/index.d.ts +20 -0
  15. package/dist/components/modals/CommentsModal.d.ts +8 -0
  16. package/dist/components/modals/DescriptionModal.d.ts +8 -0
  17. package/dist/components/modals/Modal.d.ts +10 -0
  18. package/dist/components/modals/UpvoteListModal.d.ts +7 -0
  19. package/dist/components/ui/index.d.ts +1 -0
  20. package/dist/components/user/UserAccount.d.ts +14 -0
  21. package/dist/components/user/UserFollowers.d.ts +6 -0
  22. package/dist/components/user/UserFollowing.d.ts +6 -0
  23. package/dist/components/user/UserInfo.d.ts +5 -0
  24. package/dist/components/user/UserProfilePage.d.ts +8 -0
  25. package/dist/favicon.ico +0 -0
  26. package/dist/hooks/CommunityFavouriteProvider.d.ts +5 -0
  27. package/dist/hooks/index.d.ts +2 -0
  28. package/dist/hooks/use-mobile.d.ts +1 -0
  29. package/dist/hooks/use-toast.d.ts +52 -0
  30. package/dist/index.d.ts +29 -0
  31. package/dist/index.es.js +3988 -0
  32. package/dist/index.umd.js +102 -0
  33. package/dist/main.d.ts +1 -0
  34. package/dist/pages/Index.d.ts +2 -0
  35. package/dist/pages/NotFound.d.ts +2 -0
  36. package/dist/pages/UserProfile.d.ts +2 -0
  37. package/dist/placeholder.svg +1 -0
  38. package/dist/robots.txt +14 -0
  39. package/dist/services/apiService.d.ts +49 -0
  40. package/dist/services/communityService.d.ts +11 -0
  41. package/dist/services/userService.d.ts +10 -0
  42. package/dist/store/walletStore.d.ts +2 -0
  43. package/dist/types/comment.d.ts +13 -0
  44. package/dist/types/community.d.ts +57 -0
  45. package/dist/types/graphql.d.ts +28 -0
  46. package/dist/types/index.d.ts +5 -0
  47. package/dist/types/trending.d.ts +4 -0
  48. package/dist/types/user.d.ts +44 -0
  49. package/dist/types/video.d.ts +106 -0
  50. package/dist/types/wallet.d.ts +17 -0
  51. package/dist/utils/thumbnail.d.ts +1 -0
  52. package/package.json +128 -0
@@ -0,0 +1,3988 @@
1
+ var mr = Object.defineProperty;
2
+ var ur = (t, s, r) => s in t ? mr(t, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[s] = r;
3
+ var $e = (t, s, r) => ur(t, typeof s != "symbol" ? s + "" : s, r);
4
+ import * as Ae from "react";
5
+ import le, { useState as p, useEffect as H, useMemo as gr, useCallback as je, useRef as Le } from "react";
6
+ import { Clock as Ft, Play as et, ThumbsUp as tt, MessageCircle as rt, Eye as Lt, Info as Rt, Share2 as st, Heart as hr, Users as De, RefreshCw as se, Loader2 as ae, X as xr, Send as fr, FileText as pr, ArrowLeft as Ce, BookmarkCheck as br, Bookmark as yr, Search as Ye, Calendar as Pt, Rss as Vt, MoreVertical as at, Upload as vr, Video as kt, Hourglass as jr, Ban as _t } from "lucide-react";
7
+ import { formatDistanceToNow as nt } from "date-fns";
8
+ import * as wr from "@hiveio/dhive";
9
+ import { Client as Nr } from "@hiveio/dhive";
10
+ import { useParams as kr, useNavigate as Ie } from "react-router-dom";
11
+ import ve from "hls.js";
12
+ import { create as _r } from "zustand";
13
+ var Ze = { exports: {} }, ke = {};
14
+ /**
15
+ * @license React
16
+ * react-jsx-runtime.production.min.js
17
+ *
18
+ * Copyright (c) Facebook, Inc. and its affiliates.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */
23
+ var Et;
24
+ function Er() {
25
+ if (Et) return ke;
26
+ Et = 1;
27
+ var t = le, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
28
+ function i(u, c, m) {
29
+ var l, x = {}, v = null, w = null;
30
+ m !== void 0 && (v = "" + m), c.key !== void 0 && (v = "" + c.key), c.ref !== void 0 && (w = c.ref);
31
+ for (l in c) a.call(c, l) && !d.hasOwnProperty(l) && (x[l] = c[l]);
32
+ if (u && u.defaultProps) for (l in c = u.defaultProps, c) x[l] === void 0 && (x[l] = c[l]);
33
+ return { $$typeof: s, type: u, key: v, ref: w, props: x, _owner: o.current };
34
+ }
35
+ return ke.Fragment = r, ke.jsx = i, ke.jsxs = i, ke;
36
+ }
37
+ var _e = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Facebook, Inc. and its affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var Ct;
48
+ function Cr() {
49
+ return Ct || (Ct = 1, process.env.NODE_ENV !== "production" && function() {
50
+ var t = le, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), l = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), k = Symbol.iterator, T = "@@iterator";
51
+ function f(n) {
52
+ if (n === null || typeof n != "object")
53
+ return null;
54
+ var g = k && n[k] || n[T];
55
+ return typeof g == "function" ? g : null;
56
+ }
57
+ var j = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
+ function b(n) {
59
+ {
60
+ for (var g = arguments.length, y = new Array(g > 1 ? g - 1 : 0), S = 1; S < g; S++)
61
+ y[S - 1] = arguments[S];
62
+ M("error", n, y);
63
+ }
64
+ }
65
+ function M(n, g, y) {
66
+ {
67
+ var S = j.ReactDebugCurrentFrame, A = S.getStackAddendum();
68
+ A !== "" && (g += "%s", y = y.concat([A]));
69
+ var D = y.map(function(P) {
70
+ return String(P);
71
+ });
72
+ D.unshift("Warning: " + g), Function.prototype.apply.call(console[n], console, D);
73
+ }
74
+ }
75
+ var _ = !1, E = !1, C = !1, Y = !1, h = !1, $;
76
+ $ = Symbol.for("react.module.reference");
77
+ function O(n) {
78
+ return !!(typeof n == "string" || typeof n == "function" || n === a || n === d || h || n === o || n === m || n === l || Y || n === w || _ || E || C || typeof n == "object" && n !== null && (n.$$typeof === v || n.$$typeof === x || n.$$typeof === i || n.$$typeof === u || n.$$typeof === c || // This needs to include all possible module reference object
79
+ // types supported by any Flight configuration anywhere since
80
+ // we don't know which Flight build this will end up being used
81
+ // with.
82
+ n.$$typeof === $ || n.getModuleId !== void 0));
83
+ }
84
+ function F(n, g, y) {
85
+ var S = n.displayName;
86
+ if (S)
87
+ return S;
88
+ var A = g.displayName || g.name || "";
89
+ return A !== "" ? y + "(" + A + ")" : y;
90
+ }
91
+ function G(n) {
92
+ return n.displayName || "Context";
93
+ }
94
+ function N(n) {
95
+ if (n == null)
96
+ return null;
97
+ if (typeof n.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof n == "function")
98
+ return n.displayName || n.name || null;
99
+ if (typeof n == "string")
100
+ return n;
101
+ switch (n) {
102
+ case a:
103
+ return "Fragment";
104
+ case r:
105
+ return "Portal";
106
+ case d:
107
+ return "Profiler";
108
+ case o:
109
+ return "StrictMode";
110
+ case m:
111
+ return "Suspense";
112
+ case l:
113
+ return "SuspenseList";
114
+ }
115
+ if (typeof n == "object")
116
+ switch (n.$$typeof) {
117
+ case u:
118
+ var g = n;
119
+ return G(g) + ".Consumer";
120
+ case i:
121
+ var y = n;
122
+ return G(y._context) + ".Provider";
123
+ case c:
124
+ return F(n, n.render, "ForwardRef");
125
+ case x:
126
+ var S = n.displayName || null;
127
+ return S !== null ? S : N(n.type) || "Memo";
128
+ case v: {
129
+ var A = n, D = A._payload, P = A._init;
130
+ try {
131
+ return N(P(D));
132
+ } catch {
133
+ return null;
134
+ }
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ var L = Object.assign, V = 0, U, I, q, J, ne, K, ue;
140
+ function ge() {
141
+ }
142
+ ge.__reactDisabledLog = !0;
143
+ function B() {
144
+ {
145
+ if (V === 0) {
146
+ U = console.log, I = console.info, q = console.warn, J = console.error, ne = console.group, K = console.groupCollapsed, ue = console.groupEnd;
147
+ var n = {
148
+ configurable: !0,
149
+ enumerable: !0,
150
+ value: ge,
151
+ writable: !0
152
+ };
153
+ Object.defineProperties(console, {
154
+ info: n,
155
+ log: n,
156
+ warn: n,
157
+ error: n,
158
+ group: n,
159
+ groupCollapsed: n,
160
+ groupEnd: n
161
+ });
162
+ }
163
+ V++;
164
+ }
165
+ }
166
+ function oe() {
167
+ {
168
+ if (V--, V === 0) {
169
+ var n = {
170
+ configurable: !0,
171
+ enumerable: !0,
172
+ writable: !0
173
+ };
174
+ Object.defineProperties(console, {
175
+ log: L({}, n, {
176
+ value: U
177
+ }),
178
+ info: L({}, n, {
179
+ value: I
180
+ }),
181
+ warn: L({}, n, {
182
+ value: q
183
+ }),
184
+ error: L({}, n, {
185
+ value: J
186
+ }),
187
+ group: L({}, n, {
188
+ value: ne
189
+ }),
190
+ groupCollapsed: L({}, n, {
191
+ value: K
192
+ }),
193
+ groupEnd: L({}, n, {
194
+ value: ue
195
+ })
196
+ });
197
+ }
198
+ V < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
199
+ }
200
+ }
201
+ var te = j.ReactCurrentDispatcher, de;
202
+ function he(n, g, y) {
203
+ {
204
+ if (de === void 0)
205
+ try {
206
+ throw Error();
207
+ } catch (A) {
208
+ var S = A.stack.trim().match(/\n( *(at )?)/);
209
+ de = S && S[1] || "";
210
+ }
211
+ return `
212
+ ` + de + n;
213
+ }
214
+ }
215
+ var pe = !1, Se;
216
+ {
217
+ var Ut = typeof WeakMap == "function" ? WeakMap : Map;
218
+ Se = new Ut();
219
+ }
220
+ function ct(n, g) {
221
+ if (!n || pe)
222
+ return "";
223
+ {
224
+ var y = Se.get(n);
225
+ if (y !== void 0)
226
+ return y;
227
+ }
228
+ var S;
229
+ pe = !0;
230
+ var A = Error.prepareStackTrace;
231
+ Error.prepareStackTrace = void 0;
232
+ var D;
233
+ D = te.current, te.current = null, B();
234
+ try {
235
+ if (g) {
236
+ var P = function() {
237
+ throw Error();
238
+ };
239
+ if (Object.defineProperty(P.prototype, "props", {
240
+ set: function() {
241
+ throw Error();
242
+ }
243
+ }), typeof Reflect == "object" && Reflect.construct) {
244
+ try {
245
+ Reflect.construct(P, []);
246
+ } catch (ee) {
247
+ S = ee;
248
+ }
249
+ Reflect.construct(n, [], P);
250
+ } else {
251
+ try {
252
+ P.call();
253
+ } catch (ee) {
254
+ S = ee;
255
+ }
256
+ n.call(P.prototype);
257
+ }
258
+ } else {
259
+ try {
260
+ throw Error();
261
+ } catch (ee) {
262
+ S = ee;
263
+ }
264
+ n();
265
+ }
266
+ } catch (ee) {
267
+ if (ee && S && typeof ee.stack == "string") {
268
+ for (var R = ee.stack.split(`
269
+ `), X = S.stack.split(`
270
+ `), W = R.length - 1, z = X.length - 1; W >= 1 && z >= 0 && R[W] !== X[z]; )
271
+ z--;
272
+ for (; W >= 1 && z >= 0; W--, z--)
273
+ if (R[W] !== X[z]) {
274
+ if (W !== 1 || z !== 1)
275
+ do
276
+ if (W--, z--, z < 0 || R[W] !== X[z]) {
277
+ var re = `
278
+ ` + R[W].replace(" at new ", " at ");
279
+ return n.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", n.displayName)), typeof n == "function" && Se.set(n, re), re;
280
+ }
281
+ while (W >= 1 && z >= 0);
282
+ break;
283
+ }
284
+ }
285
+ } finally {
286
+ pe = !1, te.current = D, oe(), Error.prepareStackTrace = A;
287
+ }
288
+ var ye = n ? n.displayName || n.name : "", xe = ye ? he(ye) : "";
289
+ return typeof n == "function" && Se.set(n, xe), xe;
290
+ }
291
+ function It(n, g, y) {
292
+ return ct(n, !1);
293
+ }
294
+ function Ht(n) {
295
+ var g = n.prototype;
296
+ return !!(g && g.isReactComponent);
297
+ }
298
+ function Te(n, g, y) {
299
+ if (n == null)
300
+ return "";
301
+ if (typeof n == "function")
302
+ return ct(n, Ht(n));
303
+ if (typeof n == "string")
304
+ return he(n);
305
+ switch (n) {
306
+ case m:
307
+ return he("Suspense");
308
+ case l:
309
+ return he("SuspenseList");
310
+ }
311
+ if (typeof n == "object")
312
+ switch (n.$$typeof) {
313
+ case c:
314
+ return It(n.render);
315
+ case x:
316
+ return Te(n.type, g, y);
317
+ case v: {
318
+ var S = n, A = S._payload, D = S._init;
319
+ try {
320
+ return Te(D(A), g, y);
321
+ } catch {
322
+ }
323
+ }
324
+ }
325
+ return "";
326
+ }
327
+ var Ne = Object.prototype.hasOwnProperty, dt = {}, mt = j.ReactDebugCurrentFrame;
328
+ function Oe(n) {
329
+ if (n) {
330
+ var g = n._owner, y = Te(n.type, n._source, g ? g.type : null);
331
+ mt.setExtraStackFrame(y);
332
+ } else
333
+ mt.setExtraStackFrame(null);
334
+ }
335
+ function Wt(n, g, y, S, A) {
336
+ {
337
+ var D = Function.call.bind(Ne);
338
+ for (var P in n)
339
+ if (D(n, P)) {
340
+ var R = void 0;
341
+ try {
342
+ if (typeof n[P] != "function") {
343
+ var X = Error((S || "React class") + ": " + y + " type `" + P + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[P] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
+ throw X.name = "Invariant Violation", X;
345
+ }
346
+ R = n[P](g, P, S, y, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
+ } catch (W) {
348
+ R = W;
349
+ }
350
+ R && !(R instanceof Error) && (Oe(A), b("%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).", S || "React class", y, P, typeof R), Oe(null)), R instanceof Error && !(R.message in dt) && (dt[R.message] = !0, Oe(A), b("Failed %s type: %s", y, R.message), Oe(null));
351
+ }
352
+ }
353
+ }
354
+ var Bt = Array.isArray;
355
+ function He(n) {
356
+ return Bt(n);
357
+ }
358
+ function zt(n) {
359
+ {
360
+ var g = typeof Symbol == "function" && Symbol.toStringTag, y = g && n[Symbol.toStringTag] || n.constructor.name || "Object";
361
+ return y;
362
+ }
363
+ }
364
+ function qt(n) {
365
+ try {
366
+ return ut(n), !1;
367
+ } catch {
368
+ return !0;
369
+ }
370
+ }
371
+ function ut(n) {
372
+ return "" + n;
373
+ }
374
+ function gt(n) {
375
+ if (qt(n))
376
+ return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", zt(n)), ut(n);
377
+ }
378
+ var ht = j.ReactCurrentOwner, Yt = {
379
+ key: !0,
380
+ ref: !0,
381
+ __self: !0,
382
+ __source: !0
383
+ }, xt, ft;
384
+ function Jt(n) {
385
+ if (Ne.call(n, "ref")) {
386
+ var g = Object.getOwnPropertyDescriptor(n, "ref").get;
387
+ if (g && g.isReactWarning)
388
+ return !1;
389
+ }
390
+ return n.ref !== void 0;
391
+ }
392
+ function Gt(n) {
393
+ if (Ne.call(n, "key")) {
394
+ var g = Object.getOwnPropertyDescriptor(n, "key").get;
395
+ if (g && g.isReactWarning)
396
+ return !1;
397
+ }
398
+ return n.key !== void 0;
399
+ }
400
+ function Kt(n, g) {
401
+ typeof n.ref == "string" && ht.current;
402
+ }
403
+ function Qt(n, g) {
404
+ {
405
+ var y = function() {
406
+ xt || (xt = !0, b("%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)", g));
407
+ };
408
+ y.isReactWarning = !0, Object.defineProperty(n, "key", {
409
+ get: y,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ function Xt(n, g) {
415
+ {
416
+ var y = function() {
417
+ ft || (ft = !0, b("%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)", g));
418
+ };
419
+ y.isReactWarning = !0, Object.defineProperty(n, "ref", {
420
+ get: y,
421
+ configurable: !0
422
+ });
423
+ }
424
+ }
425
+ var Zt = function(n, g, y, S, A, D, P) {
426
+ var R = {
427
+ // This tag allows us to uniquely identify this as a React Element
428
+ $$typeof: s,
429
+ // Built-in properties that belong on the element
430
+ type: n,
431
+ key: g,
432
+ ref: y,
433
+ props: P,
434
+ // Record the component responsible for creating this element.
435
+ _owner: D
436
+ };
437
+ return R._store = {}, Object.defineProperty(R._store, "validated", {
438
+ configurable: !1,
439
+ enumerable: !1,
440
+ writable: !0,
441
+ value: !1
442
+ }), Object.defineProperty(R, "_self", {
443
+ configurable: !1,
444
+ enumerable: !1,
445
+ writable: !1,
446
+ value: S
447
+ }), Object.defineProperty(R, "_source", {
448
+ configurable: !1,
449
+ enumerable: !1,
450
+ writable: !1,
451
+ value: A
452
+ }), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
453
+ };
454
+ function er(n, g, y, S, A) {
455
+ {
456
+ var D, P = {}, R = null, X = null;
457
+ y !== void 0 && (gt(y), R = "" + y), Gt(g) && (gt(g.key), R = "" + g.key), Jt(g) && (X = g.ref, Kt(g, A));
458
+ for (D in g)
459
+ Ne.call(g, D) && !Yt.hasOwnProperty(D) && (P[D] = g[D]);
460
+ if (n && n.defaultProps) {
461
+ var W = n.defaultProps;
462
+ for (D in W)
463
+ P[D] === void 0 && (P[D] = W[D]);
464
+ }
465
+ if (R || X) {
466
+ var z = typeof n == "function" ? n.displayName || n.name || "Unknown" : n;
467
+ R && Qt(P, z), X && Xt(P, z);
468
+ }
469
+ return Zt(n, R, X, A, S, ht.current, P);
470
+ }
471
+ }
472
+ var We = j.ReactCurrentOwner, pt = j.ReactDebugCurrentFrame;
473
+ function be(n) {
474
+ if (n) {
475
+ var g = n._owner, y = Te(n.type, n._source, g ? g.type : null);
476
+ pt.setExtraStackFrame(y);
477
+ } else
478
+ pt.setExtraStackFrame(null);
479
+ }
480
+ var Be;
481
+ Be = !1;
482
+ function ze(n) {
483
+ return typeof n == "object" && n !== null && n.$$typeof === s;
484
+ }
485
+ function bt() {
486
+ {
487
+ if (We.current) {
488
+ var n = N(We.current.type);
489
+ if (n)
490
+ return `
491
+
492
+ Check the render method of \`` + n + "`.";
493
+ }
494
+ return "";
495
+ }
496
+ }
497
+ function tr(n) {
498
+ return "";
499
+ }
500
+ var yt = {};
501
+ function rr(n) {
502
+ {
503
+ var g = bt();
504
+ if (!g) {
505
+ var y = typeof n == "string" ? n : n.displayName || n.name;
506
+ y && (g = `
507
+
508
+ Check the top-level render call using <` + y + ">.");
509
+ }
510
+ return g;
511
+ }
512
+ }
513
+ function vt(n, g) {
514
+ {
515
+ if (!n._store || n._store.validated || n.key != null)
516
+ return;
517
+ n._store.validated = !0;
518
+ var y = rr(g);
519
+ if (yt[y])
520
+ return;
521
+ yt[y] = !0;
522
+ var S = "";
523
+ n && n._owner && n._owner !== We.current && (S = " It was passed a child from " + N(n._owner.type) + "."), be(n), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', y, S), be(null);
524
+ }
525
+ }
526
+ function jt(n, g) {
527
+ {
528
+ if (typeof n != "object")
529
+ return;
530
+ if (He(n))
531
+ for (var y = 0; y < n.length; y++) {
532
+ var S = n[y];
533
+ ze(S) && vt(S, g);
534
+ }
535
+ else if (ze(n))
536
+ n._store && (n._store.validated = !0);
537
+ else if (n) {
538
+ var A = f(n);
539
+ if (typeof A == "function" && A !== n.entries)
540
+ for (var D = A.call(n), P; !(P = D.next()).done; )
541
+ ze(P.value) && vt(P.value, g);
542
+ }
543
+ }
544
+ }
545
+ function sr(n) {
546
+ {
547
+ var g = n.type;
548
+ if (g == null || typeof g == "string")
549
+ return;
550
+ var y;
551
+ if (typeof g == "function")
552
+ y = g.propTypes;
553
+ else if (typeof g == "object" && (g.$$typeof === c || // Note: Memo only checks outer props here.
554
+ // Inner props are checked in the reconciler.
555
+ g.$$typeof === x))
556
+ y = g.propTypes;
557
+ else
558
+ return;
559
+ if (y) {
560
+ var S = N(g);
561
+ Wt(y, n.props, "prop", S, n);
562
+ } else if (g.PropTypes !== void 0 && !Be) {
563
+ Be = !0;
564
+ var A = N(g);
565
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
566
+ }
567
+ typeof g.getDefaultProps == "function" && !g.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
+ }
569
+ }
570
+ function ar(n) {
571
+ {
572
+ for (var g = Object.keys(n.props), y = 0; y < g.length; y++) {
573
+ var S = g[y];
574
+ if (S !== "children" && S !== "key") {
575
+ be(n), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), be(null);
576
+ break;
577
+ }
578
+ }
579
+ n.ref !== null && (be(n), b("Invalid attribute `ref` supplied to `React.Fragment`."), be(null));
580
+ }
581
+ }
582
+ var wt = {};
583
+ function Nt(n, g, y, S, A, D) {
584
+ {
585
+ var P = O(n);
586
+ if (!P) {
587
+ var R = "";
588
+ (n === void 0 || typeof n == "object" && n !== null && Object.keys(n).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
+ var X = tr();
590
+ X ? R += X : R += bt();
591
+ var W;
592
+ n === null ? W = "null" : He(n) ? W = "array" : n !== void 0 && n.$$typeof === s ? (W = "<" + (N(n.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : W = typeof n, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", W, R);
593
+ }
594
+ var z = er(n, g, y, A, D);
595
+ if (z == null)
596
+ return z;
597
+ if (P) {
598
+ var re = g.children;
599
+ if (re !== void 0)
600
+ if (S)
601
+ if (He(re)) {
602
+ for (var ye = 0; ye < re.length; ye++)
603
+ jt(re[ye], n);
604
+ Object.freeze && Object.freeze(re);
605
+ } else
606
+ b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
+ else
608
+ jt(re, n);
609
+ }
610
+ if (Ne.call(g, "key")) {
611
+ var xe = N(n), ee = Object.keys(g).filter(function(dr) {
612
+ return dr !== "key";
613
+ }), qe = ee.length > 0 ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}";
614
+ if (!wt[xe + qe]) {
615
+ var cr = ee.length > 0 ? "{" + ee.join(": ..., ") + ": ...}" : "{}";
616
+ b(`A props object containing a "key" prop is being spread into JSX:
617
+ let props = %s;
618
+ <%s {...props} />
619
+ React keys must be passed directly to JSX without using spread:
620
+ let props = %s;
621
+ <%s key={someKey} {...props} />`, qe, xe, cr, xe), wt[xe + qe] = !0;
622
+ }
623
+ }
624
+ return n === a ? ar(z) : sr(z), z;
625
+ }
626
+ }
627
+ function nr(n, g, y) {
628
+ return Nt(n, g, y, !0);
629
+ }
630
+ function or(n, g, y) {
631
+ return Nt(n, g, y, !1);
632
+ }
633
+ var ir = or, lr = nr;
634
+ _e.Fragment = a, _e.jsx = ir, _e.jsxs = lr;
635
+ }()), _e;
636
+ }
637
+ process.env.NODE_ENV === "production" ? Ze.exports = Er() : Ze.exports = Cr();
638
+ var e = Ze.exports;
639
+ const me = {
640
+ domain: "https://studio.3speak.tv",
641
+ kThreeSpeakApiUrl: "https://studio.3speak.tv/mobile/api",
642
+ userOwnerThumb: (t) => `https://images.hive.blog/u/${t}/avatar`,
643
+ graphQLServerUrl: "https://union.us-02.infra.3speak.tv"
644
+ }, Je = new Nr([
645
+ "https://api.hive.blog",
646
+ "https://api.syncad.com",
647
+ "https://api.deathwing.me"
648
+ ]);
649
+ class Sr {
650
+ constructor() {
651
+ // Common data fields fragment (for reuse)
652
+ $e(this, "commonFields", `
653
+ items {
654
+ created_at
655
+ title
656
+ permlink
657
+ author {
658
+ username
659
+ }
660
+ json_metadata {
661
+ raw
662
+ }
663
+ stats {
664
+ active_voters {
665
+ percent
666
+ rshares
667
+ voter
668
+ weight
669
+ }
670
+ num_comments
671
+ num_votes
672
+ total_hive_reward
673
+ }
674
+ ... on HivePost {
675
+ lang
676
+ tags
677
+ spkvideo
678
+ }
679
+ }
680
+ `);
681
+ }
682
+ // Generic GraphQL feed fetcher
683
+ async getGQLFeed(s, r) {
684
+ var o, d, i;
685
+ const a = `${me.graphQLServerUrl}/api/v2/graphql`;
686
+ try {
687
+ const u = await fetch(a, {
688
+ method: "POST",
689
+ headers: {
690
+ "Content-Type": "application/json"
691
+ },
692
+ body: JSON.stringify({
693
+ query: r,
694
+ operationName: s
695
+ })
696
+ });
697
+ if (!u.ok)
698
+ throw new Error(`GraphQL request failed: ${u.statusText}`);
699
+ const c = await u.json();
700
+ if (c.errors)
701
+ throw new Error(
702
+ `GraphQL error: ${c.errors.map((l) => l.message).join(", ")}`
703
+ );
704
+ const m = c.data;
705
+ return (o = m.socialFeed) != null && o.items ? m.socialFeed.items : (d = m.trendingFeed) != null && d.items ? m.trendingFeed.items : (i = m.searchFeed) != null && i.items ? m.searchFeed.items : [];
706
+ } catch (u) {
707
+ throw console.error(`Failed to fetch ${s}:`, u), u;
708
+ }
709
+ }
710
+ async handleLogin(s) {
711
+ const r = `${me.domain}/mobile/login`, a = await fetch(r, {
712
+ method: "POST",
713
+ headers: { "Content-Type": "application/json" },
714
+ body: JSON.stringify({
715
+ challenge: s.challenge,
716
+ proof: s.proof,
717
+ publicKey: s.publicKey,
718
+ username: s.username
719
+ })
720
+ });
721
+ if (a.ok)
722
+ return await a.json();
723
+ throw new Error(`Login API error: ${await a.text()}`);
724
+ }
725
+ async handleUpvote({
726
+ author: s,
727
+ permlink: r,
728
+ weight: a,
729
+ authToken: o
730
+ }) {
731
+ const d = `${me.domain}/mobile/vote`, i = await fetch(d, {
732
+ method: "POST",
733
+ headers: {
734
+ "Content-Type": "application/json",
735
+ authorization: o
736
+ },
737
+ body: JSON.stringify({
738
+ author: s,
739
+ permlink: r,
740
+ weight: a
741
+ })
742
+ });
743
+ if (i.ok)
744
+ return await i.json();
745
+ {
746
+ const u = await i.json();
747
+ throw new Error(u.error || "Unknown API error");
748
+ }
749
+ }
750
+ async handleComment({
751
+ author: s,
752
+ permlink: r,
753
+ body: a,
754
+ authToken: o
755
+ }) {
756
+ const d = `${me.domain}/mobile/comment`, i = await fetch(d, {
757
+ method: "POST",
758
+ headers: {
759
+ "Content-Type": "application/json",
760
+ authorization: o
761
+ },
762
+ body: JSON.stringify({
763
+ author: s,
764
+ permlink: r,
765
+ comment: a
766
+ })
767
+ });
768
+ if (i.ok)
769
+ return await i.json();
770
+ {
771
+ const u = await i.json();
772
+ throw new Error(u.error || "Unknown API error");
773
+ }
774
+ }
775
+ async getVideoDetails(s, r) {
776
+ const a = `${me.kThreeSpeakApiUrl}/video/@${s}/${r}`, o = await fetch(a);
777
+ if (o.ok)
778
+ return await o.json();
779
+ console.error("Failed to fetch video details:", o.statusText);
780
+ }
781
+ // Common feed fetching method to reduce code duplication
782
+ async fetchFeed(s, r, a, o, d = { limit: 50, skip: 0 }) {
783
+ const { limit: i = 50, skip: u = 0 } = d, c = `
784
+ query ${s} {
785
+ ${r}(
786
+ spkvideo: { ${a} }
787
+ feedOptions: ${o}
788
+ pagination: { limit: ${i}, skip: ${u} }
789
+ ) {
790
+ ${this.commonFields}
791
+ }
792
+ }
793
+ `, m = await this.getGQLFeed(s, c);
794
+ return this.convertGQLItemsToThreeSpeakVideos(m);
795
+ }
796
+ async getUserVideos(s, r = 0) {
797
+ return await this.fetchFeed(
798
+ "UserChannelFeed",
799
+ "socialFeed",
800
+ "only: true",
801
+ `{ byCreator: { _in: ["${s}"] } }`,
802
+ { skip: r }
803
+ );
804
+ }
805
+ async getHomeVideos(s = 0) {
806
+ const r = `${me.kThreeSpeakApiUrl}/feed/home?skip=${s}`, a = await fetch(r);
807
+ if (a.ok) {
808
+ const o = await a.json();
809
+ return Array.isArray(o) ? o : [];
810
+ } else
811
+ return console.error("Failed to fetch home videos:", a.statusText), [];
812
+ }
813
+ async getTrendingVideos(s = 0) {
814
+ return await this.fetchFeed(
815
+ "TrendingFeed",
816
+ "trendingFeed",
817
+ "only: true",
818
+ "{}",
819
+ { skip: s }
820
+ );
821
+ }
822
+ async getNewVideos(s = 0) {
823
+ return await this.fetchFeed(
824
+ "NewUploadsFeed",
825
+ "socialFeed",
826
+ "only: true",
827
+ "{}",
828
+ { skip: s }
829
+ );
830
+ }
831
+ async getFirstUploadsVideos(s = 0) {
832
+ return await this.fetchFeed(
833
+ "FirstUploadsFeed",
834
+ "trendingFeed",
835
+ "only: true, firstUpload: true",
836
+ "{}",
837
+ { skip: s }
838
+ );
839
+ }
840
+ async getCommunityVideos(s, r = 0) {
841
+ return await this.fetchFeed(
842
+ "CommunityFeed",
843
+ "socialFeed",
844
+ "only: true",
845
+ `{ byCommunity: { _eq: "${s}" } }`,
846
+ { skip: r }
847
+ );
848
+ }
849
+ async getRelatedVideos(s, r = 0) {
850
+ return await this.fetchFeed(
851
+ "RelatedFeed",
852
+ "socialFeed",
853
+ "only: true",
854
+ `{ byCreator: { _in: ["${s}"] } }`,
855
+ { skip: r }
856
+ );
857
+ }
858
+ async getTaggedVideos(s, r = 0) {
859
+ return await this.fetchFeed(
860
+ "TrendingTagFeed",
861
+ "trendingFeed",
862
+ "only: true",
863
+ `{ byTag: { _eq: "${s}" } }`,
864
+ { skip: r }
865
+ );
866
+ }
867
+ async getSearchFeed(s, r = 0, a) {
868
+ const o = a ? `{ byLang: { _eq: "${a}" } }` : "{}", d = `
869
+ query SearchFeed {
870
+ searchFeed(
871
+ searchTerm: "${s}"
872
+ spkvideo: { only: true }
873
+ feedOptions: ${o}
874
+ pagination: { limit: 50, skip: ${r} }
875
+ ) {
876
+ ${this.commonFields}
877
+ }
878
+ }
879
+ `, i = await this.getGQLFeed("SearchFeed", d);
880
+ return this.convertGQLItemsToThreeSpeakVideos(i);
881
+ }
882
+ async getTrendingTags() {
883
+ var a, o;
884
+ const s = `${me.graphQLServerUrl}/api/v2/graphql`, r = `
885
+ query TrendingTags {
886
+ trendingTags(limit: 50) {
887
+ tags {
888
+ score
889
+ tag
890
+ }
891
+ }
892
+ }
893
+ `;
894
+ try {
895
+ const d = await fetch(s, {
896
+ method: "POST",
897
+ headers: {
898
+ "Content-Type": "application/json"
899
+ },
900
+ body: JSON.stringify({
901
+ query: r,
902
+ operationName: "TrendingTags"
903
+ })
904
+ });
905
+ if (!d.ok)
906
+ throw new Error(`GraphQL request failed: ${d.statusText}`);
907
+ const i = await d.json();
908
+ if (i.errors)
909
+ throw new Error(
910
+ `GraphQL error: ${i.errors.map((u) => u.message).join(", ")}`
911
+ );
912
+ return ((o = (a = i.data) == null ? void 0 : a.trendingTags) == null ? void 0 : o.tags) || [];
913
+ } catch (d) {
914
+ throw console.error("Failed to fetch trending tags:", d), d;
915
+ }
916
+ }
917
+ // Convert GQL items to ThreeSpeakVideo format
918
+ convertGQLItemsToThreeSpeakVideos(s) {
919
+ return s.map((r) => {
920
+ var o, d, i, u, c, m, l, x, v, w, k, T, f, j;
921
+ let a = null;
922
+ try {
923
+ typeof r.spkvideo == "string" ? a = JSON.parse(r.spkvideo) : a = r.spkvideo;
924
+ } catch (b) {
925
+ console.error("Error parsing spkvideo JSON", b);
926
+ }
927
+ return {
928
+ title: r.title || "Untitled",
929
+ owner: ((o = r.author) == null ? void 0 : o.username) || "",
930
+ permlink: r.permlink || "",
931
+ created: new Date(r.created_at),
932
+ category: r.tags && r.tags.length > 0 ? r.tags[0] : "general",
933
+ duration: (a == null ? void 0 : a.duration) || ((c = (u = (i = (d = r.json_metadata) == null ? void 0 : d.raw) == null ? void 0 : i.video) == null ? void 0 : u.info) == null ? void 0 : c.duration) || 0,
934
+ thumbnail: (a == null ? void 0 : a.thumbnail_url) || ((v = (x = (l = (m = r.json_metadata) == null ? void 0 : m.raw) == null ? void 0 : l.video) == null ? void 0 : x.info) == null ? void 0 : v.thumbnail),
935
+ // Include stats from GraphQL response
936
+ numOfUpvotes: (w = r.stats) == null ? void 0 : w.num_votes,
937
+ numOfComments: (k = r.stats) == null ? void 0 : k.num_comments,
938
+ hiveValue: (T = r.stats) == null ? void 0 : T.total_hive_reward,
939
+ // Store active_voters for later use
940
+ active_votes: ((j = (f = r.stats) == null ? void 0 : f.active_voters) == null ? void 0 : j.map((b) => ({
941
+ voter: b.voter,
942
+ percent: b.percent,
943
+ rshares: b.rshares,
944
+ weight: b.weight
945
+ }))) || []
946
+ };
947
+ });
948
+ }
949
+ async getContentStats(s, r) {
950
+ try {
951
+ const a = await Je.call(
952
+ "condenser_api",
953
+ "get_content",
954
+ [s, r]
955
+ );
956
+ return {
957
+ numOfUpvotes: (a == null ? void 0 : a.net_votes) ?? 0,
958
+ numOfComments: (a == null ? void 0 : a.children) ?? 0,
959
+ hiveValue: a != null && a.pending_payout_value ? parseFloat(a.pending_payout_value) : 0
960
+ };
961
+ } catch {
962
+ return {
963
+ numOfUpvotes: 0,
964
+ numOfComments: 0,
965
+ hiveValue: 0
966
+ };
967
+ }
968
+ }
969
+ async getActiveVotes(s, r) {
970
+ try {
971
+ return await Je.call(
972
+ "condenser_api",
973
+ "get_active_votes",
974
+ [s, r]
975
+ );
976
+ } catch (a) {
977
+ return console.error("Error calling get_active_votes:", a), [];
978
+ }
979
+ }
980
+ async getCommentsList(s, r) {
981
+ try {
982
+ const a = await Je.call(
983
+ "bridge",
984
+ "get_discussion",
985
+ [s, r]
986
+ );
987
+ return (Array.isArray(a) ? a : a && typeof a == "object" ? Object.values(a) : []).map((d) => {
988
+ const i = d.depth;
989
+ if (typeof i == "string") {
990
+ const c = parseInt(i, 10);
991
+ d.depth = Number.isFinite(c) ? c : 0;
992
+ } else (typeof i != "number" || !Number.isFinite(i)) && (d.depth = d.depth ?? 0);
993
+ const u = d.json_metadata;
994
+ try {
995
+ if (u && typeof u == "string") {
996
+ const c = u.trim();
997
+ (c.startsWith("{") && c.endsWith("}") || c.startsWith("[") && c.endsWith("]")) && (d.json_metadata_parsed = JSON.parse(c));
998
+ } else u && typeof u == "object" && (d.json_metadata_parsed = u);
999
+ } catch {
1000
+ console.warn(
1001
+ `Skipped invalid json_metadata for ${d.author}/${d.permlink}`
1002
+ );
1003
+ }
1004
+ return d;
1005
+ });
1006
+ } catch (a) {
1007
+ return console.error("Error fetching comments list:", a), [];
1008
+ }
1009
+ }
1010
+ async getMyVideos(s) {
1011
+ const r = `${me.domain}/mobile/api/my-videos`, a = await fetch(r, {
1012
+ method: "GET",
1013
+ headers: {
1014
+ "Content-Type": "application/json",
1015
+ Authorization: s
1016
+ }
1017
+ });
1018
+ if (a.ok) {
1019
+ const o = await a.json();
1020
+ return Array.isArray(o) ? o : [];
1021
+ } else
1022
+ throw console.error("Failed to fetch my videos:", a.statusText), new Error(`Failed to fetch my videos: ${a.status}`);
1023
+ }
1024
+ }
1025
+ const Z = new Sr(), fe = (t) => t ? t.startsWith("Qm") || t.startsWith("baf") ? `https://ipfs-3speak.b-cdn.net/ipfs/${t}` : t.startsWith("http") ? t : t.startsWith("/") ? `https://3speak.tv${t}` : t : "/placeholder.svg", Tr = ({
1026
+ video: t,
1027
+ onVideoClick: s,
1028
+ onAuthorClick: r,
1029
+ isGrid: a = !1
1030
+ }) => {
1031
+ const [o, d] = p({
1032
+ numOfUpvotes: t.numOfUpvotes,
1033
+ numOfComments: t.numOfComments,
1034
+ hiveValue: t.hiveValue
1035
+ });
1036
+ H(() => {
1037
+ if (o.numOfUpvotes === void 0 && t.numOfUpvotes === void 0) {
1038
+ let c = !0;
1039
+ return (async () => {
1040
+ try {
1041
+ const m = await Z.getContentStats(
1042
+ t.author || "",
1043
+ t.permlink || ""
1044
+ );
1045
+ c && d(m);
1046
+ } catch (m) {
1047
+ console.error("Error fetching content stats for VideoCard:", m);
1048
+ }
1049
+ })(), () => {
1050
+ c = !1;
1051
+ };
1052
+ } else t.numOfUpvotes !== void 0 && d({
1053
+ numOfUpvotes: t.numOfUpvotes,
1054
+ numOfComments: t.numOfComments || 0,
1055
+ hiveValue: t.hiveValue || 0
1056
+ });
1057
+ }, [t.author, t.permlink, o.numOfUpvotes, t.numOfUpvotes, t.numOfComments, t.hiveValue]);
1058
+ const i = (c) => {
1059
+ if (!c) return "00:00";
1060
+ const m = Math.floor(c), l = Math.floor(m / 3600), x = Math.floor(m % 3600 / 60), v = m % 60, w = (k) => k.toString().padStart(2, "0");
1061
+ return m < 60 ? `00:${w(v)}` : l === 0 ? `${w(x)}:${w(v)}` : `${w(l)}:${w(x)}:${w(v)}`;
1062
+ }, u = (c) => c == null ? "" : c >= 1e6 ? `${(c / 1e6).toFixed(1)}M` : c >= 1e3 ? `${(c / 1e3).toFixed(1)}K` : c.toString();
1063
+ return /* @__PURE__ */ e.jsxs("div", { className: "group bg-card border border-border rounded-xl overflow-hidden shadow-card hover:shadow-card-hover transition-all duration-200 hover:-translate-y-1 cursor-pointer", children: [
1064
+ /* @__PURE__ */ e.jsxs(
1065
+ "div",
1066
+ {
1067
+ className: "relative aspect-video bg-muted overflow-hidden",
1068
+ onClick: () => s(t),
1069
+ children: [
1070
+ /* @__PURE__ */ e.jsx(
1071
+ "img",
1072
+ {
1073
+ src: fe(t.thumbnail),
1074
+ alt: t.title,
1075
+ onError: (c) => {
1076
+ c.target.src = `https://images.hive.blog/u/${t.author}/avatar`;
1077
+ },
1078
+ className: "w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"
1079
+ }
1080
+ ),
1081
+ t.duration && /* @__PURE__ */ e.jsxs("div", { className: "absolute bottom-3 right-3 bg-black/80 text-white text-xs px-2 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm", children: [
1082
+ /* @__PURE__ */ e.jsx(Ft, { className: "w-3 h-3" }),
1083
+ i(t.duration)
1084
+ ] }),
1085
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all duration-300 bg-black/20", children: /* @__PURE__ */ e.jsx("div", { className: "bg-primary hover:bg-primary-hover rounded-full p-4 transform scale-75 group-hover:scale-100 transition-all duration-300 shadow-lg", children: /* @__PURE__ */ e.jsx(et, { className: "w-6 h-6 text-primary-foreground ml-0.5", fill: "currentColor" }) }) }),
1086
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-gradient-overlay opacity-0 group-hover:opacity-30 transition-opacity duration-300" })
1087
+ ]
1088
+ }
1089
+ ),
1090
+ /* @__PURE__ */ e.jsxs("div", { className: "p-4 space-y-3", children: [
1091
+ /* @__PURE__ */ e.jsx(
1092
+ "h3",
1093
+ {
1094
+ className: "font-semibold text-card-foreground line-clamp-2 group-hover:text-primary transition-colors cursor-pointer leading-tight",
1095
+ onClick: () => s(t),
1096
+ children: t.title
1097
+ }
1098
+ ),
1099
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1100
+ /* @__PURE__ */ e.jsxs(
1101
+ "div",
1102
+ {
1103
+ className: "flex items-center gap-2 cursor-pointer hover:text-primary transition-colors group/author",
1104
+ onClick: () => r(t.author),
1105
+ children: [
1106
+ /* @__PURE__ */ e.jsx(
1107
+ "img",
1108
+ {
1109
+ src: `https://images.hive.blog/u/${t.author}/avatar`,
1110
+ alt: t.author,
1111
+ className: "w-8 h-8 rounded-full object-cover border-2 border-border group-hover/author:border-primary transition-colors",
1112
+ onError: (c) => {
1113
+ c.target.src = "https://images.hive.blog/u/null/avatar";
1114
+ }
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ e.jsxs("span", { className: "font-medium text-sm text-muted-foreground group-hover/author:text-primary transition-colors", children: [
1118
+ "@",
1119
+ t.author
1120
+ ] })
1121
+ ]
1122
+ }
1123
+ ),
1124
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: nt(t.created, { addSuffix: !0 }) })
1125
+ ] }),
1126
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
1127
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
1128
+ o.numOfUpvotes != null && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-muted-foreground hover:text-primary transition-colors cursor-pointer", children: [
1129
+ /* @__PURE__ */ e.jsx(tt, { className: "w-4 h-4" }),
1130
+ /* @__PURE__ */ e.jsx("span", { children: u(o.numOfUpvotes) })
1131
+ ] }),
1132
+ o.numOfComments != null && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-muted-foreground hover:text-primary transition-colors cursor-pointer", children: [
1133
+ /* @__PURE__ */ e.jsx(rt, { className: "w-4 h-4" }),
1134
+ /* @__PURE__ */ e.jsx("span", { children: u(o.numOfComments) })
1135
+ ] })
1136
+ ] }),
1137
+ o.hiveValue != null && o.hiveValue > 0 && /* @__PURE__ */ e.jsxs("div", { className: "text-primary font-semibold", children: [
1138
+ "$",
1139
+ o.hiveValue.toFixed(2)
1140
+ ] })
1141
+ ] }),
1142
+ t.category && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx("span", { className: "inline-block bg-primary/10 text-primary text-xs px-2 py-1 rounded-full font-medium", children: t.category }) })
1143
+ ] })
1144
+ ] });
1145
+ };
1146
+ var Q = /* @__PURE__ */ ((t) => (t.HOME = "home", t.TRENDING = "trending", t.NEW_VIDEOS = "newVideos", t.FIRST_UPLOADS = "firstUploads", t.USER = "user", t.COMMUNITY = "community", t.RELATED = "related", t.TAG_FEED = "tag_feed", t.SEARCH = "search", t))(Q || {});
1147
+ const St = /* @__PURE__ */ new Map(), Or = ({
1148
+ title: t,
1149
+ author: s,
1150
+ permlink: r,
1151
+ createdAt: a,
1152
+ video: o,
1153
+ currentUser: d,
1154
+ isContentVoted: i = !1,
1155
+ description: u,
1156
+ onTapComment: c,
1157
+ onTapUpvote: m,
1158
+ onTapShare: l,
1159
+ onTapBookmark: x,
1160
+ onTapAuthor: v,
1161
+ onTapInfo: w
1162
+ }) => {
1163
+ const [k, T] = p(o.numOfComments || 0), [f, j] = p(o.numOfUpvotes || 0), [b, M] = p(!1), [_, E] = p(!1), [C, Y] = p(""), h = (U) => {
1164
+ Y(U), E(!0), setTimeout(() => E(!1), 3e3);
1165
+ }, $ = (U, I) => `${U}:${I}`;
1166
+ H(() => {
1167
+ const U = $(s, r), I = St.get(U);
1168
+ I ? (T(I.comments), j(I.upvotes)) : (async () => {
1169
+ const J = await Z.getContentStats(s, r);
1170
+ j(J.numOfUpvotes), T(J.numOfComments), St.set($(s, r), {
1171
+ comments: J.numOfComments,
1172
+ upvotes: J.numOfUpvotes
1173
+ });
1174
+ })();
1175
+ }, [s, r]);
1176
+ const O = () => {
1177
+ c ? c(s, r) : h("Comments feature coming soon!");
1178
+ }, F = () => {
1179
+ m ? m(s, r) : h("Upvote feature requires authentication!");
1180
+ }, G = () => {
1181
+ if (l)
1182
+ l(s, r);
1183
+ else {
1184
+ const U = `https://3speak.tv/user/${s}/${r}`;
1185
+ navigator.share ? navigator.share({ title: t, url: U }) : (navigator.clipboard.writeText(U), h("Link copied to clipboard!"));
1186
+ }
1187
+ }, N = () => {
1188
+ x ? x(s, r) : (M(!b), h(
1189
+ b ? "Removed from bookmarks" : "Added to bookmarks"
1190
+ ));
1191
+ }, L = () => v == null ? void 0 : v(s, r), V = () => {
1192
+ w ? w(s, r) : h("Video details coming soon!");
1193
+ };
1194
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1195
+ /* @__PURE__ */ e.jsxs("div", { className: "p-6 bg-card border-b border-border", children: [
1196
+ /* @__PURE__ */ e.jsx("h1", { className: "text-xl font-bold text-card-foreground mb-4 line-clamp-2", children: t }),
1197
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-4", children: [
1198
+ /* @__PURE__ */ e.jsx(
1199
+ "button",
1200
+ {
1201
+ onClick: L,
1202
+ className: "flex-shrink-0 group",
1203
+ children: /* @__PURE__ */ e.jsx(
1204
+ "img",
1205
+ {
1206
+ src: `https://images.hive.blog/u/${s}/avatar`,
1207
+ alt: s,
1208
+ className: "w-12 h-12 rounded-full object-cover border-2 border-border group-hover:border-primary transition-all duration-200",
1209
+ onError: (U) => {
1210
+ U.target.src = `https://ui-avatars.com/api/?name=${s}&background=random`;
1211
+ }
1212
+ }
1213
+ )
1214
+ }
1215
+ ),
1216
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1", children: [
1217
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between mb-4", children: /* @__PURE__ */ e.jsxs("div", { children: [
1218
+ /* @__PURE__ */ e.jsxs(
1219
+ "button",
1220
+ {
1221
+ onClick: L,
1222
+ className: "font-semibold text-card-foreground hover:text-primary transition-colors text-base",
1223
+ children: [
1224
+ "@",
1225
+ s
1226
+ ]
1227
+ }
1228
+ ),
1229
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 mt-1 text-sm text-muted-foreground", children: [
1230
+ o.views && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
1231
+ /* @__PURE__ */ e.jsx(Lt, { className: "w-4 h-4" }),
1232
+ /* @__PURE__ */ e.jsxs("span", { children: [
1233
+ o.views.toLocaleString(),
1234
+ " views"
1235
+ ] })
1236
+ ] }),
1237
+ a && /* @__PURE__ */ e.jsx("span", { children: nt(a, { addSuffix: !0 }) })
1238
+ ] })
1239
+ ] }) }),
1240
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1241
+ /* @__PURE__ */ e.jsxs(
1242
+ "button",
1243
+ {
1244
+ type: "button",
1245
+ onClick: V,
1246
+ className: "inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-muted text-muted-foreground hover:bg-primary/10 hover:text-primary transition-all duration-200",
1247
+ "aria-label": "Show description",
1248
+ children: [
1249
+ /* @__PURE__ */ e.jsx(Rt, { className: "w-4 h-4" }),
1250
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: "Info" })
1251
+ ]
1252
+ }
1253
+ ),
1254
+ /* @__PURE__ */ e.jsxs(
1255
+ "button",
1256
+ {
1257
+ type: "button",
1258
+ onClick: O,
1259
+ className: "inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-muted text-muted-foreground hover:bg-primary/10 hover:text-primary transition-all duration-200",
1260
+ "aria-label": "Show comments",
1261
+ children: [
1262
+ /* @__PURE__ */ e.jsx(rt, { className: "w-4 h-4" }),
1263
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: k })
1264
+ ]
1265
+ }
1266
+ ),
1267
+ /* @__PURE__ */ e.jsxs(
1268
+ "button",
1269
+ {
1270
+ type: "button",
1271
+ onClick: F,
1272
+ className: `inline-flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200 ${i ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground hover:bg-primary/10 hover:text-primary"}`,
1273
+ "aria-label": "Show upvotes",
1274
+ children: [
1275
+ /* @__PURE__ */ e.jsx(
1276
+ tt,
1277
+ {
1278
+ className: `w-4 h-4 ${i ? "fill-current" : ""}`
1279
+ }
1280
+ ),
1281
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: f })
1282
+ ]
1283
+ }
1284
+ ),
1285
+ /* @__PURE__ */ e.jsxs(
1286
+ "button",
1287
+ {
1288
+ type: "button",
1289
+ onClick: G,
1290
+ className: "inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-muted text-muted-foreground hover:bg-secondary/10 hover:text-secondary transition-all duration-200",
1291
+ "aria-label": "Share video",
1292
+ children: [
1293
+ /* @__PURE__ */ e.jsx(st, { className: "w-4 h-4" }),
1294
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: "Share" })
1295
+ ]
1296
+ }
1297
+ ),
1298
+ /* @__PURE__ */ e.jsxs(
1299
+ "button",
1300
+ {
1301
+ type: "button",
1302
+ onClick: N,
1303
+ className: `inline-flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200 ${b ? "bg-error/10 text-error" : "bg-muted text-muted-foreground hover:bg-error/10 hover:text-error"}`,
1304
+ "aria-label": "Bookmark video",
1305
+ children: [
1306
+ /* @__PURE__ */ e.jsx(
1307
+ hr,
1308
+ {
1309
+ className: `w-4 h-4 ${b ? "fill-current" : ""}`
1310
+ }
1311
+ ),
1312
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: b ? "Saved" : "Save" })
1313
+ ]
1314
+ }
1315
+ )
1316
+ ] }),
1317
+ (o.hiveValue || o.category) && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 mt-4 pt-4 border-t border-border", children: [
1318
+ o.hiveValue && o.hiveValue > 0 && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1 text-success font-semibold", children: /* @__PURE__ */ e.jsxs("span", { children: [
1319
+ "$",
1320
+ o.hiveValue.toFixed(2),
1321
+ " earned"
1322
+ ] }) }),
1323
+ o.category && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
1324
+ /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4 text-muted-foreground" }),
1325
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground capitalize", children: o.category })
1326
+ ] })
1327
+ ] })
1328
+ ] })
1329
+ ] })
1330
+ ] }),
1331
+ _ && /* @__PURE__ */ e.jsx("div", { className: "fixed bottom-4 right-4 z-50 animate-slide-up", children: /* @__PURE__ */ e.jsx("div", { className: "bg-card border border-border text-card-foreground rounded-lg px-4 py-3 shadow-lg max-w-sm", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: C }) }) })
1332
+ ] });
1333
+ }, Fe = /* @__PURE__ */ new Map(), ot = ({
1334
+ feedType: t,
1335
+ username: s,
1336
+ communityId: r,
1337
+ tag: a,
1338
+ onVideoClick: o,
1339
+ onAuthorClick: d
1340
+ }) => {
1341
+ const [i, u] = p([]), [c, m] = p(!0), [l, x] = p(!1), [v, w] = p(null), [k, T] = p(!0), [f, j] = p(0), b = gr(() => {
1342
+ switch (t) {
1343
+ case Q.USER:
1344
+ return `user:${s || ""}`;
1345
+ case Q.COMMUNITY:
1346
+ return `community:${r || ""}`;
1347
+ case Q.TAG_FEED:
1348
+ return `tag:${a || ""}`;
1349
+ default:
1350
+ return t;
1351
+ }
1352
+ }, [t, s, r, a]), M = je(
1353
+ async (h) => {
1354
+ var $, O, F, G, N, L, V, U, I, q, J, ne;
1355
+ if (($ = h.author) != null && $.username) {
1356
+ if (!h.permlink) return null;
1357
+ let K = null;
1358
+ try {
1359
+ typeof h.spkvideo == "string" ? K = JSON.parse(h.spkvideo) : K = h.spkvideo;
1360
+ } catch (B) {
1361
+ console.error("Error parsing spkvideo JSON", B);
1362
+ }
1363
+ const ue = fe(K == null ? void 0 : K.thumbnail_url) || fe((N = (G = (F = (O = h.json_metadata) == null ? void 0 : O.raw) == null ? void 0 : F.video) == null ? void 0 : G.info) == null ? void 0 : N.thumbnail), ge = (K == null ? void 0 : K.duration) || ((I = (U = (V = (L = h.json_metadata) == null ? void 0 : L.raw) == null ? void 0 : V.video) == null ? void 0 : U.info) == null ? void 0 : I.duration) || 0;
1364
+ return {
1365
+ title: h.title || "Untitled",
1366
+ author: h.author.username,
1367
+ permlink: h.permlink,
1368
+ created: new Date(h.created_at),
1369
+ category: h.tags && h.tags.length > 0 ? h.tags[0] : "general",
1370
+ duration: ge,
1371
+ thumbnail: ue,
1372
+ numOfUpvotes: ((q = h.stats) == null ? void 0 : q.num_votes) || h.numOfUpvotes,
1373
+ numOfComments: ((J = h.stats) == null ? void 0 : J.num_comments) || h.numOfComments,
1374
+ hiveValue: ((ne = h.stats) == null ? void 0 : ne.total_hive_reward) || h.hiveValue
1375
+ };
1376
+ }
1377
+ return h.owner ? {
1378
+ title: h.title || "Untitled",
1379
+ author: h.owner,
1380
+ permlink: h.permlink || "",
1381
+ created: new Date(h.created || Date.now()),
1382
+ category: h.category || "general",
1383
+ duration: h.duration,
1384
+ thumbnail: fe(h.thumbnail),
1385
+ // Use stats from GraphQL if available
1386
+ numOfUpvotes: h.numOfUpvotes,
1387
+ numOfComments: h.numOfComments,
1388
+ hiveValue: h.hiveValue
1389
+ } : null;
1390
+ },
1391
+ []
1392
+ ), _ = je(
1393
+ async (h, $ = !1) => {
1394
+ try {
1395
+ let O = [];
1396
+ switch (t) {
1397
+ case Q.SEARCH:
1398
+ a && (O = await Z.getSearchFeed(a, h));
1399
+ break;
1400
+ case Q.TAG_FEED:
1401
+ a && (O = await Z.getTaggedVideos(a, h));
1402
+ break;
1403
+ case Q.HOME:
1404
+ O = await Z.getHomeVideos(h);
1405
+ break;
1406
+ case Q.TRENDING:
1407
+ O = await Z.getTrendingVideos(h);
1408
+ break;
1409
+ case Q.NEW_VIDEOS:
1410
+ O = await Z.getNewVideos(h);
1411
+ break;
1412
+ case Q.FIRST_UPLOADS:
1413
+ O = await Z.getFirstUploadsVideos(h);
1414
+ break;
1415
+ case Q.USER:
1416
+ s && (O = await Z.getUserVideos(s, h));
1417
+ break;
1418
+ case Q.COMMUNITY:
1419
+ r && (O = await Z.getCommunityVideos(
1420
+ r,
1421
+ h
1422
+ ));
1423
+ break;
1424
+ case Q.RELATED:
1425
+ s && (O = await Z.getRelatedVideos(
1426
+ s,
1427
+ h
1428
+ ));
1429
+ break;
1430
+ }
1431
+ const G = (await Promise.all(
1432
+ O.map(M)
1433
+ )).filter(
1434
+ (N) => N !== null
1435
+ );
1436
+ $ ? (u(G), Fe.set(b, G)) : u((N) => {
1437
+ const L = [...N, ...G];
1438
+ return Fe.set(b, L), L;
1439
+ }), T(O.length >= 20), j(h + O.length), w(null);
1440
+ } catch (O) {
1441
+ w(O instanceof Error ? O.message : "Failed to load videos");
1442
+ }
1443
+ },
1444
+ [t, s, r, a, b, M]
1445
+ );
1446
+ H(() => {
1447
+ (async () => {
1448
+ m(!0), u([]), j(0);
1449
+ const $ = Fe.get(b);
1450
+ $ != null && $.length && (u($), m(!1)), await _(0, !0), m(!1);
1451
+ })();
1452
+ }, [b, _]);
1453
+ const E = je(async () => {
1454
+ l || !k || (x(!0), await _(f), x(!1));
1455
+ }, [l, k, f, _]), C = je(async () => {
1456
+ Fe.delete(b), m(!0), j(0), await _(0, !0), m(!1);
1457
+ }, [b, _]);
1458
+ H(() => {
1459
+ const h = () => {
1460
+ window.innerHeight + document.documentElement.scrollTop >= document.documentElement.offsetHeight - 1e3 && E();
1461
+ };
1462
+ return window.addEventListener("scroll", h), () => window.removeEventListener("scroll", h);
1463
+ }, [E]);
1464
+ const Y = () => /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6", children: Array.from({ length: 8 }).map((h, $) => /* @__PURE__ */ e.jsxs(
1465
+ "div",
1466
+ {
1467
+ className: "bg-card border border-border rounded-xl overflow-hidden animate-pulse",
1468
+ children: [
1469
+ /* @__PURE__ */ e.jsx("div", { className: "aspect-video bg-muted" }),
1470
+ /* @__PURE__ */ e.jsxs("div", { className: "p-4 space-y-3", children: [
1471
+ /* @__PURE__ */ e.jsx("div", { className: "h-4 bg-muted rounded w-3/4" }),
1472
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1473
+ /* @__PURE__ */ e.jsx("div", { className: "w-8 h-8 bg-muted rounded-full" }),
1474
+ /* @__PURE__ */ e.jsx("div", { className: "h-3 bg-muted rounded w-20" })
1475
+ ] }),
1476
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between", children: [
1477
+ /* @__PURE__ */ e.jsx("div", { className: "h-3 bg-muted rounded w-16" }),
1478
+ /* @__PURE__ */ e.jsx("div", { className: "h-3 bg-muted rounded w-12" })
1479
+ ] })
1480
+ ] })
1481
+ ]
1482
+ },
1483
+ $
1484
+ )) });
1485
+ return c && i.length === 0 ? /* @__PURE__ */ e.jsx(Y, {}) : v && i.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
1486
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-card-foreground mb-2", children: "Failed to load videos" }),
1487
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground mb-4", children: v }),
1488
+ /* @__PURE__ */ e.jsxs(
1489
+ "button",
1490
+ {
1491
+ onClick: C,
1492
+ className: "inline-flex items-center justify-center rounded-md border border-border bg-card px-4 py-2 text-sm font-medium text-card-foreground shadow-sm transition-colors hover:bg-card-hover focus:outline-none focus:ring-2 focus:ring-primary",
1493
+ children: [
1494
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
1495
+ "Try Again"
1496
+ ]
1497
+ }
1498
+ )
1499
+ ] }) }) : i.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
1500
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-card-foreground mb-2", children: "No videos found" }),
1501
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground mb-4", children: "Check back later for new content" }),
1502
+ /* @__PURE__ */ e.jsxs(
1503
+ "button",
1504
+ {
1505
+ onClick: C,
1506
+ className: "inline-flex items-center justify-center rounded-md border border-border bg-card px-4 py-2 text-sm font-medium text-card-foreground shadow-sm transition-colors hover:bg-card-hover focus:outline-none focus:ring-2 focus:ring-primary",
1507
+ children: [
1508
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
1509
+ "Refresh"
1510
+ ]
1511
+ }
1512
+ )
1513
+ ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
1514
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center", children: [
1515
+ /* @__PURE__ */ e.jsxs("h2", { className: "text-2xl font-bold text-card-foreground capitalize", children: [
1516
+ t.replace(/([A-Z])/g, " $1").toLowerCase(),
1517
+ " Videos"
1518
+ ] }),
1519
+ /* @__PURE__ */ e.jsxs(
1520
+ "button",
1521
+ {
1522
+ onClick: C,
1523
+ className: "inline-flex items-center justify-center rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-card-foreground shadow-sm transition-colors hover:bg-card-hover focus:outline-none focus:ring-2 focus:ring-primary",
1524
+ children: [
1525
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
1526
+ "Refresh"
1527
+ ]
1528
+ }
1529
+ )
1530
+ ] }),
1531
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6", children: i.map((h, $) => /* @__PURE__ */ e.jsx(
1532
+ Tr,
1533
+ {
1534
+ video: h,
1535
+ onVideoClick: o,
1536
+ onAuthorClick: d,
1537
+ isGrid: !0
1538
+ },
1539
+ `${h.author}-${h.permlink}-${$}`
1540
+ )) }),
1541
+ k && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center pt-8", children: l ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
1542
+ /* @__PURE__ */ e.jsx(ae, { className: "w-4 h-4 animate-spin" }),
1543
+ "Loading more videos..."
1544
+ ] }) : /* @__PURE__ */ e.jsx(
1545
+ "button",
1546
+ {
1547
+ onClick: E,
1548
+ className: "inline-flex items-center justify-center rounded-md border border-border bg-card px-4 py-2 text-sm font-medium text-card-foreground shadow-sm transition-colors hover:bg-card-hover focus:outline-none focus:ring-2 focus:ring-primary",
1549
+ children: "Load More Videos"
1550
+ }
1551
+ ) })
1552
+ ] });
1553
+ }, it = ({ isOpen: t, onClose: s, title: r, children: a, maxWidth: o = "max-w-2xl" }) => t ? /* @__PURE__ */ e.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
1554
+ /* @__PURE__ */ e.jsx(
1555
+ "div",
1556
+ {
1557
+ className: "absolute inset-0 bg-black/60 backdrop-blur-sm",
1558
+ onClick: s
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ e.jsxs("div", { className: `relative bg-card border border-border rounded-xl shadow-xl w-full mx-4 ${o} max-h-[90vh] overflow-hidden animate-scale-in`, children: [
1562
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-6 border-b border-border", children: [
1563
+ /* @__PURE__ */ e.jsx("h2", { className: "text-xl font-bold text-card-foreground", children: r }),
1564
+ /* @__PURE__ */ e.jsx(
1565
+ "button",
1566
+ {
1567
+ onClick: s,
1568
+ className: "p-2 rounded-lg hover:bg-muted transition-colors",
1569
+ children: /* @__PURE__ */ e.jsx(xr, { className: "w-5 h-5 text-muted-foreground" })
1570
+ }
1571
+ )
1572
+ ] }),
1573
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-y-auto max-h-[calc(90vh-80px)] custom-scrollbar", children: a })
1574
+ ] })
1575
+ ] }) : null, $r = ({ author: t, permlink: s, currentUser: r, onClose: a }) => {
1576
+ const [o, d] = p([]), [i, u] = p(!0), [c, m] = p(null), [l, x] = p(""), [v, w] = p(!1);
1577
+ H(() => {
1578
+ (async () => {
1579
+ try {
1580
+ u(!0);
1581
+ const b = (await Z.getCommentsList(t, s)).filter((M) => M.depth && M.depth > 0).sort((M, _) => new Date(_.created || 0).getTime() - new Date(M.created || 0).getTime());
1582
+ d(b);
1583
+ } catch (j) {
1584
+ m(j instanceof Error ? j.message : "Failed to load comments");
1585
+ } finally {
1586
+ u(!1);
1587
+ }
1588
+ })();
1589
+ }, [t, s]);
1590
+ const k = async () => {
1591
+ if (!(!l.trim() || !r))
1592
+ try {
1593
+ w(!0), console.log("Would submit comment:", l), x("");
1594
+ } catch (f) {
1595
+ console.error("Failed to submit comment:", f);
1596
+ } finally {
1597
+ w(!1);
1598
+ }
1599
+ }, T = (f) => {
1600
+ const j = Math.min(f.depth || 0, 5);
1601
+ return /* @__PURE__ */ e.jsx(
1602
+ "div",
1603
+ {
1604
+ className: `border-l-2 border-border ${j > 0 ? `ml-${j * 4}` : ""}`,
1605
+ children: /* @__PURE__ */ e.jsxs("div", { className: "p-4 bg-muted/30 rounded-r-lg", children: [
1606
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
1607
+ /* @__PURE__ */ e.jsx(
1608
+ "img",
1609
+ {
1610
+ src: `https://images.hive.blog/u/${f.author}/avatar`,
1611
+ alt: f.author,
1612
+ className: "w-6 h-6 rounded-full object-cover border border-border",
1613
+ onError: (b) => {
1614
+ b.target.src = `https://ui-avatars.com/api/?name=${f.author}&background=random`;
1615
+ }
1616
+ }
1617
+ ),
1618
+ /* @__PURE__ */ e.jsxs("span", { className: "font-medium text-card-foreground text-sm", children: [
1619
+ "@",
1620
+ f.author
1621
+ ] }),
1622
+ f.created && /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: nt(new Date(f.created), { addSuffix: !0 }) })
1623
+ ] }),
1624
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-card-foreground leading-relaxed", children: f.body || "No content" }),
1625
+ f.net_votes && f.net_votes > 0 && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1 mt-2", children: /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
1626
+ f.net_votes,
1627
+ " votes"
1628
+ ] }) })
1629
+ ] })
1630
+ },
1631
+ `${f.author}-${f.permlink}`
1632
+ );
1633
+ };
1634
+ return /* @__PURE__ */ e.jsx(
1635
+ it,
1636
+ {
1637
+ isOpen: !0,
1638
+ onClose: a,
1639
+ title: `Comments (${o.length})`,
1640
+ maxWidth: "max-w-2xl",
1641
+ children: /* @__PURE__ */ e.jsxs("div", { className: "p-6", children: [
1642
+ r && /* @__PURE__ */ e.jsx("div", { className: "mb-6 p-4 bg-muted/50 rounded-lg", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3", children: [
1643
+ /* @__PURE__ */ e.jsx(
1644
+ "img",
1645
+ {
1646
+ src: `https://images.hive.blog/u/${r}/avatar`,
1647
+ alt: r,
1648
+ className: "w-8 h-8 rounded-full object-cover border border-border"
1649
+ }
1650
+ ),
1651
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1", children: [
1652
+ /* @__PURE__ */ e.jsx(
1653
+ "textarea",
1654
+ {
1655
+ value: l,
1656
+ onChange: (f) => x(f.target.value),
1657
+ placeholder: "Write a comment...",
1658
+ className: "w-full p-3 bg-background border border-border rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-primary",
1659
+ rows: 3
1660
+ }
1661
+ ),
1662
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end mt-2", children: /* @__PURE__ */ e.jsxs(
1663
+ "button",
1664
+ {
1665
+ onClick: k,
1666
+ disabled: !l.trim() || v,
1667
+ className: "inline-flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
1668
+ children: [
1669
+ v ? /* @__PURE__ */ e.jsx(ae, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ e.jsx(fr, { className: "w-4 h-4" }),
1670
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: v ? "Posting..." : "Post Comment" })
1671
+ ]
1672
+ }
1673
+ ) })
1674
+ ] })
1675
+ ] }) }),
1676
+ i ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
1677
+ /* @__PURE__ */ e.jsx(ae, { className: "w-6 h-6 animate-spin text-primary" }),
1678
+ /* @__PURE__ */ e.jsx("span", { className: "ml-2 text-muted-foreground", children: "Loading comments..." })
1679
+ ] }) : c ? /* @__PURE__ */ e.jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ e.jsx("p", { className: "text-error", children: c }) }) : o.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "text-center py-8", children: [
1680
+ /* @__PURE__ */ e.jsx(rt, { className: "w-12 h-12 text-muted-foreground mx-auto mb-2" }),
1681
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: "No comments yet" }),
1682
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Be the first to share your thoughts!" })
1683
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-4", children: o.map(T) })
1684
+ ] })
1685
+ }
1686
+ );
1687
+ }, Fr = ({ author: t, permlink: s, onClose: r }) => {
1688
+ const [a, o] = p([]), [d, i] = p(!0), [u, c] = p(null);
1689
+ H(() => {
1690
+ (async () => {
1691
+ try {
1692
+ i(!0);
1693
+ const v = (await Z.getActiveVotes(t, s)).sort((w, k) => k.rshares - w.rshares);
1694
+ o(v);
1695
+ } catch (x) {
1696
+ c(x instanceof Error ? x.message : "Failed to load votes");
1697
+ } finally {
1698
+ i(!1);
1699
+ }
1700
+ })();
1701
+ }, [t, s]);
1702
+ const m = (l) => l >= 1e9 ? `${(l / 1e9).toFixed(1)}B` : l >= 1e6 ? `${(l / 1e6).toFixed(1)}M` : l >= 1e3 ? `${(l / 1e3).toFixed(1)}K` : l.toString();
1703
+ return /* @__PURE__ */ e.jsx(
1704
+ it,
1705
+ {
1706
+ isOpen: !0,
1707
+ onClose: r,
1708
+ title: `Votes (${a.length})`,
1709
+ maxWidth: "max-w-md",
1710
+ children: /* @__PURE__ */ e.jsx("div", { className: "p-6", children: d ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
1711
+ /* @__PURE__ */ e.jsx(ae, { className: "w-6 h-6 animate-spin text-primary" }),
1712
+ /* @__PURE__ */ e.jsx("span", { className: "ml-2 text-muted-foreground", children: "Loading votes..." })
1713
+ ] }) : u ? /* @__PURE__ */ e.jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ e.jsx("p", { className: "text-error", children: u }) }) : a.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "text-center py-8", children: [
1714
+ /* @__PURE__ */ e.jsx(tt, { className: "w-12 h-12 text-muted-foreground mx-auto mb-2" }),
1715
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: "No votes yet" })
1716
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: a.map((l, x) => /* @__PURE__ */ e.jsxs(
1717
+ "div",
1718
+ {
1719
+ className: "flex items-center justify-between p-3 rounded-lg bg-muted/50 hover:bg-muted transition-colors",
1720
+ children: [
1721
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
1722
+ /* @__PURE__ */ e.jsx(
1723
+ "img",
1724
+ {
1725
+ src: `https://images.hive.blog/u/${l.voter}/avatar`,
1726
+ alt: l.voter,
1727
+ className: "w-8 h-8 rounded-full object-cover border border-border",
1728
+ onError: (v) => {
1729
+ v.target.src = `https://ui-avatars.com/api/?name=${l.voter}&background=random`;
1730
+ }
1731
+ }
1732
+ ),
1733
+ /* @__PURE__ */ e.jsxs("div", { children: [
1734
+ /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-card-foreground", children: [
1735
+ "@",
1736
+ l.voter
1737
+ ] }),
1738
+ l.time && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: new Date(l.time).toLocaleDateString() })
1739
+ ] })
1740
+ ] }),
1741
+ /* @__PURE__ */ e.jsxs("div", { className: "text-right", children: [
1742
+ l.percent && /* @__PURE__ */ e.jsxs("div", { className: "text-sm font-medium text-primary", children: [
1743
+ (l.percent / 100).toFixed(1),
1744
+ "%"
1745
+ ] }),
1746
+ /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-muted-foreground", children: [
1747
+ m(l.rshares),
1748
+ " rshares"
1749
+ ] })
1750
+ ] })
1751
+ ]
1752
+ },
1753
+ `${l.voter}-${x}`
1754
+ )) }) })
1755
+ }
1756
+ );
1757
+ }, Lr = ({ author: t, permlink: s, content: r, onClose: a }) => /* @__PURE__ */ e.jsx(
1758
+ it,
1759
+ {
1760
+ isOpen: !0,
1761
+ onClose: a,
1762
+ title: "Video Description",
1763
+ maxWidth: "max-w-2xl",
1764
+ children: /* @__PURE__ */ e.jsxs("div", { className: "p-6", children: [
1765
+ r ? /* @__PURE__ */ e.jsx("div", { className: "prose prose-sm max-w-none", children: /* @__PURE__ */ e.jsx("div", { className: "bg-muted/30 rounded-lg p-4", children: /* @__PURE__ */ e.jsx("pre", { className: "whitespace-pre-wrap text-sm text-card-foreground font-sans leading-relaxed", children: r }) }) }) : /* @__PURE__ */ e.jsxs("div", { className: "text-center py-8", children: [
1766
+ /* @__PURE__ */ e.jsx(pr, { className: "w-12 h-12 text-muted-foreground mx-auto mb-2" }),
1767
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: "No description available" }),
1768
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "This video doesn't have a description yet." })
1769
+ ] }),
1770
+ /* @__PURE__ */ e.jsx("div", { className: "mt-6 pt-4 border-t border-border", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
1771
+ /* @__PURE__ */ e.jsxs("span", { children: [
1772
+ "By @",
1773
+ t
1774
+ ] }),
1775
+ /* @__PURE__ */ e.jsx("span", { children: "•" }),
1776
+ /* @__PURE__ */ e.jsxs("span", { children: [
1777
+ "/",
1778
+ s
1779
+ ] })
1780
+ ] }) })
1781
+ ] })
1782
+ }
1783
+ ), bs = () => {
1784
+ const { author: t, permlink: s } = kr(), r = Ie(), [a, o] = p(null), [d, i] = p(!0), [u, c] = p(null), [m, l] = p(!1), [x, v] = p(null), [w, k] = p(!1), [T, f] = p(!1), [j, b] = p(!1), [M, _] = p(!1), E = Le(null), C = Le(null), Y = Le(null);
1785
+ H(() => {
1786
+ (async () => {
1787
+ if (!(!t || !s))
1788
+ try {
1789
+ i(!0), c(null);
1790
+ const L = await Z.getVideoDetails(t, s);
1791
+ o(L), l(!1), v(null);
1792
+ } catch (L) {
1793
+ c(L instanceof Error ? L.message : "Failed to load video");
1794
+ } finally {
1795
+ i(!1);
1796
+ }
1797
+ })();
1798
+ }, [t, s]);
1799
+ const h = (N) => N ? N.startsWith("ipfs://") ? `https://ipfs-3speak.b-cdn.net/ipfs/${N.replace("ipfs://", "").split("/")[0]}/manifest.m3u8` : N : "";
1800
+ H(() => ((async () => {
1801
+ const L = a == null ? void 0 : a.video_v2;
1802
+ if (!m || !L || !E.current) return;
1803
+ const V = E.current, U = h(L);
1804
+ C.current && (C.current.destroy(), C.current = null), V.src = "", V.load();
1805
+ try {
1806
+ let I = !1;
1807
+ const q = () => {
1808
+ I || (I = !0, V.play().then(() => v(null)).catch((B) => v(`Playback failed: ${B.message}`)));
1809
+ };
1810
+ if (ve.isSupported()) {
1811
+ const B = new ve({
1812
+ debug: !1,
1813
+ enableWorker: !1,
1814
+ lowLatencyMode: !1,
1815
+ backBufferLength: 90,
1816
+ maxLoadingDelay: 4,
1817
+ maxBufferLength: 30,
1818
+ maxMaxBufferLength: 600,
1819
+ startLevel: -1
1820
+ });
1821
+ C.current = B, B.on(ve.Events.MANIFEST_PARSED, () => {
1822
+ }), B.on(ve.Events.ERROR, (oe, te) => {
1823
+ if (te.fatal)
1824
+ switch (te.type) {
1825
+ case ve.ErrorTypes.NETWORK_ERROR:
1826
+ v("Network error, retrying..."), setTimeout(() => B.startLoad(), 1e3);
1827
+ break;
1828
+ case ve.ErrorTypes.MEDIA_ERROR:
1829
+ v("Media error, retrying..."), setTimeout(() => B.recoverMediaError(), 1e3);
1830
+ break;
1831
+ default:
1832
+ v(`Fatal error: ${te.details}`), B.destroy(), C.current = null;
1833
+ break;
1834
+ }
1835
+ }), B.attachMedia(V), B.loadSource(U);
1836
+ } else if (V.canPlayType("application/vnd.apple.mpegurl"))
1837
+ V.src = U;
1838
+ else {
1839
+ const B = U.replace(
1840
+ "/manifest.m3u8",
1841
+ "/480p/index.m3u8"
1842
+ );
1843
+ V.src = B;
1844
+ }
1845
+ const J = () => k(!0), ne = () => {
1846
+ k(!1), q();
1847
+ }, K = (B) => {
1848
+ var te;
1849
+ const oe = B.target;
1850
+ v(
1851
+ `Video error: ${((te = oe.error) == null ? void 0 : te.message) || "Unknown error"}`
1852
+ ), k(!1);
1853
+ }, ue = () => k(!1);
1854
+ V.addEventListener("loadstart", J), V.addEventListener("canplay", ne), V.addEventListener("error", K), V.addEventListener("loadeddata", ue);
1855
+ const ge = async () => {
1856
+ var oe, te, de, he;
1857
+ const B = !!document.fullscreenElement;
1858
+ try {
1859
+ B ? "orientation" in screen && await (((te = (oe = screen.orientation) == null ? void 0 : oe.lock) == null ? void 0 : te.call(oe, "landscape")) ?? Promise.resolve()) : "orientation" in screen && ((he = (de = screen.orientation) == null ? void 0 : de.unlock) == null || he.call(de));
1860
+ } catch {
1861
+ }
1862
+ };
1863
+ return document.addEventListener("fullscreenchange", ge), Y.current = () => {
1864
+ document.removeEventListener("fullscreenchange", ge);
1865
+ }, () => {
1866
+ V.removeEventListener("loadstart", J), V.removeEventListener("canplay", ne), V.removeEventListener("error", K), V.removeEventListener("loadeddata", ue), Y.current && Y.current();
1867
+ };
1868
+ } catch (I) {
1869
+ v(
1870
+ `Setup error: ${I instanceof Error ? I.message : "Unknown"}`
1871
+ );
1872
+ }
1873
+ })(), () => {
1874
+ C.current && (C.current.destroy(), C.current = null);
1875
+ }), [m, a == null ? void 0 : a.video_v2]);
1876
+ const $ = () => {
1877
+ if (!(a == null ? void 0 : a.video_v2)) {
1878
+ v("No video source available");
1879
+ return;
1880
+ }
1881
+ l(!0), v(null), k(!0);
1882
+ }, O = (N) => {
1883
+ r(`/video/${N.author}/${N.permlink}`);
1884
+ }, F = (N) => {
1885
+ r(`/user/${N}`);
1886
+ }, G = (N) => {
1887
+ if (!N) return "00:00";
1888
+ const L = Math.floor(N), V = Math.floor(L / 3600), U = Math.floor(L % 3600 / 60), I = L % 60, q = (J) => J.toString().padStart(2, "0");
1889
+ return L < 60 ? `00:${q(I)}` : V === 0 ? `${q(U)}:${q(I)}` : `${q(V)}:${q(U)}:${q(I)}`;
1890
+ };
1891
+ return d ? /* @__PURE__ */ e.jsxs("div", { className: "min-h-screen bg-background", children: [
1892
+ /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-50 w-full bg-background border-b border-border", children: /* @__PURE__ */ e.jsx("div", { className: "container mx-auto px-4 py-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-8 w-24 bg-muted rounded-full animate-pulse" }) }) }),
1893
+ /* @__PURE__ */ e.jsx("div", { className: "container mx-auto px-4 py-8 max-w-6xl", children: /* @__PURE__ */ e.jsxs("div", { className: "animate-pulse space-y-6", children: [
1894
+ /* @__PURE__ */ e.jsx("div", { className: "aspect-video bg-muted rounded-xl" }),
1895
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
1896
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 bg-muted rounded w-3/4" }),
1897
+ /* @__PURE__ */ e.jsx("div", { className: "h-4 bg-muted rounded w-1/2" })
1898
+ ] })
1899
+ ] }) })
1900
+ ] }) : u || !a ? /* @__PURE__ */ e.jsx("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center max-w-md mx-auto px-4", children: [
1901
+ /* @__PURE__ */ e.jsx("h2", { className: "text-xl font-semibold text-card-foreground mb-2", children: "Failed to Load Video" }),
1902
+ /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground mb-4", children: u || "Video not found" }),
1903
+ /* @__PURE__ */ e.jsxs(
1904
+ "button",
1905
+ {
1906
+ onClick: () => r(-1),
1907
+ className: "inline-flex items-center gap-2 px-4 py-2 bg-card border border-border text-card-foreground rounded-lg hover:bg-card-hover transition-colors",
1908
+ children: [
1909
+ /* @__PURE__ */ e.jsx(Ce, { className: "w-4 h-4" }),
1910
+ "Go Back"
1911
+ ]
1912
+ }
1913
+ )
1914
+ ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "min-h-screen bg-background", children: [
1915
+ /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-50 w-full bg-background/95 backdrop-blur-sm border-b border-border", children: /* @__PURE__ */ e.jsx("div", { className: "container mx-auto px-4 py-3", children: /* @__PURE__ */ e.jsxs(
1916
+ "button",
1917
+ {
1918
+ onClick: () => r(-1),
1919
+ className: "inline-flex items-center gap-2 text-muted-foreground hover:text-card-foreground transition-colors",
1920
+ children: [
1921
+ /* @__PURE__ */ e.jsx(Ce, { className: "w-4 h-4" }),
1922
+ "Back"
1923
+ ]
1924
+ }
1925
+ ) }) }),
1926
+ /* @__PURE__ */ e.jsx("div", { className: "container mx-auto px-4 py-8 max-w-6xl", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-8", children: [
1927
+ /* @__PURE__ */ e.jsxs("div", { className: "lg:col-span-2 space-y-6", children: [
1928
+ /* @__PURE__ */ e.jsx("div", { className: "w-full aspect-video bg-black rounded-xl overflow-hidden relative shadow-card", children: m ? /* @__PURE__ */ e.jsxs("div", { className: "relative w-full h-full", children: [
1929
+ /* @__PURE__ */ e.jsx(
1930
+ "video",
1931
+ {
1932
+ ref: E,
1933
+ controls: !0,
1934
+ poster: fe(a.thumbnail),
1935
+ className: "w-full h-full object-contain bg-black",
1936
+ onDoubleClick: async (N) => {
1937
+ const L = N.currentTarget;
1938
+ try {
1939
+ document.fullscreenElement ? await document.exitFullscreen() : await L.requestFullscreen();
1940
+ } catch {
1941
+ }
1942
+ }
1943
+ }
1944
+ ),
1945
+ w && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-primary" }) }),
1946
+ x && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/80", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center text-white", children: [
1947
+ /* @__PURE__ */ e.jsx("p", { className: "mb-4", children: x }),
1948
+ /* @__PURE__ */ e.jsx(
1949
+ "button",
1950
+ {
1951
+ onClick: () => {
1952
+ l(!1), v(null);
1953
+ },
1954
+ className: "px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary-hover transition-colors",
1955
+ children: "Try Again"
1956
+ }
1957
+ )
1958
+ ] }) })
1959
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1960
+ /* @__PURE__ */ e.jsx(
1961
+ "img",
1962
+ {
1963
+ src: fe(a.thumbnail) || `https://images.hive.blog/u/${a.owner}/avatar`,
1964
+ alt: a.title,
1965
+ className: "w-full h-full object-cover",
1966
+ onError: (N) => {
1967
+ N.target.src = `https://images.hive.blog/u/${a.owner}/avatar`;
1968
+ }
1969
+ }
1970
+ ),
1971
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-gradient-overlay opacity-30" }),
1972
+ /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e.jsx(
1973
+ "button",
1974
+ {
1975
+ onClick: $,
1976
+ className: "bg-primary hover:bg-primary-hover rounded-full p-6 transform hover:scale-110 transition-all duration-300 shadow-lg",
1977
+ children: /* @__PURE__ */ e.jsx(et, { className: "w-8 h-8 text-primary-foreground ml-1", fill: "currentColor" })
1978
+ }
1979
+ ) }),
1980
+ a.duration && /* @__PURE__ */ e.jsxs("div", { className: "absolute bottom-4 right-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm", children: [
1981
+ /* @__PURE__ */ e.jsx(Ft, { className: "w-3 h-3" }),
1982
+ G(a.duration)
1983
+ ] }),
1984
+ a.views && /* @__PURE__ */ e.jsxs("div", { className: "absolute bottom-4 left-4 bg-black/80 text-white text-sm px-3 py-1 rounded-md flex items-center gap-1 backdrop-blur-sm", children: [
1985
+ /* @__PURE__ */ e.jsx(Lt, { className: "w-3 h-3" }),
1986
+ a.views.toLocaleString(),
1987
+ " views"
1988
+ ] })
1989
+ ] }) }),
1990
+ /* @__PURE__ */ e.jsx(
1991
+ Or,
1992
+ {
1993
+ title: a.title || "",
1994
+ author: a.owner || "",
1995
+ permlink: a.permlink || "",
1996
+ createdAt: a.created,
1997
+ description: a.description || "",
1998
+ video: {
1999
+ title: a.title || "",
2000
+ author: a.owner || "",
2001
+ permlink: a.permlink || "",
2002
+ created: a.created || /* @__PURE__ */ new Date(),
2003
+ category: a.category || "",
2004
+ numOfUpvotes: void 0,
2005
+ numOfComments: void 0,
2006
+ hiveValue: void 0,
2007
+ duration: a.duration,
2008
+ thumbnail: a.thumbnail,
2009
+ views: a.views
2010
+ },
2011
+ onTapComment: () => f(!0),
2012
+ onTapUpvote: () => b(!0),
2013
+ onTapInfo: () => _(!0),
2014
+ onTapAuthor: () => r(`/user/${a.owner}`)
2015
+ }
2016
+ ),
2017
+ a.tags && /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: a.tags.split(",").map((N, L) => /* @__PURE__ */ e.jsxs(
2018
+ "span",
2019
+ {
2020
+ className: "bg-primary/10 text-primary px-3 py-1 rounded-full text-sm font-medium hover:bg-primary/20 transition-colors cursor-pointer",
2021
+ onClick: () => r(`/tag/${N.trim()}`),
2022
+ children: [
2023
+ "#",
2024
+ N.trim()
2025
+ ]
2026
+ },
2027
+ L
2028
+ )) })
2029
+ ] }),
2030
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-card border border-border rounded-xl p-6 sticky top-24", children: [
2031
+ /* @__PURE__ */ e.jsx("h3", { className: "font-semibold text-card-foreground mb-4 text-lg", children: "Related Videos" }),
2032
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ e.jsx(
2033
+ ot,
2034
+ {
2035
+ feedType: Q.RELATED,
2036
+ username: a.owner,
2037
+ onVideoClick: O,
2038
+ onAuthorClick: F
2039
+ }
2040
+ ) })
2041
+ ] })
2042
+ ] }) }),
2043
+ T && t && s && /* @__PURE__ */ e.jsx(
2044
+ $r,
2045
+ {
2046
+ author: t,
2047
+ permlink: s,
2048
+ onClose: () => f(!1)
2049
+ }
2050
+ ),
2051
+ j && t && s && /* @__PURE__ */ e.jsx(
2052
+ Fr,
2053
+ {
2054
+ author: t,
2055
+ permlink: s,
2056
+ onClose: () => b(!1)
2057
+ }
2058
+ ),
2059
+ M && t && s && /* @__PURE__ */ e.jsx(
2060
+ Lr,
2061
+ {
2062
+ author: t,
2063
+ permlink: s,
2064
+ content: a.description || "",
2065
+ onClose: () => _(!1)
2066
+ }
2067
+ )
2068
+ ] });
2069
+ };
2070
+ var At = {
2071
+ color: void 0,
2072
+ size: void 0,
2073
+ className: void 0,
2074
+ style: void 0,
2075
+ attr: void 0
2076
+ }, Tt = le.createContext && /* @__PURE__ */ le.createContext(At), Rr = ["attr", "size", "title"];
2077
+ function Pr(t, s) {
2078
+ if (t == null) return {};
2079
+ var r = Vr(t, s), a, o;
2080
+ if (Object.getOwnPropertySymbols) {
2081
+ var d = Object.getOwnPropertySymbols(t);
2082
+ for (o = 0; o < d.length; o++)
2083
+ a = d[o], !(s.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(t, a) && (r[a] = t[a]);
2084
+ }
2085
+ return r;
2086
+ }
2087
+ function Vr(t, s) {
2088
+ if (t == null) return {};
2089
+ var r = {};
2090
+ for (var a in t)
2091
+ if (Object.prototype.hasOwnProperty.call(t, a)) {
2092
+ if (s.indexOf(a) >= 0) continue;
2093
+ r[a] = t[a];
2094
+ }
2095
+ return r;
2096
+ }
2097
+ function Me() {
2098
+ return Me = Object.assign ? Object.assign.bind() : function(t) {
2099
+ for (var s = 1; s < arguments.length; s++) {
2100
+ var r = arguments[s];
2101
+ for (var a in r)
2102
+ Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
2103
+ }
2104
+ return t;
2105
+ }, Me.apply(this, arguments);
2106
+ }
2107
+ function Ot(t, s) {
2108
+ var r = Object.keys(t);
2109
+ if (Object.getOwnPropertySymbols) {
2110
+ var a = Object.getOwnPropertySymbols(t);
2111
+ s && (a = a.filter(function(o) {
2112
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
2113
+ })), r.push.apply(r, a);
2114
+ }
2115
+ return r;
2116
+ }
2117
+ function Ue(t) {
2118
+ for (var s = 1; s < arguments.length; s++) {
2119
+ var r = arguments[s] != null ? arguments[s] : {};
2120
+ s % 2 ? Ot(Object(r), !0).forEach(function(a) {
2121
+ Ar(t, a, r[a]);
2122
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ot(Object(r)).forEach(function(a) {
2123
+ Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(r, a));
2124
+ });
2125
+ }
2126
+ return t;
2127
+ }
2128
+ function Ar(t, s, r) {
2129
+ return s = Dr(s), s in t ? Object.defineProperty(t, s, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[s] = r, t;
2130
+ }
2131
+ function Dr(t) {
2132
+ var s = Mr(t, "string");
2133
+ return typeof s == "symbol" ? s : s + "";
2134
+ }
2135
+ function Mr(t, s) {
2136
+ if (typeof t != "object" || !t) return t;
2137
+ var r = t[Symbol.toPrimitive];
2138
+ if (r !== void 0) {
2139
+ var a = r.call(t, s);
2140
+ if (typeof a != "object") return a;
2141
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2142
+ }
2143
+ return (s === "string" ? String : Number)(t);
2144
+ }
2145
+ function Dt(t) {
2146
+ return t && t.map((s, r) => /* @__PURE__ */ le.createElement(s.tag, Ue({
2147
+ key: r
2148
+ }, s.attr), Dt(s.child)));
2149
+ }
2150
+ function we(t) {
2151
+ return (s) => /* @__PURE__ */ le.createElement(Ur, Me({
2152
+ attr: Ue({}, t.attr)
2153
+ }, s), Dt(t.child));
2154
+ }
2155
+ function Ur(t) {
2156
+ var s = (r) => {
2157
+ var {
2158
+ attr: a,
2159
+ size: o,
2160
+ title: d
2161
+ } = t, i = Pr(t, Rr), u = o || r.size || "1em", c;
2162
+ return r.className && (c = r.className), t.className && (c = (c ? c + " " : "") + t.className), /* @__PURE__ */ le.createElement("svg", Me({
2163
+ stroke: "currentColor",
2164
+ fill: "currentColor",
2165
+ strokeWidth: "0"
2166
+ }, r.attr, a, i, {
2167
+ className: c,
2168
+ style: Ue(Ue({
2169
+ color: t.color || r.color
2170
+ }, r.style), t.style),
2171
+ height: u,
2172
+ width: u,
2173
+ xmlns: "http://www.w3.org/2000/svg"
2174
+ }), d && /* @__PURE__ */ le.createElement("title", null, d), t.children);
2175
+ };
2176
+ return Tt !== void 0 ? /* @__PURE__ */ le.createElement(Tt.Consumer, null, (r) => s(r)) : s(At);
2177
+ }
2178
+ function Ir(t) {
2179
+ return we({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z" }, child: [] }] })(t);
2180
+ }
2181
+ function Hr(t) {
2182
+ return we({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 405.3V448c0 35.3 86 64 192 64s192-28.7 192-64v-42.7C342.7 434.4 267.2 448 192 448S41.3 434.4 0 405.3zM320 128c106 0 192-28.7 192-64S426 0 320 0 128 28.7 128 64s86 64 192 64zM0 300.4V352c0 35.3 86 64 192 64s192-28.7 192-64v-51.6c-41.3 34-116.9 51.6-192 51.6S41.3 334.4 0 300.4zm416 11c57.3-11.1 96-31.7 96-55.4v-42.7c-23.2 16.4-57.3 27.6-96 34.5v63.6zM192 160C86 160 0 195.8 0 240s86 80 192 80 192-35.8 192-80-86-80-192-80zm219.3 56.3c60-10.8 100.7-32 100.7-56.3v-42.7c-35.5 25.1-96.5 38.6-160.7 41.8 29.5 14.3 51.2 33.5 60 57.2z" }, child: [] }] })(t);
2183
+ }
2184
+ function Wr(t) {
2185
+ return we({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z" }, child: [] }] })(t);
2186
+ }
2187
+ function Br(t) {
2188
+ return we({ attr: { viewBox: "0 0 640 512" }, child: [{ tag: "path", attr: { d: "M608 64H32C14.33 64 0 78.33 0 96v320c0 17.67 14.33 32 32 32h576c17.67 0 32-14.33 32-32V96c0-17.67-14.33-32-32-32zM48 400v-64c35.35 0 64 28.65 64 64H48zm0-224v-64h64c0 35.35-28.65 64-64 64zm272 176c-44.19 0-80-42.99-80-96 0-53.02 35.82-96 80-96s80 42.98 80 96c0 53.03-35.83 96-80 96zm272 48h-64c0-35.35 28.65-64 64-64v64zm0-224c-35.35 0-64-28.65-64-64h64v64z" }, child: [] }] })(t);
2189
+ }
2190
+ function zr(t) {
2191
+ return we({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M560 224h-29.5c-8.8-20-21.6-37.7-37.4-52.5L512 96h-32c-29.4 0-55.4 13.5-73 34.3-7.6-1.1-15.1-2.3-23-2.3H256c-77.4 0-141.9 55-156.8 128H56c-14.8 0-26.5-13.5-23.5-28.8C34.7 215.8 45.4 208 57 208h1c3.3 0 6-2.7 6-6v-20c0-3.3-2.7-6-6-6-28.5 0-53.9 20.4-57.5 48.6C-3.9 258.8 22.7 288 56 288h40c0 52.2 25.4 98.1 64 127.3V496c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-48h128v48c0 8.8 7.2 16 16 16h64c8.8 0 16-7.2 16-16v-80.7c11.8-8.9 22.3-19.4 31.3-31.3H560c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16zm-128 64c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zM256 96h128c5.4 0 10.7.4 15.9.8 0-.3.1-.5.1-.8 0-53-43-96-96-96s-96 43-96 96c0 2.1.5 4.1.6 6.2 15.2-3.9 31-6.2 47.4-6.2z" }, child: [] }] })(t);
2192
+ }
2193
+ function qr(t) {
2194
+ return we({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z" }, child: [] }] })(t);
2195
+ }
2196
+ const lt = new wr.Client(["https://api.hive.blog"]), Yr = async (t) => {
2197
+ try {
2198
+ const s = await lt.database.getAccounts([t]);
2199
+ if (!s || s.length === 0)
2200
+ throw new Error("Account not found");
2201
+ return s[0];
2202
+ } catch (s) {
2203
+ return console.error("Error in getWalletDataDetail:", s), { error: s instanceof Error ? s.message : "Unknown error" };
2204
+ }
2205
+ }, Jr = async (t) => {
2206
+ try {
2207
+ const s = await lt.database.getDynamicGlobalProperties(), r = parseFloat(t.split(" ")[0]), a = parseFloat(
2208
+ String(s.total_vesting_shares).split(" ")[0]
2209
+ ), o = parseFloat(
2210
+ String(s.total_vesting_fund_hive).split(" ")[0]
2211
+ );
2212
+ return (r * o / a).toFixed(3);
2213
+ } catch (s) {
2214
+ return console.error("Error in convertVestingSharesToHiveData:", s), "0";
2215
+ }
2216
+ }, Gr = async (t) => {
2217
+ try {
2218
+ const r = (await lt.database.call("get_feed_history", [])).current_median_history, a = parseFloat(r.base.split(" ")[0]), o = typeof t == "string" ? parseFloat(t) : t;
2219
+ return (a * o).toFixed(2);
2220
+ } catch (s) {
2221
+ return console.error("Error in convertHivetoUSDData:", s), "0";
2222
+ }
2223
+ }, Kr = _r((t) => ({
2224
+ walletData: null,
2225
+ isLoading: !1,
2226
+ error: null,
2227
+ setWalletData: (s) => t({ walletData: s }),
2228
+ clearWalletData: () => t({ walletData: null, error: null }),
2229
+ fetchWalletData: async (s) => {
2230
+ t({ isLoading: !0, error: null });
2231
+ try {
2232
+ const r = await Yr(s), a = (T) => "error" in T;
2233
+ if (!r || a(r))
2234
+ throw new Error(a(r) ? r.error : "Account not found");
2235
+ const o = typeof r.vesting_shares == "string" ? r.vesting_shares : "0.000000 VESTS", d = typeof r.balance == "string" ? r.balance : r.balance.toString(), i = typeof r.hbd_balance == "string" ? r.hbd_balance : r.hbd_balance.toString(), u = typeof r.savings_balance == "string" ? r.savings_balance : r.savings_balance.toString(), c = typeof r.savings_hbd_balance == "string" ? r.savings_hbd_balance : r.savings_hbd_balance.toString(), m = await Jr(o), l = parseFloat(d.split(" ")[0] || "0"), x = parseFloat(m), v = (l + x).toFixed(3), w = await Gr(v), k = {
2236
+ balance: d,
2237
+ hbd_balance: i,
2238
+ savings_balance: u,
2239
+ savings_hbd_balance: c,
2240
+ hive_power: `${m} HP`,
2241
+ estimated_value: `$${w}`
2242
+ };
2243
+ return t({ walletData: k }), k;
2244
+ } catch (r) {
2245
+ const a = r instanceof Error ? r.message : "Failed to fetch wallet data";
2246
+ console.error("Wallet fetch error:", a);
2247
+ const o = {
2248
+ balance: "0.000 HIVE",
2249
+ hbd_balance: "0.000 HBD",
2250
+ savings_balance: "0.000 HIVE",
2251
+ savings_hbd_balance: "0.000 HBD",
2252
+ hive_power: "0 HP",
2253
+ estimated_value: "$0.00",
2254
+ error: a
2255
+ };
2256
+ return t({ walletData: o, error: a }), o;
2257
+ } finally {
2258
+ t({ isLoading: !1 });
2259
+ }
2260
+ }
2261
+ })), ys = ({ username: t, className: s = "" }) => {
2262
+ const { walletData: r, fetchWalletData: a, isLoading: o, error: d } = Kr();
2263
+ H(() => {
2264
+ t && a(t);
2265
+ }, [t, a]);
2266
+ const i = ({ label: u, value: c, icon: m, colorClass: l = "bg-primary/10" }) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-4 rounded-lg bg-card border border-border shadow-sm mb-3 transition-all duration-200 hover:shadow-md", children: [
2267
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2268
+ m && /* @__PURE__ */ e.jsx("div", { className: `p-2 rounded-full flex items-center justify-center ${l} text-primary`, children: m }),
2269
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-card-foreground", children: u })
2270
+ ] }),
2271
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium text-muted-foreground", children: c ?? "-" })
2272
+ ] });
2273
+ return /* @__PURE__ */ e.jsx("div", { className: `min-h-screen bg-gradient-elegant p-4 transition-all duration-300 ${s}`, children: /* @__PURE__ */ e.jsxs("div", { className: "max-w-md mx-auto", children: [
2274
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center p-6 mb-6 rounded-xl bg-card border border-border shadow-elegant", children: [
2275
+ t && /* @__PURE__ */ e.jsx(
2276
+ "img",
2277
+ {
2278
+ src: `https://images.hive.blog/u/${t}/avatar`,
2279
+ alt: `${t} avatar`,
2280
+ className: "w-20 h-20 rounded-full border-4 border-primary/20 mb-3 transition-transform hover:scale-105",
2281
+ onError: (u) => {
2282
+ u.target.src = `https://ui-avatars.com/api/?name=${t}&background=random`;
2283
+ }
2284
+ }
2285
+ ),
2286
+ /* @__PURE__ */ e.jsx("div", { className: "text-lg font-bold text-card-foreground", children: t }),
2287
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: "Hive Wallet Overview" })
2288
+ ] }),
2289
+ /* @__PURE__ */ e.jsxs("div", { className: "text-center rounded-xl bg-gradient-primary shadow-glow p-6 mb-6 transition-all duration-300 hover:shadow-elegant", children: [
2290
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm font-semibold text-primary-foreground/80", children: "Estimated Value" }),
2291
+ /* @__PURE__ */ e.jsx("div", { className: "text-3xl font-bold mt-2 text-primary-foreground", children: o ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-2", children: [
2292
+ /* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin" }),
2293
+ "Loading..."
2294
+ ] }) : (r == null ? void 0 : r.estimated_value) ?? "-" })
2295
+ ] }),
2296
+ d && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center p-3 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive mb-4", children: [
2297
+ /* @__PURE__ */ e.jsx(Wr, { className: "mr-2" }),
2298
+ /* @__PURE__ */ e.jsx("span", { children: d })
2299
+ ] }),
2300
+ /* @__PURE__ */ e.jsx(
2301
+ i,
2302
+ {
2303
+ label: "Balance",
2304
+ value: r == null ? void 0 : r.balance,
2305
+ icon: /* @__PURE__ */ e.jsx(qr, {}),
2306
+ colorClass: "bg-blue-500/10"
2307
+ }
2308
+ ),
2309
+ /* @__PURE__ */ e.jsx(
2310
+ i,
2311
+ {
2312
+ label: "HBD Balance",
2313
+ value: r == null ? void 0 : r.hbd_balance,
2314
+ icon: /* @__PURE__ */ e.jsx(Br, {}),
2315
+ colorClass: "bg-green-500/10"
2316
+ }
2317
+ ),
2318
+ /* @__PURE__ */ e.jsx(
2319
+ i,
2320
+ {
2321
+ label: "Savings Balance",
2322
+ value: r == null ? void 0 : r.savings_balance,
2323
+ icon: /* @__PURE__ */ e.jsx(zr, {}),
2324
+ colorClass: "bg-yellow-500/10"
2325
+ }
2326
+ ),
2327
+ /* @__PURE__ */ e.jsx(
2328
+ i,
2329
+ {
2330
+ label: "Savings HBD Balance",
2331
+ value: r == null ? void 0 : r.savings_hbd_balance,
2332
+ icon: /* @__PURE__ */ e.jsx(Hr, {}),
2333
+ colorClass: "bg-purple-500/10"
2334
+ }
2335
+ ),
2336
+ /* @__PURE__ */ e.jsx(
2337
+ i,
2338
+ {
2339
+ label: "Hive Power",
2340
+ value: r == null ? void 0 : r.hive_power,
2341
+ icon: /* @__PURE__ */ e.jsx(Ir, {}),
2342
+ colorClass: "bg-orange-500/10"
2343
+ }
2344
+ )
2345
+ ] }) });
2346
+ }, Ge = "_communityLocalKey", Re = {
2347
+ getBookmarkedCommunities: () => {
2348
+ const t = localStorage.getItem(Ge);
2349
+ return t ? JSON.parse(t) : [];
2350
+ },
2351
+ isUserPresentLocally: (t) => {
2352
+ const s = localStorage.getItem(Ge);
2353
+ return s ? JSON.parse(s).includes(t) : !1;
2354
+ },
2355
+ storeLikedCommunityLocally: (t, s = !1) => {
2356
+ let r = Re.getBookmarkedCommunities();
2357
+ return r.includes(t) ? r = r.filter((a) => a !== t) : s || r.push(t), localStorage.setItem(Ge, JSON.stringify(r)), r;
2358
+ }
2359
+ }, Mt = ({
2360
+ id: t,
2361
+ toastType: s,
2362
+ isLiked: r,
2363
+ onAdd: a,
2364
+ onRemove: o,
2365
+ onFavourite: d
2366
+ }) => {
2367
+ const [i, u] = p(
2368
+ r ?? Re.isUserPresentLocally(t)
2369
+ );
2370
+ H(() => {
2371
+ r !== void 0 && u(r);
2372
+ }, [r]);
2373
+ const c = () => {
2374
+ d && d(), i ? (o ? o(t, "remove_bookmark") : Re.storeLikedCommunityLocally(
2375
+ t,
2376
+ !0
2377
+ ), m(!1)) : (a ? a(t, "add_bookmark") : Re.storeLikedCommunityLocally(t), m(!0)), u(!i);
2378
+ }, m = (l) => {
2379
+ alert(`The ${s} is ${l ? "added to" : "removed from"} your bookmarks`);
2380
+ };
2381
+ return /* @__PURE__ */ e.jsx(
2382
+ "button",
2383
+ {
2384
+ onClick: c,
2385
+ className: "p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
2386
+ children: i ? /* @__PURE__ */ e.jsx(br, { className: "w-5 h-5 text-blue-600 dark:text-blue-400" }) : /* @__PURE__ */ e.jsx(yr, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
2387
+ }
2388
+ );
2389
+ };
2390
+ class Qr {
2391
+ constructor() {
2392
+ $e(this, "HIVE_API_URL", "https://api.hive.blog");
2393
+ }
2394
+ async getListOfCommunities(s, r = 20, a) {
2395
+ const o = { limit: r };
2396
+ a && a.trim() !== "" && (o.last = a), s && s.trim() !== "" && (o.query = s);
2397
+ const d = {
2398
+ jsonrpc: "2.0",
2399
+ method: "bridge.list_communities",
2400
+ params: o,
2401
+ id: 1
2402
+ };
2403
+ try {
2404
+ const i = await fetch(this.HIVE_API_URL, {
2405
+ method: "POST",
2406
+ headers: {
2407
+ "Content-Type": "application/json"
2408
+ },
2409
+ body: JSON.stringify(d)
2410
+ });
2411
+ if (!i.ok)
2412
+ throw new Error(`HTTP error! status: ${i.status}`);
2413
+ return (await i.json()).result || [];
2414
+ } catch (i) {
2415
+ throw console.error("Error fetching communities:", i), i;
2416
+ }
2417
+ }
2418
+ async getCommunityDetails(s) {
2419
+ const r = {
2420
+ jsonrpc: "2.0",
2421
+ method: "bridge.get_community",
2422
+ params: { name: s },
2423
+ id: 1
2424
+ };
2425
+ try {
2426
+ const a = await fetch(this.HIVE_API_URL, {
2427
+ method: "POST",
2428
+ headers: {
2429
+ "Content-Type": "application/json"
2430
+ },
2431
+ body: JSON.stringify(r)
2432
+ });
2433
+ if (!a.ok)
2434
+ throw new Error(`HTTP error! status: ${a.status}`);
2435
+ return await a.json();
2436
+ } catch (a) {
2437
+ throw console.error("Error fetching community details:", a), a;
2438
+ }
2439
+ }
2440
+ async getCommunitySubscribers(s, r = 100, a) {
2441
+ const o = { community: s, limit: r };
2442
+ a && a.trim() !== "" && (o.last = a);
2443
+ const d = {
2444
+ jsonrpc: "2.0",
2445
+ method: "bridge.list_community_roles",
2446
+ params: o,
2447
+ id: 1
2448
+ };
2449
+ try {
2450
+ const i = await fetch(this.HIVE_API_URL, {
2451
+ method: "POST",
2452
+ headers: {
2453
+ "Content-Type": "application/json"
2454
+ },
2455
+ body: JSON.stringify(d)
2456
+ });
2457
+ if (!i.ok)
2458
+ throw new Error(`HTTP error! status: ${i.status}`);
2459
+ return ((await i.json()).result || []).map((c) => ({
2460
+ username: c[0],
2461
+ role: c[1],
2462
+ extra: c[2],
2463
+ subscribedAt: c[3]
2464
+ }));
2465
+ } catch (i) {
2466
+ throw console.error("Error fetching community subscribers:", i), i;
2467
+ }
2468
+ }
2469
+ communityIcon(s) {
2470
+ return `https://images.hive.blog/u/${s}/avatar?size=icon`;
2471
+ }
2472
+ userOwnerThumb(s) {
2473
+ return `https://images.hive.blog/u/${s}/avatar`;
2474
+ }
2475
+ }
2476
+ const ce = new Qr(), vs = ({ onSelectCommunity: t }) => {
2477
+ const [s, r] = p([]), [a, o] = p(""), [d, i] = p(!0), [u, c] = p(!1), [m, l] = p(!0), [x, v] = p(
2478
+ null
2479
+ ), [w, k] = p(null), T = 20, f = Le(null), j = je(
2480
+ async (_ = !1) => {
2481
+ if (!(!_ && (u || !m)))
2482
+ try {
2483
+ _ ? (i(!0), k(null), r([]), v(null), l(!0)) : c(!0);
2484
+ const E = a.trim(), C = await ce.getListOfCommunities(
2485
+ E.length >= 3 ? E : void 0,
2486
+ T,
2487
+ _ ? void 0 : x || void 0
2488
+ );
2489
+ r((Y) => _ ? C : [...Y, ...C]), C.length < T || C.length > 0 && C[C.length - 1].name === x ? l(!1) : C.length > 0 && v(C[C.length - 1].name || null);
2490
+ } catch (E) {
2491
+ k(
2492
+ E instanceof Error ? E.message : "Failed to load communities"
2493
+ ), l(!1);
2494
+ } finally {
2495
+ i(!1), c(!1);
2496
+ }
2497
+ },
2498
+ [a, u, m, x]
2499
+ );
2500
+ H(() => {
2501
+ const _ = setTimeout(
2502
+ () => {
2503
+ j(!0);
2504
+ },
2505
+ a.length >= 3 || a.length === 0 ? 0 : 500
2506
+ );
2507
+ return () => clearTimeout(_);
2508
+ }, [a]), H(() => {
2509
+ var _;
2510
+ (_ = f.current) == null || _.focus();
2511
+ }, [a, d, w]), H(() => {
2512
+ const _ = () => {
2513
+ window.innerHeight + document.documentElement.scrollTop >= document.documentElement.offsetHeight - 200 && !u && !d && m && j();
2514
+ };
2515
+ return window.addEventListener("scroll", _), () => window.removeEventListener("scroll", _);
2516
+ }, [j, u, d, m]);
2517
+ const b = () => {
2518
+ j(!0);
2519
+ }, M = () => /* @__PURE__ */ e.jsx("div", { className: "space-y-4", children: Array.from({ length: 6 }).map((_, E) => /* @__PURE__ */ e.jsx(
2520
+ "div",
2521
+ {
2522
+ className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 animate-pulse",
2523
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
2524
+ /* @__PURE__ */ e.jsx("div", { className: "w-12 h-12 bg-gray-200 dark:bg-gray-700 rounded-full" }),
2525
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 space-y-2", children: [
2526
+ /* @__PURE__ */ e.jsx("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-3/4" }),
2527
+ /* @__PURE__ */ e.jsx("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-1/2" })
2528
+ ] }),
2529
+ /* @__PURE__ */ e.jsx("div", { className: "h-3 bg-gray-200 dark:bg-gray-700 rounded w-16" })
2530
+ ] })
2531
+ },
2532
+ E
2533
+ )) });
2534
+ return d && s.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
2535
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
2536
+ /* @__PURE__ */ e.jsx(Ye, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 dark:text-gray-400 w-5 h-5" }),
2537
+ /* @__PURE__ */ e.jsx(
2538
+ "input",
2539
+ {
2540
+ type: "text",
2541
+ placeholder: "Search communities...",
2542
+ value: a,
2543
+ onChange: (_) => o(_.target.value),
2544
+ ref: f,
2545
+ autoFocus: !0,
2546
+ className: `w-full pl-10 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
2547
+ rounded-xl text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400
2548
+ focus:outline-none focus:ring-2 focus:ring-blue-500`
2549
+ }
2550
+ )
2551
+ ] }),
2552
+ /* @__PURE__ */ e.jsx(M, {})
2553
+ ] }) : w && s.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
2554
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
2555
+ /* @__PURE__ */ e.jsx(Ye, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 dark:text-gray-400 w-5 h-5" }),
2556
+ /* @__PURE__ */ e.jsx(
2557
+ "input",
2558
+ {
2559
+ type: "text",
2560
+ placeholder: "Search communities...",
2561
+ value: a,
2562
+ onChange: (_) => o(_.target.value),
2563
+ ref: f,
2564
+ autoFocus: !0,
2565
+ className: `w-full pl-10 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
2566
+ rounded-xl text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400
2567
+ focus:outline-none focus:ring-2 focus:ring-blue-500`
2568
+ }
2569
+ )
2570
+ ] }),
2571
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
2572
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load communities" }),
2573
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: w }),
2574
+ /* @__PURE__ */ e.jsxs(
2575
+ "button",
2576
+ {
2577
+ onClick: b,
2578
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2579
+ children: [
2580
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
2581
+ "Try Again"
2582
+ ]
2583
+ }
2584
+ )
2585
+ ] }) })
2586
+ ] }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
2587
+ /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Communities" }) }),
2588
+ /* @__PURE__ */ e.jsxs("div", { className: "relative flex justify-between items-center", children: [
2589
+ /* @__PURE__ */ e.jsx(Ye, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 dark:text-gray-400 w-5 h-5" }),
2590
+ /* @__PURE__ */ e.jsx(
2591
+ "input",
2592
+ {
2593
+ type: "text",
2594
+ placeholder: "Search communities...",
2595
+ value: a,
2596
+ onChange: (_) => o(_.target.value),
2597
+ ref: f,
2598
+ autoFocus: !0,
2599
+ className: `w-full pl-10 pr-4 py-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
2600
+ rounded-xl text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400
2601
+ focus:outline-none focus:ring-2 focus:ring-blue-500`
2602
+ }
2603
+ ),
2604
+ /* @__PURE__ */ e.jsx(
2605
+ "button",
2606
+ {
2607
+ onClick: b,
2608
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2609
+ children: /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4" })
2610
+ }
2611
+ )
2612
+ ] }),
2613
+ s.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
2614
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "No communities found" }),
2615
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: a ? "Try adjusting your search terms" : "Check back later for new communities" })
2616
+ ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2617
+ s.map((_) => /* @__PURE__ */ e.jsx(
2618
+ "div",
2619
+ {
2620
+ className: `bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
2621
+ rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
2622
+ transition-colors cursor-pointer`,
2623
+ onClick: () => t(_.name || ""),
2624
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
2625
+ /* @__PURE__ */ e.jsx(
2626
+ "img",
2627
+ {
2628
+ src: ce.communityIcon(_.name || ""),
2629
+ alt: _.title,
2630
+ className: "w-12 h-12 rounded-full object-cover",
2631
+ onError: (E) => {
2632
+ E.target.src = `https://ui-avatars.com/api/?name=${_.title}&background=random`;
2633
+ }
2634
+ }
2635
+ ),
2636
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
2637
+ /* @__PURE__ */ e.jsx("h3", { className: "font-semibold text-gray-900 dark:text-white truncate", children: _.title }),
2638
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400 line-clamp-2", children: _.about })
2639
+ ] }),
2640
+ /* @__PURE__ */ e.jsx("div", { className: "text-right", children: /* @__PURE__ */ e.jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
2641
+ (_.subscribers || 0).toLocaleString(),
2642
+ " members"
2643
+ ] }) })
2644
+ ] })
2645
+ },
2646
+ _.id
2647
+ )),
2648
+ m && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center pt-4", children: u ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
2649
+ /* @__PURE__ */ e.jsx(ae, { className: "w-4 h-4 animate-spin" }),
2650
+ "Loading more communities..."
2651
+ ] }) : /* @__PURE__ */ e.jsx(
2652
+ "button",
2653
+ {
2654
+ onClick: () => j(),
2655
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2656
+ children: "Load More Communities"
2657
+ }
2658
+ ) })
2659
+ ] })
2660
+ ] });
2661
+ }, Xr = ({ communityId: t }) => {
2662
+ var x, v, w;
2663
+ const [s, r] = p(null), [a, o] = p(!0), [d, i] = p(null), u = async () => {
2664
+ try {
2665
+ o(!0), i(null);
2666
+ const k = await ce.getCommunityDetails(t);
2667
+ r(k);
2668
+ } catch (k) {
2669
+ i(
2670
+ k instanceof Error ? k.message : "Failed to load community details"
2671
+ );
2672
+ } finally {
2673
+ o(!1);
2674
+ }
2675
+ };
2676
+ H(() => {
2677
+ u();
2678
+ }, [t]);
2679
+ const c = (k) => {
2680
+ try {
2681
+ return new Date(k).toLocaleDateString("en-US", {
2682
+ year: "numeric",
2683
+ month: "long",
2684
+ day: "numeric"
2685
+ });
2686
+ } catch {
2687
+ return k;
2688
+ }
2689
+ }, m = (k) => k.replace(/<[^>]*>/g, "");
2690
+ if (a)
2691
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
2692
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
2693
+ "Loading community details..."
2694
+ ] }) });
2695
+ if (d)
2696
+ return /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
2697
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load community details" }),
2698
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: d }),
2699
+ /* @__PURE__ */ e.jsxs(
2700
+ "button",
2701
+ {
2702
+ onClick: u,
2703
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2704
+ children: [
2705
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4" }),
2706
+ "Try Again"
2707
+ ]
2708
+ }
2709
+ )
2710
+ ] }) });
2711
+ if (!(s != null && s.result))
2712
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "No community details available" }) });
2713
+ const l = s.result;
2714
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6", children: [
2715
+ l.about && /* @__PURE__ */ e.jsxs("div", { className: "mb-6", children: [
2716
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-3", children: "About" }),
2717
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-300 leading-relaxed", children: m(l.about) })
2718
+ ] }),
2719
+ l.description && /* @__PURE__ */ e.jsxs("div", { className: "mb-6", children: [
2720
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-3", children: "Information" }),
2721
+ /* @__PURE__ */ e.jsx("div", { className: "text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap", children: m(l.description) })
2722
+ ] }),
2723
+ l.flag_text && /* @__PURE__ */ e.jsxs("div", { className: "mb-6", children: [
2724
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-3", children: "Community Rules" }),
2725
+ /* @__PURE__ */ e.jsx("div", { className: "text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap", children: m(l.flag_text) })
2726
+ ] }),
2727
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [
2728
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2729
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Total Authors" }),
2730
+ /* @__PURE__ */ e.jsx("p", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: ((x = l.num_authors) == null ? void 0 : x.toLocaleString()) || "0" })
2731
+ ] }),
2732
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2733
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Subscribers" }),
2734
+ /* @__PURE__ */ e.jsx("p", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: ((v = l.subscribers) == null ? void 0 : v.toLocaleString()) || "0" })
2735
+ ] }),
2736
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2737
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Created" }),
2738
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: l.created_at ? c(l.created_at) : "Unknown" })
2739
+ ] }),
2740
+ l.lang && /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2741
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Language" }),
2742
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: l.lang.toUpperCase() })
2743
+ ] }),
2744
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2745
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Pending Posts" }),
2746
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: ((w = l.num_pending) == null ? void 0 : w.toLocaleString()) || "0" })
2747
+ ] }),
2748
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
2749
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Type" }),
2750
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: l.is_nsfw ? "NSFW" : "Safe" })
2751
+ ] })
2752
+ ] })
2753
+ ] }) });
2754
+ }, Zr = ({
2755
+ communityId: t,
2756
+ onSelectTeamMember: s
2757
+ }) => {
2758
+ var l;
2759
+ const [r, a] = p(null), [o, d] = p(!0), [i, u] = p(null), c = async () => {
2760
+ try {
2761
+ d(!0), u(null);
2762
+ const x = await ce.getCommunityDetails(t);
2763
+ a(x);
2764
+ } catch (x) {
2765
+ u(
2766
+ x instanceof Error ? x.message : "Failed to load team details"
2767
+ );
2768
+ } finally {
2769
+ d(!1);
2770
+ }
2771
+ };
2772
+ H(() => {
2773
+ c();
2774
+ }, [t]);
2775
+ const m = ((l = r == null ? void 0 : r.result) == null ? void 0 : l.team) || [];
2776
+ return o ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
2777
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
2778
+ "Loading team members..."
2779
+ ] }) }) : i ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
2780
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load team details" }),
2781
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: i }),
2782
+ /* @__PURE__ */ e.jsxs(
2783
+ "button",
2784
+ {
2785
+ onClick: c,
2786
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2787
+ children: [
2788
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
2789
+ "Try Again"
2790
+ ]
2791
+ }
2792
+ )
2793
+ ] }) }) : m.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "No team members found" }) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4", children: m.map((x, v) => {
2794
+ const w = x[0], k = x.length > 1 ? x[1] : "";
2795
+ return /* @__PURE__ */ e.jsx(
2796
+ "div",
2797
+ {
2798
+ onClick: () => s && s(w),
2799
+ className: `bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
2800
+ rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
2801
+ transition-colors cursor-pointer`,
2802
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2803
+ /* @__PURE__ */ e.jsx(
2804
+ "img",
2805
+ {
2806
+ src: ce.userOwnerThumb(w),
2807
+ alt: w,
2808
+ className: "w-12 h-12 rounded-full object-cover",
2809
+ onError: (T) => {
2810
+ T.target.src = `https://ui-avatars.com/api/?name=${w}&background=random`;
2811
+ }
2812
+ }
2813
+ ),
2814
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
2815
+ /* @__PURE__ */ e.jsxs("h3", { className: "font-semibold text-gray-900 dark:text-white truncate", children: [
2816
+ "@",
2817
+ w
2818
+ ] }),
2819
+ k && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400 capitalize truncate", children: k })
2820
+ ] })
2821
+ ] })
2822
+ },
2823
+ `${w}-${v}`
2824
+ );
2825
+ }) }) });
2826
+ }, es = ({ communityId: t, onSelectCommunityMember: s }) => {
2827
+ const [r, a] = p([]), [o, d] = p(!0), [i, u] = p(!1), [c, m] = p(!0), [l, x] = p(null), [v, w] = p(null), k = 100, T = je(
2828
+ async (f = !1) => {
2829
+ if (!(i && !f))
2830
+ try {
2831
+ f ? (d(!0), w(null), a([]), x(null), m(!0)) : u(!0);
2832
+ const j = await ce.getCommunitySubscribers(
2833
+ t,
2834
+ k,
2835
+ f ? void 0 : l || void 0
2836
+ );
2837
+ j.length === 0 ? m(!1) : (a((b) => {
2838
+ if (f) return j;
2839
+ const M = new Set(b.map((E) => E.username)), _ = j.filter(
2840
+ (E) => !M.has(E.username)
2841
+ );
2842
+ return [...b, ..._];
2843
+ }), j.length > 0 && x(j[j.length - 1].username), m(j.length === k));
2844
+ } catch (j) {
2845
+ w(j instanceof Error ? j.message : "Failed to load members");
2846
+ } finally {
2847
+ d(!1), u(!1);
2848
+ }
2849
+ },
2850
+ [t, i, l]
2851
+ );
2852
+ return H(() => {
2853
+ T(!0);
2854
+ }, [t]), H(() => {
2855
+ const f = () => {
2856
+ window.innerHeight + document.documentElement.scrollTop >= document.documentElement.offsetHeight - 200 && !i && !o && c && T();
2857
+ };
2858
+ return window.addEventListener("scroll", f), () => window.removeEventListener("scroll", f);
2859
+ }, [T, i, o, c]), o && r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
2860
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
2861
+ "Loading members..."
2862
+ ] }) }) : v && r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
2863
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load members" }),
2864
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: v }),
2865
+ /* @__PURE__ */ e.jsxs(
2866
+ "button",
2867
+ {
2868
+ onClick: () => T(!0),
2869
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2870
+ children: [
2871
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
2872
+ "Try Again"
2873
+ ]
2874
+ }
2875
+ )
2876
+ ] }) }) : r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "No community members found" }) }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
2877
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4", children: r.map((f, j) => /* @__PURE__ */ e.jsx(
2878
+ "div",
2879
+ {
2880
+ className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors cursor-pointer",
2881
+ onClick: () => s == null ? void 0 : s(f.username),
2882
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2883
+ /* @__PURE__ */ e.jsx(
2884
+ "img",
2885
+ {
2886
+ src: ce.userOwnerThumb(f.username),
2887
+ alt: f.username,
2888
+ className: "w-12 h-12 rounded-full object-cover",
2889
+ onError: (b) => {
2890
+ b.target.src = `https://ui-avatars.com/api/?name=${f.username}&background=random`;
2891
+ }
2892
+ }
2893
+ ),
2894
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
2895
+ /* @__PURE__ */ e.jsxs("h3", { className: "font-semibold text-gray-900 dark:text-white truncate", children: [
2896
+ "@",
2897
+ f.username
2898
+ ] }),
2899
+ f.role && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400 capitalize truncate", children: f.role })
2900
+ ] })
2901
+ ] })
2902
+ },
2903
+ `${f.username}-${j}`
2904
+ )) }),
2905
+ c && /* @__PURE__ */ e.jsx("div", { className: "flex justify-center pt-4", children: i ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
2906
+ /* @__PURE__ */ e.jsx(ae, { className: "w-4 h-4 animate-spin" }),
2907
+ "Loading more members..."
2908
+ ] }) : /* @__PURE__ */ e.jsx(
2909
+ "button",
2910
+ {
2911
+ onClick: () => T(),
2912
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
2913
+ children: "Load More Members"
2914
+ }
2915
+ ) })
2916
+ ] });
2917
+ }, js = ({
2918
+ communityId: t,
2919
+ onVideoClick: s,
2920
+ onAuthorClick: r,
2921
+ onBack: a,
2922
+ onclickAboutTab: o,
2923
+ onclickTeamTab: d,
2924
+ onclickMemberTab: i,
2925
+ onShare: u,
2926
+ onFavourite: c,
2927
+ onRss: m,
2928
+ onMoreVertical: l,
2929
+ showMoreVertical: x = !0
2930
+ }) => {
2931
+ const v = Ie(), [w, k] = p("videos"), [T, f] = p(null), [j, b] = p(!1), [M, _] = p(!0);
2932
+ H(() => {
2933
+ (async () => {
2934
+ try {
2935
+ _(!0);
2936
+ const O = await ce.getCommunityDetails(t);
2937
+ f(O);
2938
+ } catch (O) {
2939
+ console.error("Failed to fetch community details:", O);
2940
+ } finally {
2941
+ _(!1);
2942
+ }
2943
+ })();
2944
+ }, [t]);
2945
+ const E = () => {
2946
+ var O;
2947
+ const $ = `https://3speak.tv/user/${t}`;
2948
+ navigator.share ? navigator.share({
2949
+ title: ((O = T == null ? void 0 : T.result) == null ? void 0 : O.title) || t,
2950
+ url: $
2951
+ }) : navigator.clipboard.writeText($);
2952
+ }, C = () => {
2953
+ window.open(`https://3speak.tv/rss/${t}.xml`, "_blank");
2954
+ }, Y = ($) => {
2955
+ v(`/user/${$}`);
2956
+ };
2957
+ if (M)
2958
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsxs("div", { className: "animate-pulse", children: [
2959
+ /* @__PURE__ */ e.jsx("div", { className: "h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6" }),
2960
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6", children: [
2961
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 mb-4", children: [
2962
+ /* @__PURE__ */ e.jsx("div", { className: "w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full" }),
2963
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 space-y-2", children: [
2964
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 bg-gray-200 dark:bg-gray-700 rounded w-48" }),
2965
+ /* @__PURE__ */ e.jsx("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-32" })
2966
+ ] })
2967
+ ] }),
2968
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: Array.from({ length: 4 }).map(($, O) => /* @__PURE__ */ e.jsx(
2969
+ "div",
2970
+ {
2971
+ className: "h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"
2972
+ },
2973
+ O
2974
+ )) })
2975
+ ] })
2976
+ ] }) });
2977
+ const h = T == null ? void 0 : T.result;
2978
+ return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
2979
+ /* @__PURE__ */ e.jsxs(
2980
+ "button",
2981
+ {
2982
+ onClick: a,
2983
+ className: "flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",
2984
+ children: [
2985
+ /* @__PURE__ */ e.jsx(Ce, { className: "w-4 h-4 mr-2" }),
2986
+ "Back"
2987
+ ]
2988
+ }
2989
+ ),
2990
+ /* @__PURE__ */ e.jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col md:flex-row items-start md:items-center gap-6", children: [
2991
+ /* @__PURE__ */ e.jsx(
2992
+ "img",
2993
+ {
2994
+ src: ce.userOwnerThumb(t),
2995
+ alt: (h == null ? void 0 : h.title) || t,
2996
+ className: "w-16 h-16 rounded-full object-cover",
2997
+ onError: ($) => {
2998
+ $.target.src = `https://images.hive.blog/u/${(h == null ? void 0 : h.title) || t}/avatar`;
2999
+ }
3000
+ }
3001
+ ),
3002
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1", children: [
3003
+ /* @__PURE__ */ e.jsx("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: (h == null ? void 0 : h.title) || t }),
3004
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-400 mb-4", children: (h == null ? void 0 : h.about) || "Community description" }),
3005
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap gap-6 text-sm", children: [
3006
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3007
+ /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }),
3008
+ /* @__PURE__ */ e.jsxs("span", { children: [
3009
+ ((h == null ? void 0 : h.subscribers) || 0).toLocaleString(),
3010
+ " members"
3011
+ ] })
3012
+ ] }),
3013
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3014
+ /* @__PURE__ */ e.jsx(Pt, { className: "w-4 h-4" }),
3015
+ /* @__PURE__ */ e.jsxs("span", { children: [
3016
+ "Created",
3017
+ " ",
3018
+ h != null && h.created_at ? new Date(h.created_at).getFullYear() : "Unknown"
3019
+ ] })
3020
+ ] })
3021
+ ] })
3022
+ ] }),
3023
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
3024
+ /* @__PURE__ */ e.jsx(
3025
+ Mt,
3026
+ {
3027
+ id: t,
3028
+ toastType: "community",
3029
+ onAdd: ($, O) => console.log("Added:", $, O),
3030
+ onRemove: ($, O) => console.log("Removed:", $, O),
3031
+ onFavourite: c
3032
+ }
3033
+ ),
3034
+ /* @__PURE__ */ e.jsx(
3035
+ "button",
3036
+ {
3037
+ onClick: m || C,
3038
+ className: "p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
3039
+ children: /* @__PURE__ */ e.jsx(Vt, { className: "w-4 h-4" })
3040
+ }
3041
+ ),
3042
+ /* @__PURE__ */ e.jsx(
3043
+ "button",
3044
+ {
3045
+ onClick: u || E,
3046
+ className: "p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
3047
+ children: /* @__PURE__ */ e.jsx(st, { className: "w-4 h-4" })
3048
+ }
3049
+ ),
3050
+ x && /* @__PURE__ */ e.jsx(
3051
+ "button",
3052
+ {
3053
+ onClick: l || (() => {
3054
+ }),
3055
+ className: "p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
3056
+ children: /* @__PURE__ */ e.jsx(at, { className: "w-4 h-4" })
3057
+ }
3058
+ )
3059
+ ] })
3060
+ ] }) }),
3061
+ /* @__PURE__ */ e.jsxs("div", { children: [
3062
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-4 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [
3063
+ /* @__PURE__ */ e.jsx(
3064
+ "button",
3065
+ {
3066
+ onClick: () => k("videos"),
3067
+ className: `px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${w === "videos" ? "bg-blue-600 dark:bg-blue-500 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,
3068
+ children: "Videos"
3069
+ }
3070
+ ),
3071
+ /* @__PURE__ */ e.jsx(
3072
+ "button",
3073
+ {
3074
+ onClick: () => o ? o() : k("about"),
3075
+ className: `px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${w === "about" ? "bg-blue-600 dark:bg-blue-500 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,
3076
+ children: "About"
3077
+ }
3078
+ ),
3079
+ /* @__PURE__ */ e.jsx(
3080
+ "button",
3081
+ {
3082
+ onClick: () => d ? d() : k("team"),
3083
+ className: `px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${w === "team" ? "bg-blue-600 dark:bg-blue-500 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,
3084
+ children: "Team"
3085
+ }
3086
+ ),
3087
+ /* @__PURE__ */ e.jsx(
3088
+ "button",
3089
+ {
3090
+ onClick: () => i ? i() : k("members"),
3091
+ className: `px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${w === "members" ? "bg-blue-600 dark:bg-blue-500 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,
3092
+ children: "Members"
3093
+ }
3094
+ )
3095
+ ] }),
3096
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-6", children: [
3097
+ w === "videos" && /* @__PURE__ */ e.jsx(
3098
+ ot,
3099
+ {
3100
+ feedType: Q.COMMUNITY,
3101
+ communityId: t,
3102
+ onVideoClick: s,
3103
+ onAuthorClick: r
3104
+ }
3105
+ ),
3106
+ w === "about" && !o && /* @__PURE__ */ e.jsx(Xr, { communityId: t }),
3107
+ w === "team" && !d && /* @__PURE__ */ e.jsx(
3108
+ Zr,
3109
+ {
3110
+ communityId: t,
3111
+ onSelectTeamMember: Y
3112
+ }
3113
+ ),
3114
+ w === "members" && !i && /* @__PURE__ */ e.jsx(
3115
+ es,
3116
+ {
3117
+ communityId: t,
3118
+ onSelectCommunityMember: Y
3119
+ }
3120
+ )
3121
+ ] })
3122
+ ] })
3123
+ ] });
3124
+ }, ws = ({
3125
+ currentUser: t,
3126
+ onTabChanged: s,
3127
+ onPublish: r,
3128
+ onViewMyVideo: a,
3129
+ onMoreOptions: o,
3130
+ onTapBackButton: d,
3131
+ shouldShowBackButton: i = !0,
3132
+ shouldShowPublishButton: u = !1,
3133
+ shouldShowMoreOptionsButton: c = !1
3134
+ }) => {
3135
+ const m = Ie(), [l, x] = p(0), [v, w] = p([]), [k, T] = p(!0), [f, j] = p(null), b = v.filter(
3136
+ (F) => [
3137
+ "encoding",
3138
+ "uploaded",
3139
+ "encoding_queued",
3140
+ "encoding_preparing",
3141
+ "ipfs_pinning",
3142
+ "ipfs_pinning_failed",
3143
+ "encoding_failed",
3144
+ "encoding_ipfs"
3145
+ ].includes(F.status || "")
3146
+ ), M = v.filter((F) => F.status === "publish_manual"), _ = v.filter((F) => F.status === "published");
3147
+ H(() => {
3148
+ t != null && t.token && E();
3149
+ }, [t]);
3150
+ const E = async () => {
3151
+ if (!(t != null && t.token)) {
3152
+ j("No authentication token provided"), T(!1);
3153
+ return;
3154
+ }
3155
+ T(!0), j(null);
3156
+ try {
3157
+ const F = await Z.getMyVideos(t.token);
3158
+ w(F);
3159
+ } catch (F) {
3160
+ console.error("Error fetching videos:", F), j(
3161
+ `Failed to load videos: ${F instanceof Error ? F.message : "Unknown error"}`
3162
+ );
3163
+ } finally {
3164
+ T(!1);
3165
+ }
3166
+ }, C = (F) => {
3167
+ x(F), s == null || s(F);
3168
+ }, Y = (F) => {
3169
+ F.owner && F.permlink && m(`/video/${F.owner}/${F.permlink}`);
3170
+ }, h = (F) => {
3171
+ switch (F.toLowerCase()) {
3172
+ case "published":
3173
+ return "bg-green-500";
3174
+ case "encoding":
3175
+ case "encoding_queued":
3176
+ return "bg-orange-500";
3177
+ case "uploaded":
3178
+ return "bg-blue-500";
3179
+ case "publish_manual":
3180
+ return "bg-purple-500";
3181
+ default:
3182
+ return "bg-gray-500";
3183
+ }
3184
+ }, $ = [
3185
+ "ipfs_pinning",
3186
+ "ipfs_pinning_failed",
3187
+ "encoding",
3188
+ "encoding_failed",
3189
+ "encoding_ipfs"
3190
+ ], O = (F, G) => {
3191
+ if (F.length === 0) {
3192
+ let N = "";
3193
+ switch (G) {
3194
+ case "publishNow":
3195
+ N = "No videos ready to publish.";
3196
+ break;
3197
+ case "myVideos":
3198
+ N = "No published videos found.";
3199
+ break;
3200
+ case "encoding":
3201
+ N = "No videos currently encoding.";
3202
+ break;
3203
+ }
3204
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-16", children: [
3205
+ /* @__PURE__ */ e.jsx(kt, { className: "w-16 h-16 text-gray-400 mb-4" }),
3206
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-400 text-center", children: N })
3207
+ ] });
3208
+ }
3209
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-3 w-full", children: F.map((N, L) => {
3210
+ const V = N.thumbnail || "", U = N.title || "No Title", I = N.permlink || "", q = N.owner || (t == null ? void 0 : t.username) || "", J = N.id || "", ne = $.includes(N.status || "");
3211
+ return /* @__PURE__ */ e.jsx(
3212
+ "div",
3213
+ {
3214
+ className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-3 hover:shadow-md transition-shadow",
3215
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
3216
+ /* @__PURE__ */ e.jsxs("div", { className: "relative flex-shrink-0", children: [
3217
+ /* @__PURE__ */ e.jsx(
3218
+ "img",
3219
+ {
3220
+ src: fe(V) || `https://images.hive.blog/u/${t == null ? void 0 : t.username}/avatar`,
3221
+ alt: U,
3222
+ className: "w-24 h-16 rounded-lg object-cover",
3223
+ onError: (K) => {
3224
+ K.target.src = `https://images.hive.blog/u/${t == null ? void 0 : t.username}/avatar`;
3225
+ }
3226
+ }
3227
+ ),
3228
+ $.includes(N.status || "") ? /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/30 rounded-lg", children: /* @__PURE__ */ e.jsx(_t, { className: "w-6 h-6 text-red-500" }) }) : /* @__PURE__ */ e.jsx(
3229
+ "div",
3230
+ {
3231
+ className: "absolute inset-0 flex items-center justify-center bg-black/20 opacity-0 hover:opacity-100 transition-opacity cursor-pointer rounded-lg",
3232
+ onClick: () => Y(N),
3233
+ children: /* @__PURE__ */ e.jsx(et, { className: "w-6 h-6 text-white" })
3234
+ }
3235
+ )
3236
+ ] }),
3237
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
3238
+ /* @__PURE__ */ e.jsx(
3239
+ "h3",
3240
+ {
3241
+ className: "font-semibold text-gray-900 dark:text-white text-sm cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",
3242
+ onClick: () => Y(N),
3243
+ style: {
3244
+ display: "-webkit-box",
3245
+ WebkitLineClamp: 2,
3246
+ WebkitBoxOrient: "vertical",
3247
+ overflow: "hidden",
3248
+ textOverflow: "ellipsis"
3249
+ },
3250
+ children: U
3251
+ }
3252
+ ),
3253
+ /* @__PURE__ */ e.jsxs("p", { className: "text-gray-600 dark:text-gray-400 text-xs mt-1", children: [
3254
+ "By ",
3255
+ q
3256
+ ] }),
3257
+ N.status && /* @__PURE__ */ e.jsx("div", { className: "mt-2", children: /* @__PURE__ */ e.jsx(
3258
+ "span",
3259
+ {
3260
+ className: `inline-block px-2 py-1 rounded-full text-xs font-semibold text-white ${h(
3261
+ N.status
3262
+ )}`,
3263
+ children: N.status.toUpperCase()
3264
+ }
3265
+ ) })
3266
+ ] }),
3267
+ ne ? /* @__PURE__ */ e.jsx("div", { className: "flex-shrink-0 pl-2", children: /* @__PURE__ */ e.jsx(_t, { className: "w-5 h-5 text-red-500" }) }) : /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-end gap-2", children: [
3268
+ G === "publishNow" && u && /* @__PURE__ */ e.jsx(
3269
+ "button",
3270
+ {
3271
+ onClick: () => r == null ? void 0 : r(q, I),
3272
+ className: "bg-green-600 hover:bg-green-700 text-white text-xs px-3 py-1 rounded-md transition-colors",
3273
+ children: "Publish"
3274
+ }
3275
+ ),
3276
+ G === "myVideos" && /* @__PURE__ */ e.jsx(
3277
+ "button",
3278
+ {
3279
+ onClick: () => a ? a(q, I) : Y(N),
3280
+ className: "bg-blue-600 hover:bg-blue-700 text-white text-xs px-3 py-1 rounded-md transition-colors",
3281
+ children: "View"
3282
+ }
3283
+ ),
3284
+ c && /* @__PURE__ */ e.jsx(
3285
+ "button",
3286
+ {
3287
+ onClick: () => o == null ? void 0 : o(J),
3288
+ className: "p-1 h-6 w-6 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",
3289
+ children: /* @__PURE__ */ e.jsx(at, { className: "w-4 h-4" })
3290
+ }
3291
+ )
3292
+ ] })
3293
+ ] })
3294
+ },
3295
+ `${J}-${L}`
3296
+ );
3297
+ }) });
3298
+ };
3299
+ return t ? /* @__PURE__ */ e.jsxs("div", { className: "min-h-screen bg-gray-50 dark:bg-gray-900", children: [
3300
+ i && /* @__PURE__ */ e.jsxs(
3301
+ "button",
3302
+ {
3303
+ onClick: d,
3304
+ className: "flex items-center justify-center mr-4 my-2 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",
3305
+ children: [
3306
+ /* @__PURE__ */ e.jsx(Ce, { className: "w-4 h-4 mr-2" }),
3307
+ "Back"
3308
+ ]
3309
+ }
3310
+ ),
3311
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: [
3312
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-4", children: [
3313
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
3314
+ /* @__PURE__ */ e.jsx(
3315
+ "img",
3316
+ {
3317
+ src: `https://images.hive.blog/u/${t.username}/avatar`,
3318
+ alt: t.username,
3319
+ className: "w-12 h-12 md:w-16 md:h-16 rounded-full object-cover border-2 border-gray-200 dark:border-gray-700",
3320
+ onError: (F) => {
3321
+ F.target.src = `https://ui-avatars.com/api/?name=${t.username}&background=random&size=64`;
3322
+ }
3323
+ }
3324
+ ),
3325
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx("h1", { className: "text-lg md:text-xl font-semibold text-gray-900 dark:text-white", children: t.username }) })
3326
+ ] }) }),
3327
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(
3328
+ "button",
3329
+ {
3330
+ onClick: E,
3331
+ className: "p-2 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",
3332
+ children: /* @__PURE__ */ e.jsx(se, { className: "w-5 h-5" })
3333
+ }
3334
+ ) })
3335
+ ] }),
3336
+ /* @__PURE__ */ e.jsx("div", { className: "border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ e.jsxs("div", { className: "flex overflow-x-auto scrollbar-hide", children: [
3337
+ /* @__PURE__ */ e.jsxs(
3338
+ "button",
3339
+ {
3340
+ onClick: () => C(0),
3341
+ className: `flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${l === 0 ? "border-blue-500 text-blue-600 dark:text-blue-400" : "border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,
3342
+ children: [
3343
+ /* @__PURE__ */ e.jsx(vr, { className: "w-4 h-4" }),
3344
+ /* @__PURE__ */ e.jsx("span", { className: "hidden sm:inline", children: "Publish Now" }),
3345
+ /* @__PURE__ */ e.jsx("span", { className: "sm:hidden", children: "Publish" }),
3346
+ M.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full", children: M.length })
3347
+ ]
3348
+ }
3349
+ ),
3350
+ /* @__PURE__ */ e.jsxs(
3351
+ "button",
3352
+ {
3353
+ onClick: () => C(1),
3354
+ className: `flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${l === 1 ? "border-blue-500 text-blue-600 dark:text-blue-400" : "border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,
3355
+ children: [
3356
+ /* @__PURE__ */ e.jsx(kt, { className: "w-4 h-4" }),
3357
+ /* @__PURE__ */ e.jsx("span", { className: "hidden sm:inline", children: "My Videos" }),
3358
+ /* @__PURE__ */ e.jsx("span", { className: "sm:hidden", children: "Videos" }),
3359
+ _.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full", children: _.length })
3360
+ ]
3361
+ }
3362
+ ),
3363
+ /* @__PURE__ */ e.jsxs(
3364
+ "button",
3365
+ {
3366
+ onClick: () => C(2),
3367
+ className: `flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${l === 2 ? "border-blue-500 text-blue-600 dark:text-blue-400" : "border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,
3368
+ children: [
3369
+ /* @__PURE__ */ e.jsx(jr, { className: "w-4 h-4" }),
3370
+ /* @__PURE__ */ e.jsx("span", { className: "hidden sm:inline", children: "Encoding" }),
3371
+ /* @__PURE__ */ e.jsx("span", { className: "sm:hidden", children: "Encoding" }),
3372
+ b.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full", children: b.length })
3373
+ ]
3374
+ }
3375
+ )
3376
+ ] }) })
3377
+ ] }),
3378
+ /* @__PURE__ */ e.jsx("div", { className: "py-4 md:py-6 w-full", children: k ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }) }) : f ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-center", children: [
3379
+ /* @__PURE__ */ e.jsx("div", { className: "w-16 h-16 bg-red-100 dark:bg-red-900 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ e.jsx(Rt, { className: "w-8 h-8 text-red-600 dark:text-red-400" }) }),
3380
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load videos" }),
3381
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-400 mb-4", children: f }),
3382
+ /* @__PURE__ */ e.jsx(
3383
+ "button",
3384
+ {
3385
+ onClick: E,
3386
+ className: "bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition-colors",
3387
+ children: "Retry"
3388
+ }
3389
+ )
3390
+ ] }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
3391
+ l === 0 && O(
3392
+ M,
3393
+ "publishNow"
3394
+ /* PUBLISH_NOW */
3395
+ ),
3396
+ l === 1 && O(
3397
+ _,
3398
+ "myVideos"
3399
+ /* MY_VIDEOS */
3400
+ ),
3401
+ l === 2 && O(
3402
+ b,
3403
+ "encoding"
3404
+ /* ENCODING */
3405
+ )
3406
+ ] }) })
3407
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-400", children: "Please login to view your account" }) });
3408
+ };
3409
+ class ts {
3410
+ constructor() {
3411
+ $e(this, "HIVE_API_URL", "https://api.hive.blog");
3412
+ }
3413
+ async getProfile(s) {
3414
+ const r = {
3415
+ jsonrpc: "2.0",
3416
+ method: "bridge.get_profile",
3417
+ params: {
3418
+ account: s
3419
+ },
3420
+ id: 1
3421
+ }, a = await fetch(this.HIVE_API_URL, {
3422
+ method: "POST",
3423
+ headers: {
3424
+ "Content-Type": "application/json"
3425
+ },
3426
+ body: JSON.stringify(r)
3427
+ });
3428
+ if (!a.ok)
3429
+ throw new Error(`HTTP error! status: ${a.status}`);
3430
+ return await a.json();
3431
+ }
3432
+ async getFollowers(s) {
3433
+ const r = {
3434
+ jsonrpc: "2.0",
3435
+ method: "condenser_api.get_followers",
3436
+ params: [s, null, "blog"],
3437
+ id: 1
3438
+ }, a = await fetch(this.HIVE_API_URL, {
3439
+ method: "POST",
3440
+ headers: {
3441
+ "Content-Type": "application/json"
3442
+ },
3443
+ body: JSON.stringify(r)
3444
+ });
3445
+ if (!a.ok)
3446
+ throw new Error(`HTTP error! status: ${a.status}`);
3447
+ return (await a.json()).result;
3448
+ }
3449
+ async getFollowing(s) {
3450
+ const r = {
3451
+ jsonrpc: "2.0",
3452
+ method: "condenser_api.get_following",
3453
+ params: [s, null, "blog"],
3454
+ id: 1
3455
+ }, a = await fetch(this.HIVE_API_URL, {
3456
+ method: "POST",
3457
+ headers: {
3458
+ "Content-Type": "application/json"
3459
+ },
3460
+ body: JSON.stringify(r)
3461
+ });
3462
+ if (!a.ok)
3463
+ throw new Error(`HTTP error! status: ${a.status}`);
3464
+ return (await a.json()).result;
3465
+ }
3466
+ userAvatar(s) {
3467
+ return `https://images.hive.blog/u/${s}/avatar`;
3468
+ }
3469
+ }
3470
+ const ie = new ts(), rs = ({
3471
+ username: t,
3472
+ onSelectUser: s
3473
+ }) => {
3474
+ const [r, a] = p([]), [o, d] = p(!0), [i, u] = p(null), c = async () => {
3475
+ try {
3476
+ d(!0), u(null);
3477
+ const m = await ie.getFollowers(t);
3478
+ a(m);
3479
+ } catch (m) {
3480
+ u(
3481
+ m instanceof Error ? m.message : "Failed to load followers"
3482
+ );
3483
+ } finally {
3484
+ d(!1);
3485
+ }
3486
+ };
3487
+ return H(() => {
3488
+ c();
3489
+ }, [t]), o ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3490
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
3491
+ "Loading followers..."
3492
+ ] }) }) : i ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
3493
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load followers" }),
3494
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: i }),
3495
+ /* @__PURE__ */ e.jsxs(
3496
+ "button",
3497
+ {
3498
+ onClick: c,
3499
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
3500
+ children: [
3501
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
3502
+ "Try Again"
3503
+ ]
3504
+ }
3505
+ )
3506
+ ] }) }) : r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "This user has no followers." }) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4", children: r.map((m, l) => /* @__PURE__ */ e.jsx(
3507
+ "div",
3508
+ {
3509
+ onClick: () => s && s(m.follower),
3510
+ className: `bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
3511
+ rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
3512
+ transition-colors cursor-pointer`,
3513
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
3514
+ /* @__PURE__ */ e.jsx(
3515
+ "img",
3516
+ {
3517
+ src: ie.userAvatar(m.follower),
3518
+ alt: m.follower,
3519
+ className: "w-12 h-12 rounded-full object-cover",
3520
+ onError: (x) => {
3521
+ x.target.src = `https://ui-avatars.com/api/?name=${m.follower}&background=random`;
3522
+ }
3523
+ }
3524
+ ),
3525
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ e.jsxs("h3", { className: "font-semibold text-gray-900 dark:text-white truncate", children: [
3526
+ "@",
3527
+ m.follower
3528
+ ] }) })
3529
+ ] })
3530
+ },
3531
+ `${m.follower}-${l}`
3532
+ )) }) });
3533
+ }, ss = ({
3534
+ username: t,
3535
+ onSelectUser: s
3536
+ }) => {
3537
+ const [r, a] = p([]), [o, d] = p(!0), [i, u] = p(null), c = async () => {
3538
+ try {
3539
+ d(!0), u(null);
3540
+ const m = await ie.getFollowing(t);
3541
+ a(m);
3542
+ } catch (m) {
3543
+ u(
3544
+ m instanceof Error ? m.message : "Failed to load following list"
3545
+ );
3546
+ } finally {
3547
+ d(!1);
3548
+ }
3549
+ };
3550
+ return H(() => {
3551
+ c();
3552
+ }, [t]), o ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3553
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
3554
+ "Loading following list..."
3555
+ ] }) }) : i ? /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
3556
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load following list" }),
3557
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: i }),
3558
+ /* @__PURE__ */ e.jsxs(
3559
+ "button",
3560
+ {
3561
+ onClick: c,
3562
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
3563
+ children: [
3564
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4 mr-2" }),
3565
+ "Try Again"
3566
+ ]
3567
+ }
3568
+ )
3569
+ ] }) }) : r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "This user is not following anyone." }) }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4", children: r.map((m, l) => /* @__PURE__ */ e.jsx(
3570
+ "div",
3571
+ {
3572
+ onClick: () => s && s(m.following),
3573
+ className: `bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
3574
+ rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
3575
+ transition-colors cursor-pointer`,
3576
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
3577
+ /* @__PURE__ */ e.jsx(
3578
+ "img",
3579
+ {
3580
+ src: ie.userAvatar(m.following),
3581
+ alt: m.following,
3582
+ className: "w-12 h-12 rounded-full object-cover",
3583
+ onError: (x) => {
3584
+ x.target.src = `https://ui-avatars.com/api/?name=${m.following}&background=random`;
3585
+ }
3586
+ }
3587
+ ),
3588
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ e.jsxs("h3", { className: "font-semibold text-gray-900 dark:text-white truncate", children: [
3589
+ "@",
3590
+ m.following
3591
+ ] }) })
3592
+ ] })
3593
+ },
3594
+ `${m.following}-${l}`
3595
+ )) }) });
3596
+ }, as = ({ username: t }) => {
3597
+ var v, w, k, T, f, j;
3598
+ const [s, r] = p(null), [a, o] = p(!0), [d, i] = p(null), u = async () => {
3599
+ try {
3600
+ o(!0), i(null);
3601
+ const b = await ie.getProfile(t);
3602
+ r(b);
3603
+ } catch (b) {
3604
+ i(
3605
+ b instanceof Error ? b.message : "Failed to load user details"
3606
+ );
3607
+ } finally {
3608
+ o(!1);
3609
+ }
3610
+ };
3611
+ H(() => {
3612
+ u();
3613
+ }, [t]);
3614
+ const c = (b) => {
3615
+ try {
3616
+ return new Date(b).toLocaleDateString("en-US", {
3617
+ year: "numeric",
3618
+ month: "long",
3619
+ day: "numeric"
3620
+ });
3621
+ } catch {
3622
+ return b;
3623
+ }
3624
+ }, m = (b) => b.replace(/<[^>]*>/g, "");
3625
+ if (a)
3626
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3627
+ /* @__PURE__ */ e.jsx(ae, { className: "w-5 h-5 animate-spin" }),
3628
+ "Loading user details..."
3629
+ ] }) });
3630
+ if (d)
3631
+ return /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center min-h-[400px] space-y-4", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center", children: [
3632
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Failed to load user details" }),
3633
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400 mb-4", children: d }),
3634
+ /* @__PURE__ */ e.jsxs(
3635
+ "button",
3636
+ {
3637
+ onClick: u,
3638
+ className: "m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",
3639
+ children: [
3640
+ /* @__PURE__ */ e.jsx(se, { className: "w-4 h-4" }),
3641
+ "Try Again"
3642
+ ]
3643
+ }
3644
+ )
3645
+ ] }) });
3646
+ if (!(s != null && s.result))
3647
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 dark:text-gray-400", children: "No user details available" }) });
3648
+ const l = s.result, x = (v = l.metadata) == null ? void 0 : v.profile;
3649
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6", children: [
3650
+ (x == null ? void 0 : x.about) && /* @__PURE__ */ e.jsxs("div", { className: "mb-6", children: [
3651
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-3", children: "About" }),
3652
+ /* @__PURE__ */ e.jsx("div", { className: "text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap", children: m(x.about) })
3653
+ ] }),
3654
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [
3655
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3656
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Location" }),
3657
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: (x == null ? void 0 : x.location) || "Not specified" })
3658
+ ] }),
3659
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3660
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Website" }),
3661
+ /* @__PURE__ */ e.jsx("a", { href: x == null ? void 0 : x.website, target: "_blank", rel: "noopener noreferrer", className: "text-lg font-semibold text-blue-500 hover:underline", children: (x == null ? void 0 : x.website) || "Not specified" })
3662
+ ] }),
3663
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3664
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Joined" }),
3665
+ /* @__PURE__ */ e.jsx("p", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: l.created ? c(l.created) : "Unknown" })
3666
+ ] }),
3667
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3668
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Followers" }),
3669
+ /* @__PURE__ */ e.jsx("p", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: ((k = (w = l.stats) == null ? void 0 : w.followers) == null ? void 0 : k.toLocaleString()) || "0" })
3670
+ ] }),
3671
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3672
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Following" }),
3673
+ /* @__PURE__ */ e.jsx("p", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: ((f = (T = l.stats) == null ? void 0 : T.following) == null ? void 0 : f.toLocaleString()) || "0" })
3674
+ ] }),
3675
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-gray-50 dark:bg-gray-900 p-4 rounded-lg", children: [
3676
+ /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-medium text-gray-500 dark:text-gray-400 mb-1", children: "Post Count" }),
3677
+ /* @__PURE__ */ e.jsx("p", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: ((j = l.post_count) == null ? void 0 : j.toLocaleString()) || "0" })
3678
+ ] })
3679
+ ] })
3680
+ ] }) });
3681
+ }, Ns = ({
3682
+ username: t,
3683
+ onVideoClick: s,
3684
+ onAuthorClick: r,
3685
+ onBack: a
3686
+ }) => {
3687
+ var b, M, _;
3688
+ const o = Ie(), [d, i] = p("videos"), [u, c] = p(null), [m, l] = p(!1), [x, v] = p(!0);
3689
+ H(() => {
3690
+ (async () => {
3691
+ try {
3692
+ v(!0);
3693
+ const C = await ie.getProfile(t);
3694
+ c(C);
3695
+ } catch (C) {
3696
+ console.error("Failed to fetch user details:", C);
3697
+ } finally {
3698
+ v(!1);
3699
+ }
3700
+ })();
3701
+ }, [t]);
3702
+ const w = () => {
3703
+ var C;
3704
+ const E = `https://3speak.tv/user/${t}`;
3705
+ navigator.share ? navigator.share({
3706
+ title: ((C = u == null ? void 0 : u.result) == null ? void 0 : C.name) || t,
3707
+ url: E
3708
+ }) : navigator.clipboard.writeText(E);
3709
+ }, k = () => {
3710
+ window.open(`https://3speak.tv/rss/${t}.xml`, "_blank");
3711
+ }, T = (E) => {
3712
+ o(`/user/${E}`);
3713
+ };
3714
+ if (x)
3715
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6", children: /* @__PURE__ */ e.jsxs("div", { className: "animate-pulse", children: [
3716
+ /* @__PURE__ */ e.jsx("div", { className: "h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6" }),
3717
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6", children: [
3718
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 mb-4", children: [
3719
+ /* @__PURE__ */ e.jsx("div", { className: "w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full" }),
3720
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 space-y-2", children: [
3721
+ /* @__PURE__ */ e.jsx("div", { className: "h-6 bg-gray-200 dark:bg-gray-700 rounded w-48" }),
3722
+ /* @__PURE__ */ e.jsx("div", { className: "h-4 bg-gray-200 dark:bg-gray-700 rounded w-32" })
3723
+ ] })
3724
+ ] }),
3725
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: Array.from({ length: 4 }).map((E, C) => /* @__PURE__ */ e.jsx(
3726
+ "div",
3727
+ {
3728
+ className: "h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"
3729
+ },
3730
+ C
3731
+ )) })
3732
+ ] })
3733
+ ] }) });
3734
+ const f = u == null ? void 0 : u.result, j = (b = f == null ? void 0 : f.metadata) == null ? void 0 : b.profile;
3735
+ return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
3736
+ /* @__PURE__ */ e.jsxs(
3737
+ "button",
3738
+ {
3739
+ onClick: a,
3740
+ className: "flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",
3741
+ children: [
3742
+ /* @__PURE__ */ e.jsx(Ce, { className: "w-4 h-4 mr-2" }),
3743
+ "Back"
3744
+ ]
3745
+ }
3746
+ ),
3747
+ /* @__PURE__ */ e.jsxs("div", { className: "relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden", children: [
3748
+ /* @__PURE__ */ e.jsx(
3749
+ "img",
3750
+ {
3751
+ src: j.cover_image || ie.userAvatar(t),
3752
+ alt: "Cover",
3753
+ className: "w-full h-48 object-cover",
3754
+ onError: (E) => {
3755
+ E.target.src = ie.userAvatar(t);
3756
+ }
3757
+ }
3758
+ ),
3759
+ /* @__PURE__ */ e.jsx("div", { className: "p-6", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col md:flex-row items-start md:items-center gap-6", children: [
3760
+ /* @__PURE__ */ e.jsx(
3761
+ "img",
3762
+ {
3763
+ src: j == null ? void 0 : j.profile_image,
3764
+ alt: j == null ? void 0 : j.name,
3765
+ className: "w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",
3766
+ onError: (E) => {
3767
+ E.target.src = ie.userAvatar(t);
3768
+ }
3769
+ }
3770
+ ),
3771
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1", children: [
3772
+ /* @__PURE__ */ e.jsx("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: (j == null ? void 0 : j.name) || t }),
3773
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-600 dark:text-gray-400 mb-4", children: (j == null ? void 0 : j.about) || "No description available" }),
3774
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap gap-6 text-sm", children: [
3775
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3776
+ /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }),
3777
+ /* @__PURE__ */ e.jsxs("span", { children: [
3778
+ (((M = f == null ? void 0 : f.stats) == null ? void 0 : M.followers) || 0).toLocaleString(),
3779
+ " Followers"
3780
+ ] })
3781
+ ] }),
3782
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3783
+ /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }),
3784
+ /* @__PURE__ */ e.jsxs("span", { children: [
3785
+ (((_ = f == null ? void 0 : f.stats) == null ? void 0 : _.following) || 0).toLocaleString(),
3786
+ " Following"
3787
+ ] })
3788
+ ] }),
3789
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-gray-500 dark:text-gray-400", children: [
3790
+ /* @__PURE__ */ e.jsx(Pt, { className: "w-4 h-4" }),
3791
+ /* @__PURE__ */ e.jsxs("span", { children: [
3792
+ "Joined",
3793
+ " ",
3794
+ f != null && f.created ? new Date(f.created).getFullYear() : "Unknown"
3795
+ ] })
3796
+ ] })
3797
+ ] })
3798
+ ] }),
3799
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
3800
+ /* @__PURE__ */ e.jsx(
3801
+ Mt,
3802
+ {
3803
+ id: t,
3804
+ toastType: "user",
3805
+ onAdd: (E, C) => console.log("Added:", E, C),
3806
+ onRemove: (E, C) => console.log("Removed:", E, C)
3807
+ }
3808
+ ),
3809
+ /* @__PURE__ */ e.jsx(
3810
+ "button",
3811
+ {
3812
+ onClick: k,
3813
+ className: "p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
3814
+ children: /* @__PURE__ */ e.jsx(Vt, { className: "w-4 h-4" })
3815
+ }
3816
+ ),
3817
+ /* @__PURE__ */ e.jsx(
3818
+ "button",
3819
+ {
3820
+ onClick: w,
3821
+ className: "p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",
3822
+ children: /* @__PURE__ */ e.jsx(st, { className: "w-4 h-4" })
3823
+ }
3824
+ ),
3825
+ /* @__PURE__ */ e.jsx("button", { className: "p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700", children: /* @__PURE__ */ e.jsx(at, { className: "w-4 h-4" }) })
3826
+ ] })
3827
+ ] }) })
3828
+ ] }),
3829
+ /* @__PURE__ */ e.jsxs("div", { children: [
3830
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [
3831
+ { key: "videos", label: "Videos" },
3832
+ { key: "about", label: "User Info" },
3833
+ { key: "followers", label: "Followers" },
3834
+ { key: "following", label: "Following" }
3835
+ ].map((E, C) => /* @__PURE__ */ e.jsx(
3836
+ "button",
3837
+ {
3838
+ onClick: () => i(E.key),
3839
+ className: `px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${d === E.key ? "bg-blue-600 dark:bg-blue-500 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,
3840
+ children: E.label
3841
+ },
3842
+ E.key
3843
+ )) }),
3844
+ /* @__PURE__ */ e.jsxs("div", { className: "mt-6", children: [
3845
+ d === "videos" && /* @__PURE__ */ e.jsx(
3846
+ ot,
3847
+ {
3848
+ feedType: Q.USER,
3849
+ username: t,
3850
+ onVideoClick: s,
3851
+ onAuthorClick: r
3852
+ }
3853
+ ),
3854
+ d === "about" && /* @__PURE__ */ e.jsx(as, { username: t }),
3855
+ d === "followers" && /* @__PURE__ */ e.jsx(rs, { username: t, onSelectUser: T }),
3856
+ d === "following" && /* @__PURE__ */ e.jsx(ss, { username: t, onSelectUser: T })
3857
+ ] })
3858
+ ] })
3859
+ ] });
3860
+ }, Ke = 768;
3861
+ function ks() {
3862
+ const [t, s] = Ae.useState(void 0);
3863
+ return Ae.useEffect(() => {
3864
+ const r = window.matchMedia(`(max-width: ${Ke - 1}px)`), a = () => {
3865
+ s(window.innerWidth < Ke);
3866
+ };
3867
+ return r.addEventListener("change", a), s(window.innerWidth < Ke), () => r.removeEventListener("change", a);
3868
+ }, []), !!t;
3869
+ }
3870
+ const ns = 1, os = 1e6;
3871
+ let Qe = 0;
3872
+ function is() {
3873
+ return Qe = (Qe + 1) % Number.MAX_SAFE_INTEGER, Qe.toString();
3874
+ }
3875
+ const Xe = /* @__PURE__ */ new Map(), $t = (t) => {
3876
+ if (Xe.has(t))
3877
+ return;
3878
+ const s = setTimeout(() => {
3879
+ Xe.delete(t), Ee({
3880
+ type: "REMOVE_TOAST",
3881
+ toastId: t
3882
+ });
3883
+ }, os);
3884
+ Xe.set(t, s);
3885
+ }, ls = (t, s) => {
3886
+ switch (s.type) {
3887
+ case "ADD_TOAST":
3888
+ return {
3889
+ ...t,
3890
+ toasts: [s.toast, ...t.toasts].slice(0, ns)
3891
+ };
3892
+ case "UPDATE_TOAST":
3893
+ return {
3894
+ ...t,
3895
+ toasts: t.toasts.map((r) => r.id === s.toast.id ? { ...r, ...s.toast } : r)
3896
+ };
3897
+ case "DISMISS_TOAST": {
3898
+ const { toastId: r } = s;
3899
+ return r ? $t(r) : t.toasts.forEach((a) => {
3900
+ $t(a.id);
3901
+ }), {
3902
+ ...t,
3903
+ toasts: t.toasts.map(
3904
+ (a) => a.id === r || r === void 0 ? {
3905
+ ...a,
3906
+ open: !1
3907
+ } : a
3908
+ )
3909
+ };
3910
+ }
3911
+ case "REMOVE_TOAST":
3912
+ return s.toastId === void 0 ? {
3913
+ ...t,
3914
+ toasts: []
3915
+ } : {
3916
+ ...t,
3917
+ toasts: t.toasts.filter((r) => r.id !== s.toastId)
3918
+ };
3919
+ }
3920
+ }, Pe = [];
3921
+ let Ve = { toasts: [] };
3922
+ function Ee(t) {
3923
+ Ve = ls(Ve, t), Pe.forEach((s) => {
3924
+ s(Ve);
3925
+ });
3926
+ }
3927
+ function cs({ ...t }) {
3928
+ const s = is(), r = (o) => Ee({
3929
+ type: "UPDATE_TOAST",
3930
+ toast: { ...o, id: s }
3931
+ }), a = () => Ee({ type: "DISMISS_TOAST", toastId: s });
3932
+ return Ee({
3933
+ type: "ADD_TOAST",
3934
+ toast: {
3935
+ ...t,
3936
+ id: s,
3937
+ open: !0,
3938
+ onOpenChange: (o) => {
3939
+ o || a();
3940
+ }
3941
+ }
3942
+ }), {
3943
+ id: s,
3944
+ dismiss: a,
3945
+ update: r
3946
+ };
3947
+ }
3948
+ function _s() {
3949
+ const [t, s] = Ae.useState(Ve);
3950
+ return Ae.useEffect(() => (Pe.push(s), () => {
3951
+ const r = Pe.indexOf(s);
3952
+ r > -1 && Pe.splice(r, 1);
3953
+ }), [t]), {
3954
+ ...t,
3955
+ toast: cs,
3956
+ dismiss: (r) => Ee({ type: "DISMISS_TOAST", toastId: r })
3957
+ };
3958
+ }
3959
+ export {
3960
+ Q as ApiVideoFeedType,
3961
+ $r as CommentsModal,
3962
+ vs as CommunitiesList,
3963
+ Xr as CommunityAbout,
3964
+ js as CommunityDetail,
3965
+ es as CommunityMembers,
3966
+ Zr as CommunityTeam,
3967
+ Lr as DescriptionModal,
3968
+ Mt as FavouriteWidget,
3969
+ it as Modal,
3970
+ Fr as UpvoteListModal,
3971
+ ws as UserAccount,
3972
+ rs as UserFollowers,
3973
+ ss as UserFollowing,
3974
+ as as UserInfo,
3975
+ Ns as UserProfilePage,
3976
+ Tr as VideoCard,
3977
+ bs as VideoDetail,
3978
+ ot as VideoFeed,
3979
+ Or as VideoInfo,
3980
+ ys as Wallet,
3981
+ Z as apiService,
3982
+ ls as reducer,
3983
+ me as server,
3984
+ cs as toast,
3985
+ ks as useIsMobile,
3986
+ _s as useToast,
3987
+ Kr as useWalletStore
3988
+ };