@buoy-gg/network 7.0.41 → 7.0.42

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 (272) hide show
  1. package/README.md +11 -85
  2. package/lib/commonjs/index.js +1 -332
  3. package/lib/commonjs/index.web.js +1 -420
  4. package/lib/commonjs/network/components/DataViewer.web.js +1 -879
  5. package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
  6. package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
  7. package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
  8. package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
  9. package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
  10. package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
  11. package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
  12. package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
  13. package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
  14. package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
  15. package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
  16. package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
  17. package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
  18. package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
  19. package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
  20. package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
  21. package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
  22. package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
  23. package/lib/commonjs/network/components/NetworkModal.js +1 -786
  24. package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
  25. package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
  26. package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
  27. package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
  28. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
  29. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
  30. package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
  31. package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
  32. package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
  33. package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
  34. package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
  35. package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
  36. package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
  37. package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
  38. package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
  39. package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
  40. package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
  41. package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
  42. package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
  43. package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
  44. package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
  45. package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
  46. package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
  47. package/lib/commonjs/network/conditions/store.js +1 -75
  48. package/lib/commonjs/network/conditions/wait.js +1 -43
  49. package/lib/commonjs/network/conditions/xhr.js +1 -135
  50. package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
  51. package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
  52. package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
  53. package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
  54. package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
  55. package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
  56. package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
  57. package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
  58. package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
  59. package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
  60. package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
  61. package/lib/commonjs/network/overrides/engine.js +1 -93
  62. package/lib/commonjs/network/overrides/matchRule.js +1 -87
  63. package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
  64. package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
  65. package/lib/commonjs/network/overrides/presets.js +1 -70
  66. package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
  67. package/lib/commonjs/network/overrides/types.js +1 -90
  68. package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
  69. package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
  70. package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
  71. package/lib/commonjs/network/types/index.js +1 -5
  72. package/lib/commonjs/network/utils/extractOperationName.js +1 -80
  73. package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
  74. package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
  75. package/lib/commonjs/network/utils/formatting.js +1 -30
  76. package/lib/commonjs/network/utils/generateCurl.js +2 -71
  77. package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
  78. package/lib/commonjs/network/utils/httpCompletion.js +1 -37
  79. package/lib/commonjs/network/utils/networkEventStore.js +1 -411
  80. package/lib/commonjs/network/utils/networkListener.js +4 -1352
  81. package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
  82. package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
  83. package/lib/commonjs/network/utils/realNow.js +1 -0
  84. package/lib/commonjs/network/utils/requestId.js +1 -16
  85. package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
  86. package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
  87. package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
  88. package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
  89. package/lib/commonjs/preset.js +1 -93
  90. package/lib/module/index.js +1 -104
  91. package/lib/module/index.web.js +1 -82
  92. package/lib/module/network/components/DataViewer.web.js +1 -875
  93. package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
  94. package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
  95. package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
  96. package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
  97. package/lib/module/network/components/NetworkDetailStepper.js +1 -104
  98. package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
  99. package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
  100. package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
  101. package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
  102. package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
  103. package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
  104. package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
  105. package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
  106. package/lib/module/network/components/NetworkHeaderLive.js +1 -366
  107. package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
  108. package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
  109. package/lib/module/network/components/NetworkListScreen.js +1 -399
  110. package/lib/module/network/components/NetworkListScreen.web.js +1 -622
  111. package/lib/module/network/components/NetworkModal.js +1 -781
  112. package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
  113. package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
  114. package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
  115. package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
  116. package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
  117. package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
  118. package/lib/module/network/components/NetworkOverridesButton.js +1 -87
  119. package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
  120. package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
  121. package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
  122. package/lib/module/network/components/NetworkSavedScreen.js +1 -222
  123. package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
  124. package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
  125. package/lib/module/network/components/response-editor/Explorer.js +1 -972
  126. package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
  127. package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
  128. package/lib/module/network/components/response-editor/editorContext.js +1 -29
  129. package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
  130. package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
  131. package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
  132. package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
  133. package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
  134. package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
  135. package/lib/module/network/conditions/store.js +1 -65
  136. package/lib/module/network/conditions/wait.js +1 -38
  137. package/lib/module/network/conditions/xhr.js +1 -131
  138. package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
  139. package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
  140. package/lib/module/network/hooks/useNetworkEventList.js +1 -104
  141. package/lib/module/network/hooks/useNetworkEvents.js +1 -314
  142. package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
  143. package/lib/module/network/hooks/useNetworkSaved.js +1 -34
  144. package/lib/module/network/hooks/useNetworkSelection.js +1 -46
  145. package/lib/module/network/hooks/useOverrideRules.js +1 -32
  146. package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
  147. package/lib/module/network/overrides/applyToFetch.js +1 -72
  148. package/lib/module/network/overrides/applyToXhr.js +2 -502
  149. package/lib/module/network/overrides/engine.js +1 -85
  150. package/lib/module/network/overrides/matchRule.js +1 -81
  151. package/lib/module/network/overrides/overriddenRows.js +1 -33
  152. package/lib/module/network/overrides/overrideRulesStore.js +1 -547
  153. package/lib/module/network/overrides/presets.js +1 -65
  154. package/lib/module/network/overrides/resolveOverride.js +1 -152
  155. package/lib/module/network/overrides/types.js +1 -86
  156. package/lib/module/network/sync/networkBodyResolver.js +1 -34
  157. package/lib/module/network/sync/networkSyncAdapter.js +1 -880
  158. package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
  159. package/lib/module/network/types/index.js +1 -3
  160. package/lib/module/network/utils/extractOperationName.js +1 -76
  161. package/lib/module/network/utils/filterNetworkEvents.js +1 -92
  162. package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
  163. package/lib/module/network/utils/formatting.js +1 -9
  164. package/lib/module/network/utils/generateCurl.js +2 -67
  165. package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
  166. package/lib/module/network/utils/httpCompletion.js +1 -32
  167. package/lib/module/network/utils/networkEventStore.js +1 -409
  168. package/lib/module/network/utils/networkListener.js +4 -1341
  169. package/lib/module/network/utils/networkSavedStore.js +3 -572
  170. package/lib/module/network/utils/networkSelectionStore.js +1 -188
  171. package/lib/module/network/utils/realNow.js +1 -0
  172. package/lib/module/network/utils/requestId.js +1 -12
  173. package/lib/module/network/utils/resolveRequestUrl.js +1 -11
  174. package/lib/module/network/utils/selectSavedEvents.js +1 -35
  175. package/lib/module/network/utils/startNetworkCapture.js +1 -21
  176. package/lib/module/network/utils/withPinnedFirst.js +1 -28
  177. package/lib/module/preset.js +1 -91
  178. package/lib/typescript/network/overrides/engine.d.ts +1 -1
  179. package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
  180. package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
  181. package/lib/typescript/network/overrides/types.d.ts +9 -0
  182. package/lib/typescript/network/utils/networkListener.d.ts +11 -0
  183. package/lib/typescript/network/utils/realNow.d.ts +18 -0
  184. package/lib/web/index.mjs +73 -74
  185. package/package.json +2 -2
  186. package/lib/typescript/index.d.ts.map +0 -1
  187. package/lib/typescript/index.web.d.ts.map +0 -1
  188. package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
  189. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
  190. package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
  191. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
  192. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
  193. package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
  194. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
  195. package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
  196. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
  197. package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
  198. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
  199. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
  200. package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
  201. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
  202. package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
  203. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
  204. package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
  205. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
  206. package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
  207. package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
  208. package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
  209. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
  210. package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
  211. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
  212. package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
  213. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
  214. package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
  215. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
  216. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
  217. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
  218. package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
  219. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
  220. package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
  221. package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
  222. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
  223. package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
  224. package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
  225. package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
  226. package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
  227. package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
  228. package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
  229. package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
  230. package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
  231. package/lib/typescript/network/conditions/store.d.ts.map +0 -1
  232. package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
  233. package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
  234. package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
  235. package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
  236. package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
  237. package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
  238. package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
  239. package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
  240. package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
  241. package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
  242. package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
  243. package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
  244. package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
  245. package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
  246. package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
  247. package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
  248. package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
  249. package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
  250. package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
  251. package/lib/typescript/network/overrides/types.d.ts.map +0 -1
  252. package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
  253. package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
  254. package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
  255. package/lib/typescript/network/types/index.d.ts.map +0 -1
  256. package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
  257. package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
  258. package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
  259. package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
  260. package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
  261. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
  262. package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
  263. package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
  264. package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
  265. package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
  266. package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
  267. package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
  268. package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
  269. package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
  270. package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
  271. package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
  272. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,1136 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = Explorer;
7
- var _react = require("react");
8
- var _DataViewer = require("../DataViewer.web");
9
- var _updateNestedDataByPath = require("./updateNestedDataByPath");
10
- var _deleteNestedDataByPath = require("./deleteNestedDataByPath");
11
- var _editorContext = require("./editorContext");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- /**
14
- * Explorer.web — DOM twin of response-editor/Explorer.tsx (the response-body
15
- * tree: preview and editor as ONE surface, ported from the React Query tool's
16
- * Explorer). Same recursion, same chunked pages (CHUNK_SIZE 100), same
17
- * local-input-state race guard, and the same landing spot for edits: the
18
- * `onChange` from `ResponseEditorContext`.
19
- *
20
- * REUSED, not forked (all platform-free):
21
- * - `updateNestedDataByPath` / `deleteNestedDataByPath` — the pure tree ops.
22
- * - `editorContext` (`ResponseEditorContext` / `useResponseEditor`) — the
23
- * root-document + onChange seam.
24
- * - `CopyButton` — the DOM twin already ported in DataViewer.web (F3), the
25
- * same way native Explorer reuses shared-ui's CopyButton.
26
- *
27
- * NOTE on DataViewer.web: native Explorer and native VirtualizedDataExplorer
28
- * are SEPARATE trees (different lineage — this one is the React Query port,
29
- * the viewer is the flat-row virtualized explorer) sharing only the copy
30
- * button and `displayValue`. The web twins mirror that exact relationship:
31
- * this file recurses like native Explorer, and shares DataViewer.web's
32
- * CopyButton rather than its flatten pipeline.
33
- *
34
- * shared-ui RN chrome is replicated as DOM with provenance (web consumers
35
- * resolve `@buoy-gg/shared-ui` to a minimal shim):
36
- * - `buoyColors` — inlined verbatim subset from
37
- * shared/src/ui/gameUI/constants/gameUIColors.ts.
38
- * - Icons — inline lucide SVGs (shared-ui's icons are lucide re-exports).
39
- * - `CyberpunkInput` — inlined DOM twin below, values from
40
- * shared/src/dataViewer/CyberpunkInput.tsx.
41
- *
42
- * Intentional deviations (all logged):
43
- * - CyberpunkInput's RN `Animated` glitch loops (flicker overlay, x/y jitter,
44
- * scale pulse) are not ported — focus still swaps the border/label/corner
45
- * accents to the primary color, which is the state the animation decorates.
46
- * - `displayValue`'s minimal-SuperJSON serialization → JSON.stringify (same
47
- * deviation DataViewer.web logs; identical output for JSON payloads).
48
- * - `hitSlop` has no DOM equivalent — buttons keep their natural hit areas.
49
- *
50
- * @platform React DOM Web
51
- */
52
-
53
- // Stable constants to prevent re-renders — native Explorer, verbatim.
54
- const CHUNK_SIZE = 100;
55
- const EXPANDER_SIZE = 12;
56
-
57
- // =============================
58
- // Native palette (provenance)
59
- // =============================
60
-
61
- /** buoyColors subset — shared/src/ui/gameUI/constants/gameUIColors.ts, verbatim. */
62
- const buoyColors = {
63
- card: "#1A1A1A",
64
- text: "#E0E0E0",
65
- textSecondary: "#A0A0A0",
66
- textMuted: "#888888",
67
- primary: "#20C997",
68
- warning: "#FFA94D",
69
- error: "#EF4444"
70
- };
71
-
72
- // =============================
73
- // Inline lucide icons (shared-ui icons are lucide re-exports)
74
- // =============================
75
-
76
- function Svg({
77
- size = 14,
78
- color = "currentColor",
79
- strokeWidth = 2,
80
- children
81
- }) {
82
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
83
- width: size,
84
- height: size,
85
- viewBox: "0 0 24 24",
86
- fill: "none",
87
- stroke: color,
88
- strokeWidth: strokeWidth,
89
- strokeLinecap: "round",
90
- strokeLinejoin: "round",
91
- style: {
92
- flexShrink: 0,
93
- display: "block"
94
- },
95
- children: children
96
- });
97
- }
98
- const ChevronRight = p => /*#__PURE__*/(0, _jsxRuntime.jsx)(Svg, {
99
- ...p,
100
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
101
- d: "m9 18 6-6-6-6"
102
- })
103
- });
104
- const ChevronDown = p => /*#__PURE__*/(0, _jsxRuntime.jsx)(Svg, {
105
- ...p,
106
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
107
- d: "m6 9 6 6 6-6"
108
- })
109
- });
110
- const ChevronUp = p => /*#__PURE__*/(0, _jsxRuntime.jsx)(Svg, {
111
- ...p,
112
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
113
- d: "m18 15-6-6-6 6"
114
- })
115
- });
116
- const Trash = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
117
- ...p,
118
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
119
- d: "M3 6h18"
120
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
121
- d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"
122
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
123
- d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
124
- })]
125
- });
126
-
127
- /** displayValue twin — JSON.stringify-based, see the deviations log. */
128
- function displayValue(value) {
129
- if (value === undefined) return "undefined";
130
- if (typeof value === "bigint") return `${value}n`;
131
- if (typeof value === "function") return String(value).slice(0, 50);
132
- if (typeof value === "symbol") return String(value);
133
- try {
134
- return JSON.stringify(value) ?? String(value);
135
- } catch {
136
- return String(value);
137
- }
138
- }
139
-
140
- // Optimized chunking function moved to module scope — native, verbatim.
141
- const chunkArray = (array, size = CHUNK_SIZE) => {
142
- if (size < 1 || array.length === 0) return [];
143
- const result = [];
144
- for (let i = 0; i < array.length; i += size) {
145
- result.push(array.slice(i, i + size));
146
- }
147
- return result;
148
- };
149
-
150
- // Memoized Expander component — native styles.expanderIcon(+Main).
151
- const Expander = /*#__PURE__*/(0, _react.memo)(({
152
- expanded,
153
- isFocused = false,
154
- isMain = false
155
- }) => {
156
- const color = isFocused ? buoyColors.primary : isMain ? buoyColors.text : buoyColors.textSecondary;
157
- const Chevron = expanded ? ChevronDown : ChevronRight;
158
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
159
- style: {
160
- ...styles.expanderIcon,
161
- ...(isMain ? styles.expanderIconMain : null)
162
- },
163
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
164
- size: isMain ? 14 : EXPANDER_SIZE,
165
- color: color,
166
- strokeWidth: 2.5
167
- })
168
- });
169
- });
170
- Expander.displayName = "Expander";
171
-
172
- // Local wrapper for the shared CopyButton — same backward-compat shim as
173
- // native (28×28 card-fill box; focused = primary ring + tint).
174
- const CopyButton = /*#__PURE__*/(0, _react.memo)(({
175
- value,
176
- isFocused = false
177
- }) => {
178
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DataViewer.CopyButton, {
179
- value: value,
180
- size: 14,
181
- buttonStyle: isFocused ? {
182
- ...styles.buttonStyle,
183
- ...styles.buttonStyleFocused
184
- } : styles.buttonStyle
185
- });
186
- });
187
- CopyButton.displayName = "CopyButton";
188
-
189
- // Memoized DeleteItemButton component — native, verbatim behavior.
190
- const DeleteItemButton = /*#__PURE__*/(0, _react.memo)(({
191
- dataPath,
192
- isFocused = false
193
- }) => {
194
- const editor = (0, _editorContext.useResponseEditor)();
195
- const handleDelete = (0, _react.useCallback)(() => {
196
- if (!editor) return;
197
- editor.onChange((0, _deleteNestedDataByPath.deleteNestedDataByPath)(editor.root, dataPath));
198
- }, [editor, dataPath]);
199
- if (!editor) return null;
200
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
201
- type: "button",
202
- onClick: handleDelete,
203
- style: {
204
- ...styles.deleteButton,
205
- ...(isFocused ? styles.deleteButtonFocused : null)
206
- },
207
- "aria-label": "Delete item",
208
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Trash, {
209
- size: 14,
210
- strokeWidth: 2,
211
- color: isFocused ? buoyColors.error : buoyColors.error + "CC"
212
- })
213
- });
214
- });
215
- DeleteItemButton.displayName = "DeleteItemButton";
216
-
217
- // Memoized ClearArrayButton component — native, verbatim behavior.
218
- const ClearArrayButton = /*#__PURE__*/(0, _react.memo)(({
219
- dataPath,
220
- isFocused = false
221
- }) => {
222
- const editor = (0, _editorContext.useResponseEditor)();
223
- const handleClear = (0, _react.useCallback)(() => {
224
- if (!editor) return;
225
- editor.onChange((0, _updateNestedDataByPath.updateNestedDataByPath)(editor.root, dataPath, []));
226
- }, [editor, dataPath]);
227
- if (!editor) return null;
228
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
229
- type: "button",
230
- style: {
231
- ...styles.clearButton,
232
- ...(isFocused ? styles.clearButtonFocused : null)
233
- },
234
- "aria-label": "Remove all items",
235
- onClick: handleClear,
236
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
237
- style: {
238
- ...styles.clearButtonText,
239
- color: isFocused ? buoyColors.warning : buoyColors.warning + "CC"
240
- },
241
- children: "[]"
242
- })
243
- });
244
- });
245
- ClearArrayButton.displayName = "ClearArrayButton";
246
-
247
- // ToggleValueButton — not memoized (same reasoning as native: the parent
248
- // passes a fresh dataPath array each render, which defeats memo anyway).
249
- function ToggleValueButton({
250
- dataPath,
251
- value,
252
- itemsDeletable
253
- }) {
254
- const editor = (0, _editorContext.useResponseEditor)();
255
- const handleClick = (0, _react.useCallback)(() => {
256
- if (!editor) return;
257
- const currentValue = typeof value === "boolean" ? value : false;
258
- editor.onChange((0, _updateNestedDataByPath.updateNestedDataByPath)(editor.root, dataPath, !currentValue));
259
- }, [editor, dataPath, value]);
260
- const handleDelete = (0, _react.useCallback)(() => {
261
- if (!editor) return;
262
- editor.onChange((0, _deleteNestedDataByPath.deleteNestedDataByPath)(editor.root, dataPath));
263
- }, [editor, dataPath]);
264
- if (!editor) return null;
265
-
266
- // Pre-compute styles based on value state — native, verbatim.
267
- const badgeStyle = value ? styles.toggleBadgeTrue : styles.toggleBadgeFalse;
268
- const textStyle = value ? styles.toggleTextTrue : styles.toggleTextFalse;
269
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
270
- role: "button",
271
- tabIndex: 0,
272
- style: styles.modernToggleButton,
273
- onClick: handleClick,
274
- onKeyDown: e => {
275
- if (e.key === "Enter" || e.key === " ") handleClick();
276
- },
277
- "aria-label": value ? "Set to false" : "Set to true",
278
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
279
- style: {
280
- ...styles.toggleBadge,
281
- ...badgeStyle
282
- },
283
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
284
- style: {
285
- ...styles.toggleBadgeText,
286
- ...textStyle
287
- },
288
- children: value ? "TRUE" : "FALSE"
289
- })
290
- }), itemsDeletable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
291
- type: "button",
292
- onClick: e => {
293
- // The delete button nests inside the toggle's press target on
294
- // native too; stop the toggle from also firing.
295
- e.stopPropagation();
296
- handleDelete();
297
- },
298
- style: styles.deleteButtonInToggle,
299
- "aria-label": "Delete item",
300
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Trash, {
301
- size: 14,
302
- strokeWidth: 2,
303
- color: buoyColors.error + "CC"
304
- })
305
- })]
306
- });
307
- }
308
-
309
- // =============================
310
- // CyberpunkInput twin (shared/src/dataViewer/CyberpunkInput.tsx)
311
- // =============================
312
-
313
- /**
314
- * The inline value input: uppercase mono label, bordered field, optional
315
- * number steppers and delete button, corner accents. Focus swaps everything to
316
- * the primary color — the RN glitch animation is not ported (see the
317
- * deviations log).
318
- */
319
- function CyberpunkInputWeb({
320
- label,
321
- value,
322
- isNumber,
323
- onChangeText,
324
- onFocus,
325
- onBlur,
326
- showNumberControls = false,
327
- onIncrement,
328
- onDecrement,
329
- showDeleteButton = false,
330
- onDelete,
331
- "aria-label": ariaLabel
332
- }) {
333
- const [isFocused, setIsFocused] = (0, _react.useState)(false);
334
- const cornerStyle = corner => ({
335
- ...styles.cornerAccent,
336
- ...corner,
337
- ...(isFocused ? styles.cornerAccentFocused : null)
338
- });
339
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
340
- style: styles.cyberContainer,
341
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
342
- style: styles.cyberRow,
343
- children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
344
- style: {
345
- ...styles.cyberLabel,
346
- ...(isFocused ? styles.cyberLabelFocused : null)
347
- },
348
- children: label.toUpperCase()
349
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
350
- style: {
351
- ...styles.cyberInputContainer,
352
- opacity: isFocused ? 1 : 0.6,
353
- borderColor: isFocused ? buoyColors.primary : buoyColors.textMuted + "4D"
354
- },
355
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
356
- value: value,
357
- onChange: e => onChangeText(e.target.value),
358
- onFocus: () => {
359
- setIsFocused(true);
360
- onFocus?.();
361
- },
362
- onBlur: () => {
363
- setIsFocused(false);
364
- onBlur?.();
365
- },
366
- inputMode: isNumber ? "decimal" : undefined,
367
- autoComplete: "off",
368
- autoCorrect: "off",
369
- autoCapitalize: "none",
370
- spellCheck: false,
371
- "aria-label": ariaLabel ?? "Data input field for editing values",
372
- style: {
373
- ...styles.cyberInput,
374
- ...(isNumber ? styles.textNumber : styles.textString)
375
- }
376
- }), showNumberControls && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
377
- style: styles.numberControls,
378
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
379
- type: "button",
380
- style: {
381
- ...styles.controlButton,
382
- ...(isFocused ? styles.controlButtonFocused : null)
383
- },
384
- onClick: onIncrement,
385
- "aria-label": "Increment value",
386
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ChevronUp, {
387
- size: 14,
388
- strokeWidth: 2.5,
389
- color: isFocused ? buoyColors.primary : buoyColors.textMuted
390
- })
391
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
392
- type: "button",
393
- style: {
394
- ...styles.controlButton,
395
- ...(isFocused ? styles.controlButtonFocused : null)
396
- },
397
- onClick: onDecrement,
398
- "aria-label": "Decrement value",
399
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ChevronDown, {
400
- size: 14,
401
- strokeWidth: 2.5,
402
- color: isFocused ? buoyColors.primary : buoyColors.textMuted
403
- })
404
- })]
405
- }), showDeleteButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
406
- type: "button",
407
- style: {
408
- ...styles.cyberDeleteButton,
409
- ...(isFocused ? styles.cyberDeleteButtonFocused : null)
410
- },
411
- onClick: onDelete,
412
- "aria-label": "Delete item",
413
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Trash, {
414
- size: 14,
415
- strokeWidth: 2,
416
- color: isFocused ? buoyColors.error : buoyColors.error + "CC"
417
- })
418
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
419
- style: cornerStyle({
420
- top: -1,
421
- left: 5
422
- })
423
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
424
- style: cornerStyle({
425
- top: -1,
426
- right: 5
427
- })
428
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
429
- style: cornerStyle({
430
- bottom: -1,
431
- left: 5
432
- })
433
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
434
- style: cornerStyle({
435
- bottom: -1,
436
- right: 5
437
- })
438
- })]
439
- })]
440
- })
441
- });
442
- }
443
- /**
444
- * Recursive data explorer — the editable JSON tree. Same prop contract,
445
- * derivation order and edit semantics as the native file.
446
- */
447
- function Explorer({
448
- editable,
449
- label,
450
- value,
451
- defaultExpanded,
452
- dataPath,
453
- itemsDeletable,
454
- dataVersion = 0
455
- }) {
456
- const editor = (0, _editorContext.useResponseEditor)();
457
- const [isRowFocused, setIsRowFocused] = (0, _react.useState)(false);
458
-
459
- // Local state for input value to handle typing properly
460
- const [localInputValue, setLocalInputValue] = (0, _react.useState)("");
461
-
462
- // Sync local state with prop value
463
- // ⚠️ CRITICAL: Do NOT add localInputValue to the dependency array!
464
- // Adding localInputValue causes a race condition where user edits get
465
- // reverted (type "5101" → store updates → effect fires while the prop is
466
- // still 5100 → syncs back to 5100). Only sync when EXTERNAL changes happen
467
- // (value, label, dataVersion) — carried over from native unchanged.
468
- (0, _react.useEffect)(() => {
469
- if (value !== null && value !== undefined && (typeof value === "string" || typeof value === "number")) {
470
- const newValue = value.toString();
471
- setLocalInputValue(newValue);
472
- }
473
- }, [value, label, dataVersion]); // ⚠️ DO NOT add localInputValue here!
474
-
475
- // Determine if this is a main section — native, verbatim.
476
- const isMainSection = (0, _react.useMemo)(() => {
477
- const upperLabel = label.toUpperCase();
478
- return ["DATA", "QUERY", "QUERYKEY", "TYPES", "STATS", "OPTIONS", "OBSERVERS"].includes(upperLabel);
479
- }, [label]);
480
-
481
- // Explorer's section is expanded or collapsed
482
- const [isExpanded, setIsExpanded] = (0, _react.useState)((defaultExpanded || []).includes(label));
483
- const toggleExpanded = () => setIsExpanded(old => !old);
484
- const [expandedPages, setExpandedPages] = (0, _react.useState)([]);
485
-
486
- // Optimized subEntries computation — native, verbatim (1000-entry cap).
487
- const subEntries = (0, _react.useMemo)(() => {
488
- if (value === null || value === undefined || typeof value !== "object") {
489
- return [];
490
- }
491
- if (Array.isArray(value)) {
492
- const limitedValue = value.length > 1000 ? value.slice(0, 1000) : value;
493
- return limitedValue.map((d, i) => ({
494
- label: i.toString(),
495
- value: d
496
- }));
497
- }
498
- if (value instanceof Map) {
499
- const entries = Array.from(value.entries()).slice(0, 1000);
500
- return entries.map(([key, val]) => ({
501
- label: String(key),
502
- value: val
503
- }));
504
- }
505
- if (value instanceof Set) {
506
- const entries = Array.from(value).slice(0, 1000);
507
- return entries.map((val, i) => ({
508
- label: i.toString(),
509
- value: val
510
- }));
511
- }
512
- const entries = Object.entries(value).slice(0, 1000);
513
- return entries.map(([key, val]) => ({
514
- label: key,
515
- value: val
516
- }));
517
- }, [value]);
518
-
519
- // Optimized valueType computation — native, verbatim.
520
- const valueType = (0, _react.useMemo)(() => {
521
- if (Array.isArray(value)) return "array";
522
- if (value === null || typeof value !== "object") return typeof value;
523
- if (value instanceof Map || value instanceof Set) return "Iterable";
524
- return "object";
525
- }, [value]);
526
- const subEntryPages = (0, _react.useMemo)(() => {
527
- return chunkArray(subEntries, CHUNK_SIZE);
528
- }, [subEntries]);
529
- const currentDataPath = dataPath ?? [];
530
-
531
- // Optimize handleChange using refs to avoid dependency arrays — native.
532
- const editorRef = (0, _react.useRef)(editor);
533
- const dataPathRef = (0, _react.useRef)(currentDataPath);
534
- const valueTypeRef = (0, _react.useRef)(valueType);
535
- editorRef.current = editor;
536
- dataPathRef.current = currentDataPath;
537
- valueTypeRef.current = valueType;
538
- const handleChange = (0, _react.useCallback)((isNumber, newValue) => {
539
- // Update local state immediately for responsive typing
540
- setLocalInputValue(newValue);
541
- const current = editorRef.current;
542
- if (!current) return;
543
- if (isNumber && isNaN(Number(newValue))) return;
544
- const updatedValue = valueTypeRef.current === "number" ? Number(newValue) : newValue;
545
- current.onChange((0, _updateNestedDataByPath.updateNestedDataByPath)(current.root, dataPathRef.current, updatedValue));
546
- }, [setLocalInputValue]);
547
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
548
- style: styles.minWidthWrapper,
549
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
550
- style: styles.fullWidthMarginRight,
551
- children: [subEntryPages.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
552
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
553
- style: {
554
- ...styles.flexRowItemsCenterGap,
555
- ...(isMainSection ? styles.flexRowItemsCenterGapMain : null)
556
- },
557
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
558
- type: "button",
559
- style: styles.expanderButton,
560
- onClick: toggleExpanded,
561
- "aria-expanded": isExpanded,
562
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Expander, {
563
- expanded: isExpanded,
564
- isFocused: isRowFocused,
565
- isMain: isMainSection
566
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
567
- style: {
568
- ...styles.labelText,
569
- ...(isRowFocused ? styles.labelTextFocused : null),
570
- ...(isMainSection ? styles.labelTextMain : null)
571
- },
572
- children: label
573
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
574
- style: styles.textGray500,
575
- children: `${String(valueType).toLowerCase() === "iterable" ? "(Iterable) " : ""}${subEntries.length} ${subEntries.length > 1 ? `items` : `item`}`
576
- })]
577
- }), editable && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
578
- style: styles.flexRowGapItemsCenter,
579
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
580
- value: value,
581
- isFocused: isRowFocused
582
- }), itemsDeletable && editor !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(DeleteItemButton, {
583
- dataPath: currentDataPath,
584
- isFocused: isRowFocused
585
- }), valueType === "array" && editor !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(ClearArrayButton, {
586
- dataPath: currentDataPath,
587
- isFocused: isRowFocused
588
- })]
589
- })]
590
- }), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
591
- children: [subEntryPages.length === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
592
- style: {
593
- ...styles.singleEntryContainer,
594
- ...(isMainSection ? styles.singleEntryContainerMain : null)
595
- },
596
- children: subEntries.map((entry, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Explorer, {
597
- defaultExpanded: defaultExpanded,
598
- label: entry.label,
599
- value: entry.value,
600
- editable: editable,
601
- dataPath: [...currentDataPath, entry.label],
602
- itemsDeletable: valueType === "array" || valueType === "Iterable" || valueType === "object",
603
- dataVersion: dataVersion
604
- }, entry.label + index))
605
- }), subEntryPages.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
606
- style: styles.multiEntryContainer,
607
- children: subEntryPages.map((entries, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
608
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
609
- style: styles.relativeOutlineNone,
610
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
611
- type: "button",
612
- onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index]),
613
- style: styles.pageExpanderButton,
614
- "aria-expanded": expandedPages.includes(index),
615
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Expander, {
616
- expanded: expandedPages.includes(index)
617
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
618
- style: styles.pageRangeText,
619
- children: ["[", index * CHUNK_SIZE, "...", index * CHUNK_SIZE + CHUNK_SIZE - 1, "]"]
620
- })]
621
- }), expandedPages.includes(index) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
622
- style: styles.entriesContainer,
623
- children: entries.map(entry => /*#__PURE__*/(0, _jsxRuntime.jsx)(Explorer, {
624
- defaultExpanded: defaultExpanded,
625
- label: entry.label,
626
- value: entry.value,
627
- editable: editable,
628
- dataPath: [...currentDataPath, entry.label],
629
- dataVersion: dataVersion
630
- }, entry.label))
631
- })]
632
- })
633
- }, index))
634
- })]
635
- })]
636
- }), subEntryPages.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
637
- style: styles.flexRowGapFullWidth,
638
- children: [editable && editor !== null && (valueType === "string" || valueType === "number" || valueType === "boolean") ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
639
- children: [editable && editor && (valueType === "string" || valueType === "number") && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
640
- style: styles.nebulaInputWrapper,
641
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CyberpunkInputWeb, {
642
- label: label,
643
- value: localInputValue,
644
- isNumber: valueType === "number",
645
- onChangeText: newValue => handleChange(valueType === "number", newValue),
646
- onFocus: () => setIsRowFocused(true),
647
- onBlur: () => setIsRowFocused(false),
648
- showNumberControls: valueType === "number",
649
- onIncrement: () => {
650
- const currentNum = Number(localInputValue) || 0;
651
- handleChange(true, String(currentNum + 1));
652
- },
653
- onDecrement: () => {
654
- const currentNum = Number(localInputValue) || 0;
655
- handleChange(true, String(currentNum - 1));
656
- },
657
- showDeleteButton: itemsDeletable,
658
- onDelete: () => {
659
- editor.onChange((0, _deleteNestedDataByPath.deleteNestedDataByPath)(editor.root, currentDataPath));
660
- }
661
- })
662
- }), valueType === "boolean" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
663
- style: styles.booleanRowContainer,
664
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
665
- style: styles.booleanLabel,
666
- children: label
667
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
668
- style: styles.booleanToggleWrapper,
669
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ToggleValueButton, {
670
- dataPath: currentDataPath,
671
- value: value,
672
- itemsDeletable: itemsDeletable
673
- })
674
- })]
675
- })]
676
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
677
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
678
- style: styles.text344054,
679
- children: label
680
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
681
- style: styles.displayValueText,
682
- children: displayValue(value)
683
- })]
684
- }), editable && itemsDeletable && editor !== null && valueType !== "string" && valueType !== "number" && valueType !== "boolean" && /*#__PURE__*/(0, _jsxRuntime.jsx)(DeleteItemButton, {
685
- dataPath: currentDataPath,
686
- isFocused: isRowFocused
687
- })]
688
- })]
689
- })
690
- });
691
- }
692
-
693
- // Values mirror the native StyleSheet blocks 1:1 (Explorer.tsx +
694
- // CyberpunkInput.tsx).
695
- const styles = {
696
- buttonStyle: {
697
- backgroundColor: buoyColors.card + "E6",
698
- border: `1px solid ${buoyColors.textSecondary}33`,
699
- borderRadius: 6,
700
- display: "inline-flex",
701
- flexDirection: "row",
702
- alignItems: "center",
703
- justifyContent: "center",
704
- width: 28,
705
- height: 28,
706
- boxSizing: "border-box",
707
- position: "relative",
708
- padding: 0
709
- },
710
- buttonStyleFocused: {
711
- border: `1px solid ${buoyColors.primary}CC`,
712
- backgroundColor: buoyColors.primary + "26"
713
- },
714
- deleteButton: {
715
- backgroundColor: buoyColors.error + "1A",
716
- border: `1px solid ${buoyColors.error}4D`,
717
- borderRadius: 6,
718
- padding: 0,
719
- display: "inline-flex",
720
- alignItems: "center",
721
- justifyContent: "center",
722
- width: 28,
723
- height: 28,
724
- boxSizing: "border-box",
725
- position: "relative",
726
- cursor: "pointer",
727
- margin: 0,
728
- flexShrink: 0
729
- },
730
- deleteButtonFocused: {
731
- border: `1px solid ${buoyColors.error}CC`,
732
- backgroundColor: buoyColors.error + "33"
733
- },
734
- deleteButtonInToggle: {
735
- backgroundColor: buoyColors.error + "1A",
736
- border: `1px solid ${buoyColors.error}4D`,
737
- borderRadius: 6,
738
- padding: 0,
739
- display: "inline-flex",
740
- alignItems: "center",
741
- justifyContent: "center",
742
- width: 28,
743
- height: 28,
744
- boxSizing: "border-box",
745
- cursor: "pointer",
746
- margin: 0
747
- },
748
- clearButton: {
749
- backgroundColor: buoyColors.warning + "1A",
750
- border: `1px solid ${buoyColors.warning}4D`,
751
- borderRadius: 6,
752
- display: "inline-flex",
753
- flexDirection: "row",
754
- padding: 0,
755
- alignItems: "center",
756
- justifyContent: "center",
757
- width: 28,
758
- height: 28,
759
- boxSizing: "border-box",
760
- position: "relative",
761
- zIndex: 10,
762
- cursor: "pointer",
763
- margin: 0,
764
- flexShrink: 0
765
- },
766
- clearButtonFocused: {
767
- border: `1px solid ${buoyColors.warning}CC`,
768
- backgroundColor: buoyColors.warning + "33"
769
- },
770
- clearButtonText: {
771
- fontSize: 12,
772
- fontWeight: 700,
773
- fontFamily: "ui-monospace, Menlo, monospace"
774
- },
775
- expanderIcon: {
776
- width: 18,
777
- height: 18,
778
- display: "inline-flex",
779
- alignItems: "center",
780
- justifyContent: "center",
781
- marginRight: 1,
782
- backgroundColor: buoyColors.textSecondary + "14",
783
- borderRadius: 3,
784
- boxSizing: "border-box",
785
- flexShrink: 0
786
- },
787
- expanderIconMain: {
788
- backgroundColor: buoyColors.textSecondary + "1A",
789
- width: 20,
790
- height: 20,
791
- borderRadius: 4,
792
- border: `0.5px solid ${buoyColors.textSecondary}33`
793
- },
794
- minWidthWrapper: {
795
- minWidth: 180,
796
- fontSize: 11,
797
- display: "flex",
798
- flexDirection: "row",
799
- flexWrap: "wrap",
800
- width: "100%",
801
- margin: "0.5px 0"
802
- },
803
- fullWidthMarginRight: {
804
- position: "relative",
805
- width: "100%",
806
- marginRight: 1
807
- },
808
- flexRowItemsCenterGap: {
809
- display: "flex",
810
- flexDirection: "row",
811
- alignItems: "center",
812
- justifyContent: "space-between",
813
- padding: "3px 6px",
814
- margin: "1px 0",
815
- borderRadius: 4,
816
- backgroundColor: buoyColors.card + "66",
817
- border: `0.5px solid ${buoyColors.textSecondary}1A`,
818
- boxSizing: "border-box"
819
- },
820
- flexRowItemsCenterGapMain: {
821
- backgroundColor: buoyColors.card + "E6",
822
- border: `1px solid ${buoyColors.textSecondary}26`,
823
- borderLeft: `2.5px solid ${buoyColors.textSecondary}80`,
824
- padding: "5px 8px",
825
- marginBottom: 3
826
- },
827
- expanderButton: {
828
- display: "flex",
829
- flexDirection: "row",
830
- alignItems: "center",
831
- backgroundColor: "transparent",
832
- padding: "1px 2px",
833
- gap: 6,
834
- border: "none",
835
- minHeight: 24,
836
- flex: 1,
837
- minWidth: 0,
838
- cursor: "pointer",
839
- margin: 0,
840
- textAlign: "left",
841
- font: "inherit"
842
- },
843
- labelText: {
844
- color: buoyColors.textSecondary,
845
- fontSize: 10,
846
- fontWeight: 600,
847
- marginRight: 4,
848
- fontFamily: "ui-monospace, Menlo, monospace",
849
- letterSpacing: 0.4
850
- },
851
- labelTextFocused: {
852
- color: buoyColors.text
853
- },
854
- labelTextMain: {
855
- color: buoyColors.text,
856
- fontSize: 11,
857
- fontWeight: 700,
858
- letterSpacing: 0.6
859
- },
860
- textGray500: {
861
- color: buoyColors.textMuted,
862
- fontSize: 10,
863
- fontWeight: 400,
864
- fontFamily: "ui-monospace, Menlo, monospace",
865
- opacity: 0.7
866
- },
867
- pageRangeText: {
868
- color: buoyColors.textSecondary,
869
- fontSize: 10,
870
- fontWeight: 600,
871
- fontFamily: "ui-monospace, Menlo, monospace"
872
- },
873
- flexRowGapItemsCenter: {
874
- display: "flex",
875
- flexDirection: "row",
876
- alignItems: "center",
877
- gap: 4,
878
- paddingLeft: 2
879
- },
880
- singleEntryContainer: {
881
- marginLeft: 2,
882
- marginTop: 2,
883
- paddingLeft: 8,
884
- borderLeft: `1.5px solid ${buoyColors.textSecondary}40`
885
- },
886
- singleEntryContainerMain: {
887
- borderLeft: `1.5px solid ${buoyColors.textSecondary}4D`,
888
- marginLeft: 4,
889
- paddingLeft: 10
890
- },
891
- multiEntryContainer: {
892
- marginLeft: 2,
893
- marginTop: 2,
894
- paddingLeft: 8,
895
- borderLeft: `1.5px solid ${buoyColors.textSecondary}40`
896
- },
897
- relativeOutlineNone: {
898
- position: "relative"
899
- },
900
- pageExpanderButton: {
901
- display: "flex",
902
- flexDirection: "row",
903
- alignItems: "center",
904
- backgroundColor: buoyColors.card + "66",
905
- padding: "3px 6px",
906
- gap: 6,
907
- borderRadius: 4,
908
- border: `0.5px solid ${buoyColors.textSecondary}1A`,
909
- marginBottom: 2,
910
- minHeight: 24,
911
- cursor: "pointer",
912
- margin: "0 0 2px 0",
913
- width: "100%",
914
- boxSizing: "border-box",
915
- textAlign: "left",
916
- font: "inherit"
917
- },
918
- entriesContainer: {
919
- marginLeft: 2,
920
- paddingLeft: 8,
921
- marginTop: 2,
922
- borderLeft: `1.5px solid ${buoyColors.textSecondary}40`
923
- },
924
- textNumber: {
925
- color: buoyColors.text,
926
- fontWeight: 600,
927
- fontFamily: "ui-monospace, Menlo, monospace"
928
- },
929
- textString: {
930
- color: buoyColors.text,
931
- fontFamily: "ui-monospace, Menlo, monospace"
932
- },
933
- flexRowGapFullWidth: {
934
- display: "flex",
935
- flexDirection: "row",
936
- width: "100%",
937
- alignItems: "center",
938
- margin: "1px 0",
939
- gap: 6,
940
- padding: "2px 4px",
941
- borderRadius: 3,
942
- boxSizing: "border-box"
943
- },
944
- text344054: {
945
- color: buoyColors.textSecondary,
946
- fontWeight: 600,
947
- fontSize: 9,
948
- minWidth: 50,
949
- fontFamily: "ui-monospace, Menlo, monospace",
950
- letterSpacing: 0.4,
951
- opacity: 0.8,
952
- flexShrink: 0
953
- },
954
- nebulaInputWrapper: {
955
- flex: 1,
956
- width: "100%",
957
- position: "relative",
958
- minWidth: 0
959
- },
960
- displayValueText: {
961
- flex: 1,
962
- minWidth: 0,
963
- color: buoyColors.text,
964
- fontWeight: 400,
965
- fontFamily: "ui-monospace, Menlo, monospace",
966
- fontSize: 12,
967
- padding: "6px 10px",
968
- borderRadius: 6,
969
- border: `1px solid ${buoyColors.textMuted}66`,
970
- minHeight: 34,
971
- boxSizing: "border-box",
972
- overflowWrap: "anywhere"
973
- },
974
- modernToggleButton: {
975
- display: "flex",
976
- flexDirection: "row",
977
- alignItems: "center",
978
- justifyContent: "space-between",
979
- borderRadius: 6,
980
- border: `1px solid ${buoyColors.textMuted}99`,
981
- padding: "6px 8px",
982
- margin: "2px 0",
983
- minHeight: 34,
984
- gap: 8,
985
- boxSizing: "border-box",
986
- cursor: "pointer"
987
- },
988
- toggleBadge: {
989
- marginLeft: 6,
990
- padding: "3px 6px",
991
- borderRadius: 4,
992
- display: "inline-flex"
993
- },
994
- toggleBadgeText: {
995
- fontSize: 9,
996
- fontWeight: 700,
997
- textTransform: "uppercase",
998
- letterSpacing: 0.8,
999
- fontFamily: "ui-monospace, Menlo, monospace"
1000
- },
1001
- toggleBadgeTrue: {
1002
- backgroundColor: buoyColors.primary + "1A",
1003
- border: `1px solid ${buoyColors.primary}4D`
1004
- },
1005
- toggleBadgeFalse: {
1006
- backgroundColor: buoyColors.textMuted + "1A",
1007
- border: `1px solid ${buoyColors.textMuted}4D`
1008
- },
1009
- toggleTextTrue: {
1010
- color: buoyColors.primary,
1011
- fontWeight: 600
1012
- },
1013
- toggleTextFalse: {
1014
- color: buoyColors.textSecondary,
1015
- fontWeight: 500
1016
- },
1017
- booleanRowContainer: {
1018
- display: "flex",
1019
- flexDirection: "row",
1020
- alignItems: "center",
1021
- width: "100%",
1022
- gap: 8,
1023
- padding: "2px 0"
1024
- },
1025
- booleanLabel: {
1026
- color: buoyColors.textSecondary,
1027
- fontSize: 10,
1028
- fontWeight: 600,
1029
- fontFamily: "ui-monospace, Menlo, monospace",
1030
- letterSpacing: 0.4,
1031
- minWidth: 60,
1032
- flexShrink: 0
1033
- },
1034
- booleanToggleWrapper: {
1035
- flex: 1,
1036
- minWidth: 0
1037
- },
1038
- // CyberpunkInput.tsx styles, verbatim.
1039
- cyberContainer: {
1040
- width: "100%",
1041
- margin: "3px 0"
1042
- },
1043
- cyberRow: {
1044
- display: "flex",
1045
- flexDirection: "row",
1046
- alignItems: "center",
1047
- gap: 8
1048
- },
1049
- cyberLabel: {
1050
- fontSize: 10,
1051
- fontWeight: 600,
1052
- fontFamily: "ui-monospace, Menlo, monospace",
1053
- color: buoyColors.textMuted,
1054
- letterSpacing: 0.5,
1055
- minWidth: 60,
1056
- flexShrink: 0
1057
- },
1058
- cyberLabelFocused: {
1059
- color: buoyColors.primary
1060
- },
1061
- cyberInputContainer: {
1062
- flex: 1,
1063
- minWidth: 0,
1064
- borderWidth: 1,
1065
- borderStyle: "solid",
1066
- borderRadius: 6,
1067
- position: "relative",
1068
- minHeight: 34,
1069
- display: "flex",
1070
- flexDirection: "row",
1071
- alignItems: "center",
1072
- boxSizing: "border-box"
1073
- },
1074
- cyberInput: {
1075
- flex: 1,
1076
- minWidth: 0,
1077
- padding: "6px 10px",
1078
- fontSize: 12,
1079
- backgroundColor: "transparent",
1080
- zIndex: 1,
1081
- border: "none",
1082
- outline: "none"
1083
- },
1084
- numberControls: {
1085
- display: "inline-flex",
1086
- flexDirection: "row",
1087
- gap: 2,
1088
- paddingRight: 4,
1089
- zIndex: 2
1090
- },
1091
- controlButton: {
1092
- width: 28,
1093
- height: 28,
1094
- borderRadius: 6,
1095
- border: `1px solid ${buoyColors.textMuted}33`,
1096
- display: "inline-flex",
1097
- alignItems: "center",
1098
- justifyContent: "center",
1099
- boxSizing: "border-box",
1100
- background: "none",
1101
- cursor: "pointer",
1102
- padding: 0,
1103
- margin: 0
1104
- },
1105
- controlButtonFocused: {
1106
- border: `1px solid ${buoyColors.primary}CC`
1107
- },
1108
- cyberDeleteButton: {
1109
- width: 28,
1110
- height: 28,
1111
- borderRadius: 6,
1112
- border: `1px solid ${buoyColors.error}4D`,
1113
- display: "inline-flex",
1114
- alignItems: "center",
1115
- justifyContent: "center",
1116
- boxSizing: "border-box",
1117
- background: "none",
1118
- cursor: "pointer",
1119
- padding: 0,
1120
- marginRight: 4,
1121
- zIndex: 2
1122
- },
1123
- cyberDeleteButtonFocused: {
1124
- border: `1px solid ${buoyColors.error}CC`
1125
- },
1126
- cornerAccent: {
1127
- position: "absolute",
1128
- width: 6,
1129
- height: 1.2,
1130
- backgroundColor: buoyColors.textMuted + "CC",
1131
- zIndex: 0
1132
- },
1133
- cornerAccentFocused: {
1134
- backgroundColor: buoyColors.primary
1135
- }
1136
- };
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=Explorer;var _react=require("react");var _DataViewer=require("../DataViewer.web");var _updateNestedDataByPath=require("./updateNestedDataByPath");var _deleteNestedDataByPath=require("./deleteNestedDataByPath");var _editorContext=require("./editorContext");var _jsxRuntime=require("react/jsx-runtime");const CHUNK_SIZE=100;const EXPANDER_SIZE=12;const buoyColors={card:"#1A1A1A",text:"#E0E0E0",textSecondary:"#A0A0A0",textMuted:"#888888",primary:"#20C997",warning:"#FFA94D",error:"#EF4444"};function Svg({size:t=14,color:n="currentColor",strokeWidth:e=2,children:r}){return(0,_jsxRuntime.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:r})}const ChevronRight=t=>(0,_jsxRuntime.jsx)(Svg,{...t,children:(0,_jsxRuntime.jsx)("path",{d:"m9 18 6-6-6-6"})});const ChevronDown=t=>(0,_jsxRuntime.jsx)(Svg,{...t,children:(0,_jsxRuntime.jsx)("path",{d:"m6 9 6 6 6-6"})});const ChevronUp=t=>(0,_jsxRuntime.jsx)(Svg,{...t,children:(0,_jsxRuntime.jsx)("path",{d:"m18 15-6-6-6 6"})});const Trash=t=>(0,_jsxRuntime.jsxs)(Svg,{...t,children:[(0,_jsxRuntime.jsx)("path",{d:"M3 6h18"}),(0,_jsxRuntime.jsx)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,_jsxRuntime.jsx)("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]});function displayValue(t){if(t===void 0)return"undefined";if(typeof t==="bigint")return`${t}n`;if(typeof t==="function")return String(t).slice(0,50);if(typeof t==="symbol")return String(t);try{return JSON.stringify(t)??String(t)}catch{return String(t)}}const chunkArray=(t,n=CHUNK_SIZE)=>{if(n<1||t.length===0)return[];const e=[];for(let r=0;r<t.length;r+=n){e.push(t.slice(r,r+n))}return e};const Expander=(0,_react.memo)(({expanded:t,isFocused:n=false,isMain:e=false})=>{const r=n?buoyColors.primary:e?buoyColors.text:buoyColors.textSecondary;const x=t?ChevronDown:ChevronRight;return(0,_jsxRuntime.jsx)("span",{style:{...styles.expanderIcon,...e?styles.expanderIconMain:null},children:(0,_jsxRuntime.jsx)(x,{size:e?14:EXPANDER_SIZE,color:r,strokeWidth:2.5})})});Expander.displayName="Expander";const CopyButton=(0,_react.memo)(({value:t,isFocused:n=false})=>{return(0,_jsxRuntime.jsx)(_DataViewer.CopyButton,{value:t,size:14,buttonStyle:n?{...styles.buttonStyle,...styles.buttonStyleFocused}:styles.buttonStyle})});CopyButton.displayName="CopyButton";const DeleteItemButton=(0,_react.memo)(({dataPath:t,isFocused:n=false})=>{const e=(0,_editorContext.useResponseEditor)();const r=(0,_react.useCallback)(()=>{if(!e)return;e.onChange((0,_deleteNestedDataByPath.deleteNestedDataByPath)(e.root,t))},[e,t]);if(!e)return null;return(0,_jsxRuntime.jsx)("button",{type:"button",onClick:r,style:{...styles.deleteButton,...n?styles.deleteButtonFocused:null},"aria-label":"Delete item",children:(0,_jsxRuntime.jsx)(Trash,{size:14,strokeWidth:2,color:n?buoyColors.error:buoyColors.error+"CC"})})});DeleteItemButton.displayName="DeleteItemButton";const ClearArrayButton=(0,_react.memo)(({dataPath:t,isFocused:n=false})=>{const e=(0,_editorContext.useResponseEditor)();const r=(0,_react.useCallback)(()=>{if(!e)return;e.onChange((0,_updateNestedDataByPath.updateNestedDataByPath)(e.root,t,[]))},[e,t]);if(!e)return null;return(0,_jsxRuntime.jsx)("button",{type:"button",style:{...styles.clearButton,...n?styles.clearButtonFocused:null},"aria-label":"Remove all items",onClick:r,children:(0,_jsxRuntime.jsx)("span",{style:{...styles.clearButtonText,color:n?buoyColors.warning:buoyColors.warning+"CC"},children:"[]"})})});ClearArrayButton.displayName="ClearArrayButton";function ToggleValueButton({dataPath:t,value:n,itemsDeletable:e}){const r=(0,_editorContext.useResponseEditor)();const x=(0,_react.useCallback)(()=>{if(!r)return;const s=typeof n==="boolean"?n:false;r.onChange((0,_updateNestedDataByPath.updateNestedDataByPath)(r.root,t,!s))},[r,t,n]);const g=(0,_react.useCallback)(()=>{if(!r)return;r.onChange((0,_deleteNestedDataByPath.deleteNestedDataByPath)(r.root,t))},[r,t]);if(!r)return null;const b=n?styles.toggleBadgeTrue:styles.toggleBadgeFalse;const c=n?styles.toggleTextTrue:styles.toggleTextFalse;return(0,_jsxRuntime.jsxs)("div",{role:"button",tabIndex:0,style:styles.modernToggleButton,onClick:x,onKeyDown:s=>{if(s.key==="Enter"||s.key===" ")x()},"aria-label":n?"Set to false":"Set to true",children:[(0,_jsxRuntime.jsx)("span",{style:{...styles.toggleBadge,...b},children:(0,_jsxRuntime.jsx)("span",{style:{...styles.toggleBadgeText,...c},children:n?"TRUE":"FALSE"})}),e&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:s=>{s.stopPropagation();g()},style:styles.deleteButtonInToggle,"aria-label":"Delete item",children:(0,_jsxRuntime.jsx)(Trash,{size:14,strokeWidth:2,color:buoyColors.error+"CC"})})]})}function CyberpunkInputWeb({label:t,value:n,isNumber:e,onChangeText:r,onFocus:x,onBlur:g,showNumberControls:b=false,onIncrement:c,onDecrement:s,showDeleteButton:w=false,onDelete:h,"aria-label":m}){const[d,f]=(0,_react.useState)(false);const y=C=>({...styles.cornerAccent,...C,...d?styles.cornerAccentFocused:null});return(0,_jsxRuntime.jsx)("div",{style:styles.cyberContainer,children:(0,_jsxRuntime.jsxs)("div",{style:styles.cyberRow,children:[t?(0,_jsxRuntime.jsx)("span",{style:{...styles.cyberLabel,...d?styles.cyberLabelFocused:null},children:t.toUpperCase()}):null,(0,_jsxRuntime.jsxs)("div",{style:{...styles.cyberInputContainer,opacity:d?1:.6,borderColor:d?buoyColors.primary:buoyColors.textMuted+"4D"},children:[(0,_jsxRuntime.jsx)("input",{value:n,onChange:C=>r(C.target.value),onFocus:()=>{f(true);x?.()},onBlur:()=>{f(false);g?.()},inputMode:e?"decimal":void 0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:false,"aria-label":m??"Data input field for editing values",style:{...styles.cyberInput,...e?styles.textNumber:styles.textString}}),b&&(0,_jsxRuntime.jsxs)("span",{style:styles.numberControls,children:[(0,_jsxRuntime.jsx)("button",{type:"button",style:{...styles.controlButton,...d?styles.controlButtonFocused:null},onClick:c,"aria-label":"Increment value",children:(0,_jsxRuntime.jsx)(ChevronUp,{size:14,strokeWidth:2.5,color:d?buoyColors.primary:buoyColors.textMuted})}),(0,_jsxRuntime.jsx)("button",{type:"button",style:{...styles.controlButton,...d?styles.controlButtonFocused:null},onClick:s,"aria-label":"Decrement value",children:(0,_jsxRuntime.jsx)(ChevronDown,{size:14,strokeWidth:2.5,color:d?buoyColors.primary:buoyColors.textMuted})})]}),w&&(0,_jsxRuntime.jsx)("button",{type:"button",style:{...styles.cyberDeleteButton,...d?styles.cyberDeleteButtonFocused:null},onClick:h,"aria-label":"Delete item",children:(0,_jsxRuntime.jsx)(Trash,{size:14,strokeWidth:2,color:d?buoyColors.error:buoyColors.error+"CC"})}),(0,_jsxRuntime.jsx)("span",{style:y({top:-1,left:5})}),(0,_jsxRuntime.jsx)("span",{style:y({top:-1,right:5})}),(0,_jsxRuntime.jsx)("span",{style:y({bottom:-1,left:5})}),(0,_jsxRuntime.jsx)("span",{style:y({bottom:-1,right:5})})]})]})})}function Explorer({editable:t,label:n,value:e,defaultExpanded:r,dataPath:x,itemsDeletable:g,dataVersion:b=0}){const c=(0,_editorContext.useResponseEditor)();const[s,w]=(0,_react.useState)(false);const[h,m]=(0,_react.useState)("");(0,_react.useEffect)(()=>{if(e!==null&&e!==void 0&&(typeof e==="string"||typeof e==="number")){const i=e.toString();m(i)}},[e,n,b]);const d=(0,_react.useMemo)(()=>{const i=n.toUpperCase();return["DATA","QUERY","QUERYKEY","TYPES","STATS","OPTIONS","OBSERVERS"].includes(i)},[n]);const[f,y]=(0,_react.useState)((r||[]).includes(n));const C=()=>y(i=>!i);const[B,F]=(0,_react.useState)([]);const S=(0,_react.useMemo)(()=>{if(e===null||e===void 0||typeof e!=="object"){return[]}if(Array.isArray(e)){const o=e.length>1e3?e.slice(0,1e3):e;return o.map((l,p)=>({label:p.toString(),value:l}))}if(e instanceof Map){const o=Array.from(e.entries()).slice(0,1e3);return o.map(([l,p])=>({label:String(l),value:p}))}if(e instanceof Set){const o=Array.from(e).slice(0,1e3);return o.map((l,p)=>({label:p.toString(),value:l}))}const i=Object.entries(e).slice(0,1e3);return i.map(([o,l])=>({label:o,value:l}))},[e]);const a=(0,_react.useMemo)(()=>{if(Array.isArray(e))return"array";if(e===null||typeof e!=="object")return typeof e;if(e instanceof Map||e instanceof Set)return"Iterable";return"object"},[e]);const j=(0,_react.useMemo)(()=>{return chunkArray(S,CHUNK_SIZE)},[S]);const u=x??[];const R=(0,_react.useRef)(c);const I=(0,_react.useRef)(u);const D=(0,_react.useRef)(a);R.current=c;I.current=u;D.current=a;const k=(0,_react.useCallback)((i,o)=>{m(o);const l=R.current;if(!l)return;if(i&&isNaN(Number(o)))return;const p=D.current==="number"?Number(o):o;l.onChange((0,_updateNestedDataByPath.updateNestedDataByPath)(l.root,I.current,p))},[m]);return(0,_jsxRuntime.jsx)("div",{style:styles.minWidthWrapper,children:(0,_jsxRuntime.jsxs)("div",{style:styles.fullWidthMarginRight,children:[j.length>0&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)("div",{style:{...styles.flexRowItemsCenterGap,...d?styles.flexRowItemsCenterGapMain:null},children:[(0,_jsxRuntime.jsxs)("button",{type:"button",style:styles.expanderButton,onClick:C,"aria-expanded":f,children:[(0,_jsxRuntime.jsx)(Expander,{expanded:f,isFocused:s,isMain:d}),(0,_jsxRuntime.jsx)("span",{style:{...styles.labelText,...s?styles.labelTextFocused:null,...d?styles.labelTextMain:null},children:n}),(0,_jsxRuntime.jsx)("span",{style:styles.textGray500,children:`${String(a).toLowerCase()==="iterable"?"(Iterable) ":""}${S.length} ${S.length>1?`items`:`item`}`})]}),t&&(0,_jsxRuntime.jsxs)("span",{style:styles.flexRowGapItemsCenter,children:[(0,_jsxRuntime.jsx)(CopyButton,{value:e,isFocused:s}),g&&c!==null&&(0,_jsxRuntime.jsx)(DeleteItemButton,{dataPath:u,isFocused:s}),a==="array"&&c!==null&&(0,_jsxRuntime.jsx)(ClearArrayButton,{dataPath:u,isFocused:s})]})]}),f&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[j.length===1&&(0,_jsxRuntime.jsx)("div",{style:{...styles.singleEntryContainer,...d?styles.singleEntryContainerMain:null},children:S.map((i,o)=>(0,_jsxRuntime.jsx)(Explorer,{defaultExpanded:r,label:i.label,value:i.value,editable:t,dataPath:[...u,i.label],itemsDeletable:a==="array"||a==="Iterable"||a==="object",dataVersion:b},i.label+o))}),j.length>1&&(0,_jsxRuntime.jsx)("div",{style:styles.multiEntryContainer,children:j.map((i,o)=>(0,_jsxRuntime.jsx)("div",{children:(0,_jsxRuntime.jsxs)("div",{style:styles.relativeOutlineNone,children:[(0,_jsxRuntime.jsxs)("button",{type:"button",onClick:()=>F(l=>l.includes(o)?l.filter(p=>p!==o):[...l,o]),style:styles.pageExpanderButton,"aria-expanded":B.includes(o),children:[(0,_jsxRuntime.jsx)(Expander,{expanded:B.includes(o)}),(0,_jsxRuntime.jsxs)("span",{style:styles.pageRangeText,children:["[",o*CHUNK_SIZE,"...",o*CHUNK_SIZE+CHUNK_SIZE-1,"]"]})]}),B.includes(o)&&(0,_jsxRuntime.jsx)("div",{style:styles.entriesContainer,children:i.map(l=>(0,_jsxRuntime.jsx)(Explorer,{defaultExpanded:r,label:l.label,value:l.value,editable:t,dataPath:[...u,l.label],dataVersion:b},l.label))})]})},o))})]})]}),j.length===0&&(0,_jsxRuntime.jsxs)("div",{style:styles.flexRowGapFullWidth,children:[t&&c!==null&&(a==="string"||a==="number"||a==="boolean")?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[t&&c&&(a==="string"||a==="number")&&(0,_jsxRuntime.jsx)("div",{style:styles.nebulaInputWrapper,children:(0,_jsxRuntime.jsx)(CyberpunkInputWeb,{label:n,value:h,isNumber:a==="number",onChangeText:i=>k(a==="number",i),onFocus:()=>w(true),onBlur:()=>w(false),showNumberControls:a==="number",onIncrement:()=>{const i=Number(h)||0;k(true,String(i+1))},onDecrement:()=>{const i=Number(h)||0;k(true,String(i-1))},showDeleteButton:g,onDelete:()=>{c.onChange((0,_deleteNestedDataByPath.deleteNestedDataByPath)(c.root,u))}})}),a==="boolean"&&(0,_jsxRuntime.jsxs)("div",{style:styles.booleanRowContainer,children:[(0,_jsxRuntime.jsx)("span",{style:styles.booleanLabel,children:n}),(0,_jsxRuntime.jsx)("div",{style:styles.booleanToggleWrapper,children:(0,_jsxRuntime.jsx)(ToggleValueButton,{dataPath:u,value:e,itemsDeletable:g})})]})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)("span",{style:styles.text344054,children:n}),(0,_jsxRuntime.jsx)("span",{style:styles.displayValueText,children:displayValue(e)})]}),t&&g&&c!==null&&a!=="string"&&a!=="number"&&a!=="boolean"&&(0,_jsxRuntime.jsx)(DeleteItemButton,{dataPath:u,isFocused:s})]})]})})}const styles={buttonStyle:{backgroundColor:buoyColors.card+"E6",border:`1px solid ${buoyColors.textSecondary}33`,borderRadius:6,display:"inline-flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:28,height:28,boxSizing:"border-box",position:"relative",padding:0},buttonStyleFocused:{border:`1px solid ${buoyColors.primary}CC`,backgroundColor:buoyColors.primary+"26"},deleteButton:{backgroundColor:buoyColors.error+"1A",border:`1px solid ${buoyColors.error}4D`,borderRadius:6,padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,boxSizing:"border-box",position:"relative",cursor:"pointer",margin:0,flexShrink:0},deleteButtonFocused:{border:`1px solid ${buoyColors.error}CC`,backgroundColor:buoyColors.error+"33"},deleteButtonInToggle:{backgroundColor:buoyColors.error+"1A",border:`1px solid ${buoyColors.error}4D`,borderRadius:6,padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,boxSizing:"border-box",cursor:"pointer",margin:0},clearButton:{backgroundColor:buoyColors.warning+"1A",border:`1px solid ${buoyColors.warning}4D`,borderRadius:6,display:"inline-flex",flexDirection:"row",padding:0,alignItems:"center",justifyContent:"center",width:28,height:28,boxSizing:"border-box",position:"relative",zIndex:10,cursor:"pointer",margin:0,flexShrink:0},clearButtonFocused:{border:`1px solid ${buoyColors.warning}CC`,backgroundColor:buoyColors.warning+"33"},clearButtonText:{fontSize:12,fontWeight:700,fontFamily:"ui-monospace, Menlo, monospace"},expanderIcon:{width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",marginRight:1,backgroundColor:buoyColors.textSecondary+"14",borderRadius:3,boxSizing:"border-box",flexShrink:0},expanderIconMain:{backgroundColor:buoyColors.textSecondary+"1A",width:20,height:20,borderRadius:4,border:`0.5px solid ${buoyColors.textSecondary}33`},minWidthWrapper:{minWidth:180,fontSize:11,display:"flex",flexDirection:"row",flexWrap:"wrap",width:"100%",margin:"0.5px 0"},fullWidthMarginRight:{position:"relative",width:"100%",marginRight:1},flexRowItemsCenterGap:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"3px 6px",margin:"1px 0",borderRadius:4,backgroundColor:buoyColors.card+"66",border:`0.5px solid ${buoyColors.textSecondary}1A`,boxSizing:"border-box"},flexRowItemsCenterGapMain:{backgroundColor:buoyColors.card+"E6",border:`1px solid ${buoyColors.textSecondary}26`,borderLeft:`2.5px solid ${buoyColors.textSecondary}80`,padding:"5px 8px",marginBottom:3},expanderButton:{display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:"transparent",padding:"1px 2px",gap:6,border:"none",minHeight:24,flex:1,minWidth:0,cursor:"pointer",margin:0,textAlign:"left",font:"inherit"},labelText:{color:buoyColors.textSecondary,fontSize:10,fontWeight:600,marginRight:4,fontFamily:"ui-monospace, Menlo, monospace",letterSpacing:.4},labelTextFocused:{color:buoyColors.text},labelTextMain:{color:buoyColors.text,fontSize:11,fontWeight:700,letterSpacing:.6},textGray500:{color:buoyColors.textMuted,fontSize:10,fontWeight:400,fontFamily:"ui-monospace, Menlo, monospace",opacity:.7},pageRangeText:{color:buoyColors.textSecondary,fontSize:10,fontWeight:600,fontFamily:"ui-monospace, Menlo, monospace"},flexRowGapItemsCenter:{display:"flex",flexDirection:"row",alignItems:"center",gap:4,paddingLeft:2},singleEntryContainer:{marginLeft:2,marginTop:2,paddingLeft:8,borderLeft:`1.5px solid ${buoyColors.textSecondary}40`},singleEntryContainerMain:{borderLeft:`1.5px solid ${buoyColors.textSecondary}4D`,marginLeft:4,paddingLeft:10},multiEntryContainer:{marginLeft:2,marginTop:2,paddingLeft:8,borderLeft:`1.5px solid ${buoyColors.textSecondary}40`},relativeOutlineNone:{position:"relative"},pageExpanderButton:{display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:buoyColors.card+"66",padding:"3px 6px",gap:6,borderRadius:4,border:`0.5px solid ${buoyColors.textSecondary}1A`,marginBottom:2,minHeight:24,cursor:"pointer",margin:"0 0 2px 0",width:"100%",boxSizing:"border-box",textAlign:"left",font:"inherit"},entriesContainer:{marginLeft:2,paddingLeft:8,marginTop:2,borderLeft:`1.5px solid ${buoyColors.textSecondary}40`},textNumber:{color:buoyColors.text,fontWeight:600,fontFamily:"ui-monospace, Menlo, monospace"},textString:{color:buoyColors.text,fontFamily:"ui-monospace, Menlo, monospace"},flexRowGapFullWidth:{display:"flex",flexDirection:"row",width:"100%",alignItems:"center",margin:"1px 0",gap:6,padding:"2px 4px",borderRadius:3,boxSizing:"border-box"},text344054:{color:buoyColors.textSecondary,fontWeight:600,fontSize:9,minWidth:50,fontFamily:"ui-monospace, Menlo, monospace",letterSpacing:.4,opacity:.8,flexShrink:0},nebulaInputWrapper:{flex:1,width:"100%",position:"relative",minWidth:0},displayValueText:{flex:1,minWidth:0,color:buoyColors.text,fontWeight:400,fontFamily:"ui-monospace, Menlo, monospace",fontSize:12,padding:"6px 10px",borderRadius:6,border:`1px solid ${buoyColors.textMuted}66`,minHeight:34,boxSizing:"border-box",overflowWrap:"anywhere"},modernToggleButton:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:6,border:`1px solid ${buoyColors.textMuted}99`,padding:"6px 8px",margin:"2px 0",minHeight:34,gap:8,boxSizing:"border-box",cursor:"pointer"},toggleBadge:{marginLeft:6,padding:"3px 6px",borderRadius:4,display:"inline-flex"},toggleBadgeText:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:.8,fontFamily:"ui-monospace, Menlo, monospace"},toggleBadgeTrue:{backgroundColor:buoyColors.primary+"1A",border:`1px solid ${buoyColors.primary}4D`},toggleBadgeFalse:{backgroundColor:buoyColors.textMuted+"1A",border:`1px solid ${buoyColors.textMuted}4D`},toggleTextTrue:{color:buoyColors.primary,fontWeight:600},toggleTextFalse:{color:buoyColors.textSecondary,fontWeight:500},booleanRowContainer:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",gap:8,padding:"2px 0"},booleanLabel:{color:buoyColors.textSecondary,fontSize:10,fontWeight:600,fontFamily:"ui-monospace, Menlo, monospace",letterSpacing:.4,minWidth:60,flexShrink:0},booleanToggleWrapper:{flex:1,minWidth:0},cyberContainer:{width:"100%",margin:"3px 0"},cyberRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:8},cyberLabel:{fontSize:10,fontWeight:600,fontFamily:"ui-monospace, Menlo, monospace",color:buoyColors.textMuted,letterSpacing:.5,minWidth:60,flexShrink:0},cyberLabelFocused:{color:buoyColors.primary},cyberInputContainer:{flex:1,minWidth:0,borderWidth:1,borderStyle:"solid",borderRadius:6,position:"relative",minHeight:34,display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box"},cyberInput:{flex:1,minWidth:0,padding:"6px 10px",fontSize:12,backgroundColor:"transparent",zIndex:1,border:"none",outline:"none"},numberControls:{display:"inline-flex",flexDirection:"row",gap:2,paddingRight:4,zIndex:2},controlButton:{width:28,height:28,borderRadius:6,border:`1px solid ${buoyColors.textMuted}33`,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:"none",cursor:"pointer",padding:0,margin:0},controlButtonFocused:{border:`1px solid ${buoyColors.primary}CC`},cyberDeleteButton:{width:28,height:28,borderRadius:6,border:`1px solid ${buoyColors.error}4D`,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:"none",cursor:"pointer",padding:0,marginRight:4,zIndex:2},cyberDeleteButtonFocused:{border:`1px solid ${buoyColors.error}CC`},cornerAccent:{position:"absolute",width:6,height:1.2,backgroundColor:buoyColors.textMuted+"CC",zIndex:0},cornerAccentFocused:{backgroundColor:buoyColors.primary}};