@fangzhongya/utils 0.0.11 → 0.0.16

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 (158) hide show
  1. package/README.md +5 -1
  2. package/dist/basic/array/index.cjs +11 -7
  3. package/dist/basic/array/index.d.cts +1 -0
  4. package/dist/basic/array/index.d.ts +1 -0
  5. package/dist/basic/array/index.js +11 -7
  6. package/dist/basic/array/sortObj.cjs +7 -0
  7. package/dist/basic/array/sortObj.d.cts +10 -0
  8. package/dist/basic/array/sortObj.d.ts +10 -0
  9. package/dist/basic/array/sortObj.js +7 -0
  10. package/dist/basic/index.cjs +22 -17
  11. package/dist/basic/index.d.cts +8 -3
  12. package/dist/basic/index.d.ts +8 -3
  13. package/dist/basic/index.js +21 -16
  14. package/dist/basic/object/index.cjs +14 -8
  15. package/dist/basic/object/index.d.cts +1 -0
  16. package/dist/basic/object/index.d.ts +1 -0
  17. package/dist/basic/object/index.js +13 -7
  18. package/dist/basic/object/objValue.cjs +9 -0
  19. package/dist/basic/object/objValue.d.cts +7 -0
  20. package/dist/basic/object/objValue.d.ts +7 -0
  21. package/dist/basic/object/objValue.js +9 -0
  22. package/dist/basic/string/appearNum.cjs +2 -2
  23. package/dist/basic/string/appearNum.js +1 -1
  24. package/dist/basic/string/getStrNunPosit.cjs +7 -0
  25. package/dist/basic/string/getStrNunPosit.d.cts +10 -0
  26. package/dist/basic/string/getStrNunPosit.d.ts +10 -0
  27. package/dist/basic/string/getStrNunPosit.js +7 -0
  28. package/dist/basic/string/index.cjs +26 -7
  29. package/dist/basic/string/index.d.cts +3 -0
  30. package/dist/basic/string/index.d.ts +3 -0
  31. package/dist/basic/string/index.js +29 -10
  32. package/dist/basic/string/startsNum.cjs +7 -0
  33. package/dist/basic/string/startsNum.d.cts +9 -0
  34. package/dist/basic/string/startsNum.d.ts +9 -0
  35. package/dist/basic/string/startsNum.js +7 -0
  36. package/dist/basic/string/toFunction.cjs +2 -2
  37. package/dist/basic/string/toFunction.d.cts +15 -7
  38. package/dist/basic/string/toFunction.d.ts +15 -7
  39. package/dist/basic/string/toFunction.js +1 -1
  40. package/dist/basic/string/toJson.cjs +3 -3
  41. package/dist/basic/string/toJson.d.cts +2 -5
  42. package/dist/basic/string/toJson.d.ts +2 -5
  43. package/dist/basic/string/toJson.js +2 -2
  44. package/dist/basic/string/toJsons.cjs +15 -0
  45. package/dist/basic/string/toJsons.d.cts +60 -0
  46. package/dist/basic/string/toJsons.d.ts +60 -0
  47. package/dist/basic/string/toJsons.js +15 -0
  48. package/dist/chunk-2H3KVSFA.cjs +16 -0
  49. package/dist/{chunk-LZ7JIJ4I.cjs → chunk-2J3S75C6.cjs} +6 -2
  50. package/dist/{chunk-6RIGEV6G.cjs → chunk-3DD7YCN2.cjs} +2 -2
  51. package/dist/chunk-3NBXSBFM.js +29 -0
  52. package/dist/{chunk-VQKOHGV5.cjs → chunk-4BGJIMWM.cjs} +9 -5
  53. package/dist/chunk-5HC662VK.js +432 -0
  54. package/dist/chunk-754Z5VW6.js +29 -0
  55. package/dist/chunk-7O4MJOHM.js +142 -0
  56. package/dist/{chunk-X4WTO4NR.js → chunk-CMBQ66JH.js} +5 -1
  57. package/dist/chunk-E4WBX6J5.cjs +29 -0
  58. package/dist/chunk-ETMYYVQJ.cjs +432 -0
  59. package/dist/{chunk-R5TH6GQE.js → chunk-FSIQKHKH.js} +5 -5
  60. package/dist/{chunk-QJVB3JIZ.js → chunk-HWR2FRME.js} +1 -1
  61. package/dist/{chunk-JJLYV6GY.js → chunk-IEQHKLEL.js} +12 -6
  62. package/dist/chunk-ILJLXJ5O.cjs +15 -0
  63. package/dist/chunk-JHV27P2Q.cjs +54 -0
  64. package/dist/{chunk-SNABGVNO.js → chunk-LPMR5W6M.js} +1 -1
  65. package/dist/{chunk-2KT66KQH.js → chunk-LU22MUUS.js} +10 -6
  66. package/dist/chunk-NESVPZNF.cjs +29 -0
  67. package/dist/chunk-O34QAOO7.js +16 -0
  68. package/dist/{chunk-3HXQ7TGV.cjs → chunk-OJBZ7UUC.cjs} +1 -1
  69. package/dist/{chunk-YHLI3SF7.js → chunk-OVHYLUAS.js} +8 -0
  70. package/dist/chunk-P7AWHISY.js +15 -0
  71. package/dist/chunk-PLNZCEDI.js +442 -0
  72. package/dist/chunk-PSHKOVLY.cjs +24 -0
  73. package/dist/{chunk-V5HVA7TW.cjs → chunk-PV2N6PF2.cjs} +8 -0
  74. package/dist/chunk-QXK4IUBI.cjs +142 -0
  75. package/dist/chunk-RYBJGHXK.cjs +153 -0
  76. package/dist/{chunk-ZRZ5HATA.js → chunk-SE7A43WC.js} +1 -1
  77. package/dist/chunk-U3PZBQ6G.js +54 -0
  78. package/dist/{chunk-SLRWY5FH.cjs → chunk-UGT4QBTM.cjs} +12 -6
  79. package/dist/chunk-UHKL2RG3.cjs +80 -0
  80. package/dist/chunk-USIMBBLW.js +16 -0
  81. package/dist/{chunk-FCCQIHFD.js → chunk-UZ3LZBJ5.js} +1 -1
  82. package/dist/chunk-V2DXOH6B.cjs +442 -0
  83. package/dist/chunk-VJUGYXBC.cjs +70 -0
  84. package/dist/chunk-XQOH3NGZ.js +153 -0
  85. package/dist/chunk-XW3XIK3D.cjs +16 -0
  86. package/dist/chunk-YKNGDK4I.js +80 -0
  87. package/dist/{chunk-GIJMEVTJ.js → chunk-ZEMAXGD5.js} +27 -9
  88. package/dist/index-20jIrGxr.d.ts +36 -0
  89. package/dist/index-B7gdHwF9.d.cts +40 -0
  90. package/dist/{index-EY4Ag8_f.d.cts → index-BU0xla6v.d.cts} +4 -1
  91. package/dist/{index-D92-6As_.d.ts → index-C29DFVeC.d.ts} +3 -1
  92. package/dist/index-C6CeIuau.d.cts +36 -0
  93. package/dist/index-CPO1AFVg.d.ts +14 -0
  94. package/dist/{index-Dm5gvjpr.d.cts → index-C__Goqn1.d.cts} +3 -1
  95. package/dist/index-D1WceQZE.d.ts +9 -0
  96. package/dist/{index-CsP95PJy.d.ts → index-DOq59RNr.d.ts} +4 -1
  97. package/dist/index-DPrdy8Ms.d.ts +40 -0
  98. package/dist/{index-D-JJ6qt2.d.ts → index-IJlghj8j.d.ts} +3 -1
  99. package/dist/index-cuR7l2XV.d.cts +14 -0
  100. package/dist/index-haAz3CpA.d.cts +9 -0
  101. package/dist/{index-BrxHOuw0.d.cts → index-qUiGxoy_.d.cts} +3 -1
  102. package/dist/index.cjs +45 -37
  103. package/dist/index.d.cts +15 -7
  104. package/dist/index.d.ts +15 -7
  105. package/dist/index.js +48 -40
  106. package/dist/judge/index.cjs +57 -5
  107. package/dist/judge/index.d.cts +1 -0
  108. package/dist/judge/index.d.ts +1 -0
  109. package/dist/judge/index.js +57 -5
  110. package/dist/judge/judge.cjs +55 -0
  111. package/dist/judge/judge.d.cts +155 -0
  112. package/dist/judge/judge.d.ts +155 -0
  113. package/dist/judge/judge.js +55 -0
  114. package/dist/judge/matchs.cjs +3 -3
  115. package/dist/judge/matchs.js +2 -2
  116. package/dist/name/index.cjs +3 -3
  117. package/dist/name/index.js +4 -4
  118. package/dist/node/getPort.js +1 -1
  119. package/dist/node/index.js +2 -2
  120. package/dist/tree/index.cjs +11 -2
  121. package/dist/tree/index.d.cts +1 -0
  122. package/dist/tree/index.d.ts +1 -0
  123. package/dist/tree/index.js +10 -1
  124. package/dist/tree/splitGroup.cjs +12 -0
  125. package/dist/tree/splitGroup.d.cts +15 -0
  126. package/dist/tree/splitGroup.d.ts +15 -0
  127. package/dist/tree/splitGroup.js +12 -0
  128. package/dist/urls/getReplaceCompleteUrl.cjs +10 -0
  129. package/dist/urls/getReplaceCompleteUrl.d.cts +9 -0
  130. package/dist/urls/getReplaceCompleteUrl.d.ts +9 -0
  131. package/dist/urls/getReplaceCompleteUrl.js +10 -0
  132. package/dist/urls/getReplaceUrl.cjs +3 -3
  133. package/dist/urls/getReplaceUrl.js +2 -2
  134. package/dist/urls/index.cjs +10 -4
  135. package/dist/urls/index.d.cts +1 -0
  136. package/dist/urls/index.d.ts +1 -0
  137. package/dist/urls/index.js +9 -3
  138. package/package.json +46 -6
  139. package/dist/chunk-45M6CPWK.cjs +0 -52
  140. package/dist/chunk-6YI3CDEW.js +0 -35
  141. package/dist/chunk-AFKJQ4QP.js +0 -35
  142. package/dist/chunk-JYPJ5QJ5.cjs +0 -35
  143. package/dist/chunk-T7XQBASK.js +0 -28
  144. package/dist/chunk-U5TCBGC3.cjs +0 -28
  145. package/dist/chunk-WMZ6P3AK.cjs +0 -24
  146. package/dist/chunk-ZJIRJ4YJ.cjs +0 -35
  147. package/dist/index-BWAB-b69.d.ts +0 -10
  148. package/dist/index-CIOxFVHu.d.ts +0 -9
  149. package/dist/index-CVNtXK0N.d.ts +0 -14
  150. package/dist/index-D-5HNg2W.d.cts +0 -14
  151. package/dist/index-DBBlm0PZ.d.cts +0 -26
  152. package/dist/index-DTk8hXm8.d.cts +0 -10
  153. package/dist/index-DfmnOk56.d.cts +0 -9
  154. package/dist/index-DjtNMmhM.d.ts +0 -26
  155. package/dist/{chunk-IVDRKJ33.js → chunk-BFN33JM5.js} +3 -3
  156. package/dist/{chunk-ZXWKQRGH.cjs → chunk-BG2YS767.cjs} +2 -2
  157. package/dist/{chunk-NGQKVTCR.cjs → chunk-T22I7TJQ.cjs} +3 -3
  158. package/dist/{chunk-FRGDQOX4.js → chunk-T2QKEABG.js} +3 -3
@@ -0,0 +1,432 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
4
+
5
+
6
+ var _chunkE4WBX6J5cjs = require('./chunk-E4WBX6J5.cjs');
7
+
8
+ // packages/basic/string/toJsons.ts
9
+ var TYPE_MARKERS = {
10
+ FUNCTION_REF: "_FR_",
11
+ CODE_BLOCK: "_CB_",
12
+ /**内置对象*/
13
+ SYMBOL: "_Sy_",
14
+ FUNCTION: "_F_",
15
+ UNDEFINED: "_UN_",
16
+ DATE: "_D_",
17
+ REGEXP: "_R_",
18
+ NAN: "_N_",
19
+ BIGINT: "_BI_",
20
+ MAP: "_M_",
21
+ SET: "_S_",
22
+ ARRAY_BUFFER: "_AB_",
23
+ TYPED_ARRAY: "_TA_",
24
+ DATA_VIEW: "_DV_",
25
+ ERROR: "_E_",
26
+ URL: "_U_",
27
+ INFINITY: "_I_",
28
+ NEGATIVE_INFINITY: "_NI_",
29
+ INT8_ARRAY: "_I8_",
30
+ UINT8_ARRAY: "_U8_",
31
+ UINT8_CLAMPED_ARRAY: "_U8C_",
32
+ INT16_ARRAY: "_I1_",
33
+ UINT16_ARRAY: "_U1_",
34
+ INT32_ARRAY: "_I3_",
35
+ UINT32_ARRAY: "_U3_",
36
+ FLOAT32_ARRAY: "_F3_",
37
+ FLOAT64_ARRAY: "_F6_",
38
+ BIGINT64_ARRAY: "_BI6_",
39
+ BIGUINT64_ARRAY: "_BU6_"
40
+ };
41
+ var arrayBufferUtils = {
42
+ // 将ArrayBuffer编码为Base64字符串
43
+ encode: (buffer) => {
44
+ if (typeof Buffer !== "undefined") {
45
+ const bytes = new Uint8Array(buffer);
46
+ let binary = "";
47
+ bytes.forEach((byte) => binary += String.fromCharCode(byte));
48
+ return btoa(binary);
49
+ }
50
+ if (typeof btoa === "function") {
51
+ const bytes = new Uint8Array(buffer);
52
+ let binary = "";
53
+ for (let i = 0; i < bytes.byteLength; i++) {
54
+ binary += String.fromCharCode(bytes[i]);
55
+ }
56
+ return btoa(binary);
57
+ }
58
+ throw new Error(
59
+ "ArrayBuffer encoding not supported in this environment"
60
+ );
61
+ },
62
+ // 将Base64字符串解码为ArrayBuffer
63
+ decode: (base64Str) => {
64
+ if (typeof Buffer !== "undefined") {
65
+ const binaryString = atob(base64Str);
66
+ const bytes = new Uint8Array(binaryString.length);
67
+ for (let i = 0; i < binaryString.length; i++) {
68
+ bytes[i] = binaryString.charCodeAt(i);
69
+ }
70
+ return bytes.buffer;
71
+ }
72
+ if (typeof atob === "function") {
73
+ const binaryString = atob(base64Str);
74
+ const bytes = new Uint8Array(binaryString.length);
75
+ for (let i = 0; i < binaryString.length; i++) {
76
+ bytes[i] = binaryString.charCodeAt(i);
77
+ }
78
+ return bytes.buffer;
79
+ }
80
+ throw new Error(
81
+ "ArrayBuffer decoding not supported in this environment"
82
+ );
83
+ },
84
+ // 获取ArrayBuffer的字节数组表示
85
+ toByteArray: (buffer) => {
86
+ return Array.from(new Uint8Array(buffer));
87
+ },
88
+ // 从字节数组创建ArrayBuffer
89
+ fromByteArray: (array) => {
90
+ const buffer = new ArrayBuffer(array.length);
91
+ const view = new Uint8Array(buffer);
92
+ array.forEach((value, index) => view[index] = value);
93
+ return buffer;
94
+ }
95
+ };
96
+ function toJSONSStringify(obj, space) {
97
+ const seen = /* @__PURE__ */ new WeakSet();
98
+ return JSON.stringify(
99
+ obj,
100
+ function(key, value) {
101
+ if (value === null) {
102
+ return null;
103
+ }
104
+ if (typeof value === "object") {
105
+ if (seen.has(value)) return "[Circular]";
106
+ seen.add(value);
107
+ }
108
+ if (this[key] instanceof Date) {
109
+ return {
110
+ [TYPE_MARKERS.DATE]: this[key].getTime()
111
+ };
112
+ }
113
+ if (this[key] instanceof URL) {
114
+ return {
115
+ [TYPE_MARKERS.URL]: this[key].href
116
+ };
117
+ }
118
+ if (value === Infinity) {
119
+ return { [TYPE_MARKERS.INFINITY]: 1 };
120
+ }
121
+ if (value === -Infinity) {
122
+ return { [TYPE_MARKERS.NEGATIVE_INFINITY]: 1 };
123
+ }
124
+ if (value === void 0) {
125
+ return { [TYPE_MARKERS.UNDEFINED]: 1 };
126
+ }
127
+ if (Object.is(value, NaN)) {
128
+ return { [TYPE_MARKERS.NAN]: 1 };
129
+ }
130
+ switch (typeof value) {
131
+ case "bigint":
132
+ return { [TYPE_MARKERS.BIGINT]: value.toString() };
133
+ case "symbol":
134
+ return {
135
+ [TYPE_MARKERS.SYMBOL]: {
136
+ k: _nullishCoalesce(Symbol.keyFor(value), () => ( 0)),
137
+ d: value.description || ""
138
+ }
139
+ };
140
+ case "function":
141
+ return {
142
+ [TYPE_MARKERS.FUNCTION]: value.toString()
143
+ };
144
+ case "object":
145
+ if (value instanceof RegExp) {
146
+ return {
147
+ [TYPE_MARKERS.REGEXP]: {
148
+ s: value.source,
149
+ f: value.flags
150
+ }
151
+ };
152
+ }
153
+ if (value instanceof Map) {
154
+ return {
155
+ [TYPE_MARKERS.MAP]: Array.from(value.entries())
156
+ };
157
+ }
158
+ if (value instanceof Set) {
159
+ return {
160
+ [TYPE_MARKERS.SET]: Array.from(value.values())
161
+ };
162
+ }
163
+ if (value instanceof ArrayBuffer) {
164
+ return {
165
+ [TYPE_MARKERS.ARRAY_BUFFER]: arrayBufferUtils.encode(value)
166
+ };
167
+ }
168
+ if (value instanceof Int8Array) {
169
+ return {
170
+ [TYPE_MARKERS.INT8_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
171
+ };
172
+ }
173
+ if (value instanceof Uint8Array) {
174
+ return {
175
+ [TYPE_MARKERS.UINT8_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
176
+ };
177
+ }
178
+ if (value instanceof Uint8ClampedArray) {
179
+ return {
180
+ [TYPE_MARKERS.UINT8_CLAMPED_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
181
+ };
182
+ }
183
+ if (value instanceof Int16Array) {
184
+ return {
185
+ [TYPE_MARKERS.INT16_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
186
+ };
187
+ }
188
+ if (value instanceof Uint16Array) {
189
+ return {
190
+ [TYPE_MARKERS.UINT16_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
191
+ };
192
+ }
193
+ if (value instanceof Int32Array) {
194
+ return {
195
+ [TYPE_MARKERS.INT32_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
196
+ };
197
+ }
198
+ if (value instanceof Uint32Array) {
199
+ return {
200
+ [TYPE_MARKERS.UINT32_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
201
+ };
202
+ }
203
+ if (value instanceof Float32Array) {
204
+ return {
205
+ [TYPE_MARKERS.FLOAT32_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
206
+ };
207
+ }
208
+ if (value instanceof Float64Array) {
209
+ return {
210
+ [TYPE_MARKERS.FLOAT64_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
211
+ };
212
+ }
213
+ if (value instanceof BigInt64Array) {
214
+ return {
215
+ [TYPE_MARKERS.BIGINT64_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
216
+ };
217
+ }
218
+ if (value instanceof BigUint64Array) {
219
+ return {
220
+ [TYPE_MARKERS.BIGUINT64_ARRAY]: arrayBufferUtils.toByteArray(value.buffer)
221
+ };
222
+ }
223
+ if (value instanceof DataView) {
224
+ return {
225
+ [TYPE_MARKERS.DATA_VIEW]: {
226
+ b: arrayBufferUtils.encode(
227
+ value.buffer
228
+ ),
229
+ o: value.byteOffset,
230
+ l: value.byteLength
231
+ }
232
+ };
233
+ }
234
+ if (value instanceof Error) {
235
+ return {
236
+ [TYPE_MARKERS.ERROR]: {
237
+ n: value.name,
238
+ m: value.message,
239
+ s: value.stack
240
+ }
241
+ };
242
+ }
243
+ }
244
+ return value;
245
+ },
246
+ space
247
+ );
248
+ }
249
+ function toJSONSParse(str, context) {
250
+ try {
251
+ const parsed = JSON.parse(str, (key, value) => {
252
+ if (value && typeof value === "object") {
253
+ const markers = Object.keys(value);
254
+ if (markers.length === 1) {
255
+ const marker = markers[0];
256
+ const markerValue = value[marker];
257
+ switch (marker) {
258
+ case TYPE_MARKERS.BIGINT:
259
+ return BigInt(markerValue);
260
+ case TYPE_MARKERS.SYMBOL:
261
+ return markerValue.k ? Symbol.for(markerValue.k) : Symbol(markerValue.d);
262
+ case TYPE_MARKERS.FUNCTION:
263
+ return _chunkQXK4IUBIcjs.toFunction.call(void 0, markerValue, key) || function() {
264
+ };
265
+ case TYPE_MARKERS.NAN:
266
+ return NaN;
267
+ case TYPE_MARKERS.INFINITY:
268
+ return Infinity;
269
+ case TYPE_MARKERS.NEGATIVE_INFINITY:
270
+ return -Infinity;
271
+ case TYPE_MARKERS.FUNCTION_REF:
272
+ return context ? _chunkE4WBX6J5cjs.getObjValue.call(void 0, markerValue, context) : void 0;
273
+ case TYPE_MARKERS.CODE_BLOCK:
274
+ return getCodeBlock(markerValue, key);
275
+ }
276
+ }
277
+ }
278
+ return value;
279
+ });
280
+ return restoreSpecialValues(parsed);
281
+ } catch (error) {
282
+ console.error("JSON parse error:", {
283
+ str: str.slice(0, 200) + "...",
284
+ error
285
+ });
286
+ return {};
287
+ }
288
+ }
289
+ function restoreSpecialValues(obj, depth = 0) {
290
+ if (depth > 100) throw new Error("Recursion limit exceeded");
291
+ if (obj === null || typeof obj !== "object") {
292
+ return obj;
293
+ }
294
+ if (Array.isArray(obj)) {
295
+ return obj.map((item) => {
296
+ const converted = convertSpecialValue(item);
297
+ if (converted !== item) {
298
+ return converted;
299
+ }
300
+ return restoreSpecialValues(item, depth + 1);
301
+ });
302
+ }
303
+ const result = {};
304
+ for (const key in obj) {
305
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
306
+ let value = obj[key];
307
+ const converted = convertSpecialValue(value);
308
+ if (converted !== value) {
309
+ value = converted;
310
+ } else {
311
+ value = restoreSpecialValues(value, depth + 1);
312
+ }
313
+ result[key] = value;
314
+ }
315
+ }
316
+ return result;
317
+ }
318
+ function convertSpecialValue(value) {
319
+ if (value && typeof value === "object") {
320
+ const keys = Object.keys(value);
321
+ if (keys.length === 1) {
322
+ const [marker] = keys;
323
+ const markerValue = value[marker];
324
+ switch (marker) {
325
+ case TYPE_MARKERS.UNDEFINED:
326
+ return void 0;
327
+ case TYPE_MARKERS.DATE:
328
+ return new Date(markerValue);
329
+ // 从时间戳恢复Date
330
+ case TYPE_MARKERS.REGEXP: {
331
+ return new RegExp(markerValue.s, markerValue.f);
332
+ }
333
+ case TYPE_MARKERS.MAP:
334
+ return new Map(markerValue);
335
+ case TYPE_MARKERS.SET:
336
+ return new Set(markerValue);
337
+ case TYPE_MARKERS.ARRAY_BUFFER:
338
+ return arrayBufferUtils.decode(markerValue);
339
+ case TYPE_MARKERS.ERROR: {
340
+ const { n, m, s } = markerValue;
341
+ const error = new Error(m);
342
+ error.name = n;
343
+ error.stack = s;
344
+ return error;
345
+ }
346
+ case TYPE_MARKERS.URL:
347
+ return new URL(markerValue);
348
+ // 处理所有TypedArray类型
349
+ case TYPE_MARKERS.INT8_ARRAY:
350
+ return new Int8Array(
351
+ arrayBufferUtils.fromByteArray(markerValue)
352
+ );
353
+ case TYPE_MARKERS.UINT8_ARRAY:
354
+ return new Uint8Array(
355
+ arrayBufferUtils.fromByteArray(markerValue)
356
+ );
357
+ case TYPE_MARKERS.UINT8_CLAMPED_ARRAY:
358
+ return new Uint8ClampedArray(
359
+ arrayBufferUtils.fromByteArray(markerValue)
360
+ );
361
+ case TYPE_MARKERS.INT16_ARRAY:
362
+ return new Int16Array(
363
+ arrayBufferUtils.fromByteArray(markerValue)
364
+ );
365
+ case TYPE_MARKERS.UINT16_ARRAY:
366
+ return new Uint16Array(
367
+ arrayBufferUtils.fromByteArray(markerValue)
368
+ );
369
+ case TYPE_MARKERS.INT32_ARRAY:
370
+ return new Int32Array(
371
+ arrayBufferUtils.fromByteArray(markerValue)
372
+ );
373
+ case TYPE_MARKERS.UINT32_ARRAY:
374
+ return new Uint32Array(
375
+ arrayBufferUtils.fromByteArray(markerValue)
376
+ );
377
+ case TYPE_MARKERS.FLOAT32_ARRAY:
378
+ return new Float32Array(
379
+ arrayBufferUtils.fromByteArray(markerValue)
380
+ );
381
+ case TYPE_MARKERS.FLOAT64_ARRAY:
382
+ return new Float64Array(
383
+ arrayBufferUtils.fromByteArray(markerValue)
384
+ );
385
+ case TYPE_MARKERS.BIGINT64_ARRAY:
386
+ return new BigInt64Array(
387
+ arrayBufferUtils.fromByteArray(markerValue)
388
+ );
389
+ case TYPE_MARKERS.BIGUINT64_ARRAY:
390
+ return new BigUint64Array(
391
+ arrayBufferUtils.fromByteArray(markerValue)
392
+ );
393
+ case TYPE_MARKERS.DATA_VIEW: {
394
+ const buffer = arrayBufferUtils.decode(markerValue.b);
395
+ return new DataView(buffer, markerValue.o, markerValue.l);
396
+ }
397
+ }
398
+ }
399
+ }
400
+ return value;
401
+ }
402
+ function getCodeBlock(value, key) {
403
+ try {
404
+ try {
405
+ const fullFunction = `function ${_nullishCoalesce(_nullishCoalesce(value.name, () => ( key)), () => ( ""))}(${value.params.join(",")}) { ${value.body} }`;
406
+ return new Function(`"use strict";
407
+ return (${fullFunction})`)();
408
+ } catch (error) {
409
+ return new Function(
410
+ ...value.params,
411
+ `"use strict";
412
+ ${value.body}`
413
+ );
414
+ }
415
+ } catch (error) {
416
+ console.error("Code block execution failed", error);
417
+ return value;
418
+ }
419
+ }
420
+ function serializeFunctionRef(key) {
421
+ return { [TYPE_MARKERS.FUNCTION_REF]: key };
422
+ }
423
+ function serializeCodeBlock(value) {
424
+ return { [TYPE_MARKERS.CODE_BLOCK]: value };
425
+ }
426
+
427
+
428
+
429
+
430
+
431
+
432
+ exports.toJSONSStringify = toJSONSStringify; exports.toJSONSParse = toJSONSParse; exports.serializeFunctionRef = serializeFunctionRef; exports.serializeCodeBlock = serializeCodeBlock;
@@ -1,12 +1,12 @@
1
- import {
2
- object_exports
3
- } from "./chunk-JJLYV6GY.js";
4
1
  import {
5
2
  string_exports
6
- } from "./chunk-GIJMEVTJ.js";
3
+ } from "./chunk-ZEMAXGD5.js";
4
+ import {
5
+ object_exports
6
+ } from "./chunk-IEQHKLEL.js";
7
7
  import {
8
8
  array_exports
9
- } from "./chunk-2KT66KQH.js";
9
+ } from "./chunk-LU22MUUS.js";
10
10
  import {
11
11
  __export
12
12
  } from "./chunk-MLKGABMK.js";
@@ -1,5 +1,5 @@
1
1
  // packages/node/getPort.ts
2
- import { createServer } from "node:net";
2
+ import { createServer } from "net";
3
3
  function getPort(host, port = 5173, isLocal = true) {
4
4
  return new Promise((resolve, reject) => {
5
5
  isPortOccupied(port, host, isLocal).then((v) => {
@@ -1,3 +1,10 @@
1
+ import {
2
+ mergeObject
3
+ } from "./chunk-RD4EP3M5.js";
4
+ import {
5
+ getObjValue,
6
+ setObjValue
7
+ } from "./chunk-754Z5VW6.js";
1
8
  import {
2
9
  reverseObj
3
10
  } from "./chunk-B3IGSYZT.js";
@@ -7,6 +14,9 @@ import {
7
14
  import {
8
15
  unmergeObject
9
16
  } from "./chunk-A6J46LQK.js";
17
+ import {
18
+ attrValueSort
19
+ } from "./chunk-T4BAVDTH.js";
10
20
  import {
11
21
  deepCopy
12
22
  } from "./chunk-PHKZER72.js";
@@ -19,12 +29,6 @@ import {
19
29
  import {
20
30
  hasOwn
21
31
  } from "./chunk-3IR2ABRO.js";
22
- import {
23
- mergeObject
24
- } from "./chunk-RD4EP3M5.js";
25
- import {
26
- attrValueSort
27
- } from "./chunk-T4BAVDTH.js";
28
32
  import {
29
33
  isObjectArray
30
34
  } from "./chunk-GYE23WAN.js";
@@ -41,12 +45,14 @@ __export(object_exports, {
41
45
  attrValueSort: () => attrValueSort,
42
46
  deepCopy: () => deepCopy,
43
47
  filterObject: () => filterObject,
48
+ getObjValue: () => getObjValue,
44
49
  getSort: () => getSort,
45
50
  hasOwn: () => hasOwn,
46
51
  isObject: () => isObject,
47
52
  isObjectArray: () => isObjectArray,
48
53
  mergeObject: () => mergeObject,
49
54
  reverseObj: () => reverseObj,
55
+ setObjValue: () => setObjValue,
50
56
  setSort: () => setSort,
51
57
  unmergeObject: () => unmergeObject
52
58
  });
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/string/startsNum.ts
2
+ function startsNum(str, substring) {
3
+ if (substring.length === 0) return 0;
4
+ let count = 0;
5
+ let index = 0;
6
+ while (str.startsWith(substring, index)) {
7
+ count++;
8
+ index += substring.length;
9
+ }
10
+ return count;
11
+ }
12
+
13
+
14
+
15
+ exports.startsNum = startsNum;
@@ -0,0 +1,54 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
4
+
5
+ // packages/basic/string/toJson.ts
6
+ function toJSONStringify(obj, space) {
7
+ return JSON.stringify(
8
+ obj,
9
+ (_, value) => {
10
+ if (typeof value === "symbol") {
11
+ return { __type: "symbol", value: value.description };
12
+ } else if (typeof value === "function") {
13
+ return {
14
+ __type: "function",
15
+ value: value.toString()
16
+ };
17
+ } else if (value === void 0) {
18
+ return { __type: "undefined" };
19
+ } else if (value instanceof Date) {
20
+ return { __type: "Date", value: value.toISOString() };
21
+ } else if (value instanceof RegExp) {
22
+ return { __type: "RegExp", value: value.toString() };
23
+ }
24
+ return value;
25
+ },
26
+ space
27
+ );
28
+ }
29
+ function toJSONParse(str, reviver) {
30
+ return JSON.parse(str, (key, value) => {
31
+ if (value && typeof value === "object") {
32
+ switch (value.__type) {
33
+ case "symbol":
34
+ return Symbol(value.value);
35
+ case "function":
36
+ return _chunkQXK4IUBIcjs.toFunction.call(void 0, value.value) || value;
37
+ case "undefined":
38
+ return void 0;
39
+ case "Date":
40
+ return new Date(value.value);
41
+ case "RegExp": {
42
+ const match = value.value.match(/\/(.*)\/([gimuy]*)/);
43
+ return match ? new RegExp(match[1], match[2]) : value;
44
+ }
45
+ }
46
+ }
47
+ return reviver ? reviver(key, value) : value;
48
+ });
49
+ }
50
+
51
+
52
+
53
+
54
+ exports.toJSONStringify = toJSONStringify; exports.toJSONParse = toJSONParse;
@@ -2,7 +2,7 @@
2
2
  function appearNum(str, t) {
3
3
  let reg = t;
4
4
  if (typeof t == "string") {
5
- reg = new RegExp(t, "g");
5
+ reg = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
6
6
  }
7
7
  let arr = str.match(reg);
8
8
  let c = arr ? arr.length : 0;
@@ -1,9 +1,3 @@
1
- import {
2
- duplicateRemoval
3
- } from "./chunk-ZVBCHJA5.js";
4
- import {
5
- replaceAfter
6
- } from "./chunk-K33LOE73.js";
7
1
  import {
8
2
  toggleArray
9
3
  } from "./chunk-APKFW4LU.js";
@@ -13,6 +7,15 @@ import {
13
7
  import {
14
8
  deleteArray
15
9
  } from "./chunk-DBSRZCFK.js";
10
+ import {
11
+ duplicateRemoval
12
+ } from "./chunk-ZVBCHJA5.js";
13
+ import {
14
+ replaceAfter
15
+ } from "./chunk-K33LOE73.js";
16
+ import {
17
+ sortObj
18
+ } from "./chunk-O34QAOO7.js";
16
19
  import {
17
20
  isArray
18
21
  } from "./chunk-5PX3AFSC.js";
@@ -28,6 +31,7 @@ __export(array_exports, {
28
31
  duplicateRemoval: () => duplicateRemoval,
29
32
  isArray: () => isArray,
30
33
  replaceAfter: () => replaceAfter,
34
+ sortObj: () => sortObj,
31
35
  toggleArray: () => toggleArray
32
36
  });
33
37
 
@@ -0,0 +1,29 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk77SI5VSScjs = require('./chunk-77SI5VSS.cjs');
4
+
5
+
6
+ var _chunk2H3KVSFAcjs = require('./chunk-2H3KVSFA.cjs');
7
+
8
+
9
+ var _chunkILJLXJ5Ocjs = require('./chunk-ILJLXJ5O.cjs');
10
+
11
+ // packages/urls/getReplaceCompleteUrl.ts
12
+ function getReplaceCompleteUrl(url, imp) {
13
+ const obj = _chunk77SI5VSScjs.getUrlCatalogueObj.call(void 0, url);
14
+ if (!/[\\|\/]/.test(imp)) {
15
+ imp = "./" + imp;
16
+ }
17
+ const apart = _nullishCoalesce(obj.apart, () => ( "/"));
18
+ if (imp.startsWith("./")) {
19
+ return obj.catalogue + apart + imp.replace(/^\.\//, "").replace(/[\\|\/]/g, apart);
20
+ } else {
21
+ const v = _chunkILJLXJ5Ocjs.startsNum.call(void 0, imp, "../");
22
+ const m = obj.catalogue;
23
+ return m.substring(0, _chunk2H3KVSFAcjs.getStrNunPosit.call(void 0, m, "/", v)) + apart + imp.replace(RegExp("^(\\.\\.\\/){" + v + "}"), "");
24
+ }
25
+ }
26
+
27
+
28
+
29
+ exports.getReplaceCompleteUrl = getReplaceCompleteUrl;
@@ -0,0 +1,16 @@
1
+ // packages/basic/array/sortObj.ts
2
+ function sortObj(arr, value) {
3
+ return arr.sort((a, b) => {
4
+ if (a[value] > b[value]) {
5
+ return 1;
6
+ } else if (a[value] < b[value]) {
7
+ return -1;
8
+ } else {
9
+ return 0;
10
+ }
11
+ });
12
+ }
13
+
14
+ export {
15
+ sortObj
16
+ };
@@ -2,7 +2,7 @@
2
2
  function appearNum(str, t) {
3
3
  let reg = t;
4
4
  if (typeof t == "string") {
5
- reg = new RegExp(t, "g");
5
+ reg = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
6
6
  }
7
7
  let arr = str.match(reg);
8
8
  let c = arr ? arr.length : 0;
@@ -3,6 +3,11 @@ import {
3
3
  getTreeObj,
4
4
  treeToArray
5
5
  } from "./chunk-GVVJIN46.js";
6
+ import {
7
+ splitGroup,
8
+ splitGroupDitto,
9
+ splitGroupExist
10
+ } from "./chunk-XQOH3NGZ.js";
6
11
  import {
7
12
  __export
8
13
  } from "./chunk-MLKGABMK.js";
@@ -12,6 +17,9 @@ var tree_exports = {};
12
17
  __export(tree_exports, {
13
18
  arrayToTree: () => arrayToTree,
14
19
  getTreeObj: () => getTreeObj,
20
+ splitGroup: () => splitGroup,
21
+ splitGroupDitto: () => splitGroupDitto,
22
+ splitGroupExist: () => splitGroupExist,
15
23
  treeToArray: () => treeToArray
16
24
  });
17
25