@famibee/skynovel 1.65.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +3 -3
  2. package/dist/Button.js +131 -163
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CallStack.js +19 -22
  5. package/dist/CallStack.js.map +1 -1
  6. package/dist/CmnInterface.js +91 -0
  7. package/dist/CmnInterface.js.map +1 -0
  8. package/dist/CmnLib.js +94 -0
  9. package/dist/CmnLib.js.map +1 -0
  10. package/dist/Config.js +26 -0
  11. package/dist/Config.js.map +1 -0
  12. package/dist/ConfigBase.js +152 -0
  13. package/dist/ConfigBase.js.map +1 -0
  14. package/dist/DebugMng.js +89 -102
  15. package/dist/DebugMng.js.map +1 -1
  16. package/dist/EventListenerCtn.js +21 -0
  17. package/dist/EventListenerCtn.js.map +1 -0
  18. package/dist/EventMng.js +1435 -1577
  19. package/dist/EventMng.js.map +1 -1
  20. package/dist/Grammar.js +194 -0
  21. package/dist/Grammar.js.map +1 -0
  22. package/dist/GrpLayer.js +163 -195
  23. package/dist/GrpLayer.js.map +1 -1
  24. package/dist/Layer.js +260 -0
  25. package/dist/Layer.js.map +1 -0
  26. package/dist/LayerMng.js +810 -991
  27. package/dist/LayerMng.js.map +1 -1
  28. package/dist/Main.js +144 -393
  29. package/dist/Main.js.map +1 -1
  30. package/dist/PropParser.js +936 -834
  31. package/dist/PropParser.js.map +1 -1
  32. package/dist/Reading.js +918 -786
  33. package/dist/Reading.js.map +1 -1
  34. package/dist/RubySpliter.js +59 -92
  35. package/dist/RubySpliter.js.map +1 -1
  36. package/dist/ScriptIterator.js +805 -1034
  37. package/dist/ScriptIterator.js.map +1 -1
  38. package/dist/SndBuf.js +1097 -1332
  39. package/dist/SndBuf.js.map +1 -1
  40. package/dist/SoundMng.js +124 -135
  41. package/dist/SoundMng.js.map +1 -1
  42. package/dist/SpritesMng.js +220 -232
  43. package/dist/SpritesMng.js.map +1 -1
  44. package/dist/SysBase.js +1729 -0
  45. package/dist/SysBase.js.map +1 -0
  46. package/dist/TxtLayer.js +1212 -1397
  47. package/dist/TxtLayer.js.map +1 -1
  48. package/dist/Variable.js +398 -466
  49. package/dist/Variable.js.map +1 -1
  50. package/dist/chunk.js +18 -0
  51. package/dist/gamepad.js +723 -511
  52. package/dist/gamepad.js.map +1 -1
  53. package/dist/pixi.js +13422 -0
  54. package/dist/pixi.js.map +1 -0
  55. package/dist/platform.js +424 -369
  56. package/dist/platform.js.map +1 -1
  57. package/dist/sn/AnalyzeTagArg.d.ts +1 -1
  58. package/dist/sn/AnalyzeTagArg.d.ts.map +1 -1
  59. package/dist/sn/CmnInterface.d.ts +3 -1
  60. package/dist/sn/CmnInterface.d.ts.map +1 -1
  61. package/dist/sn/CmnLib.d.ts.map +1 -1
  62. package/dist/sn/CmnTween.d.ts +3 -3
  63. package/dist/sn/CmnTween.d.ts.map +1 -1
  64. package/dist/sn/EventMng.d.ts.map +1 -1
  65. package/dist/sn/Grammar.d.ts +1 -1
  66. package/dist/sn/Grammar.d.ts.map +1 -1
  67. package/dist/sn/PropParser.d.ts +2 -2
  68. package/dist/sn/PropParser.d.ts.map +1 -1
  69. package/dist/sn/Reading.d.ts +6 -0
  70. package/dist/sn/Reading.d.ts.map +1 -1
  71. package/dist/sn/ScriptIterator.d.ts.map +1 -1
  72. package/dist/sn/SndBuf.d.ts +27 -16
  73. package/dist/sn/SndBuf.d.ts.map +1 -1
  74. package/dist/sn/SoundMng.d.ts +4 -1
  75. package/dist/sn/SoundMng.d.ts.map +1 -1
  76. package/dist/sn/SysBase.d.ts.map +1 -1
  77. package/dist/sn/TxtStage.d.ts +2 -1
  78. package/dist/sn/TxtStage.d.ts.map +1 -1
  79. package/dist/test/ValTest.d.ts +1 -1
  80. package/dist/test/ValTest.d.ts.map +1 -1
  81. package/dist/web.js +653 -8
  82. package/dist/web.js.map +1 -1
  83. package/dist_app/Button.js +131 -163
  84. package/dist_app/Button.js.map +1 -1
  85. package/dist_app/CallStack.js +19 -22
  86. package/dist_app/CallStack.js.map +1 -1
  87. package/dist_app/CmnInterface.js +91 -0
  88. package/dist_app/CmnInterface.js.map +1 -0
  89. package/dist_app/CmnLib.js +94 -0
  90. package/dist_app/CmnLib.js.map +1 -0
  91. package/dist_app/Config.js +26 -0
  92. package/dist_app/Config.js.map +1 -0
  93. package/dist_app/ConfigBase.js +152 -0
  94. package/dist_app/ConfigBase.js.map +1 -0
  95. package/dist_app/DebugMng.js +92 -0
  96. package/dist_app/DebugMng.js.map +1 -0
  97. package/dist_app/EventListenerCtn.js +21 -0
  98. package/dist_app/EventListenerCtn.js.map +1 -0
  99. package/dist_app/EventMng.js +1435 -1577
  100. package/dist_app/EventMng.js.map +1 -1
  101. package/dist_app/Grammar.js +194 -0
  102. package/dist_app/Grammar.js.map +1 -0
  103. package/dist_app/GrpLayer.js +163 -195
  104. package/dist_app/GrpLayer.js.map +1 -1
  105. package/dist_app/Layer.js +260 -0
  106. package/dist_app/Layer.js.map +1 -0
  107. package/dist_app/LayerMng.js +810 -991
  108. package/dist_app/LayerMng.js.map +1 -1
  109. package/dist_app/Main.js +144 -392
  110. package/dist_app/Main.js.map +1 -1
  111. package/dist_app/PropParser.js +936 -834
  112. package/dist_app/PropParser.js.map +1 -1
  113. package/dist_app/Reading.js +918 -786
  114. package/dist_app/Reading.js.map +1 -1
  115. package/dist_app/RubySpliter.js +59 -92
  116. package/dist_app/RubySpliter.js.map +1 -1
  117. package/dist_app/ScriptIterator.js +805 -1033
  118. package/dist_app/ScriptIterator.js.map +1 -1
  119. package/dist_app/SndBuf.js +1097 -1332
  120. package/dist_app/SndBuf.js.map +1 -1
  121. package/dist_app/SoundMng.js +124 -135
  122. package/dist_app/SoundMng.js.map +1 -1
  123. package/dist_app/SpritesMng.js +220 -231
  124. package/dist_app/SpritesMng.js.map +1 -1
  125. package/dist_app/SysBase.js +1729 -0
  126. package/dist_app/SysBase.js.map +1 -0
  127. package/dist_app/TxtLayer.js +1212 -1396
  128. package/dist_app/TxtLayer.js.map +1 -1
  129. package/dist_app/Variable.js +398 -466
  130. package/dist_app/Variable.js.map +1 -1
  131. package/dist_app/app.js +211 -8
  132. package/dist_app/app.js.map +1 -1
  133. package/dist_app/appMain.js +20 -21
  134. package/dist_app/appMain.js.map +1 -1
  135. package/dist_app/chunk.js +18 -0
  136. package/dist_app/gamepad.js +723 -511
  137. package/dist_app/gamepad.js.map +1 -1
  138. package/dist_app/pixi.js +11181 -0
  139. package/dist_app/pixi.js.map +1 -0
  140. package/dist_app/platform.js +424 -369
  141. package/dist_app/platform.js.map +1 -1
  142. package/dist_app/preload.js +2 -2
  143. package/dist_app/preload.js.map +1 -1
  144. package/dist_app/sn/AnalyzeTagArg.d.ts +1 -1
  145. package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -1
  146. package/dist_app/sn/CmnInterface.d.ts +3 -1
  147. package/dist_app/sn/CmnInterface.d.ts.map +1 -1
  148. package/dist_app/sn/CmnLib.d.ts.map +1 -1
  149. package/dist_app/sn/CmnTween.d.ts +3 -3
  150. package/dist_app/sn/CmnTween.d.ts.map +1 -1
  151. package/dist_app/sn/EventMng.d.ts.map +1 -1
  152. package/dist_app/sn/Grammar.d.ts +1 -1
  153. package/dist_app/sn/Grammar.d.ts.map +1 -1
  154. package/dist_app/sn/PropParser.d.ts +2 -2
  155. package/dist_app/sn/PropParser.d.ts.map +1 -1
  156. package/dist_app/sn/Reading.d.ts +6 -0
  157. package/dist_app/sn/Reading.d.ts.map +1 -1
  158. package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
  159. package/dist_app/sn/SndBuf.d.ts +27 -16
  160. package/dist_app/sn/SndBuf.d.ts.map +1 -1
  161. package/dist_app/sn/SoundMng.d.ts +4 -1
  162. package/dist_app/sn/SoundMng.d.ts.map +1 -1
  163. package/dist_app/sn/SysBase.d.ts.map +1 -1
  164. package/dist_app/sn/TxtStage.d.ts +2 -1
  165. package/dist_app/sn/TxtStage.d.ts.map +1 -1
  166. package/dist_app/test/ValTest.d.ts +1 -1
  167. package/dist_app/test/ValTest.d.ts.map +1 -1
  168. package/package.json +23 -13
  169. package/dist/CmnTween.js +0 -1005
  170. package/dist/CmnTween.js.map +0 -1
  171. package/dist/web2.js +0 -21644
  172. package/dist/web2.js.map +0 -1
  173. package/dist_app/CmnTween.js +0 -1005
  174. package/dist_app/CmnTween.js.map +0 -1
  175. package/dist_app/app2.js +0 -18547
  176. package/dist_app/app2.js.map +0 -1
@@ -0,0 +1,1729 @@
1
+ import { n as __export } from "./chunk.js";
2
+ import { i as EVNM_KEY, s as argChk_Boolean, t as CmnLib } from "./CmnLib.js";
3
+ import { n as creSYS_DATA } from "./CmnInterface.js";
4
+ import { t as EventListenerCtn } from "./EventListenerCtn.js";
5
+ import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
6
+ var PACKET_TYPES = Object.create(null);
7
+ PACKET_TYPES.open = "0", PACKET_TYPES.close = "1", PACKET_TYPES.ping = "2", PACKET_TYPES.pong = "3", PACKET_TYPES.message = "4", PACKET_TYPES.upgrade = "5", PACKET_TYPES.noop = "6";
8
+ var PACKET_TYPES_REVERSE = Object.create(null);
9
+ Object.keys(PACKET_TYPES).forEach((h) => {
10
+ PACKET_TYPES_REVERSE[PACKET_TYPES[h]] = h;
11
+ });
12
+ var ERROR_PACKET = {
13
+ type: "error",
14
+ data: "parser error"
15
+ }, withNativeBlob$1 = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", withNativeArrayBuffer$2 = typeof ArrayBuffer == "function", isView$1 = (h) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(h) : h && h.buffer instanceof ArrayBuffer, encodePacket = ({ type: h, data: W }, G, K) => withNativeBlob$1 && W instanceof Blob ? G ? K(W) : encodeBlobAsBase64(W, K) : withNativeArrayBuffer$2 && (W instanceof ArrayBuffer || isView$1(W)) ? G ? K(W) : encodeBlobAsBase64(new Blob([W]), K) : K(PACKET_TYPES[h] + (W || "")), encodeBlobAsBase64 = (h, W) => {
16
+ let G = new FileReader();
17
+ return G.onload = function() {
18
+ let h = G.result.split(",")[1];
19
+ W("b" + (h || ""));
20
+ }, G.readAsDataURL(h);
21
+ };
22
+ function toArray(h) {
23
+ return h instanceof Uint8Array ? h : h instanceof ArrayBuffer ? new Uint8Array(h) : new Uint8Array(h.buffer, h.byteOffset, h.byteLength);
24
+ }
25
+ var TEXT_ENCODER;
26
+ function encodePacketToBinary(h, W) {
27
+ if (withNativeBlob$1 && h.data instanceof Blob) return h.data.arrayBuffer().then(toArray).then(W);
28
+ if (withNativeArrayBuffer$2 && (h.data instanceof ArrayBuffer || isView$1(h.data))) return W(toArray(h.data));
29
+ encodePacket(h, !1, (h) => {
30
+ TEXT_ENCODER ||= new TextEncoder(), W(TEXT_ENCODER.encode(h));
31
+ });
32
+ }
33
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", lookup$1 = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
34
+ for (let h = 0; h < 64; h++) lookup$1[chars.charCodeAt(h)] = h;
35
+ const decode$1 = (h) => {
36
+ let W = h.length * .75, G = h.length, K, q = 0, J, Y, X, Z;
37
+ h[h.length - 1] === "=" && (W--, h[h.length - 2] === "=" && W--);
38
+ let Q = new ArrayBuffer(W), $ = new Uint8Array(Q);
39
+ for (K = 0; K < G; K += 4) J = lookup$1[h.charCodeAt(K)], Y = lookup$1[h.charCodeAt(K + 1)], X = lookup$1[h.charCodeAt(K + 2)], Z = lookup$1[h.charCodeAt(K + 3)], $[q++] = J << 2 | Y >> 4, $[q++] = (Y & 15) << 4 | X >> 2, $[q++] = (X & 3) << 6 | Z & 63;
40
+ return Q;
41
+ };
42
+ var withNativeArrayBuffer$1 = typeof ArrayBuffer == "function";
43
+ const decodePacket = (h, W) => {
44
+ if (typeof h != "string") return {
45
+ type: "message",
46
+ data: mapBinary(h, W)
47
+ };
48
+ let G = h.charAt(0);
49
+ return G === "b" ? {
50
+ type: "message",
51
+ data: decodeBase64Packet(h.substring(1), W)
52
+ } : PACKET_TYPES_REVERSE[G] ? h.length > 1 ? {
53
+ type: PACKET_TYPES_REVERSE[G],
54
+ data: h.substring(1)
55
+ } : { type: PACKET_TYPES_REVERSE[G] } : ERROR_PACKET;
56
+ };
57
+ var decodeBase64Packet = (h, W) => withNativeArrayBuffer$1 ? mapBinary(decode$1(h), W) : {
58
+ base64: !0,
59
+ data: h
60
+ }, mapBinary = (h, W) => {
61
+ switch (W) {
62
+ case "blob": return h instanceof Blob ? h : new Blob([h]);
63
+ case "arraybuffer":
64
+ default: return h instanceof ArrayBuffer ? h : h.buffer;
65
+ }
66
+ }, SEPARATOR = "", encodePayload = (h, W) => {
67
+ let G = h.length, K = Array(G), q = 0;
68
+ h.forEach((h, J) => {
69
+ encodePacket(h, !1, (h) => {
70
+ K[J] = h, ++q === G && W(K.join(SEPARATOR));
71
+ });
72
+ });
73
+ }, decodePayload = (h, W) => {
74
+ let G = h.split(SEPARATOR), K = [];
75
+ for (let h = 0; h < G.length; h++) {
76
+ let q = decodePacket(G[h], W);
77
+ if (K.push(q), q.type === "error") break;
78
+ }
79
+ return K;
80
+ };
81
+ function createPacketEncoderStream() {
82
+ return new TransformStream({ transform(h, W) {
83
+ encodePacketToBinary(h, (G) => {
84
+ let K = G.length, q;
85
+ if (K < 126) q = new Uint8Array(1), new DataView(q.buffer).setUint8(0, K);
86
+ else if (K < 65536) {
87
+ q = new Uint8Array(3);
88
+ let h = new DataView(q.buffer);
89
+ h.setUint8(0, 126), h.setUint16(1, K);
90
+ } else {
91
+ q = new Uint8Array(9);
92
+ let h = new DataView(q.buffer);
93
+ h.setUint8(0, 127), h.setBigUint64(1, BigInt(K));
94
+ }
95
+ h.data && typeof h.data != "string" && (q[0] |= 128), W.enqueue(q), W.enqueue(G);
96
+ });
97
+ } });
98
+ }
99
+ var TEXT_DECODER;
100
+ function totalLength(h) {
101
+ return h.reduce((h, W) => h + W.length, 0);
102
+ }
103
+ function concatChunks(h, W) {
104
+ if (h[0].length === W) return h.shift();
105
+ let G = new Uint8Array(W), K = 0;
106
+ for (let q = 0; q < W; q++) G[q] = h[0][K++], K === h[0].length && (h.shift(), K = 0);
107
+ return h.length && K < h[0].length && (h[0] = h[0].slice(K)), G;
108
+ }
109
+ function createPacketDecoderStream(h, W) {
110
+ TEXT_DECODER ||= new TextDecoder();
111
+ let G = [], K = 0, q = -1, J = !1;
112
+ return new TransformStream({ transform(Y, X) {
113
+ for (G.push(Y);;) {
114
+ if (K === 0) {
115
+ if (totalLength(G) < 1) break;
116
+ let h = concatChunks(G, 1);
117
+ J = (h[0] & 128) == 128, q = h[0] & 127, K = q < 126 ? 3 : q === 126 ? 1 : 2;
118
+ } else if (K === 1) {
119
+ if (totalLength(G) < 2) break;
120
+ let h = concatChunks(G, 2);
121
+ q = new DataView(h.buffer, h.byteOffset, h.length).getUint16(0), K = 3;
122
+ } else if (K === 2) {
123
+ if (totalLength(G) < 8) break;
124
+ let h = concatChunks(G, 8), W = new DataView(h.buffer, h.byteOffset, h.length), J = W.getUint32(0);
125
+ if (J > 2 ** 21 - 1) {
126
+ X.enqueue(ERROR_PACKET);
127
+ break;
128
+ }
129
+ q = J * 2 ** 32 + W.getUint32(4), K = 3;
130
+ } else {
131
+ if (totalLength(G) < q) break;
132
+ let h = concatChunks(G, q);
133
+ X.enqueue(decodePacket(J ? h : TEXT_DECODER.decode(h), W)), K = 0;
134
+ }
135
+ if (q === 0 || q > h) {
136
+ X.enqueue(ERROR_PACKET);
137
+ break;
138
+ }
139
+ }
140
+ } });
141
+ }
142
+ function Emitter(h) {
143
+ if (h) return mixin(h);
144
+ }
145
+ function mixin(h) {
146
+ for (var W in Emitter.prototype) h[W] = Emitter.prototype[W];
147
+ return h;
148
+ }
149
+ Emitter.prototype.on = Emitter.prototype.addEventListener = function(h, W) {
150
+ return this._callbacks = this._callbacks || {}, (this._callbacks["$" + h] = this._callbacks["$" + h] || []).push(W), this;
151
+ }, Emitter.prototype.once = function(h, W) {
152
+ function G() {
153
+ this.off(h, G), W.apply(this, arguments);
154
+ }
155
+ return G.fn = W, this.on(h, G), this;
156
+ }, Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(h, W) {
157
+ if (this._callbacks = this._callbacks || {}, arguments.length == 0) return this._callbacks = {}, this;
158
+ var G = this._callbacks["$" + h];
159
+ if (!G) return this;
160
+ if (arguments.length == 1) return delete this._callbacks["$" + h], this;
161
+ for (var K, q = 0; q < G.length; q++) if (K = G[q], K === W || K.fn === W) {
162
+ G.splice(q, 1);
163
+ break;
164
+ }
165
+ return G.length === 0 && delete this._callbacks["$" + h], this;
166
+ }, Emitter.prototype.emit = function(h) {
167
+ this._callbacks = this._callbacks || {};
168
+ for (var W = Array(arguments.length - 1), G = this._callbacks["$" + h], K = 1; K < arguments.length; K++) W[K - 1] = arguments[K];
169
+ if (G) {
170
+ G = G.slice(0);
171
+ for (var K = 0, q = G.length; K < q; ++K) G[K].apply(this, W);
172
+ }
173
+ return this;
174
+ }, Emitter.prototype.emitReserved = Emitter.prototype.emit, Emitter.prototype.listeners = function(h) {
175
+ return this._callbacks = this._callbacks || {}, this._callbacks["$" + h] || [];
176
+ }, Emitter.prototype.hasListeners = function(h) {
177
+ return !!this.listeners(h).length;
178
+ };
179
+ const nextTick = (() => typeof Promise == "function" && typeof Promise.resolve == "function" ? (h) => Promise.resolve().then(h) : (h, W) => W(h, 0))(), globalThisShim = (() => typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")())();
180
+ function pick(h, ...W) {
181
+ return W.reduce((W, G) => (h.hasOwnProperty(G) && (W[G] = h[G]), W), {});
182
+ }
183
+ var NATIVE_SET_TIMEOUT = globalThisShim.setTimeout, NATIVE_CLEAR_TIMEOUT = globalThisShim.clearTimeout;
184
+ function installTimerFunctions(h, W) {
185
+ W.useNativeTimers ? (h.setTimeoutFn = NATIVE_SET_TIMEOUT.bind(globalThisShim), h.clearTimeoutFn = NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)) : (h.setTimeoutFn = globalThisShim.setTimeout.bind(globalThisShim), h.clearTimeoutFn = globalThisShim.clearTimeout.bind(globalThisShim));
186
+ }
187
+ var BASE64_OVERHEAD = 1.33;
188
+ function byteLength(h) {
189
+ return typeof h == "string" ? utf8Length(h) : Math.ceil((h.byteLength || h.size) * BASE64_OVERHEAD);
190
+ }
191
+ function utf8Length(h) {
192
+ let W = 0, G = 0;
193
+ for (let K = 0, q = h.length; K < q; K++) W = h.charCodeAt(K), W < 128 ? G += 1 : W < 2048 ? G += 2 : W < 55296 || W >= 57344 ? G += 3 : (K++, G += 4);
194
+ return G;
195
+ }
196
+ function randomString() {
197
+ return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
198
+ }
199
+ function encode(h) {
200
+ let W = "";
201
+ for (let G in h) h.hasOwnProperty(G) && (W.length && (W += "&"), W += encodeURIComponent(G) + "=" + encodeURIComponent(h[G]));
202
+ return W;
203
+ }
204
+ function decode(h) {
205
+ let W = {}, G = h.split("&");
206
+ for (let h = 0, K = G.length; h < K; h++) {
207
+ let K = G[h].split("=");
208
+ W[decodeURIComponent(K[0])] = decodeURIComponent(K[1]);
209
+ }
210
+ return W;
211
+ }
212
+ var TransportError = class extends Error {
213
+ constructor(h, W, G) {
214
+ super(h), this.description = W, this.context = G, this.type = "TransportError";
215
+ }
216
+ }, Transport = class extends Emitter {
217
+ constructor(h) {
218
+ super(), this.writable = !1, installTimerFunctions(this, h), this.opts = h, this.query = h.query, this.socket = h.socket, this.supportsBinary = !h.forceBase64;
219
+ }
220
+ onError(h, W, G) {
221
+ return super.emitReserved("error", new TransportError(h, W, G)), this;
222
+ }
223
+ open() {
224
+ return this.readyState = "opening", this.doOpen(), this;
225
+ }
226
+ close() {
227
+ return (this.readyState === "opening" || this.readyState === "open") && (this.doClose(), this.onClose()), this;
228
+ }
229
+ send(h) {
230
+ this.readyState === "open" && this.write(h);
231
+ }
232
+ onOpen() {
233
+ this.readyState = "open", this.writable = !0, super.emitReserved("open");
234
+ }
235
+ onData(h) {
236
+ let W = decodePacket(h, this.socket.binaryType);
237
+ this.onPacket(W);
238
+ }
239
+ onPacket(h) {
240
+ super.emitReserved("packet", h);
241
+ }
242
+ onClose(h) {
243
+ this.readyState = "closed", super.emitReserved("close", h);
244
+ }
245
+ pause(h) {}
246
+ createUri(h, W = {}) {
247
+ return h + "://" + this._hostname() + this._port() + this.opts.path + this._query(W);
248
+ }
249
+ _hostname() {
250
+ let h = this.opts.hostname;
251
+ return h.indexOf(":") === -1 ? h : "[" + h + "]";
252
+ }
253
+ _port() {
254
+ return this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
255
+ }
256
+ _query(h) {
257
+ let W = encode(h);
258
+ return W.length ? "?" + W : "";
259
+ }
260
+ }, Polling = class extends Transport {
261
+ constructor() {
262
+ super(...arguments), this._polling = !1;
263
+ }
264
+ get name() {
265
+ return "polling";
266
+ }
267
+ doOpen() {
268
+ this._poll();
269
+ }
270
+ pause(h) {
271
+ this.readyState = "pausing";
272
+ let W = () => {
273
+ this.readyState = "paused", h();
274
+ };
275
+ if (this._polling || !this.writable) {
276
+ let h = 0;
277
+ this._polling && (h++, this.once("pollComplete", function() {
278
+ --h || W();
279
+ })), this.writable || (h++, this.once("drain", function() {
280
+ --h || W();
281
+ }));
282
+ } else W();
283
+ }
284
+ _poll() {
285
+ this._polling = !0, this.doPoll(), this.emitReserved("poll");
286
+ }
287
+ onData(h) {
288
+ decodePayload(h, this.socket.binaryType).forEach((h) => {
289
+ if (this.readyState === "opening" && h.type === "open" && this.onOpen(), h.type === "close") return this.onClose({ description: "transport closed by the server" }), !1;
290
+ this.onPacket(h);
291
+ }), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
292
+ }
293
+ doClose() {
294
+ let h = () => {
295
+ this.write([{ type: "close" }]);
296
+ };
297
+ this.readyState === "open" ? h() : this.once("open", h);
298
+ }
299
+ write(h) {
300
+ this.writable = !1, encodePayload(h, (h) => {
301
+ this.doWrite(h, () => {
302
+ this.writable = !0, this.emitReserved("drain");
303
+ });
304
+ });
305
+ }
306
+ uri() {
307
+ let h = this.opts.secure ? "https" : "http", W = this.query || {};
308
+ return !1 !== this.opts.timestampRequests && (W[this.opts.timestampParam] = randomString()), !this.supportsBinary && !W.sid && (W.b64 = 1), this.createUri(h, W);
309
+ }
310
+ }, value = !1;
311
+ try {
312
+ value = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
313
+ } catch {}
314
+ const hasCORS = value;
315
+ function empty() {}
316
+ var BaseXHR = class extends Polling {
317
+ constructor(h) {
318
+ if (super(h), typeof location < "u") {
319
+ let W = location.protocol === "https:", G = location.port;
320
+ G ||= W ? "443" : "80", this.xd = typeof location < "u" && h.hostname !== location.hostname || G !== h.port;
321
+ }
322
+ }
323
+ doWrite(h, W) {
324
+ let G = this.request({
325
+ method: "POST",
326
+ data: h
327
+ });
328
+ G.on("success", W), G.on("error", (h, W) => {
329
+ this.onError("xhr post error", h, W);
330
+ });
331
+ }
332
+ doPoll() {
333
+ let h = this.request();
334
+ h.on("data", this.onData.bind(this)), h.on("error", (h, W) => {
335
+ this.onError("xhr poll error", h, W);
336
+ }), this.pollXhr = h;
337
+ }
338
+ }, Request = class h extends Emitter {
339
+ constructor(h, W, G) {
340
+ super(), this.createRequest = h, installTimerFunctions(this, G), this._opts = G, this._method = G.method || "GET", this._uri = W, this._data = G.data === void 0 ? null : G.data, this._create();
341
+ }
342
+ _create() {
343
+ var W;
344
+ let G = pick(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
345
+ G.xdomain = !!this._opts.xd;
346
+ let K = this._xhr = this.createRequest(G);
347
+ try {
348
+ K.open(this._method, this._uri, !0);
349
+ try {
350
+ if (this._opts.extraHeaders) for (let h in K.setDisableHeaderCheck && K.setDisableHeaderCheck(!0), this._opts.extraHeaders) this._opts.extraHeaders.hasOwnProperty(h) && K.setRequestHeader(h, this._opts.extraHeaders[h]);
351
+ } catch {}
352
+ if (this._method === "POST") try {
353
+ K.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
354
+ } catch {}
355
+ try {
356
+ K.setRequestHeader("Accept", "*/*");
357
+ } catch {}
358
+ (W = this._opts.cookieJar) == null || W.addCookies(K), "withCredentials" in K && (K.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (K.timeout = this._opts.requestTimeout), K.onreadystatechange = () => {
359
+ var h;
360
+ K.readyState === 3 && ((h = this._opts.cookieJar) == null || h.parseCookies(K.getResponseHeader("set-cookie"))), K.readyState === 4 && (K.status === 200 || K.status === 1223 ? this._onLoad() : this.setTimeoutFn(() => {
361
+ this._onError(typeof K.status == "number" ? K.status : 0);
362
+ }, 0));
363
+ }, K.send(this._data);
364
+ } catch (h) {
365
+ this.setTimeoutFn(() => {
366
+ this._onError(h);
367
+ }, 0);
368
+ return;
369
+ }
370
+ typeof document < "u" && (this._index = h.requestsCount++, h.requests[this._index] = this);
371
+ }
372
+ _onError(h) {
373
+ this.emitReserved("error", h, this._xhr), this._cleanup(!0);
374
+ }
375
+ _cleanup(W) {
376
+ if (!(this._xhr === void 0 || this._xhr === null)) {
377
+ if (this._xhr.onreadystatechange = empty, W) try {
378
+ this._xhr.abort();
379
+ } catch {}
380
+ typeof document < "u" && delete h.requests[this._index], this._xhr = null;
381
+ }
382
+ }
383
+ _onLoad() {
384
+ let h = this._xhr.responseText;
385
+ h !== null && (this.emitReserved("data", h), this.emitReserved("success"), this._cleanup());
386
+ }
387
+ abort() {
388
+ this._cleanup();
389
+ }
390
+ };
391
+ if (Request.requestsCount = 0, Request.requests = {}, typeof document < "u") {
392
+ if (typeof attachEvent == "function") attachEvent("onunload", unloadHandler);
393
+ else if (typeof addEventListener == "function") {
394
+ let h = "onpagehide" in globalThisShim ? "pagehide" : "unload";
395
+ addEventListener(h, unloadHandler, !1);
396
+ }
397
+ }
398
+ function unloadHandler() {
399
+ for (let h in Request.requests) Request.requests.hasOwnProperty(h) && Request.requests[h].abort();
400
+ }
401
+ var hasXHR2 = (function() {
402
+ let h = newRequest({ xdomain: !1 });
403
+ return h && h.responseType !== null;
404
+ })(), XHR = class extends BaseXHR {
405
+ constructor(h) {
406
+ super(h);
407
+ let W = h && h.forceBase64;
408
+ this.supportsBinary = hasXHR2 && !W;
409
+ }
410
+ request(h = {}) {
411
+ return Object.assign(h, { xd: this.xd }, this.opts), new Request(newRequest, this.uri(), h);
412
+ }
413
+ };
414
+ function newRequest(h) {
415
+ let W = h.xdomain;
416
+ try {
417
+ if (typeof XMLHttpRequest < "u" && (!W || hasCORS)) return new XMLHttpRequest();
418
+ } catch {}
419
+ if (!W) try {
420
+ return new globalThisShim[["Active", "Object"].join("X")]("Microsoft.XMLHTTP");
421
+ } catch {}
422
+ }
423
+ var isReactNative = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", BaseWS = class extends Transport {
424
+ get name() {
425
+ return "websocket";
426
+ }
427
+ doOpen() {
428
+ let h = this.uri(), W = this.opts.protocols, G = isReactNative ? {} : pick(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
429
+ this.opts.extraHeaders && (G.headers = this.opts.extraHeaders);
430
+ try {
431
+ this.ws = this.createSocket(h, W, G);
432
+ } catch (h) {
433
+ return this.emitReserved("error", h);
434
+ }
435
+ this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
436
+ }
437
+ addEventListeners() {
438
+ this.ws.onopen = () => {
439
+ this.opts.autoUnref && this.ws._socket.unref(), this.onOpen();
440
+ }, this.ws.onclose = (h) => this.onClose({
441
+ description: "websocket connection closed",
442
+ context: h
443
+ }), this.ws.onmessage = (h) => this.onData(h.data), this.ws.onerror = (h) => this.onError("websocket error", h);
444
+ }
445
+ write(h) {
446
+ this.writable = !1;
447
+ for (let W = 0; W < h.length; W++) {
448
+ let G = h[W], K = W === h.length - 1;
449
+ encodePacket(G, this.supportsBinary, (h) => {
450
+ try {
451
+ this.doWrite(G, h);
452
+ } catch {}
453
+ K && nextTick(() => {
454
+ this.writable = !0, this.emitReserved("drain");
455
+ }, this.setTimeoutFn);
456
+ });
457
+ }
458
+ }
459
+ doClose() {
460
+ this.ws !== void 0 && (this.ws.onerror = () => {}, this.ws.close(), this.ws = null);
461
+ }
462
+ uri() {
463
+ let h = this.opts.secure ? "wss" : "ws", W = this.query || {};
464
+ return this.opts.timestampRequests && (W[this.opts.timestampParam] = randomString()), this.supportsBinary || (W.b64 = 1), this.createUri(h, W);
465
+ }
466
+ }, WebSocketCtor = globalThisShim.WebSocket || globalThisShim.MozWebSocket;
467
+ const transports = {
468
+ websocket: class extends BaseWS {
469
+ createSocket(h, W, G) {
470
+ return isReactNative ? new WebSocketCtor(h, W, G) : W ? new WebSocketCtor(h, W) : new WebSocketCtor(h);
471
+ }
472
+ doWrite(h, W) {
473
+ this.ws.send(W);
474
+ }
475
+ },
476
+ webtransport: class extends Transport {
477
+ get name() {
478
+ return "webtransport";
479
+ }
480
+ doOpen() {
481
+ try {
482
+ this._transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]);
483
+ } catch (h) {
484
+ return this.emitReserved("error", h);
485
+ }
486
+ this._transport.closed.then(() => {
487
+ this.onClose();
488
+ }).catch((h) => {
489
+ this.onError("webtransport error", h);
490
+ }), this._transport.ready.then(() => {
491
+ this._transport.createBidirectionalStream().then((h) => {
492
+ let W = createPacketDecoderStream(2 ** 53 - 1, this.socket.binaryType), G = h.readable.pipeThrough(W).getReader(), K = createPacketEncoderStream();
493
+ K.readable.pipeTo(h.writable), this._writer = K.writable.getWriter();
494
+ let q = () => {
495
+ G.read().then(({ done: h, value: W }) => {
496
+ h || (this.onPacket(W), q());
497
+ }).catch((h) => {});
498
+ };
499
+ q();
500
+ let J = { type: "open" };
501
+ this.query.sid && (J.data = `{"sid":"${this.query.sid}"}`), this._writer.write(J).then(() => this.onOpen());
502
+ });
503
+ });
504
+ }
505
+ write(h) {
506
+ this.writable = !1;
507
+ for (let W = 0; W < h.length; W++) {
508
+ let G = h[W], K = W === h.length - 1;
509
+ this._writer.write(G).then(() => {
510
+ K && nextTick(() => {
511
+ this.writable = !0, this.emitReserved("drain");
512
+ }, this.setTimeoutFn);
513
+ });
514
+ }
515
+ }
516
+ doClose() {
517
+ var h;
518
+ (h = this._transport) == null || h.close();
519
+ }
520
+ },
521
+ polling: XHR
522
+ };
523
+ var re = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, parts = [
524
+ "source",
525
+ "protocol",
526
+ "authority",
527
+ "userInfo",
528
+ "user",
529
+ "password",
530
+ "host",
531
+ "port",
532
+ "relative",
533
+ "path",
534
+ "directory",
535
+ "file",
536
+ "query",
537
+ "anchor"
538
+ ];
539
+ function parse(h) {
540
+ if (h.length > 8e3) throw "URI too long";
541
+ let W = h, G = h.indexOf("["), K = h.indexOf("]");
542
+ G != -1 && K != -1 && (h = h.substring(0, G) + h.substring(G, K).replace(/:/g, ";") + h.substring(K, h.length));
543
+ let q = re.exec(h || ""), J = {}, Y = 14;
544
+ for (; Y--;) J[parts[Y]] = q[Y] || "";
545
+ return G != -1 && K != -1 && (J.source = W, J.host = J.host.substring(1, J.host.length - 1).replace(/;/g, ":"), J.authority = J.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), J.ipv6uri = !0), J.pathNames = pathNames(J, J.path), J.queryKey = queryKey(J, J.query), J;
546
+ }
547
+ function pathNames(h, W) {
548
+ let G = W.replace(/\/{2,9}/g, "/").split("/");
549
+ return (W.slice(0, 1) == "/" || W.length === 0) && G.splice(0, 1), W.slice(-1) == "/" && G.splice(G.length - 1, 1), G;
550
+ }
551
+ function queryKey(h, W) {
552
+ let G = {};
553
+ return W.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(h, W, K) {
554
+ W && (G[W] = K);
555
+ }), G;
556
+ }
557
+ var withEventListeners = typeof addEventListener == "function" && typeof removeEventListener == "function", OFFLINE_EVENT_LISTENERS = [];
558
+ withEventListeners && addEventListener("offline", () => {
559
+ OFFLINE_EVENT_LISTENERS.forEach((h) => h());
560
+ }, !1);
561
+ var SocketWithoutUpgrade = class h extends Emitter {
562
+ constructor(h, W) {
563
+ if (super(), this.binaryType = "arraybuffer", this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, h && typeof h == "object" && (W = h, h = null), h) {
564
+ let G = parse(h);
565
+ W.hostname = G.host, W.secure = G.protocol === "https" || G.protocol === "wss", W.port = G.port, G.query && (W.query = G.query);
566
+ } else W.host && (W.hostname = parse(W.host).host);
567
+ installTimerFunctions(this, W), this.secure = W.secure == null ? typeof location < "u" && location.protocol === "https:" : W.secure, W.hostname && !W.port && (W.port = this.secure ? "443" : "80"), this.hostname = W.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = W.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, W.transports.forEach((h) => {
568
+ let W = h.prototype.name;
569
+ this.transports.push(W), this._transportsByName[W] = h;
570
+ }), this.opts = Object.assign({
571
+ path: "/engine.io",
572
+ agent: !1,
573
+ withCredentials: !1,
574
+ upgrade: !0,
575
+ timestampParam: "t",
576
+ rememberUpgrade: !1,
577
+ addTrailingSlash: !0,
578
+ rejectUnauthorized: !0,
579
+ perMessageDeflate: { threshold: 1024 },
580
+ transportOptions: {},
581
+ closeOnBeforeunload: !1
582
+ }, W), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = decode(this.opts.query)), withEventListeners && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
583
+ this.transport && (this.transport.removeAllListeners(), this.transport.close());
584
+ }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
585
+ this._onClose("transport close", { description: "network connection lost" });
586
+ }, OFFLINE_EVENT_LISTENERS.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
587
+ }
588
+ createTransport(h) {
589
+ let W = Object.assign({}, this.opts.query);
590
+ W.EIO = 4, W.transport = h, this.id && (W.sid = this.id);
591
+ let G = Object.assign({}, this.opts, {
592
+ query: W,
593
+ socket: this,
594
+ hostname: this.hostname,
595
+ secure: this.secure,
596
+ port: this.port
597
+ }, this.opts.transportOptions[h]);
598
+ return new this._transportsByName[h](G);
599
+ }
600
+ _open() {
601
+ if (this.transports.length === 0) {
602
+ this.setTimeoutFn(() => {
603
+ this.emitReserved("error", "No transports available");
604
+ }, 0);
605
+ return;
606
+ }
607
+ let W = this.opts.rememberUpgrade && h.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
608
+ this.readyState = "opening";
609
+ let G = this.createTransport(W);
610
+ G.open(), this.setTransport(G);
611
+ }
612
+ setTransport(h) {
613
+ this.transport && this.transport.removeAllListeners(), this.transport = h, h.on("drain", this._onDrain.bind(this)).on("packet", this._onPacket.bind(this)).on("error", this._onError.bind(this)).on("close", (h) => this._onClose("transport close", h));
614
+ }
615
+ onOpen() {
616
+ this.readyState = "open", h.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
617
+ }
618
+ _onPacket(h) {
619
+ if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") switch (this.emitReserved("packet", h), this.emitReserved("heartbeat"), h.type) {
620
+ case "open":
621
+ this.onHandshake(JSON.parse(h.data));
622
+ break;
623
+ case "ping":
624
+ this._sendPacket("pong"), this.emitReserved("ping"), this.emitReserved("pong"), this._resetPingTimeout();
625
+ break;
626
+ case "error":
627
+ let W = /* @__PURE__ */ Error("server error");
628
+ W.code = h.data, this._onError(W);
629
+ break;
630
+ case "message":
631
+ this.emitReserved("data", h.data), this.emitReserved("message", h.data);
632
+ break;
633
+ }
634
+ }
635
+ onHandshake(h) {
636
+ this.emitReserved("handshake", h), this.id = h.sid, this.transport.query.sid = h.sid, this._pingInterval = h.pingInterval, this._pingTimeout = h.pingTimeout, this._maxPayload = h.maxPayload, this.onOpen(), this.readyState !== "closed" && this._resetPingTimeout();
637
+ }
638
+ _resetPingTimeout() {
639
+ this.clearTimeoutFn(this._pingTimeoutTimer);
640
+ let h = this._pingInterval + this._pingTimeout;
641
+ this._pingTimeoutTime = Date.now() + h, this._pingTimeoutTimer = this.setTimeoutFn(() => {
642
+ this._onClose("ping timeout");
643
+ }, h), this.opts.autoUnref && this._pingTimeoutTimer.unref();
644
+ }
645
+ _onDrain() {
646
+ this.writeBuffer.splice(0, this._prevBufferLen), this._prevBufferLen = 0, this.writeBuffer.length === 0 ? this.emitReserved("drain") : this.flush();
647
+ }
648
+ flush() {
649
+ if (this.readyState !== "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length) {
650
+ let h = this._getWritablePackets();
651
+ this.transport.send(h), this._prevBufferLen = h.length, this.emitReserved("flush");
652
+ }
653
+ }
654
+ _getWritablePackets() {
655
+ if (!(this._maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1)) return this.writeBuffer;
656
+ let h = 1;
657
+ for (let W = 0; W < this.writeBuffer.length; W++) {
658
+ let G = this.writeBuffer[W].data;
659
+ if (G && (h += byteLength(G)), W > 0 && h > this._maxPayload) return this.writeBuffer.slice(0, W);
660
+ h += 2;
661
+ }
662
+ return this.writeBuffer;
663
+ }
664
+ _hasPingExpired() {
665
+ if (!this._pingTimeoutTime) return !0;
666
+ let h = Date.now() > this._pingTimeoutTime;
667
+ return h && (this._pingTimeoutTime = 0, nextTick(() => {
668
+ this._onClose("ping timeout");
669
+ }, this.setTimeoutFn)), h;
670
+ }
671
+ write(h, W, G) {
672
+ return this._sendPacket("message", h, W, G), this;
673
+ }
674
+ send(h, W, G) {
675
+ return this._sendPacket("message", h, W, G), this;
676
+ }
677
+ _sendPacket(h, W, G, K) {
678
+ if (typeof W == "function" && (K = W, W = void 0), typeof G == "function" && (K = G, G = null), this.readyState === "closing" || this.readyState === "closed") return;
679
+ G ||= {}, G.compress = !1 !== G.compress;
680
+ let q = {
681
+ type: h,
682
+ data: W,
683
+ options: G
684
+ };
685
+ this.emitReserved("packetCreate", q), this.writeBuffer.push(q), K && this.once("flush", K), this.flush();
686
+ }
687
+ close() {
688
+ let h = () => {
689
+ this._onClose("forced close"), this.transport.close();
690
+ }, W = () => {
691
+ this.off("upgrade", W), this.off("upgradeError", W), h();
692
+ }, G = () => {
693
+ this.once("upgrade", W), this.once("upgradeError", W);
694
+ };
695
+ return (this.readyState === "opening" || this.readyState === "open") && (this.readyState = "closing", this.writeBuffer.length ? this.once("drain", () => {
696
+ this.upgrading ? G() : h();
697
+ }) : this.upgrading ? G() : h()), this;
698
+ }
699
+ _onError(W) {
700
+ if (h.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening") return this.transports.shift(), this._open();
701
+ this.emitReserved("error", W), this._onClose("transport error", W);
702
+ }
703
+ _onClose(h, W) {
704
+ if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
705
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), withEventListeners && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
706
+ let h = OFFLINE_EVENT_LISTENERS.indexOf(this._offlineEventListener);
707
+ h !== -1 && OFFLINE_EVENT_LISTENERS.splice(h, 1);
708
+ }
709
+ this.readyState = "closed", this.id = null, this.emitReserved("close", h, W), this.writeBuffer = [], this._prevBufferLen = 0;
710
+ }
711
+ }
712
+ };
713
+ SocketWithoutUpgrade.protocol = 4;
714
+ var SocketWithUpgrade = class extends SocketWithoutUpgrade {
715
+ constructor() {
716
+ super(...arguments), this._upgrades = [];
717
+ }
718
+ onOpen() {
719
+ if (super.onOpen(), this.readyState === "open" && this.opts.upgrade) for (let h = 0; h < this._upgrades.length; h++) this._probe(this._upgrades[h]);
720
+ }
721
+ _probe(h) {
722
+ let W = this.createTransport(h), G = !1;
723
+ SocketWithoutUpgrade.priorWebsocketSuccess = !1;
724
+ let K = () => {
725
+ G || (W.send([{
726
+ type: "ping",
727
+ data: "probe"
728
+ }]), W.once("packet", (h) => {
729
+ if (!G) if (h.type === "pong" && h.data === "probe") {
730
+ if (this.upgrading = !0, this.emitReserved("upgrading", W), !W) return;
731
+ SocketWithoutUpgrade.priorWebsocketSuccess = W.name === "websocket", this.transport.pause(() => {
732
+ G || this.readyState !== "closed" && (Q(), this.setTransport(W), W.send([{ type: "upgrade" }]), this.emitReserved("upgrade", W), W = null, this.upgrading = !1, this.flush());
733
+ });
734
+ } else {
735
+ let h = /* @__PURE__ */ Error("probe error");
736
+ h.transport = W.name, this.emitReserved("upgradeError", h);
737
+ }
738
+ }));
739
+ };
740
+ function q() {
741
+ G || (G = !0, Q(), W.close(), W = null);
742
+ }
743
+ let J = (h) => {
744
+ let G = /* @__PURE__ */ Error("probe error: " + h);
745
+ G.transport = W.name, q(), this.emitReserved("upgradeError", G);
746
+ };
747
+ function Y() {
748
+ J("transport closed");
749
+ }
750
+ function X() {
751
+ J("socket closed");
752
+ }
753
+ function Z(h) {
754
+ W && h.name !== W.name && q();
755
+ }
756
+ let Q = () => {
757
+ W.removeListener("open", K), W.removeListener("error", J), W.removeListener("close", Y), this.off("close", X), this.off("upgrading", Z);
758
+ };
759
+ W.once("open", K), W.once("error", J), W.once("close", Y), this.once("close", X), this.once("upgrading", Z), this._upgrades.indexOf("webtransport") !== -1 && h !== "webtransport" ? this.setTimeoutFn(() => {
760
+ G || W.open();
761
+ }, 200) : W.open();
762
+ }
763
+ onHandshake(h) {
764
+ this._upgrades = this._filterUpgrades(h.upgrades), super.onHandshake(h);
765
+ }
766
+ _filterUpgrades(h) {
767
+ let W = [];
768
+ for (let G = 0; G < h.length; G++) ~this.transports.indexOf(h[G]) && W.push(h[G]);
769
+ return W;
770
+ }
771
+ }, Socket$1 = class extends SocketWithUpgrade {
772
+ constructor(h, W = {}) {
773
+ let G = typeof h == "object" ? h : W;
774
+ (!G.transports || G.transports && typeof G.transports[0] == "string") && (G.transports = (G.transports || [
775
+ "polling",
776
+ "websocket",
777
+ "webtransport"
778
+ ]).map((h) => transports[h]).filter((h) => !!h)), super(h, G);
779
+ }
780
+ };
781
+ Socket$1.protocol;
782
+ function url(h, W = "", G) {
783
+ let K = h;
784
+ G ||= typeof location < "u" && location, h ??= G.protocol + "//" + G.host, typeof h == "string" && (h.charAt(0) === "/" && (h = h.charAt(1) === "/" ? G.protocol + h : G.host + h), /^(https?|wss?):\/\//.test(h) || (h = G === void 0 ? "https://" + h : G.protocol + "//" + h), K = parse(h)), K.port || (/^(http|ws)$/.test(K.protocol) ? K.port = "80" : /^(http|ws)s$/.test(K.protocol) && (K.port = "443")), K.path = K.path || "/";
785
+ let q = K.host.indexOf(":") === -1 ? K.host : "[" + K.host + "]";
786
+ return K.id = K.protocol + "://" + q + ":" + K.port + W, K.href = K.protocol + "://" + q + (G && G.port === K.port ? "" : ":" + K.port), K;
787
+ }
788
+ var withNativeArrayBuffer = typeof ArrayBuffer == "function", isView = (h) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(h) : h.buffer instanceof ArrayBuffer, toString = Object.prototype.toString, withNativeBlob = typeof Blob == "function" || typeof Blob < "u" && toString.call(Blob) === "[object BlobConstructor]", withNativeFile = typeof File == "function" || typeof File < "u" && toString.call(File) === "[object FileConstructor]";
789
+ function isBinary(h) {
790
+ return withNativeArrayBuffer && (h instanceof ArrayBuffer || isView(h)) || withNativeBlob && h instanceof Blob || withNativeFile && h instanceof File;
791
+ }
792
+ function hasBinary(h, W) {
793
+ if (!h || typeof h != "object") return !1;
794
+ if (Array.isArray(h)) {
795
+ for (let W = 0, G = h.length; W < G; W++) if (hasBinary(h[W])) return !0;
796
+ return !1;
797
+ }
798
+ if (isBinary(h)) return !0;
799
+ if (h.toJSON && typeof h.toJSON == "function" && arguments.length === 1) return hasBinary(h.toJSON(), !0);
800
+ for (let W in h) if (Object.prototype.hasOwnProperty.call(h, W) && hasBinary(h[W])) return !0;
801
+ return !1;
802
+ }
803
+ function deconstructPacket(h) {
804
+ let W = [], G = h.data, K = h;
805
+ return K.data = _deconstructPacket(G, W), K.attachments = W.length, {
806
+ packet: K,
807
+ buffers: W
808
+ };
809
+ }
810
+ function _deconstructPacket(h, W) {
811
+ if (!h) return h;
812
+ if (isBinary(h)) {
813
+ let G = {
814
+ _placeholder: !0,
815
+ num: W.length
816
+ };
817
+ return W.push(h), G;
818
+ } else if (Array.isArray(h)) {
819
+ let G = Array(h.length);
820
+ for (let K = 0; K < h.length; K++) G[K] = _deconstructPacket(h[K], W);
821
+ return G;
822
+ } else if (typeof h == "object" && !(h instanceof Date)) {
823
+ let G = {};
824
+ for (let K in h) Object.prototype.hasOwnProperty.call(h, K) && (G[K] = _deconstructPacket(h[K], W));
825
+ return G;
826
+ }
827
+ return h;
828
+ }
829
+ function reconstructPacket(h, W) {
830
+ return h.data = _reconstructPacket(h.data, W), delete h.attachments, h;
831
+ }
832
+ function _reconstructPacket(h, W) {
833
+ if (!h) return h;
834
+ if (h && h._placeholder === !0) {
835
+ if (typeof h.num == "number" && h.num >= 0 && h.num < W.length) return W[h.num];
836
+ throw Error("illegal attachments");
837
+ } else if (Array.isArray(h)) for (let G = 0; G < h.length; G++) h[G] = _reconstructPacket(h[G], W);
838
+ else if (typeof h == "object") for (let G in h) Object.prototype.hasOwnProperty.call(h, G) && (h[G] = _reconstructPacket(h[G], W));
839
+ return h;
840
+ }
841
+ var esm_exports = /* @__PURE__ */ __export({
842
+ Decoder: () => Decoder,
843
+ Encoder: () => Encoder,
844
+ PacketType: () => PacketType,
845
+ protocol: () => 5
846
+ }, 1), RESERVED_EVENTS$1 = [
847
+ "connect",
848
+ "connect_error",
849
+ "disconnect",
850
+ "disconnecting",
851
+ "newListener",
852
+ "removeListener"
853
+ ], PacketType;
854
+ (function(h) {
855
+ h[h.CONNECT = 0] = "CONNECT", h[h.DISCONNECT = 1] = "DISCONNECT", h[h.EVENT = 2] = "EVENT", h[h.ACK = 3] = "ACK", h[h.CONNECT_ERROR = 4] = "CONNECT_ERROR", h[h.BINARY_EVENT = 5] = "BINARY_EVENT", h[h.BINARY_ACK = 6] = "BINARY_ACK";
856
+ })(PacketType ||= {});
857
+ var Encoder = class {
858
+ constructor(h) {
859
+ this.replacer = h;
860
+ }
861
+ encode(h) {
862
+ return (h.type === PacketType.EVENT || h.type === PacketType.ACK) && hasBinary(h) ? this.encodeAsBinary({
863
+ type: h.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK,
864
+ nsp: h.nsp,
865
+ data: h.data,
866
+ id: h.id
867
+ }) : [this.encodeAsString(h)];
868
+ }
869
+ encodeAsString(h) {
870
+ let W = "" + h.type;
871
+ return (h.type === PacketType.BINARY_EVENT || h.type === PacketType.BINARY_ACK) && (W += h.attachments + "-"), h.nsp && h.nsp !== "/" && (W += h.nsp + ","), h.id != null && (W += h.id), h.data != null && (W += JSON.stringify(h.data, this.replacer)), W;
872
+ }
873
+ encodeAsBinary(h) {
874
+ let W = deconstructPacket(h), G = this.encodeAsString(W.packet), K = W.buffers;
875
+ return K.unshift(G), K;
876
+ }
877
+ };
878
+ function isObject(h) {
879
+ return Object.prototype.toString.call(h) === "[object Object]";
880
+ }
881
+ var Decoder = class h extends Emitter {
882
+ constructor(h) {
883
+ super(), this.reviver = h;
884
+ }
885
+ add(h) {
886
+ let W;
887
+ if (typeof h == "string") {
888
+ if (this.reconstructor) throw Error("got plaintext data when reconstructing a packet");
889
+ W = this.decodeString(h);
890
+ let G = W.type === PacketType.BINARY_EVENT;
891
+ G || W.type === PacketType.BINARY_ACK ? (W.type = G ? PacketType.EVENT : PacketType.ACK, this.reconstructor = new BinaryReconstructor(W), W.attachments === 0 && super.emitReserved("decoded", W)) : super.emitReserved("decoded", W);
892
+ } else if (isBinary(h) || h.base64) if (this.reconstructor) W = this.reconstructor.takeBinaryData(h), W && (this.reconstructor = null, super.emitReserved("decoded", W));
893
+ else throw Error("got binary data when not reconstructing a packet");
894
+ else throw Error("Unknown type: " + h);
895
+ }
896
+ decodeString(W) {
897
+ let G = 0, K = { type: Number(W.charAt(0)) };
898
+ if (PacketType[K.type] === void 0) throw Error("unknown packet type " + K.type);
899
+ if (K.type === PacketType.BINARY_EVENT || K.type === PacketType.BINARY_ACK) {
900
+ let h = G + 1;
901
+ for (; W.charAt(++G) !== "-" && G != W.length;);
902
+ let q = W.substring(h, G);
903
+ if (q != Number(q) || W.charAt(G) !== "-") throw Error("Illegal attachments");
904
+ K.attachments = Number(q);
905
+ }
906
+ if (W.charAt(G + 1) === "/") {
907
+ let h = G + 1;
908
+ for (; ++G && !(W.charAt(G) === "," || G === W.length););
909
+ K.nsp = W.substring(h, G);
910
+ } else K.nsp = "/";
911
+ let q = W.charAt(G + 1);
912
+ if (q !== "" && Number(q) == q) {
913
+ let h = G + 1;
914
+ for (; ++G;) {
915
+ let h = W.charAt(G);
916
+ if (h == null || Number(h) != h) {
917
+ --G;
918
+ break;
919
+ }
920
+ if (G === W.length) break;
921
+ }
922
+ K.id = Number(W.substring(h, G + 1));
923
+ }
924
+ if (W.charAt(++G)) {
925
+ let q = this.tryParse(W.substr(G));
926
+ if (h.isPayloadValid(K.type, q)) K.data = q;
927
+ else throw Error("invalid payload");
928
+ }
929
+ return K;
930
+ }
931
+ tryParse(h) {
932
+ try {
933
+ return JSON.parse(h, this.reviver);
934
+ } catch {
935
+ return !1;
936
+ }
937
+ }
938
+ static isPayloadValid(h, W) {
939
+ switch (h) {
940
+ case PacketType.CONNECT: return isObject(W);
941
+ case PacketType.DISCONNECT: return W === void 0;
942
+ case PacketType.CONNECT_ERROR: return typeof W == "string" || isObject(W);
943
+ case PacketType.EVENT:
944
+ case PacketType.BINARY_EVENT: return Array.isArray(W) && (typeof W[0] == "number" || typeof W[0] == "string" && RESERVED_EVENTS$1.indexOf(W[0]) === -1);
945
+ case PacketType.ACK:
946
+ case PacketType.BINARY_ACK: return Array.isArray(W);
947
+ }
948
+ }
949
+ destroy() {
950
+ this.reconstructor &&= (this.reconstructor.finishedReconstruction(), null);
951
+ }
952
+ }, BinaryReconstructor = class {
953
+ constructor(h) {
954
+ this.packet = h, this.buffers = [], this.reconPack = h;
955
+ }
956
+ takeBinaryData(h) {
957
+ if (this.buffers.push(h), this.buffers.length === this.reconPack.attachments) {
958
+ let h = reconstructPacket(this.reconPack, this.buffers);
959
+ return this.finishedReconstruction(), h;
960
+ }
961
+ return null;
962
+ }
963
+ finishedReconstruction() {
964
+ this.reconPack = null, this.buffers = [];
965
+ }
966
+ };
967
+ function on(h, W, G) {
968
+ return h.on(W, G), function() {
969
+ h.off(W, G);
970
+ };
971
+ }
972
+ var RESERVED_EVENTS = Object.freeze({
973
+ connect: 1,
974
+ connect_error: 1,
975
+ disconnect: 1,
976
+ disconnecting: 1,
977
+ newListener: 1,
978
+ removeListener: 1
979
+ }), Socket = class extends Emitter {
980
+ constructor(h, W, G) {
981
+ 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 = h, this.nsp = W, G && G.auth && (this.auth = G.auth), this._opts = Object.assign({}, G), this.io._autoConnect && this.open();
982
+ }
983
+ get disconnected() {
984
+ return !this.connected;
985
+ }
986
+ subEvents() {
987
+ if (this.subs) return;
988
+ let h = this.io;
989
+ this.subs = [
990
+ on(h, "open", this.onopen.bind(this)),
991
+ on(h, "packet", this.onpacket.bind(this)),
992
+ on(h, "error", this.onerror.bind(this)),
993
+ on(h, "close", this.onclose.bind(this))
994
+ ];
995
+ }
996
+ get active() {
997
+ return !!this.subs;
998
+ }
999
+ connect() {
1000
+ return this.connected ? this : (this.subEvents(), this.io._reconnecting || this.io.open(), this.io._readyState === "open" && this.onopen(), this);
1001
+ }
1002
+ open() {
1003
+ return this.connect();
1004
+ }
1005
+ send(...h) {
1006
+ return h.unshift("message"), this.emit.apply(this, h), this;
1007
+ }
1008
+ emit(h, ...W) {
1009
+ if (RESERVED_EVENTS.hasOwnProperty(h)) throw Error("\"" + h.toString() + "\" is a reserved event name");
1010
+ if (W.unshift(h), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) return this._addToQueue(W), this;
1011
+ let G = {
1012
+ type: PacketType.EVENT,
1013
+ data: W
1014
+ };
1015
+ if (G.options = {}, G.options.compress = this.flags.compress !== !1, typeof W[W.length - 1] == "function") {
1016
+ let h = this.ids++, K = W.pop();
1017
+ this._registerAckCallback(h, K), G.id = h;
1018
+ }
1019
+ let K = this.io.engine?.transport?.writable, q = this.connected && !this.io.engine?._hasPingExpired();
1020
+ return this.flags.volatile && !K || (q ? (this.notifyOutgoingListeners(G), this.packet(G)) : this.sendBuffer.push(G)), this.flags = {}, this;
1021
+ }
1022
+ _registerAckCallback(h, W) {
1023
+ let G = this.flags.timeout ?? this._opts.ackTimeout;
1024
+ if (G === void 0) {
1025
+ this.acks[h] = W;
1026
+ return;
1027
+ }
1028
+ let K = this.io.setTimeoutFn(() => {
1029
+ delete this.acks[h];
1030
+ for (let W = 0; W < this.sendBuffer.length; W++) this.sendBuffer[W].id === h && this.sendBuffer.splice(W, 1);
1031
+ W.call(this, /* @__PURE__ */ Error("operation has timed out"));
1032
+ }, G), q = (...h) => {
1033
+ this.io.clearTimeoutFn(K), W.apply(this, h);
1034
+ };
1035
+ q.withError = !0, this.acks[h] = q;
1036
+ }
1037
+ emitWithAck(h, ...W) {
1038
+ return new Promise((G, K) => {
1039
+ let q = (h, W) => h ? K(h) : G(W);
1040
+ q.withError = !0, W.push(q), this.emit(h, ...W);
1041
+ });
1042
+ }
1043
+ _addToQueue(h) {
1044
+ let W;
1045
+ typeof h[h.length - 1] == "function" && (W = h.pop());
1046
+ let G = {
1047
+ id: this._queueSeq++,
1048
+ tryCount: 0,
1049
+ pending: !1,
1050
+ args: h,
1051
+ flags: Object.assign({ fromQueue: !0 }, this.flags)
1052
+ };
1053
+ h.push((h, ...K) => {
1054
+ if (G === this._queue[0]) return h === null ? (this._queue.shift(), W && W(null, ...K)) : G.tryCount > this._opts.retries && (this._queue.shift(), W && W(h)), G.pending = !1, this._drainQueue();
1055
+ }), this._queue.push(G), this._drainQueue();
1056
+ }
1057
+ _drainQueue(h = !1) {
1058
+ if (!this.connected || this._queue.length === 0) return;
1059
+ let W = this._queue[0];
1060
+ W.pending && !h || (W.pending = !0, W.tryCount++, this.flags = W.flags, this.emit.apply(this, W.args));
1061
+ }
1062
+ packet(h) {
1063
+ h.nsp = this.nsp, this.io._packet(h);
1064
+ }
1065
+ onopen() {
1066
+ typeof this.auth == "function" ? this.auth((h) => {
1067
+ this._sendConnectPacket(h);
1068
+ }) : this._sendConnectPacket(this.auth);
1069
+ }
1070
+ _sendConnectPacket(h) {
1071
+ this.packet({
1072
+ type: PacketType.CONNECT,
1073
+ data: this._pid ? Object.assign({
1074
+ pid: this._pid,
1075
+ offset: this._lastOffset
1076
+ }, h) : h
1077
+ });
1078
+ }
1079
+ onerror(h) {
1080
+ this.connected || this.emitReserved("connect_error", h);
1081
+ }
1082
+ onclose(h, W) {
1083
+ this.connected = !1, delete this.id, this.emitReserved("disconnect", h, W), this._clearAcks();
1084
+ }
1085
+ _clearAcks() {
1086
+ Object.keys(this.acks).forEach((h) => {
1087
+ if (!this.sendBuffer.some((W) => String(W.id) === h)) {
1088
+ let W = this.acks[h];
1089
+ delete this.acks[h], W.withError && W.call(this, /* @__PURE__ */ Error("socket has been disconnected"));
1090
+ }
1091
+ });
1092
+ }
1093
+ onpacket(h) {
1094
+ if (h.nsp === this.nsp) switch (h.type) {
1095
+ case PacketType.CONNECT:
1096
+ h.data && h.data.sid ? this.onconnect(h.data.sid, h.data.pid) : this.emitReserved("connect_error", /* @__PURE__ */ 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/)"));
1097
+ break;
1098
+ case PacketType.EVENT:
1099
+ case PacketType.BINARY_EVENT:
1100
+ this.onevent(h);
1101
+ break;
1102
+ case PacketType.ACK:
1103
+ case PacketType.BINARY_ACK:
1104
+ this.onack(h);
1105
+ break;
1106
+ case PacketType.DISCONNECT:
1107
+ this.ondisconnect();
1108
+ break;
1109
+ case PacketType.CONNECT_ERROR:
1110
+ this.destroy();
1111
+ let W = Error(h.data.message);
1112
+ W.data = h.data.data, this.emitReserved("connect_error", W);
1113
+ break;
1114
+ }
1115
+ }
1116
+ onevent(h) {
1117
+ let W = h.data || [];
1118
+ h.id != null && W.push(this.ack(h.id)), this.connected ? this.emitEvent(W) : this.receiveBuffer.push(Object.freeze(W));
1119
+ }
1120
+ emitEvent(h) {
1121
+ if (this._anyListeners && this._anyListeners.length) {
1122
+ let W = this._anyListeners.slice();
1123
+ for (let G of W) G.apply(this, h);
1124
+ }
1125
+ super.emit.apply(this, h), this._pid && h.length && typeof h[h.length - 1] == "string" && (this._lastOffset = h[h.length - 1]);
1126
+ }
1127
+ ack(h) {
1128
+ let W = this, G = !1;
1129
+ return function(...K) {
1130
+ G || (G = !0, W.packet({
1131
+ type: PacketType.ACK,
1132
+ id: h,
1133
+ data: K
1134
+ }));
1135
+ };
1136
+ }
1137
+ onack(h) {
1138
+ let W = this.acks[h.id];
1139
+ typeof W == "function" && (delete this.acks[h.id], W.withError && h.data.unshift(null), W.apply(this, h.data));
1140
+ }
1141
+ onconnect(h, W) {
1142
+ this.id = h, this.recovered = W && this._pid === W, this._pid = W, this.connected = !0, this.emitBuffered(), this.emitReserved("connect"), this._drainQueue(!0);
1143
+ }
1144
+ emitBuffered() {
1145
+ this.receiveBuffer.forEach((h) => this.emitEvent(h)), this.receiveBuffer = [], this.sendBuffer.forEach((h) => {
1146
+ this.notifyOutgoingListeners(h), this.packet(h);
1147
+ }), this.sendBuffer = [];
1148
+ }
1149
+ ondisconnect() {
1150
+ this.destroy(), this.onclose("io server disconnect");
1151
+ }
1152
+ destroy() {
1153
+ this.subs &&= (this.subs.forEach((h) => h()), void 0), this.io._destroy(this);
1154
+ }
1155
+ disconnect() {
1156
+ return this.connected && this.packet({ type: PacketType.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1157
+ }
1158
+ close() {
1159
+ return this.disconnect();
1160
+ }
1161
+ compress(h) {
1162
+ return this.flags.compress = h, this;
1163
+ }
1164
+ get volatile() {
1165
+ return this.flags.volatile = !0, this;
1166
+ }
1167
+ timeout(h) {
1168
+ return this.flags.timeout = h, this;
1169
+ }
1170
+ onAny(h) {
1171
+ return this._anyListeners = this._anyListeners || [], this._anyListeners.push(h), this;
1172
+ }
1173
+ prependAny(h) {
1174
+ return this._anyListeners = this._anyListeners || [], this._anyListeners.unshift(h), this;
1175
+ }
1176
+ offAny(h) {
1177
+ if (!this._anyListeners) return this;
1178
+ if (h) {
1179
+ let W = this._anyListeners;
1180
+ for (let G = 0; G < W.length; G++) if (h === W[G]) return W.splice(G, 1), this;
1181
+ } else this._anyListeners = [];
1182
+ return this;
1183
+ }
1184
+ listenersAny() {
1185
+ return this._anyListeners || [];
1186
+ }
1187
+ onAnyOutgoing(h) {
1188
+ return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.push(h), this;
1189
+ }
1190
+ prependAnyOutgoing(h) {
1191
+ return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.unshift(h), this;
1192
+ }
1193
+ offAnyOutgoing(h) {
1194
+ if (!this._anyOutgoingListeners) return this;
1195
+ if (h) {
1196
+ let W = this._anyOutgoingListeners;
1197
+ for (let G = 0; G < W.length; G++) if (h === W[G]) return W.splice(G, 1), this;
1198
+ } else this._anyOutgoingListeners = [];
1199
+ return this;
1200
+ }
1201
+ listenersAnyOutgoing() {
1202
+ return this._anyOutgoingListeners || [];
1203
+ }
1204
+ notifyOutgoingListeners(h) {
1205
+ if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {
1206
+ let W = this._anyOutgoingListeners.slice();
1207
+ for (let G of W) G.apply(this, h.data);
1208
+ }
1209
+ }
1210
+ };
1211
+ function Backoff(h) {
1212
+ h ||= {}, this.ms = h.min || 100, this.max = h.max || 1e4, this.factor = h.factor || 2, this.jitter = h.jitter > 0 && h.jitter <= 1 ? h.jitter : 0, this.attempts = 0;
1213
+ }
1214
+ Backoff.prototype.duration = function() {
1215
+ var h = this.ms * this.factor ** + this.attempts++;
1216
+ if (this.jitter) {
1217
+ var W = Math.random(), G = Math.floor(W * this.jitter * h);
1218
+ h = Math.floor(W * 10) & 1 ? h + G : h - G;
1219
+ }
1220
+ return Math.min(h, this.max) | 0;
1221
+ }, Backoff.prototype.reset = function() {
1222
+ this.attempts = 0;
1223
+ }, Backoff.prototype.setMin = function(h) {
1224
+ this.ms = h;
1225
+ }, Backoff.prototype.setMax = function(h) {
1226
+ this.max = h;
1227
+ }, Backoff.prototype.setJitter = function(h) {
1228
+ this.jitter = h;
1229
+ };
1230
+ var Manager = class extends Emitter {
1231
+ constructor(h, W) {
1232
+ super(), this.nsps = {}, this.subs = [], h && typeof h == "object" && (W = h, h = void 0), W ||= {}, W.path = W.path || "/socket.io", this.opts = W, installTimerFunctions(this, W), this.reconnection(W.reconnection !== !1), this.reconnectionAttempts(W.reconnectionAttempts || Infinity), this.reconnectionDelay(W.reconnectionDelay || 1e3), this.reconnectionDelayMax(W.reconnectionDelayMax || 5e3), this.randomizationFactor(W.randomizationFactor ?? .5), this.backoff = new Backoff({
1233
+ min: this.reconnectionDelay(),
1234
+ max: this.reconnectionDelayMax(),
1235
+ jitter: this.randomizationFactor()
1236
+ }), this.timeout(W.timeout == null ? 2e4 : W.timeout), this._readyState = "closed", this.uri = h;
1237
+ let G = W.parser || esm_exports;
1238
+ this.encoder = new G.Encoder(), this.decoder = new G.Decoder(), this._autoConnect = W.autoConnect !== !1, this._autoConnect && this.open();
1239
+ }
1240
+ reconnection(h) {
1241
+ return arguments.length ? (this._reconnection = !!h, h || (this.skipReconnect = !0), this) : this._reconnection;
1242
+ }
1243
+ reconnectionAttempts(h) {
1244
+ return h === void 0 ? this._reconnectionAttempts : (this._reconnectionAttempts = h, this);
1245
+ }
1246
+ reconnectionDelay(h) {
1247
+ var W;
1248
+ return h === void 0 ? this._reconnectionDelay : (this._reconnectionDelay = h, (W = this.backoff) == null || W.setMin(h), this);
1249
+ }
1250
+ randomizationFactor(h) {
1251
+ var W;
1252
+ return h === void 0 ? this._randomizationFactor : (this._randomizationFactor = h, (W = this.backoff) == null || W.setJitter(h), this);
1253
+ }
1254
+ reconnectionDelayMax(h) {
1255
+ var W;
1256
+ return h === void 0 ? this._reconnectionDelayMax : (this._reconnectionDelayMax = h, (W = this.backoff) == null || W.setMax(h), this);
1257
+ }
1258
+ timeout(h) {
1259
+ return arguments.length ? (this._timeout = h, this) : this._timeout;
1260
+ }
1261
+ maybeReconnectOnOpen() {
1262
+ !this._reconnecting && this._reconnection && this.backoff.attempts === 0 && this.reconnect();
1263
+ }
1264
+ open(h) {
1265
+ if (~this._readyState.indexOf("open")) return this;
1266
+ this.engine = new Socket$1(this.uri, this.opts);
1267
+ let W = this.engine, G = this;
1268
+ this._readyState = "opening", this.skipReconnect = !1;
1269
+ let K = on(W, "open", function() {
1270
+ G.onopen(), h && h();
1271
+ }), q = (W) => {
1272
+ this.cleanup(), this._readyState = "closed", this.emitReserved("error", W), h ? h(W) : this.maybeReconnectOnOpen();
1273
+ }, J = on(W, "error", q);
1274
+ if (!1 !== this._timeout) {
1275
+ let h = this._timeout, G = this.setTimeoutFn(() => {
1276
+ K(), q(/* @__PURE__ */ Error("timeout")), W.close();
1277
+ }, h);
1278
+ this.opts.autoUnref && G.unref(), this.subs.push(() => {
1279
+ this.clearTimeoutFn(G);
1280
+ });
1281
+ }
1282
+ return this.subs.push(K), this.subs.push(J), this;
1283
+ }
1284
+ connect(h) {
1285
+ return this.open(h);
1286
+ }
1287
+ onopen() {
1288
+ this.cleanup(), this._readyState = "open", this.emitReserved("open");
1289
+ let h = this.engine;
1290
+ this.subs.push(on(h, "ping", this.onping.bind(this)), on(h, "data", this.ondata.bind(this)), on(h, "error", this.onerror.bind(this)), on(h, "close", this.onclose.bind(this)), on(this.decoder, "decoded", this.ondecoded.bind(this)));
1291
+ }
1292
+ onping() {
1293
+ this.emitReserved("ping");
1294
+ }
1295
+ ondata(h) {
1296
+ try {
1297
+ this.decoder.add(h);
1298
+ } catch (h) {
1299
+ this.onclose("parse error", h);
1300
+ }
1301
+ }
1302
+ ondecoded(h) {
1303
+ nextTick(() => {
1304
+ this.emitReserved("packet", h);
1305
+ }, this.setTimeoutFn);
1306
+ }
1307
+ onerror(h) {
1308
+ this.emitReserved("error", h);
1309
+ }
1310
+ socket(h, W) {
1311
+ let G = this.nsps[h];
1312
+ return G ? this._autoConnect && !G.active && G.connect() : (G = new Socket(this, h, W), this.nsps[h] = G), G;
1313
+ }
1314
+ _destroy(h) {
1315
+ let W = Object.keys(this.nsps);
1316
+ for (let h of W) if (this.nsps[h].active) return;
1317
+ this._close();
1318
+ }
1319
+ _packet(h) {
1320
+ let W = this.encoder.encode(h);
1321
+ for (let G = 0; G < W.length; G++) this.engine.write(W[G], h.options);
1322
+ }
1323
+ cleanup() {
1324
+ this.subs.forEach((h) => h()), this.subs.length = 0, this.decoder.destroy();
1325
+ }
1326
+ _close() {
1327
+ this.skipReconnect = !0, this._reconnecting = !1, this.onclose("forced close");
1328
+ }
1329
+ disconnect() {
1330
+ return this._close();
1331
+ }
1332
+ onclose(h, W) {
1333
+ var G;
1334
+ this.cleanup(), (G = this.engine) == null || G.close(), this.backoff.reset(), this._readyState = "closed", this.emitReserved("close", h, W), this._reconnection && !this.skipReconnect && this.reconnect();
1335
+ }
1336
+ reconnect() {
1337
+ if (this._reconnecting || this.skipReconnect) return this;
1338
+ let h = this;
1339
+ if (this.backoff.attempts >= this._reconnectionAttempts) this.backoff.reset(), this.emitReserved("reconnect_failed"), this._reconnecting = !1;
1340
+ else {
1341
+ let W = this.backoff.duration();
1342
+ this._reconnecting = !0;
1343
+ let G = this.setTimeoutFn(() => {
1344
+ h.skipReconnect || (this.emitReserved("reconnect_attempt", h.backoff.attempts), !h.skipReconnect && h.open((W) => {
1345
+ W ? (h._reconnecting = !1, h.reconnect(), this.emitReserved("reconnect_error", W)) : h.onreconnect();
1346
+ }));
1347
+ }, W);
1348
+ this.opts.autoUnref && G.unref(), this.subs.push(() => {
1349
+ this.clearTimeoutFn(G);
1350
+ });
1351
+ }
1352
+ }
1353
+ onreconnect() {
1354
+ let h = this.backoff.attempts;
1355
+ this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", h);
1356
+ }
1357
+ }, cache = {};
1358
+ function lookup(h, W) {
1359
+ typeof h == "object" && (W = h, h = void 0), W ||= {};
1360
+ let G = url(h, W.path || "/socket.io"), K = G.source, q = G.id, J = G.path, Y = cache[q] && J in cache[q].nsps, X = W.forceNew || W["force new connection"] || !1 === W.multiplex || Y, Z;
1361
+ return X ? Z = new Manager(K, W) : (cache[q] || (cache[q] = new Manager(K, W)), Z = cache[q]), G.query && !W.query && (W.query = G.queryKey), Z.socket(G.path, W);
1362
+ }
1363
+ Object.assign(lookup, {
1364
+ Manager,
1365
+ Socket,
1366
+ io: lookup,
1367
+ connect: lookup
1368
+ });
1369
+ var SysBase = class h {
1370
+ elc = new EventListenerCtn();
1371
+ hFactoryCls = {};
1372
+ constructor(h = {}, W) {
1373
+ this.hPlg = h, this.arg = W;
1374
+ }
1375
+ destroy() {
1376
+ this.elc.clear();
1377
+ }
1378
+ async loaded(...[h]) {
1379
+ let W = h.snsys_pre;
1380
+ return delete h.snsys_pre, W?.init({
1381
+ getInfo: this.#n,
1382
+ addTag: () => {},
1383
+ addLayCls: () => {},
1384
+ searchPath: () => "",
1385
+ getVal: () => ({}),
1386
+ resume: () => {},
1387
+ render: () => {},
1388
+ setDec: (h) => {
1389
+ this.dec = h;
1390
+ },
1391
+ setDecAB: (h) => {
1392
+ this.#_ = h;
1393
+ },
1394
+ setEnc: (h) => {
1395
+ this.enc = h;
1396
+ },
1397
+ getStK: (h) => {
1398
+ this.stk = h;
1399
+ },
1400
+ getHash: (h) => {
1401
+ this.hash = h;
1402
+ }
1403
+ });
1404
+ }
1405
+ main = void 0;
1406
+ cfg;
1407
+ setMain(h, W) {
1408
+ this.main = h, this.cfg = W;
1409
+ }
1410
+ async run() {
1411
+ let [{ Main: h }, { TxtLayer: W }, { GrpLayer: G }] = await Promise.all([
1412
+ import("./Main.js"),
1413
+ import("./TxtLayer.js"),
1414
+ import("./GrpLayer.js")
1415
+ ]);
1416
+ this.hFactoryCls = {
1417
+ grp: () => new G(),
1418
+ txt: () => new W()
1419
+ }, this.run = async () => {
1420
+ this.main?.destroy(), this.main = await h.generate(this);
1421
+ }, await this.run();
1422
+ }
1423
+ stop() {
1424
+ this.main?.destroy(), this.main = void 0;
1425
+ }
1426
+ fetch = (h, W) => fetch(h, W);
1427
+ data = {
1428
+ sys: creSYS_DATA(),
1429
+ mark: {},
1430
+ kidoku: {}
1431
+ };
1432
+ async initVal(h, W) {}
1433
+ flush() {
1434
+ if (this.#e) {
1435
+ this.#t = !0;
1436
+ return;
1437
+ }
1438
+ this.flushSub(), this.#e = setTimeout(() => {
1439
+ this.#e = void 0, this.#t && (this.#t = !1, this.flush());
1440
+ }, 500);
1441
+ }
1442
+ #e = void 0;
1443
+ #t = !1;
1444
+ flushSub() {}
1445
+ val;
1446
+ init(h, W, G) {
1447
+ let q = [];
1448
+ this.val = G;
1449
+ let J = "";
1450
+ return q.push(G.init().then(() => {
1451
+ J = "sys", J += String(G.getVal("sys:TextLayer.Back.Alpha", 1)), J = "kidoku", G.saveKidoku();
1452
+ }).catch((h) => console.error(`セーブデータ(${J})が壊れています。一度クリアする必要があります(b) %o`, h))), h.close = (h) => this.close(h), h.export = (h) => this._export(h), h.import = (h) => this._import(h), h.navigate_to = (h) => this.navigate_to(h), h.title = (h) => this.title(h), h.toggle_full_screen = (h) => this.#h(h), h.update_check = (h) => this.update_check(h), h.window = (h) => this.window(h), h.title({ text: this.cfg.oCfg.book.title || "SKYNovel" }), G.defTmp("const.sn.isApp", () => this.isApp), G.defTmp("const.sn.isDbg", () => CmnLib.isDbg), G.defTmp("const.sn.isPackaged", () => CmnLib.isPackaged), G.defTmp("const.sn.needClick2Play", () => CmnLib.needClick2Play()), G.defTmp("const.sn.displayState", () => this.isFullScr), G.setVal_Nochk("sys", "const.sn.cfg.ns", this.cfg.oCfg.save_ns), G.flush(), CmnLib.isDbg && this.attach_debug(this.main), [...q, ...Object.values(this.hPlg).map((K) => K.init({
1453
+ getInfo: this.#n,
1454
+ addTag: (W, G) => {
1455
+ if (W in h) throw `すでに定義済みのタグ[${W}]です`;
1456
+ h[W] = G;
1457
+ },
1458
+ addLayCls: (h, W) => {
1459
+ if (h in this.hFactoryCls) throw `すでに定義済みのレイヤcls【${h}】です`;
1460
+ this.hFactoryCls[h] = W;
1461
+ },
1462
+ searchPath: (h, W = SEARCH_PATH_ARG_EXT.DEFAULT) => this.cfg.searchPath(h, W),
1463
+ getVal: (h, W) => G.getVal(h, W),
1464
+ resume: () => this.main?.resume(),
1465
+ render: (h, G, K = !1) => W.renderer.render(h, {
1466
+ ...G ? { renderTexture: G } : {},
1467
+ clear: K
1468
+ }),
1469
+ setDec: () => {},
1470
+ setDecAB: () => {},
1471
+ setEnc: () => {},
1472
+ getStK: () => {},
1473
+ getHash: () => {}
1474
+ }))];
1475
+ }
1476
+ #n = () => ({ window: {
1477
+ width: CmnLib.stageW,
1478
+ height: CmnLib.stageH
1479
+ } });
1480
+ #r = 0;
1481
+ #i = 0;
1482
+ #a = 1;
1483
+ #o = 0;
1484
+ #s = 0;
1485
+ #c = 0;
1486
+ #l = 0;
1487
+ get cvsWidth() {
1488
+ return this.#r;
1489
+ }
1490
+ get cvsHeight() {
1491
+ return this.#i;
1492
+ }
1493
+ get cvsScale() {
1494
+ return this.#a;
1495
+ }
1496
+ get ofsLeft4elm() {
1497
+ return this.#o;
1498
+ }
1499
+ get ofsTop4elm() {
1500
+ return this.#s;
1501
+ }
1502
+ get ofsPadLeft_Dom2PIXI() {
1503
+ return this.#c;
1504
+ }
1505
+ get ofsPadTop_Dom2PIXI() {
1506
+ return this.#l;
1507
+ }
1508
+ isFullScr = !1;
1509
+ cvsResize() {
1510
+ if (!this.main) return;
1511
+ let h = globalThis.innerWidth, W = globalThis.innerHeight, q = this.main.cvs, J = q.parentElement !== document.body;
1512
+ if (J) {
1513
+ let G = globalThis.getComputedStyle(q);
1514
+ h = parseFloat(G.width), W = parseFloat(G.height);
1515
+ }
1516
+ if (CmnLib.isMobile) {
1517
+ let G = screen.orientation.angle % 180 == 0;
1518
+ (G && h > W || !G && h < W) && ([h, W] = [W, h]);
1519
+ }
1520
+ let Y = q.getBoundingClientRect();
1521
+ if (argChk_Boolean(CmnLib.hDip, "expanding", !0) || J || CmnLib.stageW > h || CmnLib.stageH > W) if (CmnLib.stageW / CmnLib.stageH <= h / W ? (this.#i = W, this.#r = CmnLib.stageW / CmnLib.stageH * W) : (this.#r = h, this.#i = CmnLib.stageH / CmnLib.stageW * h), this.#a = this.#r / CmnLib.stageW, J) this.#c = 0, this.#l = 0;
1522
+ else {
1523
+ let G = 1 - this.#a;
1524
+ CmnLib.isMobile ? (this.#c = (h - this.#r) / 2 * G, this.#l = (W - this.#i) / 2 * G) : (this.#c = Y.left * G, this.#l = Y.top * G);
1525
+ }
1526
+ else this.#r = CmnLib.stageW, this.#i = CmnLib.stageH, this.#a = 1, this.#c = 0, this.#l = 0;
1527
+ let X = q.parentElement.style;
1528
+ J || (X.position = "relative", X.width = `${String(this.#r)}px`, X.height = `${String(this.#i)}px`);
1529
+ let Z = q.style;
1530
+ Z.width = X.width, Z.height = X.height, J ? (this.#o = Y.left, this.#s = Y.top) : (this.#o = 0, this.#s = 0), this.isFullScr && (this.#o += (h - this.#r) / 2, this.#s += (W - this.#i) / 2);
1531
+ }
1532
+ use4ViteElectron(h, W, G, K) {
1533
+ return !1;
1534
+ }
1535
+ attach_debug(h) {
1536
+ this.attach_debug = () => {};
1537
+ let W = document.createElement("style");
1538
+ W.innerHTML = "/* SKYNovel Dbg */\n.sn_BounceInOut { animation: sn_kfBounceInOut linear 1.5s; }\n@keyframes sn_kfBounceInOut{\n0% {opacity: 0; transform: scaleX(0.30) scaleY(0.30);}\n10% {opacity: 1; transform: scaleX(1.10) scaleY(1.10);}\n20% { transform: scaleX(0.95) scaleY(0.95);}\n30% { transform: scaleX(1.00) scaleY(1.00);}\n70% {opacity: 1;}\n100%{opacity: 0;}\n}\n.sn_BounceIn { animation: sn_kfBounceIn linear 0.3s; }\n@keyframes sn_kfBounceIn{\n0% {opacity: 0; transform: scaleX(0.30) scaleY(0.30);}\n50% {opacity: 1; transform: scaleX(1.10) scaleY(1.10);}\n100%{ transform: scaleX(0.95) scaleY(0.95);}\n}\n.sn_HopIn { animation: sn_kfHopIn linear 0.8s; }\n@keyframes sn_kfHopIn{\n0% {transform: translate(0px, 0px);}\n15% {transform: translate(0px, -25px);}\n30% {transform: translate(0px, 0px);}\n45% {transform: translate(0px, -15px);}\n60% {transform: translate(0px, 0px);}\n75% {transform: translate(0px, -5px);}\n100%{transform: translate(0px, 0px);}\n}", document.getElementsByTagName("head")[0].appendChild(W), this.addHook((h, W) => this.#d[h]?.(W)), this.#u = lookup(`http://localhost:${String(this.extPort)}`), this.#u.on("data", (h, W) => {
1539
+ this.callHook(h, W);
1540
+ }).on("disconnect", () => h.setLoop(!0)), this.callHook = (h, W) => {
1541
+ for (let G of this.#p) G(h, W);
1542
+ };
1543
+ }
1544
+ extPort = 3776;
1545
+ end() {
1546
+ this.#u?.disconnect(), this.#u = void 0;
1547
+ }
1548
+ #u = void 0;
1549
+ #d = {
1550
+ auth: (h) => {
1551
+ if (h.t !== this.cfg.oCfg.debuger_token) {
1552
+ this.end();
1553
+ return;
1554
+ }
1555
+ this.toast("接続");
1556
+ },
1557
+ continue: () => this.toast("再生"),
1558
+ disconnect: () => this.toast("切断"),
1559
+ restart: (h) => {
1560
+ this.send2Dbg(h?.ri ?? "", {}), this.end(), this.run();
1561
+ },
1562
+ pause: () => this.toast("一時停止"),
1563
+ stopOnEntry: () => this.toast("一時停止"),
1564
+ stopOnDataBreakpoint: () => this.toast("注意"),
1565
+ stopOnBreakpoint: () => this.toast("注意"),
1566
+ stopOnStep: () => this.toast("一歩進む"),
1567
+ stopOnStepIn: () => this.toast("ステップイン"),
1568
+ stopOnStepOut: () => this.toast("ステップアウト"),
1569
+ stopOnBackstep: () => this.toast("一歩戻る"),
1570
+ _addPath: (h) => this.cfg.addPath(h.fn, h.o)
1571
+ };
1572
+ toast(W) {
1573
+ if (!this.main) return;
1574
+ let G = document.body;
1575
+ for (let h of [...Array.from(G.getElementsByClassName("sn_BounceIn")), ...Array.from(G.getElementsByClassName("sn_HopIn"))]) h.remove();
1576
+ let q = document.createElement("img"), J = h.#f[W];
1577
+ if (!J) throw Error(`toast 名ミス=${W}`);
1578
+ q.src = `data:image/svg+xml;base64,${J.dat}`;
1579
+ let Y = Math.min(CmnLib.stageW, CmnLib.stageH) / 4 * this.#a;
1580
+ q.width = q.height = Y, q.style.cssText = `position: absolute;
1581
+ left: ${String((CmnLib.stageW - Y) / 2 * this.#a + Y * (J.dx ?? 0))}px;
1582
+ top: ${String((CmnLib.stageH - Y) / 2 * this.#a + Y * (J.dy ?? 0))}px;`, q.classList.add("sn_toast", J.ease ?? "sn_BounceInOut"), J.ease || q.addEventListener("animationend", () => G.removeChild(q), {
1583
+ once: !0,
1584
+ passive: !0
1585
+ }), G.insertBefore(q, this.main.cvs);
1586
+ }
1587
+ static #f = {
1588
+ 接続: {
1589
+ dx: -1,
1590
+ dat: "PHN2ZyBoZWlnaHQ9IjY0MCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDY0MCA2NDAiIHdpZHRoPSI2NDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJtNjQwIDMyMGMwIDE3Ni43My0xNDMuMjcgMzIwLTMyMCAzMjBzLTMyMC0xNDMuMjctMzIwLTMyMCAxNDMuMjctMzIwIDMyMC0zMjAgMzIwIDE0My4yNyAzMjAgMzIweiIvPjxwYXRoIGlkPSJiIiBkPSJtMCAyOTJ2NTUuODhoMTI3LjEzYzEyLjM3IDQ2IDU0LjEyIDc5Ljg3IDEwNCA3OS44N2g3Ny44N3YtMjE1LjYyYy00Ni43MyAwLTcyLjY4IDAtNzcuODggMC00OS43NCAwLTkxLjYyIDMzLjg3LTEwMy45OSA3OS44Ny0xNi45NSAwLTU5LjMzIDAtMTI3LjEzIDB6Ii8+PHBhdGggaWQ9ImMiIGQ9Im01MTIuODggMjkyYy0xMi4zOC00Ni01NC4xMy03OS44Ny0xMDQtNzkuODctNS4yMSAwLTMxLjIxIDAtNzggMHYyMTUuNzRoNzcuODdjNDkuODggMCA5MS43NS0zMy44NyAxMDQtNzkuODdoMTI3LjI1di01NmMtNzYuMjcgMC0xMTguNjUgMC0xMjcuMTIgMHoiLz48L2RlZnM+PHVzZSBmaWxsPSIjMmUyZTJlIiB4bGluazpocmVmPSIjYSIvPjx1c2UgZmlsbD0ibm9uZSIgeGxpbms6aHJlZj0iI2Ei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XRoIGlkPSJhIiBkPSJtMCAzMjAuMDFjMCAxNzYuNzIgMTQzLjI3IDMxOS45OSAzMTkuOTkgMzE5Ljk5IDE3Ni43NCAwIDMyMC4wMS0xNDMuMjcgMzIwLjAxLTMxOS45OSAwLTE3Ni43NC0xNDMuMjctMzIwLjAxLTMyMC4wMS0zMjAuMDEtMTc2LjcyIDAtMzE5Ljk5IDE0My4yNy0zMTkuOTkgMzIwLjAxem0zMTkuOTktMjYuOTgtMTExLjgyIDExMS44My01NS4xMi01NS4xMyAxNjYuOTQtMTY2Ljk2IDE2Ni45NiAxNjYuOTYtNTUuMTIgNTUuMTN6Ii8+PC9kZWZzPjxwYXRoIGQ9Im0xNDcuNDkgMTU0LjJoMzUyLjR2MzA4LjloLTM1Mi40eiIgZmlsbD0iI2ZmZiIvPjx1c2UgZmlsbD0iIzJlMmUyZSIgeGxpbms6aHJlZj0iI2EiLz48dXNlIGZpbGw9Im5vbmUiIHhsaW5rOmhyZWY9IiNhIi8+PC9zdmc+"
1614
+ }
1615
+ };
1616
+ pathBaseCnvSnPath4Dbg = "";
1617
+ fire;
1618
+ setFire(h) {
1619
+ this.fire = h;
1620
+ }
1621
+ #p = [];
1622
+ addHook(h) {
1623
+ this.#p.push(h);
1624
+ }
1625
+ callHook = (h, W) => {};
1626
+ send2Dbg = (h, W) => {
1627
+ this.#u?.emit("data", h, W);
1628
+ };
1629
+ copyBMFolder = (h, W) => {};
1630
+ eraseBMFolder = (h) => {};
1631
+ close = () => !1;
1632
+ _export = () => !1;
1633
+ _import = () => !1;
1634
+ navigate_to = () => !1;
1635
+ title = (h) => {
1636
+ let { text: W } = h;
1637
+ if (!W) throw "[title] textは必須です";
1638
+ return this.#m = W, this.titleSub(this.#m + this.#g), !1;
1639
+ };
1640
+ #m = "";
1641
+ titleSub(h) {}
1642
+ #h = (G) => {
1643
+ if (!G.key) return this.tglFlscr_sub().catch((W) => h.tglFlscr_HdrErr(W)), !1;
1644
+ let K = G.key.toLowerCase();
1645
+ return this.elc.add(document, EVNM_KEY, (W) => {
1646
+ h.modKey(W) + W.key.toLowerCase() === K && (W.stopPropagation(), this.tglFlscr_sub().catch((W) => h.tglFlscr_HdrErr(W)));
1647
+ }, { passive: !0 }), !1;
1648
+ };
1649
+ static tglFlscr_HdrErr(h) {
1650
+ h instanceof TypeError && console.error("フルスクリーン化でエラーです。ブラウザ環境でキー入力きっかけでないと発生します"), console.error(`fn:SysBase.ts tglFlscr ${String(h)}`);
1651
+ }
1652
+ static modKey(h) {
1653
+ return (h.altKey ? h.key === "Alt" ? "" : "alt+" : "") + (h.ctrlKey ? h.key === "Control" ? "" : "ctrl+" : "") + (h.metaKey ? h.key === "Meta" ? "" : "meta+" : "") + (h.shiftKey ? h.key === "Shift" ? "" : "shift+" : "");
1654
+ }
1655
+ async tglFlscr_sub() {}
1656
+ update_check = () => !1;
1657
+ window = () => !1;
1658
+ #g = "";
1659
+ setTitleInfo(h) {
1660
+ this.#g = h, this.titleSub(this.#m + this.#g);
1661
+ }
1662
+ #_ = () => Promise.resolve({
1663
+ ext_num: 0,
1664
+ ab: /* @__PURE__ */ new ArrayBuffer(0)
1665
+ });
1666
+ dec = (h, W) => Promise.resolve(W);
1667
+ async decAB(h) {
1668
+ let { ext_num: W, ab: G } = await this.#_(h), K = this.#v[W];
1669
+ return K?.fnc ? await K.fnc(G) : G;
1670
+ }
1671
+ #v = {
1672
+ 1: {
1673
+ ext: "jpeg",
1674
+ fnc: (h) => this.#y(h, "image/jpeg")
1675
+ },
1676
+ 2: {
1677
+ ext: "png",
1678
+ fnc: (h) => this.#y(h, "image/png")
1679
+ },
1680
+ 3: {
1681
+ ext: "svg",
1682
+ fnc: (h) => this.#y(h, "image/svg+xml")
1683
+ },
1684
+ 4: {
1685
+ ext: "webp",
1686
+ fnc: (h) => this.#y(h, "image/webp")
1687
+ },
1688
+ 20: {
1689
+ ext: "mp4",
1690
+ fnc: (h) => this.#b(h, "video/mp4")
1691
+ },
1692
+ 21: {
1693
+ ext: "webm",
1694
+ fnc: (h) => this.#b(h, "video/webm")
1695
+ },
1696
+ 22: {
1697
+ ext: "ogv",
1698
+ fnc: (h) => this.#b(h, "video/ogv")
1699
+ }
1700
+ };
1701
+ #y = (h, W) => new Promise((G, K) => {
1702
+ let q = new Blob([h], { type: W }), J = new Image();
1703
+ J.onload = () => G(J), J.onerror = (h) => K(Error(h instanceof Event ? h.type : h)), J.src = URL.createObjectURL(q);
1704
+ });
1705
+ #b = (h, W) => new Promise((G, K) => {
1706
+ let q = new Blob([h], { type: W }), J = document.createElement("video");
1707
+ this.elc.add(J, "error", () => K(Error(J.error?.message ?? ""))), this.elc.add(J, "canplay", () => G(J)), J.src = URL.createObjectURL(q);
1708
+ });
1709
+ enc = async (h) => h;
1710
+ stk = () => "";
1711
+ hash = (h) => "";
1712
+ isApp = !1;
1713
+ $path_downloads = "";
1714
+ get path_downloads() {
1715
+ return this.$path_downloads;
1716
+ }
1717
+ $path_userdata = "";
1718
+ get path_userdata() {
1719
+ return this.$path_userdata;
1720
+ }
1721
+ capturePage(h, W, G, K) {}
1722
+ async savePic(h, W) {}
1723
+ async ensureFile(h) {}
1724
+ async appendFile(h, W) {}
1725
+ async outputFile(h, W) {}
1726
+ };
1727
+ export { SysBase as t };
1728
+
1729
+ //# sourceMappingURL=SysBase.js.map