@armoyu/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/api/ApiClient.d.ts +49 -11
  2. package/dist/api/ApiClient.js +137 -33
  3. package/dist/api/ArmoyuApi.d.ts +38 -0
  4. package/dist/api/ArmoyuApi.js +66 -0
  5. package/dist/armoyu-core.bundle.js +1 -0
  6. package/dist/index.d.ts +11 -1
  7. package/dist/index.js +9 -2
  8. package/dist/models/auth/User.js +17 -22
  9. package/dist/models/core/Rule.d.ts +23 -0
  10. package/dist/models/core/Rule.js +39 -0
  11. package/dist/models/index.d.ts +1 -0
  12. package/dist/models/index.js +1 -0
  13. package/dist/models/social/Post.js +15 -15
  14. package/dist/services/AuthService.d.ts +11 -10
  15. package/dist/services/AuthService.js +56 -27
  16. package/dist/services/BaseService.d.ts +10 -0
  17. package/dist/services/BaseService.js +27 -0
  18. package/dist/services/BlogService.d.ts +16 -0
  19. package/dist/services/BlogService.js +54 -0
  20. package/dist/services/BotService.d.ts +28 -0
  21. package/dist/services/BotService.js +92 -0
  22. package/dist/services/ForumService.d.ts +19 -0
  23. package/dist/services/ForumService.js +64 -0
  24. package/dist/services/RuleService.d.ts +28 -0
  25. package/dist/services/RuleService.js +90 -0
  26. package/dist/services/ShopService.d.ts +20 -0
  27. package/dist/services/ShopService.js +53 -0
  28. package/dist/services/SocialService.d.ts +8 -7
  29. package/dist/services/SocialService.js +26 -21
  30. package/dist/services/SupportService.d.ts +16 -0
  31. package/dist/services/SupportService.js +54 -0
  32. package/dist/services/UserService.d.ts +12 -7
  33. package/dist/services/UserService.js +35 -18
  34. package/package.json +27 -21
  35. package/src/api/ApiClient.ts +0 -57
  36. package/src/index.ts +0 -24
  37. package/src/models/auth/Role.ts +0 -26
  38. package/src/models/auth/Session.ts +0 -50
  39. package/src/models/auth/User.ts +0 -111
  40. package/src/models/community/Classroom.ts +0 -34
  41. package/src/models/community/Event.ts +0 -32
  42. package/src/models/community/Faculty.ts +0 -30
  43. package/src/models/community/Forum.ts +0 -42
  44. package/src/models/community/Giveaway.ts +0 -39
  45. package/src/models/community/Group.ts +0 -78
  46. package/src/models/community/School.ts +0 -51
  47. package/src/models/community/SchoolTeam.ts +0 -49
  48. package/src/models/community/Station.ts +0 -145
  49. package/src/models/community/Survey.ts +0 -53
  50. package/src/models/community/SurveyAnswer.ts +0 -26
  51. package/src/models/community/Team.ts +0 -24
  52. package/src/models/community/Workplace.ts +0 -32
  53. package/src/models/content/Game.ts +0 -39
  54. package/src/models/content/Media.ts +0 -30
  55. package/src/models/content/Mod.ts +0 -38
  56. package/src/models/content/News.ts +0 -43
  57. package/src/models/content/Project.ts +0 -49
  58. package/src/models/core/PlatformStats.ts +0 -74
  59. package/src/models/core/SystemSettings.ts +0 -59
  60. package/src/models/index.ts +0 -37
  61. package/src/models/shop/CartItem.ts +0 -31
  62. package/src/models/shop/Order.ts +0 -48
  63. package/src/models/shop/Product.ts +0 -61
  64. package/src/models/social/Chat.ts +0 -47
  65. package/src/models/social/ChatMessage.ts +0 -30
  66. package/src/models/social/Comment.ts +0 -38
  67. package/src/models/social/Group.ts +0 -63
  68. package/src/models/social/Leaderboard.ts +0 -57
  69. package/src/models/social/Note.ts +0 -28
  70. package/src/models/social/Notification.ts +0 -99
  71. package/src/models/social/NotificationSender.ts +0 -36
  72. package/src/models/social/Post.ts +0 -75
  73. package/src/models/social/Story.ts +0 -30
  74. package/src/models/social/SupportTicket.ts +0 -38
  75. package/src/models/store/StoreItem.ts +0 -32
  76. package/src/services/AuthService.ts +0 -91
  77. package/src/services/SocialService.ts +0 -92
  78. package/src/services/SocketService.ts +0 -112
  79. package/src/services/UserService.ts +0 -69
  80. package/src/types/stats.ts +0 -17
  81. package/tsconfig.json +0 -16
@@ -1,16 +1,54 @@
1
1
  /**
2
2
  * Core API Client for the ARMOYU platform.
3
- * Used by all services in armoyu-core.
3
+ * Supports instance-based configuration and standard HTTP methods.
4
4
  */
5
- export declare const ApiConfig: {
6
- setBaseUrl(url: string): void;
7
- setToken(token: string | null): void;
8
- getToken(): string | null;
9
- };
5
+ export declare class ApiError extends Error {
6
+ message: string;
7
+ status?: number | undefined;
8
+ statusText?: string | undefined;
9
+ data?: any | undefined;
10
+ constructor(message: string, status?: number | undefined, statusText?: string | undefined, data?: any | undefined);
11
+ }
12
+ export declare enum HttpMethod {
13
+ GET = "GET",
14
+ POST = "POST",
15
+ PUT = "PUT",
16
+ PATCH = "PATCH",
17
+ DELETE = "DELETE"
18
+ }
19
+ export interface ApiRequestOptions extends RequestInit {
20
+ params?: Record<string, string | number | boolean | undefined>;
21
+ method?: HttpMethod | string;
22
+ }
23
+ export interface ApiConfig {
24
+ baseUrl: string;
25
+ token?: string | null;
26
+ apiKey?: string | null;
27
+ headers?: Record<string, string>;
28
+ }
29
+ /**
30
+ * Standard API Response structure for ARMOYU legacy and bot APIs.
31
+ */
32
+ export interface StandardApiResponse<T = any> {
33
+ durum: number;
34
+ aciklama: string | any;
35
+ aciklamadetay?: number;
36
+ icerik: T;
37
+ zaman: string;
38
+ }
10
39
  export declare class ApiClient {
11
- private static request;
12
- static get<T>(endpoint: string, options?: RequestInit): Promise<T>;
13
- static post<T>(endpoint: string, body: unknown, options?: RequestInit): Promise<T>;
14
- static put<T>(endpoint: string, body: unknown, options?: RequestInit): Promise<T>;
15
- static delete<T>(endpoint: string, options?: RequestInit): Promise<T>;
40
+ private config;
41
+ lastRawResponse: any;
42
+ constructor(config: ApiConfig);
43
+ private request;
44
+ get<T>(endpoint: string, options?: ApiRequestOptions): Promise<T>;
45
+ post<T>(endpoint: string, body?: any, options?: ApiRequestOptions): Promise<T>;
46
+ put<T>(endpoint: string, body?: any, options?: ApiRequestOptions): Promise<T>;
47
+ patch<T>(endpoint: string, body?: any, options?: ApiRequestOptions): Promise<T>;
48
+ delete<T>(endpoint: string, options?: ApiRequestOptions): Promise<T>;
49
+ setToken(token: string | null): void;
50
+ setApiKey(key: string | null): void;
51
+ getApiKey(): string | null;
52
+ setBaseUrl(url: string): void;
16
53
  }
54
+ export declare const defaultApiClient: ApiClient;
@@ -1,50 +1,154 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Core API Client for the ARMOYU platform.
4
- * Used by all services in armoyu-core.
4
+ * Supports instance-based configuration and standard HTTP methods.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ApiClient = exports.ApiConfig = void 0;
8
- let _apiUrl = 'https://api.aramizdakioyuncu.com';
9
- let _token = null;
10
- exports.ApiConfig = {
11
- setBaseUrl(url) {
12
- _apiUrl = url;
13
- },
14
- setToken(token) {
15
- _token = token;
16
- },
17
- getToken() {
18
- return _token;
7
+ exports.defaultApiClient = exports.ApiClient = exports.HttpMethod = exports.ApiError = void 0;
8
+ class ApiError extends Error {
9
+ constructor(message, status, statusText, data) {
10
+ super(message);
11
+ this.message = message;
12
+ this.status = status;
13
+ this.statusText = statusText;
14
+ this.data = data;
15
+ this.name = 'ApiError';
19
16
  }
20
- };
17
+ }
18
+ exports.ApiError = ApiError;
19
+ var HttpMethod;
20
+ (function (HttpMethod) {
21
+ HttpMethod["GET"] = "GET";
22
+ HttpMethod["POST"] = "POST";
23
+ HttpMethod["PUT"] = "PUT";
24
+ HttpMethod["PATCH"] = "PATCH";
25
+ HttpMethod["DELETE"] = "DELETE";
26
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
21
27
  class ApiClient {
22
- static async request(endpoint, options = {}) {
23
- const headers = new Headers(options.headers || {});
24
- headers.set('Content-Type', 'application/json');
25
- if (_token) {
26
- headers.set('Authorization', `Bearer ${_token}`);
28
+ constructor(config) {
29
+ this.lastRawResponse = null;
30
+ this.config = {
31
+ ...config,
32
+ headers: {
33
+ ...config.headers,
34
+ },
35
+ };
36
+ }
37
+ async request(endpoint, options = {}) {
38
+ const { params, ...fetchOptions } = options;
39
+ // Build URL with query parameters
40
+ let url = `${this.config.baseUrl}${endpoint}`;
41
+ if (params) {
42
+ const searchParams = new URLSearchParams();
43
+ Object.entries(params).forEach(([key, value]) => {
44
+ if (value !== undefined) {
45
+ searchParams.append(key, String(value));
46
+ }
47
+ });
48
+ const queryString = searchParams.toString();
49
+ if (queryString) {
50
+ url += (url.includes('?') ? '&' : '?') + queryString;
51
+ }
52
+ }
53
+ const headers = new Headers(this.config.headers || {});
54
+ // Default to JSON body handling if it's a plain object
55
+ let requestBody = options.body;
56
+ if (options.body && typeof options.body === 'object' &&
57
+ !(options.body instanceof URLSearchParams) &&
58
+ !(typeof FormData !== 'undefined' && options.body instanceof FormData)) {
59
+ headers.set('Content-Type', 'application/json');
60
+ requestBody = JSON.stringify(options.body);
61
+ }
62
+ if (this.config.token) {
63
+ // Validate token to avoid 'non ISO-8859-1' errors in headers
64
+ const isAscii = /^[ -~]*$/.test(this.config.token);
65
+ if (isAscii) {
66
+ headers.set('Authorization', `Bearer ${this.config.token}`);
67
+ }
68
+ else {
69
+ console.warn('[ApiClient] Token contains invalid characters, skipping Authorization header.');
70
+ }
27
71
  }
28
- const response = await fetch(`${_apiUrl}${endpoint}`, {
72
+ if (this.config.apiKey) {
73
+ headers.set('X-API-KEY', this.config.apiKey);
74
+ }
75
+ try {
76
+ const response = await fetch(url, {
77
+ ...fetchOptions,
78
+ headers,
79
+ body: requestBody
80
+ });
81
+ let responseData;
82
+ const contentType = response.headers.get('content-type');
83
+ if (contentType && contentType.includes('application/json')) {
84
+ responseData = await response.json();
85
+ }
86
+ else {
87
+ const text = await response.text();
88
+ try {
89
+ // Robust JSON parsing for some ARMOYU API endpoints that return JSON but with wrong Content-Type
90
+ responseData = JSON.parse(text);
91
+ }
92
+ catch {
93
+ responseData = text;
94
+ }
95
+ }
96
+ if (!response.ok) {
97
+ this.lastRawResponse = responseData;
98
+ const errorMsg = (responseData === null || responseData === void 0 ? void 0 : responseData.aciklama) || (responseData === null || responseData === void 0 ? void 0 : responseData.message) || `API Error: ${response.status} - ${response.statusText}`;
99
+ throw new ApiError(errorMsg, response.status, response.statusText, responseData);
100
+ }
101
+ this.lastRawResponse = responseData;
102
+ return responseData;
103
+ }
104
+ catch (error) {
105
+ if (error instanceof ApiError)
106
+ throw error;
107
+ throw new ApiError(error instanceof Error ? error.message : 'Unknown Network Error');
108
+ }
109
+ }
110
+ async get(endpoint, options) {
111
+ return this.request(endpoint, { ...options, method: HttpMethod.GET });
112
+ }
113
+ async post(endpoint, body, options) {
114
+ return this.request(endpoint, {
29
115
  ...options,
30
- headers,
116
+ method: HttpMethod.POST,
117
+ body: body
118
+ });
119
+ }
120
+ async put(endpoint, body, options) {
121
+ return this.request(endpoint, {
122
+ ...options,
123
+ method: HttpMethod.PUT,
124
+ body: body
125
+ });
126
+ }
127
+ async patch(endpoint, body, options) {
128
+ return this.request(endpoint, {
129
+ ...options,
130
+ method: HttpMethod.PATCH,
131
+ body: body
31
132
  });
32
- if (!response.ok) {
33
- throw new Error(`API Error: ${response.status} - ${response.statusText}`);
34
- }
35
- return response.json();
36
133
  }
37
- static async get(endpoint, options) {
38
- return this.request(endpoint, { ...options, method: 'GET' });
134
+ async delete(endpoint, options) {
135
+ return this.request(endpoint, { ...options, method: HttpMethod.DELETE });
39
136
  }
40
- static async post(endpoint, body, options) {
41
- return this.request(endpoint, { ...options, method: 'POST', body: JSON.stringify(body) });
137
+ setToken(token) {
138
+ this.config.token = token;
42
139
  }
43
- static async put(endpoint, body, options) {
44
- return this.request(endpoint, { ...options, method: 'PUT', body: JSON.stringify(body) });
140
+ setApiKey(key) {
141
+ this.config.apiKey = key;
45
142
  }
46
- static async delete(endpoint, options) {
47
- return this.request(endpoint, { ...options, method: 'DELETE' });
143
+ getApiKey() {
144
+ return this.config.apiKey || null;
145
+ }
146
+ setBaseUrl(url) {
147
+ this.config.baseUrl = url;
48
148
  }
49
149
  }
50
150
  exports.ApiClient = ApiClient;
151
+ // Default instance for shared use
152
+ exports.defaultApiClient = new ApiClient({
153
+ baseUrl: 'https://api.aramizdakioyuncu.com'
154
+ });
@@ -0,0 +1,38 @@
1
+ import { ApiConfig } from './ApiClient';
2
+ import { AuthService } from '../services/AuthService';
3
+ import { UserService } from '../services/UserService';
4
+ import { SocialService } from '../services/SocialService';
5
+ import { BlogService } from '../services/BlogService';
6
+ import { ShopService } from '../services/ShopService';
7
+ import { ForumService } from '../services/ForumService';
8
+ import { SupportService } from '../services/SupportService';
9
+ import { RuleService } from '../services/RuleService';
10
+ /**
11
+ * The main entry point for the ARMOYU platform API.
12
+ * Organizes all services into logical categories.
13
+ */
14
+ export declare class ArmoyuApi {
15
+ auth: AuthService;
16
+ users: UserService;
17
+ social: SocialService;
18
+ blog: BlogService;
19
+ shop: ShopService;
20
+ forum: ForumService;
21
+ support: SupportService;
22
+ rules: RuleService;
23
+ private client;
24
+ constructor(config?: Partial<ApiConfig>);
25
+ /**
26
+ * Set a new authentication token for all services.
27
+ */
28
+ setToken(token: string | null): void;
29
+ /**
30
+ * Set a new API key for bot/rule services.
31
+ */
32
+ setApiKey(key: string | null): void;
33
+ /**
34
+ * Get the last raw JSON response received from the API.
35
+ */
36
+ get lastResponse(): any;
37
+ }
38
+ export declare const armoyu: ArmoyuApi;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.armoyu = exports.ArmoyuApi = void 0;
4
+ const ApiClient_1 = require("./ApiClient");
5
+ const AuthService_1 = require("../services/AuthService");
6
+ const UserService_1 = require("../services/UserService");
7
+ const SocialService_1 = require("../services/SocialService");
8
+ const BlogService_1 = require("../services/BlogService");
9
+ const ShopService_1 = require("../services/ShopService");
10
+ const ForumService_1 = require("../services/ForumService");
11
+ const SupportService_1 = require("../services/SupportService");
12
+ const RuleService_1 = require("../services/RuleService");
13
+ /**
14
+ * The main entry point for the ARMOYU platform API.
15
+ * Organizes all services into logical categories.
16
+ */
17
+ class ArmoyuApi {
18
+ constructor(config) {
19
+ // Use provided config or default client
20
+ if (config && config.baseUrl) {
21
+ this.client = new ApiClient_1.ApiClient({
22
+ baseUrl: config.baseUrl,
23
+ token: config.token || null,
24
+ apiKey: config.apiKey || null,
25
+ headers: config.headers || {},
26
+ });
27
+ }
28
+ else {
29
+ this.client = ApiClient_1.defaultApiClient;
30
+ if (config && config.token)
31
+ this.client.setToken(config.token);
32
+ if (config && config.apiKey)
33
+ this.client.setApiKey(config.apiKey);
34
+ }
35
+ // Initialize services with the api client
36
+ this.auth = new AuthService_1.AuthService(this.client);
37
+ this.users = new UserService_1.UserService(this.client);
38
+ this.social = new SocialService_1.SocialService(this.client);
39
+ this.blog = new BlogService_1.BlogService(this.client);
40
+ this.shop = new ShopService_1.ShopService(this.client);
41
+ this.forum = new ForumService_1.ForumService(this.client);
42
+ this.support = new SupportService_1.SupportService(this.client);
43
+ this.rules = new RuleService_1.RuleService(this.client);
44
+ }
45
+ /**
46
+ * Set a new authentication token for all services.
47
+ */
48
+ setToken(token) {
49
+ this.client.setToken(token);
50
+ }
51
+ /**
52
+ * Set a new API key for bot/rule services.
53
+ */
54
+ setApiKey(key) {
55
+ this.client.setApiKey(key);
56
+ }
57
+ /**
58
+ * Get the last raw JSON response received from the API.
59
+ */
60
+ get lastResponse() {
61
+ return this.client.lastRawResponse;
62
+ }
63
+ }
64
+ exports.ArmoyuApi = ArmoyuApi;
65
+ // Global singleton instance for easy access
66
+ exports.armoyu = new ArmoyuApi();
@@ -0,0 +1 @@
1
+ "use strict";var ArmoyuCore=(()=>{var $e=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Or=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(i&&(e=i(i=0)),e);var Ge=(i,e)=>{for(var t in e)$e(i,t,{get:e[t],enumerable:!0})},Ar=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xr(e))!Or.call(i,s)&&s!==t&&$e(i,s,{get:()=>e[s],enumerable:!(r=vr(e,s))||r.enumerable});return i};var Tr=i=>Ar($e({},"__esModule",{value:!0}),i);var S,ce,le,Te=h(()=>{S=Object.create(null);S.open="0";S.close="1";S.ping="2";S.pong="3";S.message="4";S.upgrade="5";S.noop="6";ce=Object.create(null);Object.keys(S).forEach(i=>{ce[S[i]]=i});le={type:"error",data:"parser error"}});function Dt(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}function Vt(i,e){if(Mt&&i.data instanceof Blob)return i.data.arrayBuffer().then(Dt).then(e);if(Ft&&(i.data instanceof ArrayBuffer||qt(i.data)))return e(Dt(i.data));ue(i,!1,t=>{pt||(pt=new TextEncoder),e(pt.encode(t))})}var Mt,Ft,qt,ue,Jt,pt,$t=h(()=>{Te();Mt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ft=typeof ArrayBuffer=="function",qt=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,ue=({type:i,data:e},t,r)=>Mt&&e instanceof Blob?t?r(e):Jt(e,r):Ft&&(e instanceof ArrayBuffer||qt(e))?t?r(e):Jt(new Blob([e]),r):r(S[i]+(e||"")),Jt=(i,e)=>{let t=new FileReader;return t.onload=function(){let r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(i)}});var Gt,he,Kt,Ht=h(()=>{Gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",he=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Gt.length;i++)he[Gt.charCodeAt(i)]=i;Kt=i=>{let e=i.length*.75,t=i.length,r,s=0,n,o,l,c;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);let m=new ArrayBuffer(e),d=new Uint8Array(m);for(r=0;r<t;r+=4)n=he[i.charCodeAt(r)],o=he[i.charCodeAt(r+1)],l=he[i.charCodeAt(r+2)],c=he[i.charCodeAt(r+3)],d[s++]=n<<2|o>>4,d[s++]=(o&15)<<4|l>>2,d[s++]=(l&3)<<6|c&63;return m}});var Nr,pe,Er,zt,Yt=h(()=>{Te();Ht();Nr=typeof ArrayBuffer=="function",pe=(i,e)=>{if(typeof i!="string")return{type:"message",data:zt(i,e)};let t=i.charAt(0);return t==="b"?{type:"message",data:Er(i.substring(1),e)}:ce[t]?i.length>1?{type:ce[t],data:i.substring(1)}:{type:ce[t]}:le},Er=(i,e)=>{if(Nr){let t=Kt(i);return zt(t,e)}else return{base64:!0,data:i}},zt=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer});function Zt(){return new TransformStream({transform(i,e){Vt(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}function Ne(i){return i.reduce((e,t)=>e+t.length,0)}function Ee(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function jt(i,e){mt||(mt=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,l){for(t.push(o);;){if(r===0){if(Ne(t)<1)break;let c=Ee(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(Ne(t)<2)break;let c=Ee(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ne(t)<8)break;let c=Ee(t,8),m=new DataView(c.buffer,c.byteOffset,c.length),d=m.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(le);break}s=d*Math.pow(2,32)+m.getUint32(4),r=3}else{if(Ne(t)<s)break;let c=Ee(t,s);l.enqueue(pe(n?c:mt.decode(c),e)),r=0}if(s===0||s>i){l.enqueue(le);break}}}})}var Wt,Xt,Qt,mt,ft,z=h(()=>{$t();Yt();Te();Wt="",Xt=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{ue(n,!1,l=>{r[o]=l,++s===t&&e(r.join(Wt))})})},Qt=(i,e)=>{let t=i.split(Wt),r=[];for(let s=0;s<t.length;s++){let n=pe(t[s],e);if(r.push(n),n.type==="error")break}return r};ft=4});function p(i){if(i)return Rr(i)}function Rr(i){for(var e in p.prototype)i[e]=p.prototype[e];return i}var B=h(()=>{p.prototype.on=p.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};p.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};p.prototype.off=p.prototype.removeListener=p.prototype.removeAllListeners=p.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};p.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};p.prototype.emitReserved=p.prototype.emit;p.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};p.prototype.hasListeners=function(i){return!!this.listeners(i).length}});var _,y,er,I=h(()=>{_=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),y=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),er="arraybuffer"});function Re(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}function v(i,e){e.useNativeTimers?(i.setTimeoutFn=Pr.bind(y),i.clearTimeoutFn=Cr.bind(y)):(i.setTimeoutFn=y.setTimeout.bind(y),i.clearTimeoutFn=y.clearTimeout.bind(y))}function tr(i){return typeof i=="string"?Lr(i):Math.ceil((i.byteLength||i.size)*Ur)}function Lr(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}function Pe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}var Pr,Cr,Ur,J=h(()=>{I();Pr=y.setTimeout,Cr=y.clearTimeout;Ur=1.33});function rr(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function ir(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var dt=h(()=>{});var Ce,x,me=h(()=>{z();B();J();dt();Ce=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},x=class extends p{constructor(e){super(),this.writable=!1,v(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new Ce(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=pe(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=rr(e);return t.length?"?"+t:""}}});var Y,gt=h(()=>{me();J();z();Y=class extends x{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Qt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Xt(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Pe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}});var sr,nr,or=h(()=>{sr=!1;try{sr=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}nr=sr});function Br(){}function ar(){for(let i in N.requests)N.requests.hasOwnProperty(i)&&N.requests[i].abort()}function cr(i){let e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||nr))return new XMLHttpRequest}catch{}if(!e)try{return new y[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var yt,N,Ir,O,Ue=h(()=>{gt();B();J();I();or();yt=class extends Y{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",r=location.port;r||(r=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},N=class i extends p{constructor(e,t,r){super(),this.createRequest=e,v(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;let t=Re(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(t);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=i.requestsCount++,i.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Br,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete i.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};N.requestsCount=0;N.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ar);else if(typeof addEventListener=="function"){let i="onpagehide"in y?"pagehide":"unload";addEventListener(i,ar,!1)}}Ir=(function(){let i=cr({xdomain:!1});return i&&i.responseType!==null})(),O=class extends yt{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ir&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new N(cr,this.uri(),e)}}});var lr,St,bt,A,Le=h(()=>{me();J();z();I();lr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",St=class extends x{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,r=lr?{}:Re(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;ue(r,this.supportsBinary,n=>{try{this.doWrite(r,n)}catch{}s&&_(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Pe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},bt=y.WebSocket||y.MozWebSocket,A=class extends St{createSocket(e,t,r){return lr?new bt(e,t,r):t?new bt(e,t):new bt(e)}doWrite(e,t){this.ws.send(t)}}});var D,wt=h(()=>{me();I();z();D=class extends x{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=jt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=Zt();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();let n=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),n())}).catch(l=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this._writer.write(r).then(()=>{s&&_(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}});var kt,_t=h(()=>{Ue();Le();wt();kt={websocket:A,webtransport:D,polling:O}});function W(i){if(i.length>8e3)throw"URI too long";let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=Jr.exec(i||""),n={},o=14;for(;o--;)n[Dr[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Mr(n,n.path),n.queryKey=Fr(n,n.query),n}function Mr(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Fr(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Jr,Dr,vt=h(()=>{Jr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Dr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]});var xt,Be,M,Ie,X,Ot=h(()=>{_t();J();dt();vt();B();z();I();xt=typeof addEventListener=="function"&&typeof removeEventListener=="function",Be=[];xt&&addEventListener("offline",()=>{Be.forEach(i=>i())},!1);M=class i extends p{constructor(e,t){if(super(),this.binaryType=er,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){let r=W(e);t.hostname=r.host,t.secure=r.protocol==="https"||r.protocol==="wss",t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=W(t.host).host);v(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(r=>{let s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ir(this.opts.query)),xt&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Be.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=ft,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=tr(s)),r>0&&t>this._maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(i.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),xt&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=Be.indexOf(this._offlineEventListener);r!==-1&&Be.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}};M.protocol=ft;Ie=class extends M{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;M.priorWebsocketSuccess=!1;let s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;M.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let Q=new Error("probe error");Q.transport=t.name,this.emitReserved("upgradeError",Q)}}))};function n(){r||(r=!0,d(),t.close(),t=null)}let o=g=>{let Q=new Error("probe error: "+g);Q.transport=t.name,n(),this.emitReserved("upgradeError",Q)};function l(){o("transport closed")}function c(){o("socket closed")}function m(g){t&&g.name!==t.name&&n()}let d=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",l),this.off("close",c),this.off("upgrading",m)};t.once("open",s),t.once("error",o),t.once("close",l),this.once("close",c),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}},X=class extends Ie{constructor(e,t={}){let r=typeof e=="object"?e:t;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>kt[s]).filter(s=>!!s)),super(e,r)}}});var fe,ur=h(()=>{gt();fe=class extends Y{doPoll(){this._fetch().then(e=>{if(!e.ok)return this.onError("fetch read error",e.status,e);e.text().then(t=>this.onData(t))}).catch(e=>{this.onError("fetch read error",e)})}doWrite(e,t){this._fetch(e).then(r=>{if(!r.ok)return this.onError("fetch write error",r.status,r);t()}).catch(r=>{this.onError("fetch write error",r)})}_fetch(e){var t;let r=e!==void 0,s=new Headers(this.opts.extraHeaders);return r&&s.set("content-type","text/plain;charset=UTF-8"),(t=this.socket._cookieJar)===null||t===void 0||t.appendCookies(s),fetch(this.uri(),{method:r?"POST":"GET",body:r?e:null,headers:s,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}}});var So,Je=h(()=>{Ot();Ot();me();_t();J();vt();I();ur();Ue();Ue();Le();Le();wt();So=X.protocol});function hr(i,e="",t){let r=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),r=W(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var pr=h(()=>{Je()});function ge(i){return qr&&(i instanceof ArrayBuffer||Vr(i))||$r&&i instanceof Blob||Gr&&i instanceof File}function de(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if(de(i[t]))return!0;return!1}if(ge(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return de(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&de(i[t]))return!0;return!1}var qr,Vr,mr,$r,Gr,At=h(()=>{qr=typeof ArrayBuffer=="function",Vr=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,mr=Object.prototype.toString,$r=typeof Blob=="function"||typeof Blob<"u"&&mr.call(Blob)==="[object BlobConstructor]",Gr=typeof File=="function"||typeof File<"u"&&mr.call(File)==="[object FileConstructor]"});function fr(i){let e=[],t=i.data,r=i;return r.data=Tt(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Tt(i,e){if(!i)return i;if(ge(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Tt(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Tt(i[r],e));return t}return i}function dr(i,e){return i.data=Nt(i.data,e),delete i.attachments,i}function Nt(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Nt(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Nt(i[t],e));return i}var gr=h(()=>{At()});var Ut={};Ge(Ut,{Decoder:()=>Rt,Encoder:()=>Et,PacketType:()=>u,isPacketValid:()=>Yr,protocol:()=>Ct});function Kr(i){return typeof i=="string"}function Hr(i){return i===void 0||br(i)}function De(i){return Object.prototype.toString.call(i)==="[object Object]"}function zr(i,e){switch(i){case u.CONNECT:return e===void 0||De(e);case u.DISCONNECT:return e===void 0;case u.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&yr.indexOf(e[0])===-1);case u.ACK:return Array.isArray(e);case u.CONNECT_ERROR:return typeof e=="string"||De(e);default:return!1}}function Yr(i){return Kr(i.nsp)&&Hr(i.id)&&zr(i.type,i.data)}var yr,Ct,u,Et,Rt,Pt,br,Me=h(()=>{B();gr();At();yr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ct=5;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(u||(u={}));Et=class{constructor(e){this.replacer=e}encode(e){return(e.type===u.EVENT||e.type===u.ACK)&&de(e)?this.encodeAsBinary({type:e.type===u.EVENT?u.BINARY_EVENT:u.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===u.BINARY_EVENT||e.type===u.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=fr(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}},Rt=class i extends p{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===u.BINARY_EVENT;r||t.type===u.BINARY_ACK?(t.type=r?u.EVENT:u.ACK,this.reconstructor=new Pt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ge(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(u[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===u.BINARY_EVENT||r.type===u.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");let l=Number(o);if(!br(l)||l<0)throw new Error("Illegal attachments");if(l>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=l}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case u.CONNECT:return De(t);case u.DISCONNECT:return t===void 0;case u.CONNECT_ERROR:return typeof t=="string"||De(t);case u.EVENT:case u.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&yr.indexOf(t[0])===-1);case u.ACK:case u.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Pt=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=dr(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};br=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i}});function b(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var Lt=h(()=>{});var Wr,F,Bt=h(()=>{Me();Lt();B();Wr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),F=class extends p{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[b(e,"open",this.onopen.bind(this)),b(e,"packet",this.onpacket.bind(this)),b(e,"error",this.onerror.bind(this)),b(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,s,n;if(Wr.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:u.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let d=this.ids++,g=t.pop();this._registerAckCallback(d,g),o.id=d}let l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);t.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(n),t.apply(this,l)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((r,s)=>{let n=(o,l)=>o?s(o):r(l);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:u.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){let r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case u.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case u.EVENT:case u.BINARY_EVENT:this.onevent(e);break;case u.ACK:case u.BINARY_ACK:this.onack(e);break;case u.DISCONNECT:this.ondisconnect();break;case u.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,t.packet({type:u.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:u.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}}});function q(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}var Sr=h(()=>{q.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=(Math.floor(e*10)&1)==0?i-t:i+t}return Math.min(i,this.max)|0};q.prototype.reset=function(){this.attempts=0};q.prototype.setMin=function(i){this.ms=i};q.prototype.setMax=function(i){this.max=i};q.prototype.setJitter=function(i){this.jitter=i}});var V,wr=h(()=>{Je();Bt();Me();Lt();Sr();B();V=class extends p{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,v(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new q({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Ut;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new X(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=b(t,"open",function(){r.onopen(),e&&e()}),n=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},o=b(t,"error",n);if(this._timeout!==!1){let l=this._timeout,c=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),t.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(b(e,"ping",this.onping.bind(this)),b(e,"data",this.ondata.bind(this)),b(e,"error",this.onerror.bind(this)),b(e,"close",this.onclose.bind(this)),b(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){_(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new F(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}});var kr={};Ge(kr,{Fetch:()=>fe,Manager:()=>V,NodeWebSocket:()=>A,NodeXHR:()=>O,Socket:()=>F,WebSocket:()=>A,WebTransport:()=>D,XHR:()=>O,connect:()=>Fe,default:()=>Fe,io:()=>Fe,protocol:()=>Ct});function Fe(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=hr(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=ye[s]&&n in ye[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return l?c=new V(r,e):(ye[s]||(ye[s]=new V(r,e)),c=ye[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}var ye,_r=h(()=>{pr();wr();Bt();Me();Je();ye={};Object.assign(Fe,{Manager:V,Socket:F,io:Fe,connect:Fe})});var Qr={};Ge(Qr,{ApiClient:()=>H,ApiError:()=>K,ArmoyuApi:()=>Ve,ArmoyuEvent:()=>Ze,AuthService:()=>oe,BaseService:()=>f,BlogService:()=>Se,CartItem:()=>E,Chat:()=>Z,ChatMessage:()=>R,Classroom:()=>ie,Comment:()=>Ke,Faculty:()=>re,Forum:()=>Xe,ForumService:()=>ke,Game:()=>ot,Giveaway:()=>We,Group:()=>T,HttpMethod:()=>ut,Leaderboard:()=>Ye,LeaderboardEntry:()=>ee,Media:()=>at,Mod:()=>ct,News:()=>L,Note:()=>ze,Notification:()=>P,NotificationSender:()=>w,Order:()=>ne,PlatformStats:()=>st,Post:()=>G,Product:()=>k,Project:()=>lt,Role:()=>$,Rule:()=>C,RuleService:()=>ve,School:()=>tt,SchoolTeam:()=>se,Session:()=>j,ShopService:()=>we,SocialService:()=>be,Station:()=>je,StationCoupon:()=>Ae,StationProduct:()=>xe,StoreItem:()=>it,Story:()=>He,SupportService:()=>_e,SupportTicket:()=>U,Survey:()=>et,SurveyAnswer:()=>te,SystemSettings:()=>nt,Team:()=>rt,User:()=>a,UserService:()=>ae,Workplace:()=>Qe,WorkstationEquipment:()=>Oe,armoyu:()=>Xr,defaultApiClient:()=>ht,socketService:()=>qe});var $=class i{constructor(e){this.id="";this.name="";this.color="";this.permissions=[];Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",color:e.color||"#808080",permissions:e.permissions||[]})}};var w=class i{constructor(e){this.id="";this.name="";this.avatar="";this.type="SYSTEM";Object.assign(this,e)}static system(){return new i({id:"system",name:"ARMOYU",avatar:"https://armoyu.com/assets/img/armoyu_logo.png",type:"SYSTEM"})}};var a=class i{constructor(e){this.id="";this.username="";this.displayName="";this.avatar="";this.banner="";this.bio="";this.role=null;this.verified=!1;this.level=1;this.xp=0;this.popScore=0;this.groups=[];this.friends=[];this.myPosts=[];this.career=[];this.punishmentCount=0;this.distrustScore=1;this.odp=50;Object.assign(this,e),this.punishmentCount=e.punishmentCount||0,this.distrustScore=e.distrustScore||1,this.odp=e.odp||50}addCareerEvent(e){let t={...e,id:`CR-${Math.random().toString(36).substr(2,5).toUpperCase()}`};this.career=[t,...this.career||[]]}getProfileUrl(){return`/oyuncular/${this.username}`}toNotificationSender(){return new w({id:this.id,name:this.displayName,avatar:this.avatar,type:"USER",url:this.getProfileUrl()})}static fromJSON(e){let t=e.avatar||{},r=e.banner||{},s=e.detailInfo||{},n=e.userRole||{};return new i({id:String(e.owner_ID||e.playerID||e.id||e.id_user||e.user_id||""),username:e.username||e.user_name||e.owner_username||e.oyuncu_ad||"",displayName:e.displayname||e.owner_displayname||e.displayName||e.user_displayname||e.name||e.username||"",avatar:typeof t=="object"?t.media_URL||t.media_minURL||t.media_bigURL||"":t,banner:typeof r=="object"?r.media_URL||r.media_bigURL||r.media_minURL||"":r,bio:s.about||e.bio||e.oyuncu_bio||"",role:n.roleName?$.fromJSON({name:n.roleName,color:n.roleColor}):e.role?$.fromJSON(e.role):null,verified:e.verified||e.oyuncu_onay===1||!1,level:Number(e.level||e.oyuncu_seviye||1),xp:Number(e.levelXP||e.xp||e.user_xp||0),popScore:Number(e.popScore||e.user_popscore||0),groups:e.groups||e.user_groups||[],friends:Array.isArray(e.friends)?e.friends.map(o=>o instanceof i?o:i.fromJSON(o)):[]})}};var k=class i{constructor(e){this.isFeatured=!1;this.id=e.id||"",this.name=e.name||"",this.description=e.description||"",this.price=e.price||0,this.discountPrice=e.discountPrice,this.image=e.image||"",this.category=e.category||"",this.stock=e.stock||0,this.tags=e.tags||[],this.isFeatured=e.isFeatured||!1,this.badge=e.badge}getDisplayPrice(){return this.discountPrice&&this.discountPrice<this.price?this.discountPrice:this.price}static fromJSON(e){let t=r=>{if(typeof r=="number")return r;if(typeof r=="string"){let s=r.replace(/[₺,]/g,"").replace(" ","");return parseFloat(s)||0}return 0};return new i({id:e.id||"",name:e.name||e.product_name||"",description:e.description||e.desc||"",price:t(e.price),discountPrice:e.discountPrice!==void 0?t(e.discountPrice):void 0,image:e.image||e.img_url||"",category:e.category||"Genel",stock:e.stock||0,tags:e.tags||[],isFeatured:e.isFeatured||e.is_featured||!1,badge:e.badge})}};var E=class i{constructor(e){this.product=e.product||new k({}),this.id=e.id||`cart_${this.product.id}_${Date.now()}`,this.quantity=e.quantity||1,this.addedAt=e.addedAt||Date.now()}getTotalPrice(){return this.product.getDisplayPrice()*this.quantity}static fromJSON(e){return new i({id:e.id||"",product:e.product?k.fromJSON(e.product):void 0,quantity:e.quantity||1,addedAt:e.addedAt||Date.now()})}};var R=class i{constructor(e){this.id="";this.sender=null;this.content="";this.timestamp="";this.isSystem=!1;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",sender:e.sender?a.fromJSON(e.sender):e.sender_name?new a({displayName:e.sender_name}):null,content:e.content||e.text||"",timestamp:e.timestamp||e.time||"",isSystem:e.isSystem||e.is_system||!1})}};var Z=class i{constructor(e){this.id="";this.participants=[];this.name="";this.avatar="";this.lastMessage=null;this.time="";this.unreadCount=0;this.isOnline=!1;this.lastSeen="";this.updatedAt=0;this.isGroup=!1;this.isFavorite=!1;this.messages=[];Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",participants:Array.isArray(e.participants)?e.participants.map(t=>a.fromJSON(t)):[],name:e.name||"",avatar:e.avatar||"",lastMessage:e.lastMessage?R.fromJSON(e.lastMessage):e.last_message?R.fromJSON(e.last_message):null,time:e.time||"",unreadCount:e.unreadCount||e.unread_count||0,isOnline:e.isOnline||e.is_online||!1,lastSeen:e.lastSeen||e.last_seen||"",updatedAt:e.updatedAt||e.updated_at||0,isGroup:e.isGroup||e.is_group||!1,isFavorite:e.isFavorite||e.is_favorite||!1,messages:Array.isArray(e.messages)?e.messages.map(t=>R.fromJSON(t)):[]})}};var T=class i{constructor(e){this.id="";this.name="";this.shortName="";this.slug="";this.description="";this.category="";this.tag="";this.banner="";this.logo="";this.recruitment="A\xE7\u0131k";this.date="";this.memberCount=0;this.isPrivate=!1;this.owner=null;this.moderators=[];this.members=[];this.permissions=[];Object.assign(this,e),!this.slug&&this.name&&(this.slug=this.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""))}getGroupUrl(){return`/gruplar/${this.slug||this.name.toLowerCase().replace(/\s+/g,"-")}`}toNotificationSender(){return new w({id:this.id,name:this.name,avatar:this.logo,type:"GROUP",url:this.getGroupUrl()})}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",shortName:e.shortName||e.name_short||"",slug:e.slug||"",description:e.description||"",category:e.category||"",tag:e.tag||"",banner:e.banner||e.banner_url||"",logo:e.logo||e.logo_url||"",recruitment:e.recruitment||"A\xE7\u0131k",date:e.date||e.created_at||"",memberCount:e.memberCount||e.member_count||0,isPrivate:e.isPrivate||e.is_private||!1,owner:e.owner?a.fromJSON(e.owner):null,moderators:Array.isArray(e.moderators)?e.moderators.map(t=>a.fromJSON(t)):[],members:Array.isArray(e.members)?e.members.map(t=>a.fromJSON(t)):[],permissions:Array.isArray(e.permissions)?e.permissions:[]})}};var P=class i{constructor(e){this.id="";this.type="SYSTEM_ALERT";this.category="SYSTEM";this.title="";this.message="";this.context="";this.link="";this.isRead=!1;this.isClickable=!0;this.createdAt="";if(Object.assign(this,e),this.post&&(this.postId=this.post.id,this.context||(this.context=this.post.content.length>50?this.post.content.substring(0,47)+"...":this.post.content)),!this.link)if(this.group)this.link=this.group.getGroupUrl();else if(this.groupId){let t=this.groupId.toLowerCase().replace(/\s+/g,"-");this.link=`/gruplar/${t}`}else this.postId?this.link=`/?post=${this.postId}`:this.sender?.url&&(this.link=this.sender.url);!this.title&&this.group&&this.type==="GROUP_INVITE"&&(this.title="Grup Daveti",this.message=`${this.group.name} grubuna davet edildin.`),this.category==="SYSTEM"&&(this.sender||(this.sender=w.system()),this.isClickable=!1,this.link="")}static fromJSON(e){return new i({id:e.id||"",type:e.type||"SYSTEM_ALERT",category:e.category||"SYSTEM",title:e.title||"",message:e.message||"",context:e.context||"",sender:e.sender?new w(e.sender):void 0,link:e.link||"",isRead:e.isRead||!1,createdAt:e.createdAt||e.created_at||"",postId:e.postId||e.post_id,commentId:e.commentId||e.comment_id,eventId:e.eventId||e.event_id,groupId:e.groupId||e.group_id,group:e.group?T.fromJSON(e.group):void 0})}};var j=class i{constructor(e){this.user=e.user||null,this.token=e.token||null,this.refreshToken=e.refreshToken||null,this.expiresAt=e.expiresAt||null,this.cart=e.cart||[],this.myArticles=e.myArticles||[],this.chatList=e.chatList||[],this.notifications=e.notifications||[]}isValid(){return!this.token||!this.expiresAt?!1:Date.now()<this.expiresAt}static fromJSON(e){return new i({user:e.user?a.fromJSON(e.user):null,token:e.token||e.jwt_token||null,refreshToken:e.refreshToken||e.refresh_token||null,expiresAt:e.expiresAt||e.expires_at||Date.now()+3600*1e3,cart:Array.isArray(e.cart)?e.cart.map(t=>E.fromJSON(t)):[],myArticles:e.myArticles||[],chatList:Array.isArray(e.chatList)?e.chatList.map(t=>Z.fromJSON(t)):[],notifications:Array.isArray(e.notifications)?e.notifications.map(t=>P.fromJSON(t)):[]})}};var G=class i{constructor(e){this.id="";this.author=null;this.content="";this.media=[];this.createdAt="";this.stats={likes:0,comments:0,reposts:0,shares:0};this.hashtags=[];this.isPending=!1;this.likeList=[];this.repostList=[];this.commentList=[];Object.assign(this,e)}static fromJSON(e){return new i({id:String(e.postID||e.id||""),author:e.owner||e.author?a.fromJSON(e.owner||e.author):null,content:e.paylasimicerik||e.content||"",media:Array.isArray(e.paylasimfoto)?e.paylasimfoto.map(t=>({type:"image",url:t.fotourl||t.fotoufakurl})):Array.isArray(e.media)?e.media:[],createdAt:e.paylasimzaman||e.createdAt||e.created_at||"",stats:{likes:Number(e.begenisay||0),comments:Number(e.yorumsay||0),reposts:Number(e.repostsay||0),shares:Number(e.sikayetsay||0)},hashtags:e.hashtags||[],likeList:Array.isArray(e.paylasimilkucbegenen)?e.paylasimilkucbegenen.map(a.fromJSON):Array.isArray(e.likeList)?e.likeList.map(a.fromJSON):[],commentList:Array.isArray(e.ilkucyorum)?e.ilkucyorum.map(t=>({...t,author:a.fromJSON(t),content:t.yorumcuicerik,createdAt:t.yorumcuzaman})):[],repostOf:e.repostOf?i.fromJSON(e.repostOf):void 0})}};var Ke=class i{constructor(e){this.id="";this.author=null;this.text="";this.date="";this.replies=[];Object.assign(this,e)}addReply(e){this.replies.push(e)}static fromJSON(e){return new i({id:e.id||"",author:e.user?a.fromJSON(e.user):e.author_name?new a({displayName:e.author_name}):null,text:e.text||e.comment||"",date:e.date||e.created_at||"",replies:Array.isArray(e.replies)?e.replies.map(t=>i.fromJSON(t)):[]})}};var He=class i{constructor(e){this.id="";this.user=null;this.media="";this.hasUnseen=!1;this.isMe=!1;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",user:e.user?a.fromJSON(e.user):e.username?new a({username:e.username,avatar:e.avatar}):null,media:e.media||"",hasUnseen:e.hasUnseen||!1,isMe:e.isMe||!1})}};var ze=class i{constructor(e){this.id="";this.user=null;this.note="";this.isMe=!1;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",user:e.user?a.fromJSON(e.user):null,note:e.note||"",isMe:e.isMe||!1})}};var ee=class{constructor(e){this.displayName="";this.username="";this.score="";this.avatar="";Object.assign(this,e)}},Ye=class{static getLevelRankings(e,t=5){return[...e].sort((r,s)=>(s.level||0)-(r.level||0)||(s.xp||0)-(r.xp||0)).slice(0,t).map(r=>new ee({displayName:r.displayName||r.username,username:r.username,score:`LVL ${r.level||1}`,avatar:r.avatar}))}static getPopularityRankings(e,t=5){return[...e].sort((r,s)=>(s.popScore||0)-(r.popScore||0)).slice(0,t).map(r=>{let s=r.popScore||0,n=s>=1e3?(s/1e3).toFixed(1)+"k":s.toString();return new ee({displayName:r.displayName||r.username,username:r.username,score:n,avatar:r.avatar})})}};var We=class i{constructor(e){this.id="";this.title="";this.prize="";this.status="active";this.participants=0;this.timeLeft="";this.image="";Object.assign(this,e)}isActive(){return this.status==="active"}static fromJSON(e){return new i({id:e.id||"",title:e.title||"",prize:e.prize||"",status:e.status||"active",participants:e.participants||0,timeLeft:e.timeLeft||e.time_left||"",image:e.image||""})}};var Xe=class i{constructor(e){this.id="";this.name="";this.desc="";this.topicCount=0;this.postCount=0;Object.assign(this,e)}getUrl(){return`/forum/${this.id}`}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",desc:e.desc||e.description||"",topicCount:e.topicCount||0,postCount:e.postCount||0,lastPost:e.lastPost||null})}};var Qe=class i{constructor(e){this.id="";this.name="";this.description="";this.location="";this.logo="";this.website="";this.establishedDate="";Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",description:e.description||"",location:e.location||e.address||"",logo:e.logo||e.logo_url||"",website:e.website||"",establishedDate:e.establishedDate||e.created_at||""})}};var Ze=class i{constructor(e){this.id="";this.title="";this.status="";this.banner="";this.date="";this.location="";this.participantLimit=0;this.currentParticipants=0;this.description="";this.rules=[];this.admins=[];this.game="";this.rewards="";this.isHot=!1;this.isLive=!1;this.participants=[];this.participationType="INDIVIDUAL";this.minODP=0;this.hasStats=!1;this.template="STANDARD";this.teams=[];this.leaderboard=[];Object.assign(this,e)}static fromJSON(e){return new i(e)}};var xe=class i{constructor(e){this.id="";this.name="";this.price=0;this.category="";Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",price:e.price||0,category:e.category||"",image:e.image,isDeal:e.isDeal,discountRate:e.discountRate})}},Oe=class i{constructor(e){this.id="";this.name="Standart Masa";this.cpu="";this.gpu="";this.ram="";this.monitor="";this.keyboard="";this.mouse="";this.isAvailable=!0;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",cpu:e.cpu||"",gpu:e.gpu||"",ram:e.ram||"",monitor:e.monitor||"",keyboard:e.keyboard||"",mouse:e.mouse||"",isAvailable:e.isAvailable??!0})}},Ae=class i{constructor(e){this.code="";this.discount="";this.expiryDate="";this.description="";Object.assign(this,e)}static fromJSON(e){return new i({code:e.code||"",discount:e.discount||"",expiryDate:e.expiryDate||"",description:e.description||""})}},je=class i{constructor(e){this.id="";this.name="";this.slug="";this.type="YEMEK";this.description="";this.location="";this.logo="";this.banner="";this.rating=0;this.reviewCount=0;this.owner=null;this.products=[];this.equipment=[];this.pricing=[];this.coupons=[];this.facilities=[];Object.assign(this,e),!this.slug&&this.name&&(this.slug=this.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""))}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",slug:e.slug||"",type:e.type||"YEMEK",description:e.description||"",location:e.location||"",logo:e.logo||"",banner:e.banner||"",rating:e.rating||0,reviewCount:e.reviewCount||0,owner:e.owner?a.fromJSON(e.owner):null,products:e.products?.map(t=>xe.fromJSON(t))||[],equipment:e.equipment?.map(t=>Oe.fromJSON(t))||[],pricing:e.pricing,coupons:e.coupons?.map(t=>Ae.fromJSON(t))||[],facilities:e.facilities})}};var te=class i{constructor(e){this.id="";this.text="";this.votes=0;this.voterIds=[];Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",text:e.text||"",votes:e.votes||0,voterIds:e.voterIds||[]})}};var et=class i{constructor(e){this.id="";this.question="";this.description="";this.options=[];this.author=null;this.createdAt="";this.expiresAt="";this.totalVotes=0;this.hasVoted=!1;this.myVoteId="";Object.assign(this,e),this.totalVotes=this.options.reduce((t,r)=>t+r.votes,0)}getOptionPercentage(e){let t=this.options.find(r=>r.id===e);return!t||this.totalVotes===0?0:Math.round(t.votes/this.totalVotes*100)}static fromJSON(e){return new i({id:e.id||"",question:e.question||"",description:e.description||"",options:Array.isArray(e.options)?e.options.map(t=>te.fromJSON(t)):[],author:e.author?a.fromJSON(e.author):null,createdAt:e.createdAt||"",expiresAt:e.expiresAt||"",totalVotes:e.totalVotes||0,hasVoted:e.hasVoted||!1,myVoteId:e.myVoteId||""})}};var re=class i{constructor(e){this.id="";this.name="";this.schoolId="";this.representative=null;this.memberCount=0;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",schoolId:e.schoolId||"",representative:e.representative?a.fromJSON(e.representative):null,memberCount:e.memberCount||0})}};var ie=class i{constructor(e){this.id="";this.name="";this.password="";this.schoolId="";this.members=[];this.teacher=null;this.memberCount=0;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",password:e.password||"",schoolId:e.schoolId||"",members:Array.isArray(e.members)?e.members.map(a.fromJSON):[],teacher:e.teacher?a.fromJSON(e.teacher):null,memberCount:e.memberCount||0})}};var se=class i{constructor(e){this.id="";this.name="";this.gameOrSport="";this.type="ESPORTS";this.logo="";this.schoolId="";this.captain=null;this.coach=null;this.members=[];this.memberCount=0;this.achievements=[];Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",gameOrSport:e.gameOrSport||e.game_or_sport||"",type:e.type||"ESPORTS",logo:e.logo||"",schoolId:e.schoolId||"",captain:e.captain?a.fromJSON(e.captain):null,coach:e.coach?a.fromJSON(e.coach):null,members:Array.isArray(e.members)?e.members.map(a.fromJSON):[],memberCount:e.memberCount||0,achievements:e.achievements||[]})}};var tt=class i{constructor(e){this.id="";this.name="";this.slug="";this.logo="";this.background="";this.description="";this.representative=null;this.faculties=[];this.teams=[];this.classrooms=[];this.joinPassword="";this.isSocialFeedEnabled=!0;this.memberCount=0;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",slug:e.slug||"",logo:e.logo||"",background:e.background||"",description:e.description||"",representative:e.representative?a.fromJSON(e.representative):null,faculties:Array.isArray(e.faculties)?e.faculties.map(re.fromJSON):[],teams:Array.isArray(e.teams)?e.teams.map(se.fromJSON):[],classrooms:Array.isArray(e.classrooms)?e.classrooms.map(ie.fromJSON):[],joinPassword:e.joinPassword||"",isSocialFeedEnabled:e.isSocialFeedEnabled!==void 0?e.isSocialFeedEnabled:!0,memberCount:e.memberCount||0})}};var rt=class i{constructor(e){this.id="";this.name="";this.logo="";this.primaryColor="";this.shortName="";Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",logo:e.logo||"",primaryColor:e.primaryColor||"#1d4ed8",shortName:e.shortName||""})}};var it=class i{constructor(e){this.id="";this.name="";this.category="";this.price="";this.image="";this.isFeatured=!1;this.badge="";Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",category:e.category||"",price:e.price||"",image:e.image||"",isFeatured:e.isFeatured||!1,badge:e.badge||""})}};var ne=class i{constructor(e){this.id=e.id||"",this.items=e.items||[],this.total=e.total||0,this.status=e.status||"pending",this.createdAt=e.createdAt||Date.now(),this.paymentMethod=e.paymentMethod||"credit_card"}static fromJSON(e){return new i({id:e.id||"",items:Array.isArray(e.items)?e.items.map(t=>E.fromJSON(t)):[],total:e.total||e.total_amount||0,status:e.status||"pending",createdAt:e.createdAt||e.created_at||Date.now(),paymentMethod:e.paymentMethod||e.payment_method||"credit_card"})}getStatusLabel(){switch(this.status){case"pending":return"Haz\u0131rlan\u0131yor";case"completed":return"Tamamland\u0131";case"shipped":return"Kargoya Verildi";case"canceled":return"\u0130ptal Edildi";default:return this.status}}};var st=class{constructor(e){this.totalPlayers=e.totalPlayers,this.malePlayers=e.malePlayers,this.femalePlayers=e.femalePlayers,this.totalForums=e.totalForums,this.totalPolls=e.totalPolls,this.activeUsers24h=e.activeUsers24h,this.totalMatchesPlayed=e.totalMatchesPlayed,this.totalGuilds=e.totalGuilds,this.monthlyVisitors=e.monthlyVisitors,this.totalNews=e.totalNews}getGenderDistribution(){let e=Math.round(this.malePlayers/(this.malePlayers+this.femalePlayers)*100),t=100-e;return{malePercent:e,femalePercent:t}}getGrowthRate(e){return{totalPlayers:12.4,activeUsers24h:8.2,monthlyVisitors:5.7,totalNews:3.1,totalGuilds:1.5}[e]||0}getVisitorTrend(){return[45,52,48,70,61,85,92]}getActivityBreakdown(){return[{label:"Forum Konular\u0131",value:this.totalForums,color:"#3b82f6"},{label:"Haber \u0130\xE7erikleri",value:this.totalNews,color:"#10b981"},{label:"Aktif Anketler",value:this.totalPolls,color:"#f59e0b"}]}};var nt=class i{constructor(e={}){this.siteTitle=e.siteTitle||"ARMOYU - Aram\u0131zdaki Oyuncu",this.siteDescription=e.siteDescription||"T\xFCrkiye'nin en b\xFCy\xFCk oyun toplulu\u011Fu ve geli\u015Fim platformu.",this.isMaintenanceMode=e.isMaintenanceMode||!1,this.isRegistrationOpen=e.isRegistrationOpen||!0,this.contactEmail=e.contactEmail||"iletisim@armoyu.com",this.version=e.version||"v3.4.2-beta",this.socialLinks=e.socialLinks||{discord:"https://discord.gg/armoyu",youtube:"https://youtube.com/armoyu",instagram:"https://instagram.com/armoyu",twitter:"https://twitter.com/armoyu",github:"https://github.com/armoyu"},this.branding=e.branding||{logoUrl:"https://v3.armoyu.com/logo.png",faviconUrl:"https://v3.armoyu.com/favicon.ico",primaryColor:"#3b82f6"}}clone(){return new i(JSON.parse(JSON.stringify(this)))}toggleMaintenance(){this.isMaintenanceMode=!this.isMaintenanceMode}};var C=class i{constructor(e){this.id=0;this.text="";this.penalty="";this.createdAt="";this.subArticle=null;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||e.kuralid||0,text:e.text||e.kuralicerik||"",penalty:e.penalty||e.cezabaslangic||"",createdAt:e.createdAt||e.cezakoyulmatarihi||"",subArticle:e.subArticle||e.kuralaltmadde||null})}toJSON(){return{id:this.id,text:this.text,penalty:this.penalty,createdAt:this.createdAt,subArticle:this.subArticle}}};var U=class i{constructor(e){this.id="";this.subject="";this.category="Genel";this.status="A\xE7\u0131k";this.priority="Normal";this.createdAt="";this.updatedAt="";this.lastMessage="";Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",subject:e.subject||"",category:e.category||"Genel",status:e.status||"A\xE7\u0131k",priority:e.priority||"Normal",createdAt:e.createdAt||e.created_at||"",updatedAt:e.updatedAt||e.updated_at||"",lastMessage:e.lastMessage||e.last_message||"",author:e.author?a.fromJSON(e.author):void 0})}};var ot=class i{constructor(e){this.id="";this.name="";this.slug="";this.logo="";this.poster="";this.category="";this.developer="";this.description="";Object.assign(this,e),!this.slug&&this.name&&(this.slug=this.name.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""))}static fromJSON(e){return new i({id:e.id||"",name:e.name||"",slug:e.slug||"",logo:e.logo||e.logo_url||"",poster:e.poster||e.poster_url||"",category:e.category||"",developer:e.developer||"",description:e.description||""})}};var at=class i{constructor(e){this.title="";this.count=0;this.author="";this.date="";this.category="";this.image="";Object.assign(this,e)}static fromJSON(e){return new i({title:e.title||"",count:e.count||0,author:e.author||"",date:e.date||"",category:e.category||"",image:e.image||e.thumb||""})}};var ct=class i{constructor(e){this.id="";this.name="";this.game="";this.version="";this.author=null;this.description="";this.downloads="";this.image="";this.isFeatured=!1;Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",game:e.game||"",version:e.version||"",author:e.author?e.author instanceof a?e.author:a.fromJSON(e.author):e.authorUsername?new a({username:e.authorUsername,displayName:e.authorName}):null,description:e.description||e.desc||"",downloads:e.downloads||"0",image:e.image||"",isFeatured:e.isFeatured||!1})}};var L=class i{constructor(e){this.slug="";this.title="";this.excerpt="";this.content="";this.date="";this.category="";this.image="";this.author=null;Object.assign(this,e)}getUrl(){return`/haberler/${this.slug}`}static fromJSON(e){return new i({slug:e.slug||"",title:e.title||"",excerpt:e.excerpt||e.summary||"",content:e.content||"",date:e.date||"",category:e.category||"",image:e.image||"",author:e.author?e.author instanceof a?e.author:a.fromJSON(e.author):e.authorUsername?new a({username:e.authorUsername,displayName:e.authorName}):null})}};var lt=class i{constructor(e){this.id="";this.name="";this.description="";this.status="";this.image="";this.url="";this.githubUrl="";this.authors=[];this.group=null;this.techStack=[];Object.assign(this,e)}static fromJSON(e){return new i({id:e.id||"",name:e.name||e.title||"",description:e.description||"",status:e.status||"",image:e.image||e.thumb||"",url:e.url||e.demoUrl||"",githubUrl:e.githubUrl||e.github||"",authors:Array.isArray(e.authors)?e.authors.map(t=>({user:t.user instanceof a?t.user:a.fromJSON(t.user||t),role:t.role||"Geli\u015Ftirici"})):[],group:e.group?e.group instanceof T?e.group:T.fromJSON(e.group):null,techStack:Array.isArray(e.techStack)?e.techStack:[]})}};var K=class extends Error{constructor(t,r,s,n){super(t);this.message=t;this.status=r;this.statusText=s;this.data=n;this.name="ApiError"}},ut=(n=>(n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n))(ut||{}),H=class{constructor(e){this.lastRawResponse=null;this.config={...e,headers:{...e.headers}}}async request(e,t={}){let{params:r,...s}=t,n=`${this.config.baseUrl}${e}`;if(r){let c=new URLSearchParams;Object.entries(r).forEach(([d,g])=>{g!==void 0&&c.append(d,String(g))});let m=c.toString();m&&(n+=(n.includes("?")?"&":"?")+m)}let o=new Headers(this.config.headers||{}),l=t.body;t.body&&typeof t.body=="object"&&!(t.body instanceof URLSearchParams)&&!(typeof FormData<"u"&&t.body instanceof FormData)&&(o.set("Content-Type","application/json"),l=JSON.stringify(t.body)),this.config.token&&(/^[ -~]*$/.test(this.config.token)?o.set("Authorization",`Bearer ${this.config.token}`):console.warn("[ApiClient] Token contains invalid characters, skipping Authorization header.")),this.config.apiKey&&o.set("X-API-KEY",this.config.apiKey);try{let c=await fetch(n,{...s,headers:o,body:l}),m,d=c.headers.get("content-type");if(d&&d.includes("application/json"))m=await c.json();else{let g=await c.text();try{m=JSON.parse(g)}catch{m=g}}if(!c.ok){this.lastRawResponse=m;let g=m?.aciklama||m?.message||`API Error: ${c.status} - ${c.statusText}`;throw new K(g,c.status,c.statusText,m)}return this.lastRawResponse=m,m}catch(c){throw c instanceof K?c:new K(c instanceof Error?c.message:"Unknown Network Error")}}async get(e,t){return this.request(e,{...t,method:"GET"})}async post(e,t,r){return this.request(e,{...r,method:"POST",body:t})}async put(e,t,r){return this.request(e,{...r,method:"PUT",body:t})}async patch(e,t,r){return this.request(e,{...r,method:"PATCH",body:t})}async delete(e,t){return this.request(e,{...t,method:"DELETE"})}setToken(e){this.config.token=e}setApiKey(e){this.config.apiKey=e}getApiKey(){return this.config.apiKey||null}setBaseUrl(e){this.config.baseUrl=e}},ht=new H({baseUrl:"https://api.aramizdakioyuncu.com"});var f=class{constructor(e){this.client=e}handleResponse(e){if(e&&typeof e=="object"&&"durum"in e){let t=e;if(Number(t.durum)===1)return t.icerik;throw new Error(t.aciklama||"API Execution Error")}return e}};var oe=class extends f{constructor(){super(...arguments);this.currentUser=null;this.session=null}async login(t,r){try{let s=new FormData;s.append("username",t),s.append("password",r);let n=await this.client.post("/0/0/0",s),o=typeof n=="string"?JSON.parse(n):n,l=this.handleResponse(o),c="";return typeof o.aciklama=="string"?/^[a-zA-Z0-9.\-_=]+$/.test(o.aciklama)&&(c=o.aciklama):o.aciklama&&typeof o.aciklama=="object"&&(c=o.aciklama.token||o.aciklama.session_token||""),this.currentUser=a.fromJSON(l),this.session=new j({user:this.currentUser,token:c||l?.token||l?.session_token||null}),this.session.token&&(this.client.setToken(this.session.token),typeof window<"u"&&localStorage.setItem("armoyu_token",this.session.token)),{user:this.currentUser,session:this.session}}catch(s){throw console.error("[AuthService] Login failed:",s),s}}async register(t){try{let r=await this.client.post("/auth/register",t),s=this.handleResponse(r);return{user:a.fromJSON(s.user)}}catch(r){throw console.error("[AuthService] Registration failed:",r),r}}async logout(){try{await this.client.post("/auth/logout",{})}catch(t){console.error("[AuthService] Logout API call failed:",t)}finally{this.currentUser=null,this.session=null,this.client.setToken(null),typeof window<"u"&&localStorage.removeItem("armoyu_token")}}async me(){try{let t=await this.client.get("/auth/me"),r=this.handleResponse(t),s=r&&(r.user||r);return this.currentUser=s?a.fromJSON(s):null,this.currentUser}catch{return this.currentUser=null,null}}getCurrentUser(){return this.currentUser}getSession(){return this.session}isAuthenticated(){return!!this.currentUser||!!this.client}};var ae=class i extends f{constructor(e){super(e),console.log("[UserService] Initialized with methods:",Object.getOwnPropertyNames(i.prototype))}async search(e){try{let t=await this.client.get("/users/search",{params:{q:e}}),r=this.handleResponse(t);return Array.isArray(r)?r.map(s=>a.fromJSON(s)):[]}catch(t){return console.error("[UserService] User search failed:",t),[]}}async getUserByUsername(e){console.log("[UserService] Getting profile for:",e);try{let t=new FormData;t.append("oyuncubakusername",e);let r=await this.client.post("/0/0/0/",t),s=this.handleResponse(r);return s?a.fromJSON(s):null}catch(t){return console.error(`[UserService] Fetching profile for ${e} failed:`,t),null}}async toggleFollow(e){try{let t=await this.client.post(`/users/${e}/follow`,{});return this.handleResponse(t).following}catch(t){return console.error("[UserService] Toggle follow failed:",t),!1}}async getFriends(e){try{let t=await this.client.get(`/users/${e}/friends`),r=this.handleResponse(t);return Array.isArray(r)?r.map(s=>a.fromJSON(s)):[]}catch(t){return console.error("[UserService] Get friends failed:",t),[]}}async updateProfile(e){try{let t=await this.client.post("/users/me/update",e),r=this.handleResponse(t);return r?a.fromJSON(r):null}catch(t){return console.error("[UserService] Update profile failed:",t),null}}};var It=class{constructor(){this.socket=null;this.isConnected=!1;this.listeners=new Map;this.socketUrl="https://socket.armoyu.com";typeof window<"u"&&this.connect()}setSocketUrl(e){this.socketUrl=e}async connect(){try{let{io:e}=await Promise.resolve().then(()=>(_r(),kr));console.log("[SocketService] Connecting to socket server...");let t=e(this.socketUrl,{transports:["websocket"],reconnection:!0,reconnectionAttempts:10});this.socket=t,t.on("connect",()=>{console.log("[SocketService] Connected! ID:",t.id),this.isConnected=!0,this.emitInternal("connect",{status:"online",socketId:t.id})}),t.on("disconnect",()=>{console.log("[SocketService] Disconnected."),this.isConnected=!1,this.emitInternal("disconnect",{status:"offline"})}),["message","typing","notification","status","post","post_like","post_repost_count"].forEach(s=>{t.on(s,n=>{this.emitInternal(s,n)})})}catch(e){console.error("[SocketService] Connection failed:",e)}}emitInternal(e,t){(this.listeners.get(e)||[]).forEach(s=>s(t))}on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),e==="connect"&&this.isConnected&&t({status:"online",alreadyConnected:!0}),()=>{let r=this.listeners.get(e)||[];this.listeners.set(e,r.filter(s=>s!==t))}}emit(e,t){let r=this.socket;r&&(this.isConnected||r.connected)?r.emit(e,t):console.warn(`[SocketService] Cannot emit '${e}', not connected.`)}},qe=new It;var be=class extends f{async getFeed(e=1){try{let t=await this.client.get(`/0/0/sosyal/liste/${e}/`);return this.handleResponse(t).map(s=>G.fromJSON(s))}catch(t){return console.error("[SocialService] Fetching feed failed:",t),[]}}async createPost(e,t){try{let r=await this.client.post("/social/posts",{content:e,media:t}),s=this.handleResponse(r),n=G.fromJSON(s);return qe.emit("post",n),n}catch(r){return console.error("[SocialService] Creating post failed:",r),null}}async toggleLike(e){try{let t=await this.client.post(`/social/posts/${e}/like`,{}),r=this.handleResponse(t);return qe.emit("post_like",{postId:e,liked:r.liked}),r.liked}catch(t){return console.error("[SocialService] Toggle like failed:",t),!1}}async addComment(e,t){try{let r=await this.client.post(`/social/posts/${e}/comments`,{content:t});return this.handleResponse(r)}catch(r){return console.error("[SocialService] Adding comment failed:",r),null}}async getNotifications(){try{let e=await this.client.get("/social/notifications");return this.handleResponse(e).map(r=>P.fromJSON(r))}catch(e){return console.error("[SocialService] Fetching notifications failed:",e),[]}}async markNotificationAsRead(e){try{let t=await this.client.post(`/social/notifications/${e}/read`,{});this.handleResponse(t)}catch(t){console.error("[SocialService] Marking notification as read failed:",t)}}};var Se=class extends f{async getNews(e=1,t=10){try{let r=await this.client.get("/content/news",{params:{page:e,limit:t}});return this.handleResponse(r).news.map(n=>L.fromJSON(n))}catch(r){return console.error("[BlogService] Failed to fetch news:",r),[]}}async getNewsBySlug(e){try{let t=await this.client.get(`/content/news/${e}`),r=this.handleResponse(t);return L.fromJSON(r)}catch(t){return console.error(`[BlogService] Failed to fetch news article ${e}:`,t),null}}async searchNews(e){try{let t=await this.client.get("/content/news/search",{params:{q:e}});return this.handleResponse(t).news.map(s=>L.fromJSON(s))}catch(t){return console.error("[BlogService] News search failed:",t),[]}}};var we=class extends f{async getProducts(e,t){try{let r=await this.client.get("/shop/products",{params:{category:e,q:t}});return this.handleResponse(r).products.map(n=>k.fromJSON(n))}catch(r){return console.error("[ShopService] Failed to fetch products:",r),[]}}async getProductDetails(e){try{let t=await this.client.get(`/shop/products/${e}`),r=this.handleResponse(t);return k.fromJSON(r)}catch(t){return console.error(`[ShopService] Failed to fetch product ${e}:`,t),null}}async createOrder(e){try{let t=await this.client.post("/shop/orders",{items:e}),r=this.handleResponse(t);return ne.fromJSON(r.order)}catch(t){throw console.error("[ShopService] Order creation failed:",t),t}}};var ke=class extends f{async getCategories(){try{let e=await this.client.get("/community/forums/categories");return this.handleResponse(e)}catch(e){return console.error("[ForumService] Failed to fetch categories:",e),[]}}async getTopics(e,t=1){try{let r=await this.client.get(`/community/forums/categories/${e}/topics`,{params:{page:t}});return this.handleResponse(r)}catch(r){return console.error(`[ForumService] Failed to fetch topics for category ${e}:`,r),[]}}async createTopic(e,t,r){try{let s=await this.client.post(`/community/forums/categories/${e}/topics`,{title:t,content:r});return this.handleResponse(s)}catch(s){throw console.error("[ForumService] Topic creation failed:",s),s}}async deleteTopic(e){try{let t=await this.client.delete(`/community/forums/topics/${e}`);this.handleResponse(t)}catch(t){throw console.error(`[ForumService] Failed to delete topic ${e}:`,t),t}}};var _e=class extends f{async createTicket(e,t,r){try{let s=await this.client.post("/social/support/tickets",{subject:e,message:t,category:r}),n=this.handleResponse(s);return U.fromJSON(n.ticket)}catch(s){throw console.error("[SupportService] Failed to create ticket:",s),s}}async getMyTickets(){try{let e=await this.client.get("/social/support/my-tickets");return this.handleResponse(e).tickets.map(r=>U.fromJSON(r))}catch(e){return console.error("[SupportService] Failed to fetch user tickets:",e),[]}}async getTicketDetails(e){try{let t=await this.client.get(`/social/support/tickets/${e}`),r=this.handleResponse(t);return U.fromJSON(r)}catch(t){return console.error(`[SupportService] Failed to fetch ticket ${e}:`,t),null}}};var ve=class extends f{async call(e,t="GET",r){let n=`/0/0${e.startsWith("/")?e:"/"+e}`;try{switch(t){case"GET":return await this.client.get(n);case"POST":return await this.client.post(n,r);case"PUT":return await this.client.put(n,r);case"PATCH":return await this.client.patch(n,r);case"DELETE":return await this.client.delete(n);default:return await this.client.get(n)}}catch(o){throw console.error(`[RuleService] Request to ${e} failed:`,o),o}}async getRules(e="0"){try{let t=await this.call(`/kurallar/${e}`,"POST"),r=this.handleResponse(t);return Array.isArray(r)?r.map(s=>C.fromJSON(s)):[]}catch(t){return console.error("[RuleService] getRules failed:",t),[]}}async createRule(e="0",t,r=""){let s={kuralicerik:t,cezabaslangic:r},n=await this.call(`/kurallar/${e}/ekle`,"POST",s),o=this.handleResponse(n);return C.fromJSON(o)}async updateRule(e="0",t,r){let s={};r.text&&(s.kuralicerik=r.text),r.penalty&&(s.cezabaslangic=r.penalty);let n=await this.call(`/kurallar/${e}/duzenle/${t}`,"POST",s),o=this.handleResponse(n);return C.fromJSON(o)}async deleteRule(e="0",t){let r=await this.call(`/kurallar/${e}/sil/${t}`,"POST");return!!this.handleResponse(r)}};var Ve=class{constructor(e){e&&e.baseUrl?this.client=new H({baseUrl:e.baseUrl,token:e.token||null,apiKey:e.apiKey||null,headers:e.headers||{}}):(this.client=ht,e&&e.token&&this.client.setToken(e.token),e&&e.apiKey&&this.client.setApiKey(e.apiKey)),this.auth=new oe(this.client),this.users=new ae(this.client),this.social=new be(this.client),this.blog=new Se(this.client),this.shop=new we(this.client),this.forum=new ke(this.client),this.support=new _e(this.client),this.rules=new ve(this.client)}setToken(e){this.client.setToken(e)}setApiKey(e){this.client.setApiKey(e)}get lastResponse(){return this.client.lastRawResponse}},Xr=new Ve;return Tr(Qr);})();
package/dist/index.d.ts CHANGED
@@ -1,9 +1,19 @@
1
1
  export * from './models/index';
2
+ export * from './api/ApiClient';
3
+ export * from './api/ArmoyuApi';
4
+ export * from './services/BaseService';
2
5
  export * from './services/AuthService';
3
6
  export * from './services/UserService';
4
7
  export * from './services/SocialService';
5
8
  export * from './services/SocketService';
6
- export * from './api/ApiClient';
9
+ export * from './services/BlogService';
10
+ export * from './services/ShopService';
11
+ export * from './services/ForumService';
12
+ export * from './services/SupportService';
13
+ export * from './services/RuleService';
14
+ /**
15
+ * Global Platform Statistics
16
+ */
7
17
  export interface GlobalStats {
8
18
  totalPlayers: number;
9
19
  malePlayers: number;
package/dist/index.js CHANGED
@@ -16,10 +16,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // Models
18
18
  __exportStar(require("./models/index"), exports);
19
+ // API Core
20
+ __exportStar(require("./api/ApiClient"), exports);
21
+ __exportStar(require("./api/ArmoyuApi"), exports);
19
22
  // Services
23
+ __exportStar(require("./services/BaseService"), exports);
20
24
  __exportStar(require("./services/AuthService"), exports);
21
25
  __exportStar(require("./services/UserService"), exports);
22
26
  __exportStar(require("./services/SocialService"), exports);
23
27
  __exportStar(require("./services/SocketService"), exports);
24
- // API
25
- __exportStar(require("./api/ApiClient"), exports);
28
+ __exportStar(require("./services/BlogService"), exports);
29
+ __exportStar(require("./services/ShopService"), exports);
30
+ __exportStar(require("./services/ForumService"), exports);
31
+ __exportStar(require("./services/SupportService"), exports);
32
+ __exportStar(require("./services/RuleService"), exports);