@kky42/pievo-server 2.3.0 → 2.4.2

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 (199) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/MachinesModal-CSbnrUER.js +1 -0
  3. package/.output/public/assets/SignIn-0Tjqs-Ma.js +1 -0
  4. package/.output/public/assets/actionUi-DpwGIGpw.js +1 -0
  5. package/.output/public/assets/app-CaZpuwOS.css +2 -0
  6. package/.output/public/assets/index-CaS_SmDq.js +10 -0
  7. package/.output/public/assets/invite._token-Btg_0aLp.js +1 -0
  8. package/.output/public/assets/invite._token-KMD2JAgE.js +1 -0
  9. package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
  10. package/.output/public/assets/loops._loopId-D5usF3DO.js +67 -0
  11. package/.output/public/assets/loops._loopId_.runs._runId-DRCgXaCq.js +3 -0
  12. package/.output/public/assets/preload-helper-DsxECZIS.js +5 -0
  13. package/.output/public/assets/routes-CtFgwdgW.js +1 -0
  14. package/.output/public/assets/routes-LDbnnQ3f.js +1 -0
  15. package/.output/public/assets/t._teamId-D41xcbsF.js +1 -0
  16. package/.output/public/assets/t._teamId-DUena1pV.js +1 -0
  17. package/.output/public/assets/ui-Do4gqMyP.js +1 -0
  18. package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
  19. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  20. package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
  21. package/.output/server/_ssr/DashboardView-C2LdV6J0.mjs +914 -0
  22. package/.output/server/_ssr/{notifyFns-DuPR1zd7.mjs → MachinesModal-BjkcVjjx.mjs} +55 -35
  23. package/.output/server/_ssr/{SignIn-RmpWm9uy.mjs → SignIn-DEGrvJvb.mjs} +10 -24
  24. package/.output/server/_ssr/SocialLinks-Cm4H8pUJ.mjs +1044 -0
  25. package/.output/server/_ssr/{actionUi-BN55TNYE.mjs → actionUi-DJBWuNwr.mjs} +3 -3
  26. package/.output/server/_ssr/{artifactFiles-BCaIIrrT.mjs → artifactFiles-DtpRidFZ.mjs} +7 -8
  27. package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-FBYbgSuf.mjs} +27 -2
  28. package/.output/server/_ssr/artifacts-BR3jj0NC.mjs +2 -0
  29. package/.output/server/_ssr/{auth-30Z4lV1w.mjs → auth-C0zoZCGe.mjs} +16 -19
  30. package/.output/server/_ssr/boot-CdOO4xOo.mjs +2 -0
  31. package/.output/server/_ssr/{boot-3BNKujyp.mjs → boot-sNlIkoLe.mjs} +1331 -3927
  32. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs → bun-sqlite-dialect-BW9W1_Ps-DmlZWqO7.mjs} +2 -2
  33. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs → d1-sqlite-dialect-BLC8LXE6-CCNzqZwZ.mjs} +2 -2
  34. package/.output/server/_ssr/db-CwLD-5w1.mjs +2 -0
  35. package/.output/server/_ssr/{dist-Cd6nlLlO.mjs → dist-B3SxDOpW.mjs} +2 -2
  36. package/.output/server/_ssr/{factory-CWWwV7XZ.mjs → factory-Dv3Zopis.mjs} +2 -2
  37. package/.output/server/_ssr/invite._token-CJ6-H-s3.mjs +20 -0
  38. package/.output/server/_ssr/{invite._token-SdWXemIc.mjs → invite._token-dLKDJKVs.mjs} +9 -17
  39. package/.output/server/_ssr/{invite._token-BKlz0R2f.mjs → invite._token-l1SjouDz.mjs} +6 -15
  40. package/.output/server/_ssr/{kysely-adapter-C8iS51DB.mjs → kysely-adapter-nL7WKSgw.mjs} +1 -1
  41. package/.output/server/_ssr/{lifecycleUi-DgBQAYzp.mjs → lifecycleUi-Dad3hvhm.mjs} +11 -11
  42. package/.output/server/_ssr/logger-B8m8F1Qu.mjs +2 -0
  43. package/.output/server/_ssr/loopApi-BKyFB4KM.mjs +342 -0
  44. package/.output/server/_ssr/{adapters-BoLkOf1T.mjs → loopProjection-B8a829ij.mjs} +25 -55
  45. package/.output/server/_ssr/loops._loopId-DS16Phmq.mjs +1271 -0
  46. package/.output/server/_ssr/{loops._loopId_.runs._runId-PUGBrD5q.mjs → loops._loopId_.runs._runId-BEJI6iK5.mjs} +23 -74
  47. package/.output/server/_ssr/{loops._loopId_.runs._runId-Ymy4lwee.mjs → loops._loopId_.runs._runId-CduETLqH.mjs} +4 -5
  48. package/.output/server/_ssr/{machineFns-BZ9puxDt.mjs → machineFns-ByMsgG12.mjs} +3 -5
  49. package/.output/server/_ssr/{node-sqlite-dialect-D_3JmkMo.mjs → node-sqlite-dialect-CjNineno.mjs} +2 -2
  50. package/.output/server/_ssr/router-CXyrnvx-.mjs +565 -0
  51. package/.output/server/_ssr/{routes-ClZEdsnB.mjs → routes-BulNEUEE.mjs} +6 -10
  52. package/.output/server/_ssr/{routes-ComqHvCL.mjs → routes-DD94baie.mjs} +3 -3
  53. package/.output/server/_ssr/{routes-D5jJJ-30.mjs → routes-Wjexi35W.mjs} +6 -6
  54. package/.output/server/_ssr/runDiff-Ba8Lg1vg.mjs +2 -0
  55. package/.output/server/_ssr/ssr.mjs +60 -100
  56. package/.output/server/_ssr/store-Cujtg2QE.mjs +2 -0
  57. package/.output/server/_ssr/{t._teamId-BgHV_KFP.mjs → t._teamId-1CreIlPV.mjs} +7 -11
  58. package/.output/server/_ssr/{t._teamId-DDERNgfn.mjs → t._teamId-Bd6-zZsy.mjs} +4 -4
  59. package/.output/server/_ssr/{t._teamId-DRJvKHZn.mjs → t._teamId-COuMKQ4r.mjs} +7 -7
  60. package/.output/server/_ssr/{teamFns-Bp81UO-x.mjs → teamFns-H438WnZC.mjs} +12 -30
  61. package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-j2JKjorZ.mjs} +2 -2
  62. package/.output/server/_ssr/tokens-DgG_Syq3.mjs +2 -0
  63. package/.output/server/_ssr/{ui-Ww2tTM2u.mjs → ui-D5KWstlb.mjs} +26 -48
  64. package/.output/server/{_tanstack-start-manifest_v-DwKENYCN.mjs → _tanstack-start-manifest_v-3H7yBKLz.mjs} +25 -35
  65. package/{drizzle/0000_round_marauders.sql → .output/server/drizzle/0000_baseline.sql} +102 -44
  66. package/.output/server/drizzle/meta/_journal.json +3 -115
  67. package/.output/server/index.mjs +83 -132
  68. package/{.output/server/drizzle/0000_round_marauders.sql → drizzle/0000_baseline.sql} +102 -44
  69. package/drizzle/meta/_journal.json +3 -115
  70. package/package.json +2 -11
  71. package/scripts/pievo-server.mjs +3 -1
  72. package/scripts/server-cli-lib.mjs +23 -16
  73. package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
  74. package/.output/public/assets/LoopView-DjVHUyrR.js +0 -59
  75. package/.output/public/assets/Modal-CCRvx959.js +0 -1
  76. package/.output/public/assets/SignIn-Qxw5zDFq.js +0 -1
  77. package/.output/public/assets/actionUi-CXxhzYe2.js +0 -1
  78. package/.output/public/assets/app-D1cij_NJ.css +0 -2
  79. package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
  80. package/.output/public/assets/index-BRN_CQ8U.js +0 -12
  81. package/.output/public/assets/invite._token-BIxr8DlP.js +0 -1
  82. package/.output/public/assets/invite._token-j2BTCeG1.js +0 -1
  83. package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
  84. package/.output/public/assets/lifecycleUi-Qy_8beQK.js +0 -1
  85. package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
  86. package/.output/public/assets/loops._loopId-BRBQzioy.js +0 -4
  87. package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +0 -3
  88. package/.output/public/assets/notifyFns-DYD4EKaG.js +0 -1
  89. package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
  90. package/.output/public/assets/routes-3nuEJGdo.js +0 -1
  91. package/.output/public/assets/routes-DORLim-C.js +0 -1
  92. package/.output/public/assets/t._teamId-F5f4K8kd.js +0 -1
  93. package/.output/public/assets/t._teamId-XfE_S1Fo.js +0 -1
  94. package/.output/public/assets/ui-Dhsx6SW0.js +0 -1
  95. package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
  96. package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
  97. package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
  98. package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
  99. package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
  100. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
  101. package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
  102. package/.output/server/_libs/babel__runtime.mjs +0 -30
  103. package/.output/server/_libs/clsx.mjs +0 -16
  104. package/.output/server/_libs/codemirror__commands.mjs +0 -1725
  105. package/.output/server/_libs/codemirror__lint.mjs +0 -565
  106. package/.output/server/_libs/codemirror__search.mjs +0 -1138
  107. package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
  108. package/.output/server/_libs/d3-array.mjs +0 -231
  109. package/.output/server/_libs/d3-color.mjs +0 -330
  110. package/.output/server/_libs/d3-format.mjs +0 -252
  111. package/.output/server/_libs/d3-interpolate.mjs +0 -163
  112. package/.output/server/_libs/d3-path.mjs +0 -77
  113. package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
  114. package/.output/server/_libs/d3-shape.mjs +0 -818
  115. package/.output/server/_libs/decimal.js-light.mjs +0 -884
  116. package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
  117. package/.output/server/_libs/domhandler.mjs +0 -461
  118. package/.output/server/_libs/domutils.mjs +0 -868
  119. package/.output/server/_libs/es-toolkit.mjs +0 -1737
  120. package/.output/server/_libs/eventemitter3.mjs +0 -236
  121. package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
  122. package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
  123. package/.output/server/_libs/react-is.mjs +0 -48
  124. package/.output/server/_libs/react-redux+[...].mjs +0 -205
  125. package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
  126. package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
  127. package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
  128. package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
  129. package/.output/server/_ssr/DashboardView-BF7PciP7.mjs +0 -2736
  130. package/.output/server/_ssr/LoopPlaybook-DC7QVvPY.mjs +0 -2105
  131. package/.output/server/_ssr/LoopView-DwSrm9Ja.mjs +0 -1300
  132. package/.output/server/_ssr/Modal-MaCG52Pv.mjs +0 -49
  133. package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
  134. package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +0 -2
  135. package/.output/server/_ssr/boot-CsEFT53K.mjs +0 -2
  136. package/.output/server/_ssr/db-CXownd1H.mjs +0 -2
  137. package/.output/server/_ssr/invite._token-CWl6kipD.mjs +0 -28
  138. package/.output/server/_ssr/logger-Gy-47z3k.mjs +0 -2
  139. package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
  140. package/.output/server/_ssr/loopApi-ABi9SgWS.mjs +0 -564
  141. package/.output/server/_ssr/loops._loopId-SON_t43g.mjs +0 -30
  142. package/.output/server/_ssr/loops._loopId-p1KWsvMM.mjs +0 -1477
  143. package/.output/server/_ssr/notifyFns-BUCePuF3.mjs +0 -118
  144. package/.output/server/_ssr/router-Czxvra6l.mjs +0 -685
  145. package/.output/server/_ssr/runDiff--qLtU4FI.mjs +0 -2
  146. package/.output/server/_ssr/store-40eVzW1S.mjs +0 -2
  147. package/.output/server/_ssr/tokens-CbfoRC_s.mjs +0 -2
  148. package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
  149. package/.output/server/drizzle/0002_funny_sage.sql +0 -12
  150. package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
  151. package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
  152. package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
  153. package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  154. package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
  155. package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  156. package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
  157. package/.output/server/drizzle/0010_workable_rage.sql +0 -14
  158. package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
  159. package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
  160. package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
  161. package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
  162. package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
  163. package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
  164. package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
  165. package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
  166. package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
  167. package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
  168. package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
  169. package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
  170. package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
  171. package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
  172. package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
  173. package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
  174. package/drizzle/0001_naive_silver_fox.sql +0 -25
  175. package/drizzle/0002_funny_sage.sql +0 -12
  176. package/drizzle/0003_optimal_slapstick.sql +0 -102
  177. package/drizzle/0004_remove_grok_agent.sql +0 -5
  178. package/drizzle/0005_heavy_gauntlet.sql +0 -8
  179. package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  180. package/drizzle/0007_faulty_starbolt.sql +0 -30
  181. package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  182. package/drizzle/0009_ordinary_electro.sql +0 -1
  183. package/drizzle/0010_workable_rage.sql +0 -14
  184. package/drizzle/0011_steep_marvel_zombies.sql +0 -3
  185. package/drizzle/0012_blocked_run_status.sql +0 -12
  186. package/drizzle/0013_drop_run_outcome.sql +0 -2
  187. package/drizzle/0014_luxuriant_scrambler.sql +0 -5
  188. package/drizzle/0015_run_history_foundation.sql +0 -43
  189. package/drizzle/0016_plural_machine_runs.sql +0 -4
  190. package/drizzle/meta/0000_snapshot.json +0 -1333
  191. package/drizzle/meta/0001_snapshot.json +0 -1498
  192. package/drizzle/meta/0002_snapshot.json +0 -1576
  193. package/drizzle/meta/0003_snapshot.json +0 -1666
  194. package/drizzle/meta/0005_snapshot.json +0 -1666
  195. package/drizzle/meta/0006_snapshot.json +0 -1672
  196. package/drizzle/meta/0007_snapshot.json +0 -1787
  197. package/drizzle/meta/0009_snapshot.json +0 -1793
  198. package/drizzle/meta/0010_snapshot.json +0 -1891
  199. package/drizzle/meta/0011_snapshot.json +0 -1872
@@ -1,1737 +0,0 @@
1
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
2
- /**
3
- * Checks if a property key is unsafe to modify directly.
4
- *
5
- * This function is used in functions like `merge` to prevent prototype pollution attacks
6
- * by identifying property keys that could modify the object's prototype chain or constructor.
7
- *
8
- * @param key - The property key to check
9
- * @returns `true` if the property is unsafe to modify directly, `false` otherwise
10
- * @internal
11
- */
12
- function isUnsafeProperty(key) {
13
- return key === "__proto__";
14
- }
15
- //#endregion
16
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs
17
- /**
18
- * Checks if a given key is a deep key.
19
- *
20
- * A deep key is a string that contains a dot (.) or square brackets with a property accessor.
21
- *
22
- * @param {PropertyKey} key - The key to check.
23
- * @returns {boolean} - Returns true if the key is a deep key, otherwise false.
24
- *
25
- * Examples:
26
- *
27
- * isDeepKey('a.b') // true
28
- * isDeepKey('a[b]') // true
29
- * isDeepKey('a') // false
30
- * isDeepKey(123) // false
31
- * isDeepKey('a.b.c') // true
32
- * isDeepKey('a[b][c]') // true
33
- */
34
- function isDeepKey(key) {
35
- switch (typeof key) {
36
- case "number":
37
- case "symbol": return false;
38
- case "string": return key.includes(".") || key.includes("[") || key.includes("]");
39
- }
40
- }
41
- //#endregion
42
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs
43
- /**
44
- * Converts `value` to a string key if it's not a string or symbol.
45
- *
46
- * @private
47
- * @param {*} value The value to inspect.
48
- * @returns {string|symbol} Returns the key.
49
- */
50
- function toKey(value) {
51
- if (typeof value === "string" || typeof value === "symbol") return value;
52
- if (Object.is(value?.valueOf?.(), -0)) return "-0";
53
- return String(value);
54
- }
55
- //#endregion
56
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/util/toString.mjs
57
- /**
58
- * Converts `value` to a string.
59
- *
60
- * An empty string is returned for `null` and `undefined` values.
61
- * The sign of `-0` is preserved.
62
- *
63
- * @param value - The value to convert.
64
- * @returns Returns the converted string.
65
- *
66
- * @example
67
- * toString(null) // returns ''
68
- * toString(undefined) // returns ''
69
- * toString(-0) // returns '-0'
70
- * toString([1, 2, -0]) // returns '1,2,-0'
71
- * toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
72
- */
73
- function toString(value) {
74
- if (value == null) return "";
75
- if (typeof value === "string") return value;
76
- if (Array.isArray(value)) return value.map(toString).join(",");
77
- const result = String(value);
78
- if (result === "0" && Object.is(Number(value), -0)) return "-0";
79
- return result;
80
- }
81
- //#endregion
82
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/util/toPath.mjs
83
- /**
84
- * Converts a deep key string into an array of path segments.
85
- *
86
- * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.
87
- *
88
- * @param deepKey - The deep key string to convert.
89
- * @returns An array of strings, each representing a segment of the path.
90
- *
91
- * Examples:
92
- *
93
- * toPath('a.b.c') // Returns ['a', 'b', 'c']
94
- * toPath('a[b][c]') // Returns ['a', 'b', 'c']
95
- * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']
96
- * toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd']
97
- * toPath('') // Returns []
98
- * toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']
99
- */
100
- function toPath(deepKey) {
101
- if (Array.isArray(deepKey)) return deepKey.map(toKey);
102
- if (typeof deepKey === "symbol") return [deepKey];
103
- deepKey = toString(deepKey);
104
- const result = [];
105
- const length = deepKey.length;
106
- if (length === 0) return result;
107
- let index = 0;
108
- let key = "";
109
- let quoteChar = "";
110
- let bracket = false;
111
- if (deepKey.charCodeAt(0) === 46) result.push("");
112
- while (index < length) {
113
- const char = deepKey[index];
114
- if (quoteChar) if (char === "\\" && index + 1 < length) {
115
- index++;
116
- key += deepKey[index];
117
- } else if (char === quoteChar) quoteChar = "";
118
- else key += char;
119
- else if (bracket) if (char === "\"" || char === "'") quoteChar = char;
120
- else if (char === "]") {
121
- bracket = false;
122
- result.push(key);
123
- key = "";
124
- } else key += char;
125
- else if (char === "[") {
126
- bracket = true;
127
- if (key) {
128
- result.push(key);
129
- key = "";
130
- }
131
- } else if (char === ".") {
132
- if (key) {
133
- result.push(key);
134
- key = "";
135
- }
136
- const next = deepKey[index + 1];
137
- if (next === void 0 || next === ".") result.push("");
138
- } else key += char;
139
- index++;
140
- }
141
- if (key) result.push(key);
142
- return result;
143
- }
144
- //#endregion
145
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/object/get.mjs
146
- /**
147
- * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
148
- *
149
- * @param object - The object to query.
150
- * @param path - The path of the property to get.
151
- * @param [defaultValue] - The value returned if the resolved value is undefined.
152
- * @returns Returns the resolved value.
153
- *
154
- * @example
155
- * const object = { a: { b: { c: 1 } } };
156
- * get(object, 'a.b.c');
157
- * // => 1
158
- *
159
- * get(object, ['a', 'b', 'c']);
160
- * // => 1
161
- *
162
- * get(object, 'a.b.d', 'default');
163
- * // => 'default'
164
- */
165
- function get(object, path, defaultValue) {
166
- if (object == null) return defaultValue;
167
- switch (typeof path) {
168
- case "string": {
169
- if (isUnsafeProperty(path)) return defaultValue;
170
- const result = object[path];
171
- if (result === void 0) if (isDeepKey(path) && !Object.hasOwn(object, path)) return get(object, toPath(path), defaultValue);
172
- else return defaultValue;
173
- return result;
174
- }
175
- case "number":
176
- case "symbol": {
177
- if (typeof path === "number") path = toKey(path);
178
- const result = object[path];
179
- if (result === void 0) return defaultValue;
180
- return result;
181
- }
182
- default: {
183
- if (Array.isArray(path)) return getWithPath(object, path, defaultValue);
184
- if (Object.is(path?.valueOf(), -0)) path = "-0";
185
- else path = String(path);
186
- if (isUnsafeProperty(path)) return defaultValue;
187
- const result = object[path];
188
- if (result === void 0) return defaultValue;
189
- return result;
190
- }
191
- }
192
- }
193
- function getWithPath(object, path, defaultValue) {
194
- if (path.length === 0) return defaultValue;
195
- let current = object;
196
- for (let index = 0; index < path.length; index++) {
197
- if (current == null) return defaultValue;
198
- if (isUnsafeProperty(path[index])) return defaultValue;
199
- current = current[path[index]];
200
- }
201
- if (current === void 0) return defaultValue;
202
- return current;
203
- }
204
- //#endregion
205
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/array/uniqBy.mjs
206
- /**
207
- * Returns a new array containing only the unique elements from the original array,
208
- * based on the values returned by the mapper function.
209
- *
210
- * When duplicates are found, the first occurrence is kept and the rest are discarded.
211
- *
212
- * @template T - The type of elements in the array.
213
- * @template U - The type of mapped elements.
214
- * @param arr - The array to process.
215
- * @param mapper - The function used to convert the array elements.
216
- * @returns A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
217
- *
218
- * @example
219
- * ```ts
220
- * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
221
- * // [1.2, 2.1, 3.2, 5.7, 7.19]
222
- * ```
223
- *
224
- * @example
225
- * const array = [
226
- * { category: 'fruit', name: 'apple' },
227
- * { category: 'fruit', name: 'banana' },
228
- * { category: 'vegetable', name: 'carrot' },
229
- * ];
230
- * uniqBy(array, item => item.category).length
231
- * // 2
232
- * ```
233
- */
234
- function uniqBy$1(arr, mapper) {
235
- const map = /* @__PURE__ */ new Map();
236
- for (let i = 0; i < arr.length; i++) {
237
- const item = arr[i];
238
- const key = mapper(item, i, arr);
239
- if (!map.has(key)) map.set(key, item);
240
- }
241
- return Array.from(map.values());
242
- }
243
- //#endregion
244
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/function/ary.mjs
245
- /**
246
- * Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
247
- *
248
- * @template F - The type of the function.
249
- * @param func - The function to cap arguments for.
250
- * @param n - The arity cap.
251
- * @returns Returns the new capped function.
252
- *
253
- * @example
254
- * function fn(a: number, b: number, c: number) {
255
- * return Array.from(arguments);
256
- * }
257
- *
258
- * ary(fn, 0)(1, 2, 3) // []
259
- * ary(fn, 1)(1, 2, 3) // [1]
260
- * ary(fn, 2)(1, 2, 3) // [1, 2]
261
- * ary(fn, 3)(1, 2, 3) // [1, 2, 3]
262
- */
263
- function ary(func, n) {
264
- return function(...args) {
265
- return func.apply(this, args.slice(0, n));
266
- };
267
- }
268
- //#endregion
269
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/function/identity.mjs
270
- /**
271
- * Returns the input value unchanged.
272
- *
273
- * @template T - The type of the input value.
274
- * @param x - The value to be returned.
275
- * @returns The input value.
276
- *
277
- * @example
278
- * // Returns 5
279
- * identity(5);
280
- *
281
- * @example
282
- * // Returns 'hello'
283
- * identity('hello');
284
- *
285
- * @example
286
- * // Returns { key: 'value' }
287
- * identity({ key: 'value' });
288
- */
289
- function identity(x) {
290
- return x;
291
- }
292
- //#endregion
293
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/object/property.mjs
294
- /**
295
- * Creates a function that returns the value at a given path of an object.
296
- *
297
- * @template T - The type of object.
298
- * @template R - The type of the value to return.
299
- * @param path - The path of the property to get.
300
- * @returns Returns a new function that takes an object and returns the value at the specified path.
301
- *
302
- * @example
303
- * const getObjectValue = property('a.b.c');
304
- * const result = getObjectValue({ a: { b: { c: 3 } } });
305
- * console.log(result); // => 3
306
- *
307
- * @example
308
- * const getObjectValue = property(['a', 'b', 'c']);
309
- * const result = getObjectValue({ a: { b: { c: 3 } } });
310
- * console.log(result); // => 3
311
- */
312
- function property(path) {
313
- return function(object) {
314
- return get(object, path);
315
- };
316
- }
317
- //#endregion
318
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
319
- /**
320
- * Checks whether a value is a JavaScript primitive.
321
- * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
322
- *
323
- * @param value The value to check.
324
- * @returns Returns true if `value` is a primitive, false otherwise.
325
- *
326
- * @example
327
- * isPrimitive(null); // true
328
- * isPrimitive(undefined); // true
329
- * isPrimitive('123'); // true
330
- * isPrimitive(false); // true
331
- * isPrimitive(true); // true
332
- * isPrimitive(Symbol('a')); // true
333
- * isPrimitive(123n); // true
334
- * isPrimitive({}); // false
335
- * isPrimitive(new Date()); // false
336
- * isPrimitive(new Map()); // false
337
- * isPrimitive(new Set()); // false
338
- * isPrimitive([1, 2, 3]); // false
339
- */
340
- function isPrimitive(value) {
341
- return value == null || typeof value !== "object" && typeof value !== "function";
342
- }
343
- //#endregion
344
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
345
- /**
346
- * Checks if a value is a TypedArray.
347
- * @param x The value to check.
348
- * @returns Returns true if `x` is a TypedArray, false otherwise.
349
- *
350
- * @example
351
- * const arr = new Uint8Array([1, 2, 3]);
352
- * isTypedArray(arr); // true
353
- *
354
- * const regularArray = [1, 2, 3];
355
- * isTypedArray(regularArray); // false
356
- *
357
- * const buffer = new ArrayBuffer(16);
358
- * isTypedArray(buffer); // false
359
- */
360
- function isTypedArray(x) {
361
- return ArrayBuffer.isView(x) && !(x instanceof DataView);
362
- }
363
- //#endregion
364
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
365
- function getSymbols(object) {
366
- return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
367
- }
368
- //#endregion
369
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
370
- /**
371
- * Gets the `toStringTag` of `value`.
372
- *
373
- * @private
374
- * @param {T} value The value to query.
375
- * @returns {string} Returns the `Object.prototype.toString.call` result.
376
- */
377
- function getTag(value) {
378
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
379
- return Object.prototype.toString.call(value);
380
- }
381
- //#endregion
382
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
383
- var regexpTag = "[object RegExp]";
384
- var stringTag = "[object String]";
385
- var numberTag = "[object Number]";
386
- var booleanTag = "[object Boolean]";
387
- var argumentsTag = "[object Arguments]";
388
- var symbolTag = "[object Symbol]";
389
- var dateTag = "[object Date]";
390
- var mapTag = "[object Map]";
391
- var setTag = "[object Set]";
392
- var arrayTag = "[object Array]";
393
- var arrayBufferTag = "[object ArrayBuffer]";
394
- var objectTag = "[object Object]";
395
- var dataViewTag = "[object DataView]";
396
- var uint8ArrayTag = "[object Uint8Array]";
397
- var uint8ClampedArrayTag = "[object Uint8ClampedArray]";
398
- var uint16ArrayTag = "[object Uint16Array]";
399
- var uint32ArrayTag = "[object Uint32Array]";
400
- var int8ArrayTag = "[object Int8Array]";
401
- var int16ArrayTag = "[object Int16Array]";
402
- var int32ArrayTag = "[object Int32Array]";
403
- var float32ArrayTag = "[object Float32Array]";
404
- var float64ArrayTag = "[object Float64Array]";
405
- //#endregion
406
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
407
- var globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
408
- return this;
409
- })();
410
- //#endregion
411
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
412
- /**
413
- * Checks if the given value is a Buffer instance.
414
- *
415
- * This function tests whether the provided value is an instance of Buffer.
416
- * It returns `true` if the value is a Buffer, and `false` otherwise.
417
- *
418
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
419
- *
420
- * @param x - The value to check if it is a Buffer.
421
- * @returns Returns `true` if `x` is a Buffer, else `false`.
422
- *
423
- * @example
424
- * const buffer = Buffer.from("test");
425
- * console.log(isBuffer(buffer)); // true
426
- *
427
- * const notBuffer = "not a buffer";
428
- * console.log(isBuffer(notBuffer)); // false
429
- */
430
- function isBuffer(x) {
431
- return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
432
- }
433
- //#endregion
434
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs
435
- /**
436
- * Deeply clones the given object.
437
- *
438
- * You can customize the deep cloning process using the `cloneValue` function.
439
- * The function takes the current value `value`, the property name `key`, and the entire object `obj` as arguments.
440
- * If the function returns a value, that value is used;
441
- * if it returns `undefined`, the default cloning method is used.
442
- *
443
- * @template T - The type of the object.
444
- * @param obj - The object to clone.
445
- * @param [cloneValue] - A function to customize the cloning process.
446
- * @returns A deep clone of the given object.
447
- *
448
- * @example
449
- * // Clone a primitive value
450
- * const num = 29;
451
- * const clonedNum = cloneDeepWith(num);
452
- * console.log(clonedNum); // 29
453
- * console.log(clonedNum === num); // true
454
- *
455
- * @example
456
- * // Clone an object with a customizer
457
- * const obj = { a: 1, b: 2 };
458
- * const clonedObj = cloneDeepWith(obj, (value) => {
459
- * if (typeof value === 'number') {
460
- * return value * 2; // Double the number
461
- * }
462
- * });
463
- * console.log(clonedObj); // { a: 2, b: 4 }
464
- * console.log(clonedObj === obj); // false
465
- *
466
- * @example
467
- * // Clone an array with a customizer
468
- * const arr = [1, 2, 3];
469
- * const clonedArr = cloneDeepWith(arr, (value) => {
470
- * return value + 1; // Increment each value
471
- * });
472
- * console.log(clonedArr); // [2, 3, 4]
473
- * console.log(clonedArr === arr); // false
474
- */
475
- function cloneDeepWith$1(obj, cloneValue) {
476
- return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), cloneValue);
477
- }
478
- function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) {
479
- const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
480
- if (cloned !== void 0) return cloned;
481
- if (isPrimitive(valueToClone)) return valueToClone;
482
- if (stack.has(valueToClone)) return stack.get(valueToClone);
483
- if (Array.isArray(valueToClone)) {
484
- const result = new Array(valueToClone.length);
485
- stack.set(valueToClone, result);
486
- for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
487
- if (Object.hasOwn(valueToClone, "index")) result.index = valueToClone.index;
488
- if (Object.hasOwn(valueToClone, "input")) result.input = valueToClone.input;
489
- return result;
490
- }
491
- if (valueToClone instanceof Date) return new Date(valueToClone.getTime());
492
- if (valueToClone instanceof RegExp) {
493
- const result = new RegExp(valueToClone.source, valueToClone.flags);
494
- result.lastIndex = valueToClone.lastIndex;
495
- return result;
496
- }
497
- if (valueToClone instanceof Map) {
498
- const result = /* @__PURE__ */ new Map();
499
- stack.set(valueToClone, result);
500
- for (const [key, value] of valueToClone) result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
501
- return result;
502
- }
503
- if (valueToClone instanceof Set) {
504
- const result = /* @__PURE__ */ new Set();
505
- stack.set(valueToClone, result);
506
- for (const value of valueToClone) result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, cloneValue));
507
- return result;
508
- }
509
- if (isBuffer(valueToClone)) return valueToClone.subarray();
510
- if (isTypedArray(valueToClone)) {
511
- const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
512
- stack.set(valueToClone, result);
513
- for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
514
- return result;
515
- }
516
- if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) return valueToClone.slice(0);
517
- if (valueToClone instanceof DataView) {
518
- const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
519
- stack.set(valueToClone, result);
520
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
521
- return result;
522
- }
523
- if (typeof File !== "undefined" && valueToClone instanceof File) {
524
- const result = new File([valueToClone], valueToClone.name, { type: valueToClone.type });
525
- stack.set(valueToClone, result);
526
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
527
- return result;
528
- }
529
- if (typeof Blob !== "undefined" && valueToClone instanceof Blob) {
530
- const result = new Blob([valueToClone], { type: valueToClone.type });
531
- stack.set(valueToClone, result);
532
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
533
- return result;
534
- }
535
- if (valueToClone instanceof Error) {
536
- const result = structuredClone(valueToClone);
537
- stack.set(valueToClone, result);
538
- result.message = valueToClone.message;
539
- result.name = valueToClone.name;
540
- result.stack = valueToClone.stack;
541
- result.cause = valueToClone.cause;
542
- result.constructor = valueToClone.constructor;
543
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
544
- return result;
545
- }
546
- if (valueToClone instanceof Boolean) {
547
- const result = new Boolean(valueToClone.valueOf());
548
- stack.set(valueToClone, result);
549
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
550
- return result;
551
- }
552
- if (valueToClone instanceof Number) {
553
- const result = new Number(valueToClone.valueOf());
554
- stack.set(valueToClone, result);
555
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
556
- return result;
557
- }
558
- if (valueToClone instanceof String) {
559
- const result = new String(valueToClone.valueOf());
560
- stack.set(valueToClone, result);
561
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
562
- return result;
563
- }
564
- if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) {
565
- const result = Object.create(Object.getPrototypeOf(valueToClone));
566
- stack.set(valueToClone, result);
567
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
568
- return result;
569
- }
570
- return valueToClone;
571
- }
572
- function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
573
- const keys = [...Object.keys(source), ...getSymbols(source)];
574
- for (let i = 0; i < keys.length; i++) {
575
- const key = keys[i];
576
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
577
- if (descriptor == null || descriptor.writable) target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
578
- }
579
- }
580
- function isCloneableObject(object) {
581
- switch (getTag(object)) {
582
- case argumentsTag:
583
- case arrayTag:
584
- case arrayBufferTag:
585
- case dataViewTag:
586
- case booleanTag:
587
- case dateTag:
588
- case float32ArrayTag:
589
- case float64ArrayTag:
590
- case int8ArrayTag:
591
- case int16ArrayTag:
592
- case int32ArrayTag:
593
- case mapTag:
594
- case numberTag:
595
- case objectTag:
596
- case regexpTag:
597
- case setTag:
598
- case stringTag:
599
- case symbolTag:
600
- case uint8ArrayTag:
601
- case uint8ClampedArrayTag:
602
- case uint16ArrayTag:
603
- case uint32ArrayTag: return true;
604
- default: return false;
605
- }
606
- }
607
- //#endregion
608
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/cloneDeep.mjs
609
- /**
610
- * Creates a deep clone of the given object.
611
- *
612
- * @template T - The type of the object.
613
- * @param obj - The object to clone.
614
- * @returns A deep clone of the given object.
615
- *
616
- * @example
617
- * // Clone a primitive value
618
- * const num = 29;
619
- * const clonedNum = cloneDeep(num);
620
- * console.log(clonedNum); // 29
621
- * console.log(clonedNum === num); // true
622
- *
623
- * @example
624
- * // Clone an array
625
- * const arr = [1, 2, 3];
626
- * const clonedArr = cloneDeep(arr);
627
- * console.log(clonedArr); // [1, 2, 3]
628
- * console.log(clonedArr === arr); // false
629
- *
630
- * @example
631
- * // Clone an array with nested objects
632
- * const arr = [1, { a: 1 }, [1, 2, 3]];
633
- * const clonedArr = cloneDeep(arr);
634
- * arr[1].a = 2;
635
- * console.log(arr); // [1, { a: 2 }, [1, 2, 3]]
636
- * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
637
- * console.log(clonedArr === arr); // false
638
- *
639
- * @example
640
- * // Clone an object
641
- * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
642
- * const clonedObj = cloneDeep(obj);
643
- * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
644
- * console.log(clonedObj === obj); // false
645
- *
646
- * @example
647
- * // Clone an object with nested objects
648
- * const obj = { a: 1, b: { c: 1 } };
649
- * const clonedObj = cloneDeep(obj);
650
- * obj.b.c = 2;
651
- * console.log(obj); // { a: 1, b: { c: 2 } }
652
- * console.log(clonedObj); // { a: 1, b: { c: 1 } }
653
- * console.log(clonedObj === obj); // false
654
- */
655
- function cloneDeep$1(obj) {
656
- return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), void 0);
657
- }
658
- //#endregion
659
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
660
- /**
661
- * Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
662
- *
663
- * @param {any} value - The value to compare.
664
- * @param {any} other - The other value to compare.
665
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
666
- *
667
- * @example
668
- * eq(1, 1); // true
669
- * eq(0, -0); // true
670
- * eq(NaN, NaN); // true
671
- * eq('a', Object('a')); // false
672
- */
673
- function isEqualsSameValueZero(value, other) {
674
- return value === other || Number.isNaN(value) && Number.isNaN(other);
675
- }
676
- //#endregion
677
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
678
- /**
679
- * Checks if the given value is an object. An object is a value that is
680
- * not a primitive type (string, number, boolean, symbol, null, or undefined).
681
- *
682
- * This function tests whether the provided value is an object or not.
683
- * It returns `true` if the value is an object, and `false` otherwise.
684
- *
685
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.
686
- *
687
- * @param value - The value to check if it is an object.
688
- * @returns `true` if the value is an object, `false` otherwise.
689
- *
690
- * @example
691
- * const value1 = {};
692
- * const value2 = [1, 2, 3];
693
- * const value3 = () => {};
694
- * const value4 = null;
695
- *
696
- * console.log(isObject(value1)); // true
697
- * console.log(isObject(value2)); // true
698
- * console.log(isObject(value3)); // true
699
- * console.log(isObject(value4)); // false
700
- */
701
- function isObject(value) {
702
- return value !== null && (typeof value === "object" || typeof value === "function");
703
- }
704
- //#endregion
705
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs
706
- /**
707
- * Performs a deep comparison between a target value and a source pattern to determine if they match,
708
- * using a custom comparison function for fine-grained control over the matching logic.
709
- *
710
- * This function recursively traverses both values, calling the custom compare function for each
711
- * property/element pair. If the compare function returns a boolean, that result is used directly.
712
- * If it returns undefined, the default matching behavior continues recursively.
713
- *
714
- * The matching behavior varies by data type:
715
- * - **Objects**: Matches if all properties in the source exist in the target and match
716
- * - **Arrays**: Matches if all elements in the source array can be found in the target array (order-independent)
717
- * - **Maps**: Matches if all key-value pairs in the source Map exist and match in the target Map
718
- * - **Sets**: Matches if all elements in the source Set can be found in the target Set
719
- * - **Functions**: Matches using strict equality, or object comparison if the function has properties
720
- * - **Primitives**: Matches using strict equality
721
- *
722
- * Special cases:
723
- * - Empty objects, arrays, Maps, and Sets always match any target
724
- * - `null` and `undefined` source values have specific matching rules
725
- * - Circular references are handled using an internal stack to prevent infinite recursion
726
- *
727
- * @param target - The value to be tested for matching
728
- * @param source - The pattern/template to match against
729
- * @param [compare] - Optional custom comparison function that receives:
730
- * - `objValue` - The value from the target at the current path
731
- * - `srcValue` - The value from the source at the current path
732
- * - `key` - The property key or array index being compared
733
- * - `object` - The parent object/array from the target
734
- * - `source` - The parent object/array from the source
735
- * - `stack` - Internal Map used for circular reference detection
736
- * Should return `true` for a match, `false` for no match, or `undefined` to continue with default behavior
737
- *
738
- * @returns `true` if the target matches the source pattern, `false` otherwise
739
- *
740
- * @example
741
- * // Basic matching without custom comparator
742
- * isMatchWith({ a: 1, b: 2 }, { a: 1 }); // true
743
- * isMatchWith([1, 2, 3], [1, 3]); // true
744
- *
745
- * @example
746
- * // Custom comparison for case-insensitive string matching
747
- * const caseInsensitiveCompare = (objVal, srcVal) => {
748
- * if (typeof objVal === 'string' && typeof srcVal === 'string') {
749
- * return objVal.toLowerCase() === srcVal.toLowerCase();
750
- * }
751
- * return undefined; // Use default behavior for non-strings
752
- * };
753
- *
754
- * isMatchWith(
755
- * { name: 'JOHN', age: 30 },
756
- * { name: 'john' },
757
- * caseInsensitiveCompare
758
- * ); // true
759
- *
760
- * @example
761
- * // Custom comparison for range matching
762
- * const rangeCompare = (objVal, srcVal, key) => {
763
- * if (key === 'age' && typeof srcVal === 'object' && srcVal.min !== undefined) {
764
- * return objVal >= srcVal.min && objVal <= srcVal.max;
765
- * }
766
- * return undefined;
767
- * };
768
- *
769
- * isMatchWith(
770
- * { name: 'John', age: 25 },
771
- * { age: { min: 18, max: 30 } },
772
- * rangeCompare
773
- * ); // true
774
- */
775
- function isMatchWith(target, source, compare) {
776
- if (typeof compare !== "function") return isMatchWith(target, source, () => void 0);
777
- return isMatchWithInternal(target, source, function doesMatch(objValue, srcValue, key, object, source, stack) {
778
- const isEqual = compare(objValue, srcValue, key, object, source, stack);
779
- if (isEqual !== void 0) return Boolean(isEqual);
780
- return isMatchWithInternal(objValue, srcValue, doesMatch, stack, false);
781
- }, /* @__PURE__ */ new Map(), true);
782
- }
783
- function isMatchWithInternal(target, source, compare, stack, isRoot = false) {
784
- if (source === target) return true;
785
- switch (typeof source) {
786
- case "object": return isObjectMatch(target, source, compare, stack);
787
- case "function":
788
- if (Object.keys(source).length > 0) return isMatchWithInternal(target, { ...source }, compare, stack, isRoot);
789
- return isEqualsSameValueZero(target, source);
790
- default:
791
- if (!isObject(target)) return isEqualsSameValueZero(target, source);
792
- if (isRoot) {
793
- if (typeof source === "string") return source === "";
794
- return true;
795
- }
796
- return isEqualsSameValueZero(target, source);
797
- }
798
- }
799
- function isObjectMatch(target, source, compare, stack) {
800
- if (source == null) return true;
801
- if (Array.isArray(source)) return isArrayMatch(target, source, compare, stack);
802
- if (source instanceof Map) return isMapMatch(target, source, compare, stack);
803
- if (source instanceof Set) return isSetMatch(target, source, compare, stack);
804
- const keys = Object.keys(source);
805
- if (target == null || isPrimitive(target)) return keys.length === 0;
806
- if (keys.length === 0) return true;
807
- if (stack?.has(source)) return stack.get(source) === target;
808
- stack?.set(source, target);
809
- try {
810
- for (let i = 0; i < keys.length; i++) {
811
- const key = keys[i];
812
- if (!isPrimitive(target) && !(key in target)) return false;
813
- if (source[key] === void 0 && target[key] !== void 0) return false;
814
- if (source[key] === null && target[key] !== null) return false;
815
- if (!compare(target[key], source[key], key, target, source, stack)) return false;
816
- }
817
- return true;
818
- } finally {
819
- stack?.delete(source);
820
- }
821
- }
822
- function isMapMatch(target, source, compare, stack) {
823
- if (source.size === 0) return true;
824
- if (!(target instanceof Map)) return false;
825
- for (const [key, sourceValue] of source.entries()) if (compare(target.get(key), sourceValue, key, target, source, stack) === false) return false;
826
- return true;
827
- }
828
- function isArrayMatch(target, source, compare, stack) {
829
- if (source.length === 0) return true;
830
- if (!Array.isArray(target)) return false;
831
- const countedIndex = /* @__PURE__ */ new Set();
832
- for (let i = 0; i < source.length; i++) {
833
- const sourceItem = source[i];
834
- let found = false;
835
- for (let j = 0; j < target.length; j++) {
836
- if (countedIndex.has(j)) continue;
837
- const targetItem = target[j];
838
- let matches = false;
839
- if (compare(targetItem, sourceItem, i, target, source, stack)) matches = true;
840
- if (matches) {
841
- countedIndex.add(j);
842
- found = true;
843
- break;
844
- }
845
- }
846
- if (!found) return false;
847
- }
848
- return true;
849
- }
850
- function isSetMatch(target, source, compare, stack) {
851
- if (source.size === 0) return true;
852
- if (!(target instanceof Set)) return false;
853
- return isArrayMatch([...target], [...source], compare, stack);
854
- }
855
- //#endregion
856
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs
857
- /**
858
- * Checks if the target matches the source by comparing their structures and values.
859
- * This function supports deep comparison for objects, arrays, maps, and sets.
860
- *
861
- * @param target - The target value to match against.
862
- * @param source - The source value to match with.
863
- * @returns Returns `true` if the target matches the source, otherwise `false`.
864
- *
865
- * @example
866
- * // Basic usage
867
- * isMatch({ a: 1, b: 2 }, { a: 1 }); // true
868
- *
869
- * @example
870
- * // Matching arrays
871
- * isMatch([1, 2, 3], [1, 2, 3]); // true
872
- *
873
- * @example
874
- * // Matching maps
875
- * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);
876
- * const sourceMap = new Map([['key1', 'value1']]);
877
- * isMatch(targetMap, sourceMap); // true
878
- *
879
- * @example
880
- * // Matching sets
881
- * const targetSet = new Set([1, 2, 3]);
882
- * const sourceSet = new Set([1, 2]);
883
- * isMatch(targetSet, sourceSet); // true
884
- */
885
- function isMatch(target, source) {
886
- return isMatchWith(target, source, () => void 0);
887
- }
888
- //#endregion
889
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/matches.mjs
890
- /**
891
- * Creates a function that performs a deep comparison between a given target and the source object.
892
- *
893
- * @template T
894
- * @template V
895
- * @param source - The source object to create the matcher from.
896
- * @returns Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.
897
- *
898
- * @example
899
- * // Basic usage
900
- * const matcher = matches({ a: 1, b: 2 });
901
- * matcher({ a: 1, b: 2, c: 3 }); // true
902
- * matcher({ a: 1, c: 3 }); // false
903
- *
904
- * @example
905
- * // Matching arrays
906
- * const arrayMatcher = matches([1, 2, 3]);
907
- * arrayMatcher([1, 2, 3, 4]); // true
908
- * arrayMatcher([4, 5, 6]); // false
909
- *
910
- * @example
911
- * // Matching objects with nested structures
912
- * const nestedMatcher = matches({ a: { b: 2 } });
913
- * nestedMatcher({ a: { b: 2, c: 3 } }); // true
914
- * nestedMatcher({ a: { c: 3 } }); // false
915
- */
916
- function matches(source) {
917
- source = cloneDeep$1(source);
918
- return (target) => {
919
- return isMatch(target, source);
920
- };
921
- }
922
- //#endregion
923
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs
924
- /**
925
- * Creates a deep clone of the given object using a customizer function.
926
- *
927
- * @template T - The type of the object.
928
- * @param obj - The object to clone.
929
- * @param [cloneValue] - A function to customize the cloning process.
930
- * @returns A deep clone of the given object.
931
- *
932
- * @example
933
- * // Clone a primitive value
934
- * const num = 29;
935
- * const clonedNum = cloneDeepWith(num);
936
- * console.log(clonedNum); // 29
937
- * console.log(clonedNum === num); // true
938
- *
939
- * @example
940
- * // Clone an object with a customizer
941
- * const obj = { a: 1, b: 2 };
942
- * const clonedObj = cloneDeepWith(obj, (value) => {
943
- * if (typeof value === 'number') {
944
- * return value * 2; // Double the number
945
- * }
946
- * });
947
- * console.log(clonedObj); // { a: 2, b: 4 }
948
- * console.log(clonedObj === obj); // false
949
- *
950
- * @example
951
- * // Clone an array with a customizer
952
- * const arr = [1, 2, 3];
953
- * const clonedArr = cloneDeepWith(arr, (value) => {
954
- * return value + 1; // Increment each value
955
- * });
956
- * console.log(clonedArr); // [2, 3, 4]
957
- * console.log(clonedArr === arr); // false
958
- */
959
- function cloneDeepWith(obj, customizer) {
960
- return cloneDeepWith$1(obj, (value, key, object, stack) => {
961
- const cloned = customizer?.(value, key, object, stack);
962
- if (cloned !== void 0) return cloned;
963
- if (typeof obj !== "object") return;
964
- if (getTag(obj) === "[object Object]" && typeof obj.constructor !== "function") {
965
- const result = {};
966
- stack.set(obj, result);
967
- copyProperties(result, obj, object, stack);
968
- return result;
969
- }
970
- switch (Object.prototype.toString.call(obj)) {
971
- case numberTag:
972
- case stringTag:
973
- case booleanTag: {
974
- const result = new obj.constructor(obj?.valueOf());
975
- copyProperties(result, obj);
976
- return result;
977
- }
978
- case argumentsTag: {
979
- const result = {};
980
- copyProperties(result, obj);
981
- result.length = obj.length;
982
- result[Symbol.iterator] = obj[Symbol.iterator];
983
- return result;
984
- }
985
- default: return;
986
- }
987
- });
988
- }
989
- //#endregion
990
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs
991
- /**
992
- * Creates a deep clone of the given object.
993
- *
994
- * @template T - The type of the object.
995
- * @param obj - The object to clone.
996
- * @returns A deep clone of the given object.
997
- *
998
- * @example
999
- * // Clone a primitive value
1000
- * const num = 29;
1001
- * const clonedNum = clone(num);
1002
- * console.log(clonedNum); // 29
1003
- * console.log(clonedNum === num); // true
1004
- *
1005
- * @example
1006
- * // Clone an array
1007
- * const arr = [1, 2, 3];
1008
- * const clonedArr = clone(arr);
1009
- * console.log(clonedArr); // [1, 2, 3]
1010
- * console.log(clonedArr === arr); // false
1011
- *
1012
- * @example
1013
- * // Clone an array with nested objects
1014
- * const arr = [1, { a: 1 }, [1, 2, 3]];
1015
- * const clonedArr = clone(arr);
1016
- * arr[1].a = 2;
1017
- * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]
1018
- * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
1019
- * console.log(clonedArr === arr); // false
1020
- *
1021
- * @example
1022
- * // Clone an object
1023
- * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
1024
- * const clonedObj = clone(obj);
1025
- * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
1026
- * console.log(clonedObj === obj); // false
1027
- *
1028
- * @example
1029
- * // Clone an object with nested objects
1030
- * const obj = { a: 1, b: { c: 1 } };
1031
- * const clonedObj = clone(obj);
1032
- * obj.b.c = 2;
1033
- * console.log(obj); // { a: 1, b: { c: 2 } }
1034
- * console.log(clonedObj); // { a: 1, b: { c: 1 } }
1035
- * console.log(clonedObj === obj); // false
1036
- */
1037
- function cloneDeep(obj) {
1038
- return cloneDeepWith(obj);
1039
- }
1040
- //#endregion
1041
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
1042
- var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
1043
- function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
1044
- switch (typeof value) {
1045
- case "number": return Number.isInteger(value) && value >= 0 && value < length;
1046
- case "symbol": return false;
1047
- case "string": return IS_UNSIGNED_INTEGER.test(value);
1048
- }
1049
- }
1050
- //#endregion
1051
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs
1052
- /**
1053
- * Checks if the given value is an arguments object.
1054
- *
1055
- * This function tests whether the provided value is an arguments object or not.
1056
- * It returns `true` if the value is an arguments object, and `false` otherwise.
1057
- *
1058
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.
1059
- *
1060
- * @param value - The value to test if it is an arguments object.
1061
- * @returns `true` if the value is an arguments, `false` otherwise.
1062
- *
1063
- * @example
1064
- * const args = (function() { return arguments; })();
1065
- * const strictArgs = (function() { 'use strict'; return arguments; })();
1066
- * const value = [1, 2, 3];
1067
- *
1068
- * console.log(isArguments(args)); // true
1069
- * console.log(isArguments(strictArgs)); // true
1070
- * console.log(isArguments(value)); // false
1071
- */
1072
- function isArguments(value) {
1073
- return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]";
1074
- }
1075
- //#endregion
1076
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/object/has.mjs
1077
- /**
1078
- * Checks if a given path exists within an object.
1079
- *
1080
- * You can provide the path as a single property key, an array of property keys,
1081
- * or a string representing a deep path.
1082
- *
1083
- * If the path is an index and the object is an array or an arguments object, the function will verify
1084
- * if the index is valid and within the bounds of the array or arguments object, even if the array or
1085
- * arguments object is sparse (i.e., not all indexes are defined).
1086
- *
1087
- * @param object - The object to query.
1088
- * @param path - The path to check. This can be a single property key,
1089
- * an array of property keys, or a string representing a deep path.
1090
- * @returns Returns `true` if the path exists in the object, `false` otherwise.
1091
- *
1092
- * @example
1093
- *
1094
- * const obj = { a: { b: { c: 3 } } };
1095
- *
1096
- * has(obj, 'a'); // true
1097
- * has(obj, ['a', 'b']); // true
1098
- * has(obj, ['a', 'b', 'c']); // true
1099
- * has(obj, 'a.b.c'); // true
1100
- * has(obj, 'a.b.d'); // false
1101
- * has(obj, ['a', 'b', 'c', 'd']); // false
1102
- * has([], 0); // false
1103
- * has([1, 2, 3], 2); // true
1104
- * has([1, 2, 3], 5); // false
1105
- */
1106
- function has(object, path) {
1107
- let resolvedPath;
1108
- if (Array.isArray(path)) resolvedPath = path;
1109
- else if (typeof path === "string" && isDeepKey(path) && object?.[path] == null) resolvedPath = toPath(path);
1110
- else resolvedPath = [path];
1111
- if (resolvedPath.length === 0) return false;
1112
- let current = object;
1113
- for (let i = 0; i < resolvedPath.length; i++) {
1114
- const key = resolvedPath[i];
1115
- if (current == null || !Object.hasOwn(current, key)) {
1116
- if (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length)) return false;
1117
- }
1118
- current = current[key];
1119
- }
1120
- return true;
1121
- }
1122
- //#endregion
1123
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs
1124
- /**
1125
- * Creates a function that checks if a given target object matches a specific property value.
1126
- *
1127
- * The returned function takes a target object and determines if the property at the
1128
- * specified path within the target object is equal to the given value.
1129
- *
1130
- * @param property - The property path to check within the target object.
1131
- * This can be a single property key or an array of property keys.
1132
- * @param source - The value to compare against the property value in the target object.
1133
- *
1134
- * @returns A function that takes a target object and returns
1135
- * `true` if the property value at the given path in the target object matches the provided value,
1136
- * otherwise returns `false`.
1137
- *
1138
- * @example
1139
- * // Using a single property key
1140
- * const checkName = matchesProperty('name', 'Alice');
1141
- * console.log(checkName({ name: 'Alice' })); // true
1142
- * console.log(checkName({ name: 'Bob' })); // false
1143
- *
1144
- * // Using an array of property keys
1145
- * const checkNested = matchesProperty(['address', 'city'], 'New York');
1146
- * console.log(checkNested({ address: { city: 'New York' } })); // true
1147
- * console.log(checkNested({ address: { city: 'Los Angeles' } })); // false
1148
- */
1149
- function matchesProperty(property, source) {
1150
- switch (typeof property) {
1151
- case "object":
1152
- if (Object.is(property?.valueOf(), -0)) property = "-0";
1153
- break;
1154
- case "number":
1155
- property = toKey(property);
1156
- break;
1157
- }
1158
- source = cloneDeep(source);
1159
- return function(target) {
1160
- const result = get(target, property);
1161
- if (result === void 0) return has(target, property);
1162
- if (source === void 0) return result === void 0;
1163
- return isMatch(result, source);
1164
- };
1165
- }
1166
- //#endregion
1167
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/util/iteratee.mjs
1168
- /**
1169
- * Creates a function that returns a value from an element in a collection.
1170
- *
1171
- * You can call `iteratee` with the following types of arguments:
1172
- *
1173
- * - **Function**: Returns the function as-is, which will be called with the element from the collection.
1174
- * - **Property name**: Returns the value of the specified property from the element.
1175
- * - **Property-value pair**: Returns a boolean indicating whether the element's property matches the given value.
1176
- * - **Partial object**: Returns a boolean indicating whether the element matches the properties of the partial object.
1177
- *
1178
- * If you don't provide any arguments or pass `null`, this function will return a function that simply returns its input unchanged.
1179
- *
1180
- * @param value - The value to convert to an iteratee.
1181
- * @returns Returns the new iteratee function.
1182
- * @example
1183
- * const func = iteratee();
1184
- * [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [{ a: 1 }, { a: 2 }, { a: 3 }]
1185
- *
1186
- * const func = iteratee((object) => object.a);
1187
- * [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3]
1188
- *
1189
- * const func = iteratee('a');
1190
- * [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3]
1191
- *
1192
- * const func = iteratee({ a: 1 });
1193
- * [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
1194
- *
1195
- * const func = iteratee(['a', 1]);
1196
- * [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
1197
- */
1198
- function iteratee(value) {
1199
- if (value == null) return identity;
1200
- switch (typeof value) {
1201
- case "function": return value;
1202
- case "object":
1203
- if (Array.isArray(value) && value.length === 2) return matchesProperty(value[0], value[1]);
1204
- return matches(value);
1205
- case "string":
1206
- case "symbol":
1207
- case "number": return property(value);
1208
- }
1209
- }
1210
- //#endregion
1211
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isLength.mjs
1212
- /**
1213
- * Checks if a given value is a valid length.
1214
- *
1215
- * A valid length is of type `number`, is a non-negative integer, and is less than or equal to
1216
- * JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`).
1217
- * It returns `true` if the value is a valid length, and `false` otherwise.
1218
- *
1219
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the
1220
- * argument to a valid length (`number`).
1221
- *
1222
- * @param value The value to check.
1223
- * @returns Returns `true` if `value` is a valid length, else `false`.
1224
- *
1225
- * @example
1226
- * isLength(0); // true
1227
- * isLength(42); // true
1228
- * isLength(-1); // false
1229
- * isLength(1.5); // false
1230
- * isLength(Number.MAX_SAFE_INTEGER); // true
1231
- * isLength(Number.MAX_SAFE_INTEGER + 1); // false
1232
- */
1233
- function isLength(value) {
1234
- return Number.isSafeInteger(value) && value >= 0;
1235
- }
1236
- //#endregion
1237
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
1238
- /**
1239
- * Checks if `value` is array-like.
1240
- *
1241
- * @param value The value to check.
1242
- * @returns Returns `true` if `value` is array-like, else `false`.
1243
- *
1244
- * @example
1245
- * isArrayLike([1, 2, 3]); // true
1246
- * isArrayLike('abc'); // true
1247
- * isArrayLike({ 0: 'a', length: 1 }); // true
1248
- * isArrayLike({}); // false
1249
- * isArrayLike(null); // false
1250
- * isArrayLike(undefined); // false
1251
- */
1252
- function isArrayLike(value) {
1253
- return value != null && typeof value !== "function" && isLength(value.length);
1254
- }
1255
- //#endregion
1256
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs
1257
- /**
1258
- * Checks if the given value is object-like.
1259
- *
1260
- * A value is object-like if its type is object and it is not null.
1261
- *
1262
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value.
1263
- *
1264
- * @param value - The value to test if it is an object-like.
1265
- * @returns `true` if the value is an object-like, `false` otherwise.
1266
- *
1267
- * @example
1268
- * const value1 = { a: 1 };
1269
- * const value2 = [1, 2, 3];
1270
- * const value3 = 'abc';
1271
- * const value4 = () => {};
1272
- * const value5 = null;
1273
- *
1274
- * console.log(isObjectLike(value1)); // true
1275
- * console.log(isObjectLike(value2)); // true
1276
- * console.log(isObjectLike(value3)); // false
1277
- * console.log(isObjectLike(value4)); // false
1278
- * console.log(isObjectLike(value5)); // false
1279
- */
1280
- function isObjectLike(value) {
1281
- return typeof value === "object" && value !== null;
1282
- }
1283
- //#endregion
1284
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs
1285
- /**
1286
- * Checks if the given value is a non-primitive, array-like object.
1287
- *
1288
- * @param value The value to check.
1289
- * @returns `true` if the value is a non-primitive, array-like object, `false` otherwise.
1290
- *
1291
- * @example
1292
- * isArrayLikeObject([1, 2, 3]); // true
1293
- * isArrayLikeObject({ 0: 'a', length: 1 }); // true
1294
- * isArrayLikeObject('abc'); // false
1295
- * isArrayLikeObject(()=>{}); // false
1296
- */
1297
- function isArrayLikeObject(value) {
1298
- return isObjectLike(value) && isArrayLike(value);
1299
- }
1300
- //#endregion
1301
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs
1302
- function uniqBy(array, iteratee$1 = identity) {
1303
- if (!isArrayLikeObject(array)) return [];
1304
- return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1));
1305
- }
1306
- //#endregion
1307
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/array/flatten.mjs
1308
- /**
1309
- * Flattens an array up to the specified depth.
1310
- *
1311
- * @template T - The type of elements within the array.
1312
- * @template D - The depth to which the array should be flattened.
1313
- * @param arr - The array to flatten.
1314
- * @param depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.
1315
- * @returns A new array that has been flattened.
1316
- *
1317
- * @example
1318
- * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1);
1319
- * // Returns: [1, 2, 3, 4, [5, 6]]
1320
- *
1321
- * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2);
1322
- * // Returns: [1, 2, 3, 4, 5, 6]
1323
- */
1324
- function flatten(arr, depth = 1) {
1325
- const result = [];
1326
- const flooredDepth = Math.floor(depth);
1327
- const recursive = (arr, currentDepth) => {
1328
- for (let i = 0; i < arr.length; i++) {
1329
- const item = arr[i];
1330
- if (Array.isArray(item) && currentDepth < flooredDepth) recursive(item, currentDepth + 1);
1331
- else result.push(item);
1332
- }
1333
- };
1334
- recursive(arr, 0);
1335
- return result;
1336
- }
1337
- //#endregion
1338
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
1339
- function isIterateeCall(value, index, object) {
1340
- if (!isObject(object)) return false;
1341
- if (typeof index === "number" && isArrayLike(object) && isIndex(index) && index < object.length || typeof index === "string" && index in object) return isEqualsSameValueZero(object[index], value);
1342
- return false;
1343
- }
1344
- //#endregion
1345
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs
1346
- function getPriority(a) {
1347
- if (typeof a === "symbol") return 1;
1348
- if (a === null) return 2;
1349
- if (a === void 0) return 3;
1350
- if (a !== a) return 4;
1351
- return 0;
1352
- }
1353
- var compareValues = (a, b, order) => {
1354
- if (a !== b) {
1355
- const aPriority = getPriority(a);
1356
- const bPriority = getPriority(b);
1357
- if (aPriority === bPriority && aPriority === 0) {
1358
- if (a < b) return order === "desc" ? 1 : -1;
1359
- if (a > b) return order === "desc" ? -1 : 1;
1360
- }
1361
- return order === "desc" ? bPriority - aPriority : aPriority - bPriority;
1362
- }
1363
- return 0;
1364
- };
1365
- //#endregion
1366
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
1367
- /**
1368
- * Check whether a value is a symbol.
1369
- *
1370
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`.
1371
- *
1372
- * @param value The value to check.
1373
- * @returns Returns `true` if `value` is a symbol, else `false`.
1374
- * @example
1375
- * isSymbol(Symbol.iterator);
1376
- * // => true
1377
- *
1378
- * isSymbol('abc');
1379
- * // => false
1380
- */
1381
- function isSymbol(value) {
1382
- return typeof value === "symbol" || value instanceof Symbol;
1383
- }
1384
- //#endregion
1385
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs
1386
- /** Matches any deep property path. (e.g. `a.b[0].c`)*/
1387
- var regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
1388
- /** Matches any word character (alphanumeric & underscore).*/
1389
- var regexIsPlainProp = /^\w*$/;
1390
- /**
1391
- * Checks if `value` is a property name and not a property path. (It's ok that the `value` is not in the keys of the `object`)
1392
- * @param {unknown} value The value to check.
1393
- * @param {unknown} object The object to query.
1394
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
1395
- *
1396
- * @example
1397
- * isKey('a', { a: 1 });
1398
- * // => true
1399
- *
1400
- * isKey('a.b', { a: { b: 2 } });
1401
- * // => false
1402
- */
1403
- function isKey(value, object) {
1404
- if (Array.isArray(value)) return false;
1405
- if (typeof value === "number" || typeof value === "boolean" || value == null || isSymbol(value)) return true;
1406
- return typeof value === "string" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);
1407
- }
1408
- //#endregion
1409
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/array/orderBy.mjs
1410
- /**
1411
- * Sorts an array of objects based on multiple properties and their corresponding order directions.
1412
- *
1413
- * This function takes an array of objects, an array of criteria to sort by, and an array of order directions.
1414
- * It returns the sorted array, ordering by each key according to its corresponding direction ('asc' for ascending or 'desc' for descending).
1415
- * If values for a key are equal, it moves to the next key to determine the order.
1416
- *
1417
- * @template T - The type of elements in the array.
1418
- * @param collection - The array of objects to be sorted.
1419
- * @param criteria - An array of criteria (property names or property paths or custom key functions) to sort by.
1420
- * @param orders - An array of order directions ('asc' for ascending or 'desc' for descending).
1421
- * @param [guard] Enables use as an iteratee for methods like `_.reduce`.
1422
- * @returns The sorted array.
1423
- *
1424
- * @example
1425
- * // Sort an array of objects by 'user' in ascending order and 'age' in descending order.
1426
- * const users = [
1427
- * { user: 'fred', age: 48 },
1428
- * { user: 'barney', age: 34 },
1429
- * { user: 'fred', age: 40 },
1430
- * { user: 'barney', age: 36 },
1431
- * ];
1432
- * const result = orderBy(users, ['user', (item) => item.age], ['asc', 'desc']);
1433
- * // result will be:
1434
- * // [
1435
- * // { user: 'barney', age: 36 },
1436
- * // { user: 'barney', age: 34 },
1437
- * // { user: 'fred', age: 48 },
1438
- * // { user: 'fred', age: 40 },
1439
- * // ]
1440
- */
1441
- function orderBy(collection, criteria, orders, guard) {
1442
- if (collection == null) return [];
1443
- orders = guard ? void 0 : orders;
1444
- if (!Array.isArray(collection)) collection = Object.values(collection);
1445
- if (!Array.isArray(criteria)) criteria = criteria == null ? [null] : [criteria];
1446
- if (criteria.length === 0) criteria = [null];
1447
- if (!Array.isArray(orders)) orders = orders == null ? [] : [orders];
1448
- orders = orders.map((order) => String(order));
1449
- const getValueByNestedPath = (object, path) => {
1450
- let target = object;
1451
- for (let i = 0; i < path.length && target != null; ++i) target = target[path[i]];
1452
- return target;
1453
- };
1454
- const getValueByCriterion = (criterion, object) => {
1455
- if (object == null || criterion == null) return object;
1456
- if (typeof criterion === "object" && "key" in criterion) {
1457
- if (Object.hasOwn(object, criterion.key)) return object[criterion.key];
1458
- return getValueByNestedPath(object, criterion.path);
1459
- }
1460
- if (typeof criterion === "function") return criterion(object);
1461
- if (Array.isArray(criterion)) return getValueByNestedPath(object, criterion);
1462
- if (typeof object === "object") return object[criterion];
1463
- return object;
1464
- };
1465
- const preparedCriteria = criteria.map((criterion) => {
1466
- if (Array.isArray(criterion) && criterion.length === 1) criterion = criterion[0];
1467
- if (criterion == null || typeof criterion === "function" || Array.isArray(criterion) || isKey(criterion)) return criterion;
1468
- return {
1469
- key: criterion,
1470
- path: toPath(criterion)
1471
- };
1472
- });
1473
- return collection.map((item) => ({
1474
- original: item,
1475
- criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item))
1476
- })).slice().sort((a, b) => {
1477
- for (let i = 0; i < preparedCriteria.length; i++) {
1478
- const comparedResult = compareValues(a.criteria[i], b.criteria[i], orders[i]);
1479
- if (comparedResult !== 0) return comparedResult;
1480
- }
1481
- return 0;
1482
- }).map((item) => item.original);
1483
- }
1484
- //#endregion
1485
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/array/sortBy.mjs
1486
- function sortBy(collection, ...criteria) {
1487
- const length = criteria.length;
1488
- if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) criteria = [];
1489
- else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]];
1490
- return orderBy(collection, flatten(criteria), ["asc"]);
1491
- }
1492
- //#endregion
1493
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/function/debounce.mjs
1494
- /**
1495
- * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
1496
- * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
1497
- * method to cancel any pending execution.
1498
- *
1499
- * @template F - The type of function.
1500
- * @param func - The function to debounce.
1501
- * @param debounceMs - The number of milliseconds to delay.
1502
- * @param options - The options object
1503
- * @param options.signal - An optional AbortSignal to cancel the debounced function.
1504
- * @param options.edges - An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both.
1505
- * @returns A new debounced function with a `cancel` method.
1506
- *
1507
- * @example
1508
- * const debouncedFunction = debounce(() => {
1509
- * console.log('Function executed');
1510
- * }, 1000);
1511
- *
1512
- * // Will log 'Function executed' after 1 second if not called again in that time
1513
- * debouncedFunction();
1514
- *
1515
- * // Will not log anything as the previous call is canceled
1516
- * debouncedFunction.cancel();
1517
- *
1518
- * // With AbortSignal
1519
- * const controller = new AbortController();
1520
- * const signal = controller.signal;
1521
- * const debouncedWithSignal = debounce(() => {
1522
- * console.log('Function executed');
1523
- * }, 1000, { signal });
1524
- *
1525
- * debouncedWithSignal();
1526
- *
1527
- * // Will cancel the debounced function call
1528
- * controller.abort();
1529
- */
1530
- function debounce$1(func, debounceMs, { signal, edges } = {}) {
1531
- let pendingThis = void 0;
1532
- let pendingArgs = null;
1533
- const leading = edges != null && edges.includes("leading");
1534
- const trailing = edges == null || edges.includes("trailing");
1535
- const invoke = () => {
1536
- if (pendingArgs !== null) {
1537
- func.apply(pendingThis, pendingArgs);
1538
- pendingThis = void 0;
1539
- pendingArgs = null;
1540
- }
1541
- };
1542
- const onTimerEnd = () => {
1543
- if (trailing) invoke();
1544
- cancel();
1545
- };
1546
- let timeoutId = null;
1547
- const schedule = () => {
1548
- if (timeoutId != null) clearTimeout(timeoutId);
1549
- timeoutId = setTimeout(() => {
1550
- timeoutId = null;
1551
- onTimerEnd();
1552
- }, debounceMs);
1553
- };
1554
- const cancelTimer = () => {
1555
- if (timeoutId !== null) {
1556
- clearTimeout(timeoutId);
1557
- timeoutId = null;
1558
- }
1559
- };
1560
- const cancel = () => {
1561
- cancelTimer();
1562
- pendingThis = void 0;
1563
- pendingArgs = null;
1564
- };
1565
- const flush = () => {
1566
- invoke();
1567
- };
1568
- const debounced = function(...args) {
1569
- if (signal?.aborted) return;
1570
- pendingThis = this;
1571
- pendingArgs = args;
1572
- const isFirstCall = timeoutId == null;
1573
- schedule();
1574
- if (leading && isFirstCall) invoke();
1575
- };
1576
- debounced.schedule = schedule;
1577
- debounced.cancel = cancel;
1578
- debounced.flush = flush;
1579
- signal?.addEventListener("abort", cancel, { once: true });
1580
- return debounced;
1581
- }
1582
- //#endregion
1583
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/function/debounce.mjs
1584
- function debounce(func, debounceMs = 0, options = {}) {
1585
- if (typeof options !== "object") options = {};
1586
- const { leading = false, trailing = true, maxWait } = options;
1587
- const edges = Array(2);
1588
- if (leading) edges[0] = "leading";
1589
- if (trailing) edges[1] = "trailing";
1590
- let result = void 0;
1591
- let pendingAt = null;
1592
- const _debounced = debounce$1(function(...args) {
1593
- result = func.apply(this, args);
1594
- pendingAt = null;
1595
- }, debounceMs, { edges });
1596
- const debounced = function(...args) {
1597
- if (maxWait != null) {
1598
- if (pendingAt === null) pendingAt = Date.now();
1599
- if (Date.now() - pendingAt >= maxWait) {
1600
- result = func.apply(this, args);
1601
- pendingAt = Date.now();
1602
- _debounced.cancel();
1603
- _debounced.schedule();
1604
- return result;
1605
- }
1606
- }
1607
- _debounced.apply(this, args);
1608
- return result;
1609
- };
1610
- const flush = () => {
1611
- _debounced.flush();
1612
- return result;
1613
- };
1614
- debounced.cancel = _debounced.cancel;
1615
- debounced.flush = flush;
1616
- return debounced;
1617
- }
1618
- //#endregion
1619
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/function/throttle.mjs
1620
- /**
1621
- * Creates a throttled function that only invokes the provided function at most once
1622
- * per every `throttleMs` milliseconds. Subsequent calls to the throttled function
1623
- * within the wait time will not trigger the execution of the original function.
1624
- *
1625
- * @template F - The type of function.
1626
- * @param func - The function to throttle.
1627
- * @param throttleMs - The number of milliseconds to throttle executions to.
1628
- * @param options - The options object
1629
- * @param options.signal - An optional AbortSignal to cancel the throttled function.
1630
- * @param options.leading - If `true`, the function will be invoked on the leading edge of the timeout.
1631
- * @param options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout.
1632
- * @returns A new throttled function that accepts the same parameters as the original function.
1633
- *
1634
- * @example
1635
- * const throttledFunction = throttle(() => {
1636
- * console.log('Function executed');
1637
- * }, 1000);
1638
- *
1639
- * // Will log 'Function executed' immediately
1640
- * throttledFunction();
1641
- *
1642
- * // Will not log anything as it is within the throttle time
1643
- * throttledFunction();
1644
- *
1645
- * // After 1 second
1646
- * setTimeout(() => {
1647
- * throttledFunction(); // Will log 'Function executed'
1648
- * }, 1000);
1649
- */
1650
- function throttle(func, throttleMs = 0, options = {}) {
1651
- const { leading = true, trailing = true } = options;
1652
- return debounce(func, throttleMs, {
1653
- leading,
1654
- maxWait: throttleMs,
1655
- trailing
1656
- });
1657
- }
1658
- //#endregion
1659
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/util/toNumber.mjs
1660
- /**
1661
- * Converts `value` to a number.
1662
- *
1663
- * Unlike `Number()`, this function returns `NaN` for symbols.
1664
- *
1665
- * @param value - The value to convert.
1666
- * @returns Returns the number.
1667
- *
1668
- * @example
1669
- * toNumber(3.2); // => 3.2
1670
- * toNumber(Number.MIN_VALUE); // => 5e-324
1671
- * toNumber(Infinity); // => Infinity
1672
- * toNumber('3.2'); // => 3.2
1673
- * toNumber(Symbol.iterator); // => NaN
1674
- * toNumber(NaN); // => NaN
1675
- */
1676
- function toNumber(value) {
1677
- if (isSymbol(value)) return NaN;
1678
- return Number(value);
1679
- }
1680
- //#endregion
1681
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/util/toFinite.mjs
1682
- /**
1683
- * Converts `value` to a finite number.
1684
- *
1685
- * @param value - The value to convert.
1686
- * @returns Returns the number.
1687
- *
1688
- * @example
1689
- * toFinite(3.2); // => 3.2
1690
- * toFinite(Number.MIN_VALUE); // => 5e-324
1691
- * toFinite(Infinity); // => 1.7976931348623157e+308
1692
- * toFinite('3.2'); // => 3.2
1693
- * toFinite(Symbol.iterator); // => 0
1694
- * toFinite(NaN); // => 0
1695
- */
1696
- function toFinite(value) {
1697
- if (!value) return value === 0 ? value : 0;
1698
- value = toNumber(value);
1699
- if (value === Infinity || value === -Infinity) return (value < 0 ? -1 : 1) * Number.MAX_VALUE;
1700
- return value === value ? value : 0;
1701
- }
1702
- //#endregion
1703
- //#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/math/range.mjs
1704
- /**
1705
- * Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
1706
- *
1707
- * @param start - The starting number of the range (inclusive).
1708
- * @param end - The end number of the range (exclusive).
1709
- * @param step - The step value for the range.
1710
- * @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
1711
- *
1712
- * @example
1713
- * // Returns [0, 1, 2, 3]
1714
- * range(4);
1715
- *
1716
- * @example
1717
- * // Returns [0, -1, -2, -3]
1718
- * range(0, -4, -1);
1719
- */
1720
- function range(start, end, step) {
1721
- if (step && typeof step !== "number" && isIterateeCall(start, end, step)) end = step = void 0;
1722
- start = toFinite(start);
1723
- if (end === void 0) {
1724
- end = start;
1725
- start = 0;
1726
- } else end = toFinite(end);
1727
- step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
1728
- const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
1729
- const result = new Array(length);
1730
- for (let index = 0; index < length; index++) {
1731
- result[index] = start;
1732
- start += step;
1733
- }
1734
- return result;
1735
- }
1736
- //#endregion
1737
- export { get as a, uniqBy as i, throttle as n, sortBy as r, range as t };