@lunora/studio 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (187) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +33 -18
  4. package/dist/index.js +29 -29
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.js +3 -2
  7. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  8. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
  9. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
  10. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  12. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
  13. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  14. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
  15. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
  16. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
  17. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  18. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
  19. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  20. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
  21. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
  22. package/dist/packem_chunks/SettingsPanel.js +391 -0
  23. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +158 -387
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  25. package/dist/packem_chunks/analytics-panel.js +261 -0
  26. package/dist/packem_chunks/auth-config-panel.js +365 -0
  27. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  28. package/dist/packem_chunks/containers-panel.js +247 -0
  29. package/dist/packem_chunks/dashboards-panel.js +780 -0
  30. package/dist/packem_chunks/fanout-panel.js +482 -0
  31. package/dist/packem_chunks/flags-panel.js +176 -0
  32. package/dist/packem_chunks/kv-browser.js +1896 -0
  33. package/dist/packem_chunks/log-drains-panel.js +273 -0
  34. package/dist/packem_chunks/organizations-panel.js +3178 -0
  35. package/dist/packem_chunks/payments-panel.js +186 -0
  36. package/dist/packem_chunks/permissions-panel.js +805 -0
  37. package/dist/packem_chunks/queues-panel.js +1075 -0
  38. package/dist/packem_chunks/rls-panel.js +315 -0
  39. package/dist/packem_chunks/schedule-panel.js +831 -0
  40. package/dist/packem_chunks/sparkline.js +79 -0
  41. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  42. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  43. package/dist/packem_chunks/users-panel.js +1731 -0
  44. package/dist/packem_chunks/vector-browser.js +281 -0
  45. package/dist/packem_chunks/workflows-panel.js +562 -0
  46. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +7 -0
  47. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-CBma-lnp.js} +2 -2
  48. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-CQM3pPN7.js} +2 -1
  49. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-X2tkbyHk.js} +1 -1
  50. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-D2ywrdId.js} +198 -247
  51. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-BkTPLzAY.js} +37 -66
  52. package/dist/packem_shared/HomePanel-D1Q9LZgK.js +14 -0
  53. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-Dno-hfDb.js} +2 -1
  54. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-Ctw4jYtU.js} +163 -60
  55. package/dist/packem_shared/Studio-lJhzDAze.js +16 -0
  56. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-DiMkupvZ.js} +276 -11
  57. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-BX8OhG0w.js} +6 -6
  58. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  59. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
  60. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  61. package/dist/packem_shared/browser-storage-BTrX4y3B.js +215 -0
  62. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  63. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-CdXztApG.js} +1 -1
  64. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  65. package/dist/packem_shared/error-alert-CXjqyGw9.js +114 -0
  66. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-BF-KBDFz.js} +131 -163
  67. package/dist/packem_shared/home-panel-TFcRf9Ui.js +1889 -0
  68. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-CYcbqMjX.js} +44 -3
  69. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  70. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUiJcILV.js} +6 -45
  71. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  72. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  73. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  74. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  75. package/dist/packem_shared/studio-Dh9UlaF_.js +4015 -0
  76. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  77. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-UVIXQJdU.js} +1 -1
  78. package/dist/packem_shared/use-admin-query-CfHYWx5n.js +106 -0
  79. package/dist/packem_shared/use-async-submit-DJQiPc-_.js +91 -0
  80. package/dist/standalone/chunk-23C4TCRO.js +1 -0
  81. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  82. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  83. package/dist/standalone/chunk-3CJW6NWG.js +4 -0
  84. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  85. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  86. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  87. package/dist/standalone/chunk-5ZAA2PVR.js +1 -0
  88. package/dist/standalone/chunk-676HEBIR.js +3 -0
  89. package/dist/standalone/chunk-6VO23MMW.js +4 -0
  90. package/dist/standalone/chunk-7RE5UW27.js +8 -0
  91. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  92. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  93. package/dist/standalone/chunk-AAVIFQ4Y.js +2 -0
  94. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  95. package/dist/standalone/chunk-AJFQ3LNM.js +1 -0
  96. package/dist/standalone/chunk-AJULNB46.js +4 -0
  97. package/dist/standalone/chunk-BGXOXASQ.js +1 -0
  98. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  99. package/dist/standalone/chunk-BKW7FFEO.js +1 -0
  100. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  101. package/dist/standalone/chunk-BXOYVWJR.js +13 -0
  102. package/dist/standalone/chunk-C7WTJLC3.js +1 -0
  103. package/dist/standalone/chunk-CACB34RQ.js +1 -0
  104. package/dist/standalone/chunk-CICVBMEN.js +1 -0
  105. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  106. package/dist/standalone/chunk-CWEAJUHW.js +1 -0
  107. package/dist/standalone/chunk-DC72CQY4.js +76 -0
  108. package/dist/standalone/chunk-DECHEGIC.js +1 -0
  109. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  110. package/dist/standalone/chunk-E75ANNWX.js +19 -0
  111. package/dist/standalone/chunk-ERJNDIXC.js +1 -0
  112. package/dist/standalone/chunk-FKACHRWO.js +1 -0
  113. package/dist/standalone/chunk-FSGCANAU.js +1 -0
  114. package/dist/standalone/chunk-GLUNBZRI.js +1 -0
  115. package/dist/standalone/chunk-GMSGZDDH.js +13 -0
  116. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  117. package/dist/standalone/chunk-H6RKXQZU.js +1 -0
  118. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  119. package/dist/standalone/chunk-HZTGDL4L.js +1 -0
  120. package/dist/standalone/chunk-I7ZZRM7I.js +1 -0
  121. package/dist/standalone/chunk-IXDH4GL5.js +1 -0
  122. package/dist/standalone/chunk-J46WXQYL.js +1 -0
  123. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  124. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  125. package/dist/standalone/chunk-JVODY4EP.js +1 -0
  126. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  127. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  128. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  129. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  130. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  131. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  132. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  133. package/dist/standalone/chunk-LYB5L53X.js +1 -0
  134. package/dist/standalone/chunk-MJWVMKQ4.js +6 -0
  135. package/dist/standalone/chunk-MT2J3H7O.js +3 -0
  136. package/dist/standalone/chunk-N746FOQP.js +1 -0
  137. package/dist/standalone/chunk-NC6MBMSI.js +1 -0
  138. package/dist/standalone/chunk-NN27EDQB.js +1 -0
  139. package/dist/standalone/chunk-NY6GDADQ.js +1 -0
  140. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  141. package/dist/standalone/chunk-OY3HD7BJ.js +4 -0
  142. package/dist/standalone/chunk-P5HJXCZS.js +1 -0
  143. package/dist/standalone/chunk-PTS5TW3J.js +1 -0
  144. package/dist/standalone/chunk-Q52CHOSY.js +1 -0
  145. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  146. package/dist/standalone/chunk-QBAT52GB.js +1 -0
  147. package/dist/standalone/chunk-QDBOPDJ7.js +1 -0
  148. package/dist/standalone/chunk-QHFTGJPS.js +4 -0
  149. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  150. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  151. package/dist/standalone/chunk-SG3ALJJU.js +1 -0
  152. package/dist/standalone/chunk-SSI4G2MY.js +1 -0
  153. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  154. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  155. package/dist/standalone/chunk-TH45YG6Q.js +1 -0
  156. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  157. package/dist/standalone/chunk-UGUEC6BC.js +1 -0
  158. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  159. package/dist/standalone/chunk-UKDJ4H7I.js +1 -0
  160. package/dist/standalone/chunk-V6IWFYAQ.js +1 -0
  161. package/dist/standalone/chunk-V7SRH36W.js +1 -0
  162. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  163. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  164. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  165. package/dist/standalone/chunk-WPNXY7IS.js +1 -0
  166. package/dist/standalone/chunk-X33MSJPP.js +1 -0
  167. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  168. package/dist/standalone/chunk-XRNXOIVZ.js +1 -0
  169. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  170. package/dist/standalone/chunk-YBGC4PPD.js +1 -0
  171. package/dist/standalone/chunk-YNZ7ARWW.js +1 -0
  172. package/dist/standalone/chunk-YTO65GHS.js +1 -0
  173. package/dist/standalone/chunk-ZE6FT5Z3.js +1 -0
  174. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  175. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  176. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  177. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  178. package/dist/standalone/studio.js +104 -246
  179. package/dist/styles.css +2 -2
  180. package/package.json +15 -13
  181. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  182. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  183. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  184. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  185. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  186. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  187. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -32,7 +32,7 @@ function Table(t0) {
32
32
  if ($[5] !== props || $[6] !== t1) {
33
33
  t2 = /* @__PURE__ */ jsxDEV("div", {
34
34
  "data-slot": "table-container",
35
- className: "relative w-full overflow-x-auto",
35
+ className: "relative w-full overflow-x-auto overflow-y-clip",
36
36
  children: /* @__PURE__ */ jsxDEV("table", {
37
37
  "data-slot": "table",
38
38
  className: t1,
@@ -2,7 +2,7 @@ import { c } from 'react/compiler-runtime';
2
2
  import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
3
3
  import { jsxDEV } from 'react/jsx-dev-runtime';
4
4
  import { useState, useRef, useMemo } from 'react';
5
- import { f as fireAndForget, e as errorMessage } from './internal-rXJEAhXS.js';
5
+ import { f as fireAndForget, e as errorMessage } from './internal-CYcbqMjX.js';
6
6
  import { useVirtualizer } from '@tanstack/react-virtual';
7
7
  import { c as cn } from './utils-B05Dmz_H.js';
8
8
  import { f as flooredRectObserver } from './virtual-rect-CVMUskSm.js';
@@ -0,0 +1,106 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { useQueryClient, useQuery, keepPreviousData } from '@tanstack/react-query';
4
+ import { useState, useEffect } from 'react';
5
+ import { a as adminRef, c as callOptions, f as fireAndForget, e as errorMessage } from './internal-CYcbqMjX.js';
6
+
7
+ const adminQueryKey = (path, args, shardKey) => ["lunora-admin", path, args, shardKey.trim()];
8
+ const RPC_LOOP_WINDOW_MS = 1e3;
9
+ const RPC_LOOP_THRESHOLD = 25;
10
+ const rpcCallTimes = /* @__PURE__ */ new Map();
11
+ const noteQueryFetch = (key) => {
12
+ const now = Date.now();
13
+ const recent = (rpcCallTimes.get(key) ?? []).filter((time) => now - time < RPC_LOOP_WINDOW_MS);
14
+ recent.push(now);
15
+ rpcCallTimes.set(key, recent);
16
+ if (recent.length === RPC_LOOP_THRESHOLD) {
17
+ console.error(`[lunora-studio] possible request loop: ${key} fired ${String(RPC_LOOP_THRESHOLD)}× in <1s — a render/effect is re-issuing this read unbounded.`);
18
+ console.trace("[lunora-studio] request-loop call site");
19
+ }
20
+ };
21
+ function useClientQuery(queryKey, queryFunction, options = {}) {
22
+ const {
23
+ enabled = true,
24
+ keepPreviousData: keepPreviousData$1 = false,
25
+ staleTime = 0
26
+ } = options;
27
+ const trackedQueryFunction = () => {
28
+ noteQueryFetch(JSON.stringify(queryKey));
29
+ return queryFunction();
30
+ } ;
31
+ const query = useQuery({
32
+ enabled,
33
+ queryFn: trackedQueryFunction,
34
+ placeholderData: keepPreviousData$1 ? keepPreviousData : void 0,
35
+ queryKey,
36
+ staleTime
37
+ });
38
+ return {
39
+ data: query.data,
40
+ error: query.error ? errorMessage(query.error) : query.error,
41
+ errorSource: query.error ?? void 0,
42
+ isLoading: query.isLoading,
43
+ liveError: void 0,
44
+ refetch: () => {
45
+ fireAndForget(query.refetch());
46
+ }
47
+ };
48
+ }
49
+ function useAdminQuery(path, args, options = {}) {
50
+ const client = useLunora();
51
+ const queryClient = useQueryClient();
52
+ const {
53
+ enabled = true,
54
+ keepPreviousData = false,
55
+ live = false,
56
+ shardKey = "",
57
+ staleTime
58
+ } = options;
59
+ const queryKey = adminQueryKey(path, args, shardKey);
60
+ const base = useClientQuery(queryKey, () => client.query(adminRef(path), args, callOptions(shardKey)), {
61
+ enabled,
62
+ keepPreviousData,
63
+ staleTime: staleTime ?? (live ? Number.POSITIVE_INFINITY : 0)
64
+ });
65
+ const [liveError, setLiveError] = useState(void 0);
66
+ const keySignature = JSON.stringify(queryKey);
67
+ useEffect(() => {
68
+ if (!enabled || !live) {
69
+ return void 0;
70
+ }
71
+ setLiveError(void 0);
72
+ return client.subscribe(adminRef(path), args, (value) => {
73
+ setLiveError(void 0);
74
+ queryClient.setQueryData(queryKey, value);
75
+ }, {
76
+ ...callOptions(shardKey),
77
+ onError: (error) => {
78
+ setLiveError(error.message);
79
+ }
80
+ });
81
+ }, [keySignature, enabled, live]);
82
+ return {
83
+ ...base,
84
+ liveError: enabled && live ? liveError : void 0
85
+ };
86
+ }
87
+ const useInvalidateAdmin = () => {
88
+ const $ = c(2);
89
+ const queryClient = useQueryClient();
90
+ let t0;
91
+ if ($[0] !== queryClient) {
92
+ t0 = (path, args, shardKey) => {
93
+ const queryKey = args === void 0 ? ["lunora-admin", path] : adminQueryKey(path, args, shardKey ?? "");
94
+ fireAndForget(queryClient.invalidateQueries({
95
+ queryKey
96
+ }));
97
+ };
98
+ $[0] = queryClient;
99
+ $[1] = t0;
100
+ } else {
101
+ t0 = $[1];
102
+ }
103
+ return t0;
104
+ };
105
+
106
+ export { useClientQuery as a, useInvalidateAdmin as b, useAdminQuery as u };
@@ -0,0 +1,91 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { a as useClientQuery } from './use-admin-query-CfHYWx5n.js';
4
+ import { useState } from 'react';
5
+ import { f as fireAndForget, e as errorMessage } from './internal-CYcbqMjX.js';
6
+
7
+ const DEFAULT_AUTH_CONFIG = {
8
+ capabilities: {
9
+ accounts: true,
10
+ admin: true,
11
+ organization: false,
12
+ passkey: false,
13
+ twoFactor: false
14
+ },
15
+ emailAndPassword: false,
16
+ organization: {
17
+ enabled: false,
18
+ roles: false,
19
+ teams: false
20
+ },
21
+ plugins: [],
22
+ rateLimit: {
23
+ enabled: false
24
+ },
25
+ session: {},
26
+ socialProviders: [],
27
+ userFields: []
28
+ };
29
+ const useAuthConfig = () => {
30
+ const $ = c(6);
31
+ const client = useLunora();
32
+ let t0;
33
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
34
+ t0 = ["lunora-auth-config"];
35
+ $[0] = t0;
36
+ } else {
37
+ t0 = $[0];
38
+ }
39
+ let t1;
40
+ if ($[1] !== client) {
41
+ t1 = () => client.getAuthConfig();
42
+ $[1] = client;
43
+ $[2] = t1;
44
+ } else {
45
+ t1 = $[2];
46
+ }
47
+ const {
48
+ data,
49
+ isLoading
50
+ } = useClientQuery(t0, t1);
51
+ const t2 = data ?? DEFAULT_AUTH_CONFIG;
52
+ const t3 = !isLoading;
53
+ let t4;
54
+ if ($[3] !== t2 || $[4] !== t3) {
55
+ t4 = {
56
+ config: t2,
57
+ ready: t3
58
+ };
59
+ $[3] = t2;
60
+ $[4] = t3;
61
+ $[5] = t4;
62
+ } else {
63
+ t4 = $[5];
64
+ }
65
+ return t4;
66
+ };
67
+
68
+ const useAsyncSubmit = () => {
69
+ const [busy, setBusy] = useState(false);
70
+ const [error, setError] = useState(null);
71
+ const run = (action) => {
72
+ fireAndForget((async () => {
73
+ setBusy(true);
74
+ setError(null);
75
+ try {
76
+ await action();
77
+ } catch (error_) {
78
+ setError(errorMessage(error_));
79
+ } finally {
80
+ setBusy(false);
81
+ }
82
+ })());
83
+ };
84
+ return {
85
+ busy,
86
+ error,
87
+ run
88
+ };
89
+ };
90
+
91
+ export { useAuthConfig as a, useAsyncSubmit as u };
@@ -0,0 +1 @@
1
+ import{a as $}from"./chunk-UGUEC6BC.js";import{a as W}from"./chunk-YBGC4PPD.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-UKDJ4H7I.js";import{b as Q}from"./chunk-TBMYIZIO.js";import{R as w}from"./chunk-3CJW6NWG.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as H}from"./chunk-C7WTJLC3.js";import{a as k,e as B}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as M}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,e as F,f as K,g as O,k as j,o as z}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
@@ -0,0 +1 @@
1
+ import{a as r,e as i,f as p,g as l}from"./chunk-RRCPZMC2.js";var u=i(l(),1),n=i(p(),1);var D=r(function(e,d){let t=(0,u.c)(4),o=d===void 0?300:d,[f,m]=(0,n.useState)(e),s,c;return t[0]!==o||t[1]!==e?(s=r(()=>{let b=setTimeout(()=>{m(e)},o);return()=>{clearTimeout(b)}},"t1"),c=[e,o],t[0]=o,t[1]=e,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,n.useEffect)(s,c),f},"useDebounced");export{D as a};
@@ -0,0 +1 @@
1
+ import{a as i,e as n,g as c,h as p}from"./chunk-RRCPZMC2.js";var b=n(c(),1),d=n(p(),1);var S={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=i((r,e,a,t)=>({badgeStyle:{...S,borderColor:r,color:r},color:r,dotStyle:{...g,backgroundColor:r},hint:t,label:e,title:a}),"makeTier"),y={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=i(r=>{let e=(0,b.c)(9),{tier:a}=r,t=y[a],o=`storage-tier-${a}`,l;e[0]!==t.dotStyle?(l=(0,d.jsxDEV)("span",{"aria-hidden":"true",style:t.dotStyle},void 0,!1),e[0]=t.dotStyle,e[1]=l):l=e[1];let s;return e[2]!==t.badgeStyle||e[3]!==t.label||e[4]!==t.title||e[5]!==o||e[6]!==l||e[7]!==a?(s=(0,d.jsxDEV)("span",{"data-testid":o,"data-tier":a,style:t.badgeStyle,title:t.title,children:[l,t.label]},void 0,!0),e[2]=t.badgeStyle,e[3]=t.label,e[4]=t.title,e[5]=o,e[6]=l,e[7]=a,e[8]=s):s=e[8],s},"StorageTierBadge");export{y as a,m as b};
@@ -0,0 +1,4 @@
1
+ import{a as D,b as xe,c as T,h as Ce,i as Ie,j as Nt,w as de}from"./chunk-O3NAGRTR.js";import{a as Fr}from"./chunk-HV7G6DFP.js";import{a as St,c as H,g as N,i as ue,j as $}from"./chunk-CKSHCYGC.js";import{a as ce}from"./chunk-3OA7PECS.js";import{a as r,d as re,e as g,f as y,g as Tr,h as Dr,j as At}from"./chunk-RRCPZMC2.js";var hr=g(Tr(),1),Wa=g(y(),1);var gr=g(y(),1);var He={};re(He,{Control:()=>vt,Description:()=>ht,Error:()=>Rt,Item:()=>It,Label:()=>pt,Root:()=>mt,Validity:()=>Et});var S=g(y(),1);var ye=g(y(),1);var et=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},wt={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[et.valid]:""}:{[et.invalid]:""}}};var Vr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:N,disabled:void 0,touched:fe.touched,setTouched:N,dirty:fe.dirty,setDirty:N,filled:fe.filled,setFilled:N,focused:fe.focused,setFocused:N,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:wt,markedDirtyRef:{current:!1},registerFieldControl:N,validation:{getValidationProps:r((e,t=ue)=>t,"getValidationProps"),inputRef:{current:null},registerInput:N,commit:r(async()=>{},"commit"),change:N}},Fe=ye.createContext(Vr);Fe.displayName="FieldRootContext";function B(e=!0){let t=ye.useContext(Fe);if(t.setValidityData===N&&!e)throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");return t}r(B,"useFieldRootContext");var Te=g(y(),1);var _t=Te.createContext(void 0);_t.displayName="FieldsetRootContext";function Ot(e=!1){let t=Te.useContext(_t);if(!t&&!e)throw new Error("Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.");return t}r(Ot,"useFieldsetRootContext");var De=g(y(),1);var Mt=De.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:N,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});Mt.displayName="FormContext";function z(){return De.useContext(Mt)}r(z,"useFormContext");var Z=g(y(),1);var Ve=g(y(),1);var Lt=0;function Ar(e,t="mui"){let[o,n]=Ve.useState(e),i=e||o;return Ve.useEffect(()=>{o==null&&(Lt+=1,n(`${t}-${Lt}`))},[o,t]),i}r(Ar,"useGlobalId");var Pt=xe.useId;function kt(e,t){if(Pt!==void 0){let o=Pt();return e??(t?`${t}-${o}`:o)}return Ar(e,t)}r(kt,"useId");function J(e){return kt(e,"base-ui")}r(J,"useBaseUiId");var Ae=g(y(),1);var Se=Ae.createContext({controlId:void 0,registerControlId:N,labelId:void 0,setLabelId:N,messageIds:[],setMessageIds:N,getDescriptionProps:r(e=>e,"getDescriptionProps")});Se.displayName="LabelableContext";function P(){return Ae.useContext(Se)}r(P,"useLabelableContext");var Ut=g(ce(),1);var ge=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Z.useState(n),[a,l]=Z.useState(t.labelId),[u,d]=Z.useState([]),m=H(()=>new Map),{messageIds:f}=P(),h=T((R,F)=>{let V=m.current;if(F===void 0){V.delete(R);return}V.set(R,F),s(E=>{if(V.size===0)return;let k;for(let c of V.values()){if(E!==void 0&&c===E)return E;k===void 0&&(k=c)}return k})}),p=Z.useCallback(R=>{let F=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return F.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(F)).join(" ")||void 0}},[f,u]),v=Z.useMemo(()=>({controlId:i,registerControlId:h,labelId:a,setLabelId:l,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,a,l,u,d,p]);return(0,Ut.jsx)(Se.Provider,{value:v,children:t.children})},"LabelableProvider");ge.displayName="LabelableProvider";var Re=g(y(),1);function jt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),a=J(t),l=o?i:void 0,u=H(()=>Symbol("labelable-control")),d=Re.useRef(!1),m=Re.useRef(t!=null),f=T(()=>{!d.current||s===N||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===N)return;let h;if(o){let p=n?.current;Ce(p)&&p.closest("label")!=null?h=t??null:h=l??a}else if(t!=null)m.current=!0,h=t;else if(m.current)h=a;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,l,s,o,a,u,f]),Re.useEffect(()=>f,[f]),i??a}r(jt,"useLabelableId");function Ne(e){return e?.ownerDocument||document}r(Ne,"ownerDocument");var we={};re(we,{engine:()=>it,env:()=>at,os:()=>ot,screenReader:()=>st});var ot={};re(ot,{android:()=>Wt,apple:()=>rt,ios:()=>tt,linux:()=>Or,mac:()=>qt,windows:()=>_r});function Sr(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};{let e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:o})=>`${t}/${o}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Sr,"readRawData");var{userAgent:Nr,platform:wr,maxTouchPoints:Bt}=Sr(),ne=Nr.toLowerCase(),ie=wr.toLowerCase();var tt=/^i(os$|p)/.test(ie)||ie==="macintel"&&Bt>1,$t="android",Wt=ie===$t||ne.includes($t),qt=!tt&&ie.startsWith("mac"),_r=ie.startsWith("win"),Or=!Wt&&/^(linux|chrome os)/.test(ie),rt=qt||tt;var it={};re(it,{blink:()=>Lr,gecko:()=>Mr,webkit:()=>nt});var nt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Mr=!nt&&ne.includes("firefox"),Lr=!nt&&ne.includes("chrom");var st={};re(st,{voiceOver:()=>Pr});var Pr=rt;var at={};re(at,{jsdom:()=>kr});var kr=/jsdom|happydom/.test(ne);var lt="data-base-ui-focusable";var ct="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tn="ArrowLeft",Dn="ArrowRight",Vn="ArrowUp",An="ArrowDown";function ut(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(ut,"activeElement");function Gt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&Nt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Gt,"contains");function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(dt,"getTarget");function kn(e,t){if(!Ce(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Gt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(kn,"isTargetInsideEnabledTrigger");function Un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(Un,"isEventTargetWithin");function jn(e){return e.matches("html,body")}r(jn,"isRootElement");function Ur(e){return Ie(e)&&e.matches(ct)}r(Ur,"isTypeableElement");function Bn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`)!=null}r(Bn,"isInteractiveElement");function $n(e){return e?e.getAttribute("role")==="combobox"&&Ur(e):!1}r($n,"isTypeableCombobox");function Wn(e){if(!e||we.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r(Wn,"matchesFocusVisible");function qn(e){return e?e.hasAttribute(lt)?e:e.querySelector(`[${lt}]`)||e:null}r(qn,"getFloatingFocusElement");function Yt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Yt,"useRegisteredLabelId");function Kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:a,setLabelId:l}=P(),u=T(p=>{l(p),i?.(p)}),d=Yt(t,u),m=a??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Ne(p.currentTarget).getElementById(m);Ie(v)&&jr(v)}r(f,"focusControl");function h(p){dt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(Kt,"useLabel");function jr(e){e.focus({focusVisible:!0})}r(jr,"focusElementWithVisible");var ee=g(y(),1);var Ht=g(y(),1);var Br=[];function _e(e){Ht.useEffect(e,Br)}r(_e,"useOnMount");var he=0,ft=class e{static{r(this,"Timeout")}static create(){return new e}currentId=he;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=he,o()},t)}isStarted(){return this.currentId!==he}clear=r(()=>{this.currentId!==he&&(clearTimeout(this.currentId),this.currentId=he)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function zt(){let e=H(ft.create).current;return _e(e.disposeEffect),e}r(zt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Oe=Object.keys(oe);function $r(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Oe)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r($r,"isOnlyValueMissing");function Wr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(Wr,"findRepresentativeInput");function Jt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Jt,"clearCustomValidity");function Xt(e){let{formRef:t}=z(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:a,markedDirtyRef:l,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=zt(),v=ee.useRef(null),R=H(()=>new Set).current,F=ee.useRef(0),V=ee.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),E=T(async(b,w=!1)=>{let C=Wr(R)??v.current;if(!C)return;F.current+=1;let te=F.current;function q(L,A=a){let O=m()??f;if(O==null)return;let x=t.current.fields.get(O);if(!x)return;let K=se(L,A);t.current.fields.set(O,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let L=C.validity;if(!L.valueMissing){let O={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Jt(C,R),q(O,!1),o(O);return}let A=Oe.reduce((O,x)=>(O[x]=L[x],O),{});if(!A.valid&&!$r(A))return}function G(L){let A=Oe.reduce((x,K)=>(x[K]=L.validity[K],x),{}),O=!1;for(let x of Oe)if(x!=="valid"){if(x==="valueMissing"&&A[x])O=!0;else if(A[x])return A}return O&&!l.current&&(A.valid=!0,A.valueMissing=!1),A}r(G,"getState"),p.clear();let I=null,M=[],U=G(C),j,Y=d();if(C.validationMessage&&!Y)j=C.validationMessage,M=[C.validationMessage];else{let L=Array.from(t.current.fields.values()).reduce((O,x)=>(x.name&&(O[x.name]=x.getValue()),O),{}),A=n(b,L);if(typeof A=="object"&&A!==null&&"then"in A){if(I=await A,te!==F.current)return}else I=A;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(M=I,C.setCustomValidity(I.join(`
2
+ `))):I&&(M=[I],C.setCustomValidity(I))):Y&&(Jt(C,R),U.customError=!1,C.validationMessage?(j=C.validationMessage,M=[C.validationMessage]):C.validity.valid&&!U.valid&&(U.valid=!0))}let _={value:b,state:U,error:j??(Array.isArray(I)?I[0]:I??""),errors:M,initialValue:i.initialValue};q(_),o(_)}),k=T(b=>{p.clear();let w=d();w&&b!==""&&s?(F.current+=1,p.start(s,()=>{E(b)})):E(b,!w)}),c=ee.useCallback((b,w={})=>St(h(w),u.valid===!1&&!u.disabled&&!b?{"aria-invalid":!0}:ue),[h,u.disabled,u.valid]);return ee.useMemo(()=>({getValidationProps:c,inputRef:v,registerInput:V,commit:E,change:k}),[c,V,E,k])}r(Xt,"useFieldValidation");var Me=g(y(),1);function Qt(e){let{commit:t,invalid:o,markedDirtyRef:n,name:i,setRegisteredFieldName:s,setRegisteredFieldId:a,setValidityData:l,validityData:u}=e,{formRef:d}=z(),m=Me.useRef(null),f=Me.useRef(null),h=Me.useRef(null),p=T(()=>{let c=f.current;if(c)return c.getValue?c.getValue():c.value});function v(c){return c.value===void 0?p():c.value}r(v,"getRegistrationValue");let R=T(()=>{let c=f.current;if(n.current=!0,!c){t(u.value);return}t(v(c))});function F(){let c=f.current;!c||!c.id||d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R})}r(F,"refreshRegistration");function V(c=f.current?.id){c&&d.current.fields.delete(c)}r(V,"deleteRegistration");function E(){let c=f.current;if(!c)return;let b=v(c);u.initialValue===null&&b!==null&&l(w=>({...w,initialValue:b}))}r(E,"syncInitialValue"),D(()=>{let c=f.current;!c||!c.id||(s(i?void 0:c.name),d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R}))},[d,p,o,i,s,R,u]),D(()=>{let c=d.current.fields;return()=>{let b=f.current?.id;b&&c.delete(b)}},[d]);let k=T((c,b)=>{if(!b){m.current===c&&(m.current=null,V(),f.current=null,s(void 0),a(void 0));return}let w=f.current?.id;m.current=c,f.current=b,i||s(b.name),a(b.id),w&&w!==b.id&&V(w),E(),F()});return[R,k]}r(Qt,"useFieldControlRegistration");var Le=g(ce(),1);var Zt=S.forwardRef(r(function(t,o){let{errors:n,validationMode:i,submitAttemptedRef:s}=z(),{render:a,className:l,validate:u,validationDebounceTime:d=0,validationMode:m=i,name:f,disabled:h=!1,invalid:p,dirty:v,touched:R,actionsRef:F,style:V,...E}=t,k=Ot(!0)?.disabled,c=T(u||(()=>null)),b=k||h,[w,C]=S.useState(!1),[te,q]=S.useState(!1),[G,I]=S.useState(!1),[M,U]=S.useState(!1),j=v??te,Y=R??w,_=S.useRef(j),L=S.useRef(void 0),[A,O]=S.useState(),x=f??A;D(()=>{v!==void 0&&(_.current=v)},[v]);let K=S.useCallback(()=>L.current,[]),Er=S.useCallback(le=>{L.current=le},[]),yt=T(le=>{v===void 0&&(le&&(_.current=!0),q(le))}),Ft=T(le=>{R===void 0&&C(le)}),Je=T(()=>m==="onChange"||m==="onSubmit"&&s.current),Xe=x&&Object.hasOwn(n,x)?n[x]:null,Cr=!!(Array.isArray(Xe)?Xe.length:Xe),pe=p===!0||Cr,[be,Qe]=S.useState({state:oe,error:"",errors:[],value:null,initialValue:null}),Tt=b?null:!pe&&be.state.valid,Ee=S.useMemo(()=>({disabled:b,touched:Y,dirty:j,valid:Tt,filled:G,focused:M}),[b,Y,j,Tt,G,M]),Ze=Xt({setValidityData:Qe,validate:c,validityData:be,validationDebounceTime:d,invalid:pe,markedDirtyRef:_,state:Ee,shouldValidateOnChange:Je,getRegisteredFieldId:K}),[Dt,Vt]=Qt({commit:Ze.commit,invalid:pe,markedDirtyRef:_,name:f,setRegisteredFieldName:O,setRegisteredFieldId:Er,setValidityData:Qe,validityData:be});S.useImperativeHandle(F,()=>({validate:Dt}),[Dt]);let Ir=S.useMemo(()=>({invalid:pe,name:x,validityData:be,setValidityData:Qe,disabled:b,touched:Y,setTouched:Ft,dirty:j,setDirty:yt,filled:G,setFilled:I,focused:M,setFocused:U,validate:c,validationMode:m,validationDebounceTime:d,shouldValidateOnChange:Je,state:Ee,markedDirtyRef:_,registerFieldControl:Vt,validation:Ze}),[pe,x,be,b,Y,Ft,j,yt,G,I,M,U,c,m,d,Je,Ee,Vt,Ze]),yr=$("div",t,{ref:o,state:Ee,props:E,stateAttributesMapping:W});return(0,Le.jsx)(Fe.Provider,{value:Ir,children:yr})},"FieldRootInner"));Zt.displayName="FieldRootInner";var mt=S.forwardRef(r(function(t,o){return(0,Le.jsx)(ge,{children:(0,Le.jsx)(Zt,{...t,ref:o})})},"FieldRoot"));mt.displayName="FieldRoot";var me=g(y(),1);var Pe=g(y(),1);var ke=Pe.createContext({disabled:!1});ke.displayName="FieldItemContext";function Ue(){return Pe.useContext(ke)}r(Ue,"useFieldItemContext");var pt=me.forwardRef(r(function(t,o){let{render:n,className:i,style:s,id:a,nativeLabel:l=!0,...u}=t,d=B(!1),m=Ue(),{labelId:f}=P(),h={...d.state,disabled:d.disabled||m.disabled},p=me.useRef(null),v=Kt({id:f??a,native:l});return me.useEffect(()=>{if(!p.current)return;let F=p.current.tagName==="LABEL";if(l){if(!F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${V}`)}}else if(F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${V}`)}},[l]),$("label",t,{ref:[o,p],state:h,props:[v,u],stateAttributesMapping:W})},"FieldLabel"));pt.displayName="FieldLabel";var ae=g(y(),1);var sr=g(y(),1);var nr=g(Fr(),1);var je=null,er=globalThis.requestAnimationFrame,bt=class{static{r(this,"Scheduler")}callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=r(t=>{this.isScheduled=!1;let o=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let i=0;i<o.length;i+=1)o[i]?.(t)},"tick");request(t){let o=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;let n=er!==requestAnimationFrame&&(er=requestAnimationFrame,!0);return(!this.isScheduled||n)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),o}cancel(t){let o=t-this.startId;o<0||o>=this.callbacks.length||(this.callbacks[o]=null,this.callbacksCount-=1)}},Be=new bt,X=class e{static{r(this,"AnimationFrame")}static create(){return new e}static request(t){return Be.request(t)}static cancel(t){return Be.cancel(t)}currentId=je;request(t){this.cancel(),this.currentId=Be.request(()=>{this.currentId=je,t()})}cancel=r(()=>{this.currentId!==je&&(Be.cancel(this.currentId),this.currentId=je)},"cancel");disposeEffect=r(()=>this.cancel,"disposeEffect")};function tr(){let e=H(X.create).current;return _e(e.disposeEffect),e}r(tr,"useAnimationFrame");function rr(e){return e==null?e:"current"in e?e.current:e}r(rr,"resolveRef");var $e=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({}),qr={[$e.startingStyle]:""},Gr={[$e.endingStyle]:""},or={transitionStatus(e){return e==="starting"?qr:e==="ending"?Gr:null}};function ir(e,t=!1,o=!0){let n=tr();return T((i,s=null)=>{n.cancel();let a=rr(e);if(a==null)return;let l=a,u=r(()=>{nr.flushSync(i)},"done");if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function d(){Promise.all(l.getAnimations().map(m=>m.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(o){s?.aborted||u();return}let m=l.getAnimations();!s?.aborted&&m.length>0&&m.some(f=>f.pending||f.playState!=="finished")&&d()})}if(r(d,"exec"),t){let m=$e.startingStyle;if(!l.hasAttribute(m)){n.request(d);return}let f=new MutationObserver(()=>{l.hasAttribute(m)||(f.disconnect(),d())});f.observe(l,{attributes:!0,attributeFilter:[m]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(d)})}r(ir,"useAnimationsFinished");function ar(e){let{enabled:t=!0,open:o,ref:n,onComplete:i}=e,s=T(i),a=ir(n,o,!1);sr.useEffect(()=>{if(!t)return;let l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,o,s,a])}r(ar,"useOpenChangeComplete");var xt=g(y(),1);function We(e,t=!1,o=!1){let[n,i]=xt.useState(e&&t?"idle":void 0),[s,a]=xt.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&n!=="ending"&&!o&&i("ending"),!e&&!s&&n==="ending"&&i(void 0),D(()=>{if(!e&&s&&n!=="ending"&&o){let l=X.request(()=>{i("ending")});return()=>{X.cancel(l)}}},[e,s,n,o]),D(()=>{if(!e||t)return;let l=X.request(()=>{i(void 0)});return()=>{X.cancel(l)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&n!=="idle"&&i("starting");let l=X.request(()=>{i("idle")});return()=>{X.cancel(l)}},[t,e,s,n]),{mounted:s,setMounted:a,transitionStatus:n}}r(We,"useTransitionStatus");var gt=g(ce(),1);var Yr={...W,...or},Rt=ae.forwardRef(r(function(t,o){let{render:n,id:i,className:s,match:a,style:l,...u}=t,d=J(i),{validityData:m,state:f,name:h}=B(!1),{setMessageIds:p}=P(),{errors:v}=z(),R=h&&Object.hasOwn(v,h)?v[h]:null,F=!!(Array.isArray(R)?R.length:R),V=typeof a=="string",E=!1;a===!0?E=!0:f.disabled?E=!1:V?E=!!m.state[a]:E=F||m.state.valid===!1;let{mounted:k,transitionStatus:c,setMounted:b}=We(E);D(()=>{if(!(!E||!d))return p(_=>_.concat(d)),()=>{p(_=>_.filter(L=>L!==d))}},[E,d,p]);let w=ae.useRef(null),[C,te]=ae.useState(null),[q,G]=ae.useState(null),I=m.error;!V&&F?I=R:m.errors.length>1&&(I=m.errors);let M=I??"";Array.isArray(I)&&(M=I.length>1?(0,gt.jsx)("ul",{children:I.map(_=>(0,gt.jsx)("li",{children:_},_))}):I[0]??"");let U=Array.isArray(I)?JSON.stringify(I):I;E&&U!==q&&(G(U),te(M)),ar({open:E,ref:w,onComplete(){E||b(!1)}});let j={...f,transitionStatus:c},Y=$("div",t,{ref:[o,w],state:j,props:[{id:d,children:E?M:C},u],stateAttributesMapping:Yr,enabled:k});return k?Y:null},"FieldError"));Rt.displayName="FieldError";var lr=g(y(),1);var ht=lr.forwardRef(r(function(t,o){let{render:n,id:i,className:s,style:a,...l}=t,u=J(i),d=B(!1),m=Ue(),{setMessageIds:f}=P(),h={...d.state,disabled:d.disabled||m.disabled};return D(()=>{if(u)return f(v=>v.concat(u)),()=>{f(v=>v.filter(R=>R!==u))}},[u,f]),$("p",t,{ref:o,state:h,props:[{id:u},l],stateAttributesMapping:W})},"FieldDescription"));ht.displayName="FieldDescription";var Ge=g(y(),1);var Q=g(y(),1);function ur({controlled:e,default:t,name:o,state:n="value"}){let{current:i}=Q.useRef(e!==void 0),[s,a]=Q.useState(t),l=i?e:s;{Q.useEffect(()=>{i!==(e!==void 0)&&de([`A component is changing the ${i?"":"un"}controlled ${n} state of ${o} to be ${i?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
3
+ `))},[n,o,e]);let{current:d}=Q.useRef(t);Q.useEffect(()=>{!i&&cr(d)!==cr(t)&&de([`A component is changing the default ${n} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
4
+ `))},[t])}let u=Q.useCallback(d=>{i||a(d)},[]);return[l,u]}r(ur,"useControlled");function cr(e){let t=0,o=new WeakMap;try{return JSON.stringify(e,r(function(s,a){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof a=="bigint")return`__bigint__:${a}`;if(a!==null&&typeof a=="object"){let l=o.get(a);if(l!==void 0)return`__object__:${l}`;o.set(a,t),t+=1}return a}},"replacer"))??`__top__:${typeof e}`}catch{return"__unserializable__"}}r(cr,"serializeToDevModeString");var dr=g(y(),1);function fr(e,t,o,n,i=!0,s){let{registerFieldControl:a}=B(),l=dr.useRef(null);l.current||(l.current=Symbol()),D(()=>{let u=l.current;return!u||!i?void 0:(a(u,{controlRef:e,getValue:n,id:t,name:s,value:o}),()=>{a(u,void 0)})},[e,i,n,t,s,a,o])}r(fr,"useRegisterFieldControl");var qe={};re(qe,{cancelOpen:()=>Eo,chipRemovePress:()=>ro,clearPress:()=>to,closePress:()=>Zr,closeWatcher:()=>po,decrementPress:()=>io,disabled:()=>Io,drag:()=>Ro,escapeKey:()=>mo,focusOut:()=>fo,imperativeAction:()=>To,incrementPress:()=>no,initial:()=>Fo,inputBlur:()=>lo,inputChange:()=>so,inputClear:()=>ao,inputPaste:()=>co,inputPress:()=>uo,itemPress:()=>Qr,keyboard:()=>xo,linkPress:()=>eo,listNavigation:()=>bo,missing:()=>yo,none:()=>Kr,outsidePress:()=>Xr,pointer:()=>go,scrub:()=>vo,siblingOpen:()=>Co,swipe:()=>Do,trackPress:()=>oo,triggerFocus:()=>Jr,triggerHover:()=>zr,triggerPress:()=>Hr,wheel:()=>ho,windowResize:()=>Vo});var Kr="none",Hr="trigger-press",zr="trigger-hover",Jr="trigger-focus",Xr="outside-press",Qr="item-press",Zr="close-press",eo="link-press",to="clear-press",ro="chip-remove-press",oo="track-press",no="increment-press",io="decrement-press",so="input-change",ao="input-clear",lo="input-blur",co="input-paste",uo="input-press",fo="focus-out",mo="escape-key",po="close-watcher",bo="list-navigation",xo="keyboard",go="pointer",Ro="drag",ho="wheel",vo="scrub",Eo="cancel-open",Co="sibling-open",Io="disabled",yo="missing",Fo="initial",To="imperative-action",Do="swipe",Vo="window-resize";function mr(e,t,o,n){let i=!1,s=!1,a=n??ue;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:o,...a}}r(mr,"createChangeEventDetails");var vt=Ge.forwardRef(r(function(t,o){let{render:n,className:i,id:s,name:a,value:l,disabled:u=!1,onValueChange:d,defaultValue:m,autoFocus:f=!1,style:h,...p}=t,{state:v,name:R,disabled:F,setTouched:V,setDirty:E,validityData:k,setFocused:c,setFilled:b,validationMode:w,validation:C}=B(),{clearErrors:te}=z(),q=F||u,G=R??a,I={...v,disabled:q},{labelId:M}=P(),U=jt({id:s});D(()=>{let x=l!=null;C.inputRef.current?.value||x&&l!==""?b(!0):x&&l===""&&b(!1)},[C.inputRef,b,l]);let j=Ge.useRef(null);D(()=>{f&&j.current===ut(Ne(j.current))&&c(!0)},[f,c]);let[Y]=ur({controlled:l,default:m,name:"FieldControl",state:"value"}),_=l!==void 0,L=_?Y:void 0,A=T(()=>C.inputRef.current?.value);return fr(C.inputRef,U,L,A,!q,a),$("input",t,{ref:[o,j],state:I,props:[{id:U,disabled:q,name:G,ref:C.inputRef,"aria-labelledby":M,autoFocus:f,..._?{value:L}:{defaultValue:m},onChange(x){let K=x.currentTarget.value;d?.(K,mr(qe.none,x.nativeEvent)),E(K!==k.initialValue),b(K!==""),x.nativeEvent.defaultPrevented||(te(G),C.change(K))},onFocus(){c(!0)},onBlur(x){V(!0),c(!1),w==="onBlur"&&C.commit(x.currentTarget.value)},onKeyDown(x){x.currentTarget.tagName==="INPUT"&&x.key==="Enter"&&(V(!0),C.commit(x.currentTarget.value))}},p,x=>C.getValidationProps(q,x)],stateAttributesMapping:W})},"FieldControl"));vt.displayName="FieldControl";var ve=g(y(),1);var pr=g(ce(),1);var Et=r(function(t){let{children:o}=t,{validityData:n,invalid:i}=B(!1),s=ve.useMemo(()=>se(n,i),[n,i]),a=s.state.valid===!1,{transitionStatus:l}=We(a),u=ve.useMemo(()=>({...s,validity:s.state,transitionStatus:l}),[s,l]);return(0,pr.jsx)(ve.Fragment,{children:o(u)})},"FieldValidity");Et.displayName="FieldValidity";var Ke=g(y(),1);var Ye=g(y(),1);var br=Ye.createContext(void 0);br.displayName="CheckboxGroupContext";function xr(e=!0){let t=Ye.useContext(br);if(t===void 0&&!e)throw new Error("Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.");return t}r(xr,"useCheckboxGroupContext");var Ct=g(ce(),1);var It=Ke.forwardRef(r(function(t,o){let{render:n,className:i,style:s,disabled:a=!1,...l}=t,{state:u,disabled:d}=B(!1),m=d||a,f={...u,disabled:m},h=xr(),v=h?.allValues!==void 0?h?.parent.id:void 0,R=Ke.useMemo(()=>({disabled:m}),[m]),F=$("div",t,{ref:o,state:f,props:l,stateAttributesMapping:W});return(0,Ct.jsx)(ge,{controlId:v,children:(0,Ct.jsx)(ke.Provider,{value:R,children:F})})},"FieldItem"));It.displayName="FieldItem";var Rr=g(ce(),1);var ze=gr.forwardRef(r(function(t,o){return(0,Rr.jsx)(He.Control,{ref:o,...t})},"Input"));ze.displayName="Input";var vr=g(Dr(),1);function Ya(e){let t=(0,hr.c)(10),o,n,i;t[0]!==e?({className:o,type:i,...n}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=i):(o=t[1],n=t[2],i=t[3]);let s;t[4]!==o?(s=At("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),t[4]=o,t[5]=s):s=t[5];let a;return t[6]!==n||t[7]!==s||t[8]!==i?(a=(0,vr.jsxDEV)(ze,{type:i,"data-slot":"input",className:s,...n},void 0,!1),t[6]=n,t[7]=s,t[8]=i,t[9]=a):a=t[9],a}r(Ya,"Input");export{W as a,B as b,z as c,kt as d,J as e,P as f,jt as g,Ne as h,we as i,lt as j,Tn as k,Dn as l,Vn as m,An as n,ut as o,Gt as p,dt as q,kn as r,Un as s,jn as t,Ur as u,Bn as v,$n as w,Wn as x,qn as y,Kt as z,_e as A,ft as B,zt as C,Ue as D,X as E,tr as F,rr as G,$e as H,or as I,ir as J,ar as K,We as L,ur as M,fr as N,qe as O,mr as P,xr as Q,Ya as R};
@@ -0,0 +1,6 @@
1
+ import{a as o,c as N,f as Q}from"./chunk-RRCPZMC2.js";var C=N(i=>{"use strict";(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===B?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case m:return"Fragment";case U:return"Profiler";case L:return"StrictMode";case G:return"Suspense";case X:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case W:return"Portal";case V:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case z:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case d:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}o(l,"getComponentNameFromType");function p(e){return""+e}o(p,"testStringCoercion");function v(e){try{p(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),p(e)}}o(v,"checkKeyStringCoercion");function f(e){if(e===m)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===d)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}o(f,"getTaskName");function Y(){var e=b.A;return e===null?null:e.getOwner()}o(Y,"getOwner");function R(){return Error("react-stack-top-frame")}o(R,"UnknownOwner");function I(e){if(A.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}o(I,"hasValidKey");function D(e,r){function t(){S||(S=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}o(t,"warnAboutAccessingKey"),t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}o(D,"defineKeyPropWarningGetter");function $(){var e=l(this.type);return w[e]||(w[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}o($,"elementRefGetterWithDeprecationWarning");function F(e,r,t,n,u,_){var a=t.ref;return e={$$typeof:y,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:$}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:u}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}o(F,"ReactElement");function O(e,r,t,n,u,_){var a=r.children;if(a!==void 0)if(n)if(H(a)){for(n=0;n<a.length;n++)k(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else k(a);if(A.call(r,"key")){a=l(e);var c=Object.keys(r).filter(function(Z){return Z!=="key"});n=0<c.length?"{key: someKey, "+c.join(": ..., ")+": ...}":"{key: someKey}",h[a+n]||(c=0<c.length?"{"+c.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,n,a,c,a),h[a+n]=!0)}if(a=null,t!==void 0&&(v(t),a=""+t),I(r)&&(v(r.key),a=""+r.key),"key"in r){t={};for(var T in r)T!=="key"&&(t[T]=r[T])}else t=r;return a&&D(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),F(e,a,t,Y(),u,_)}o(O,"jsxDEVImpl");function k(e){g(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===d&&(e._payload.status==="fulfilled"?g(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}o(k,"validateChildKeys");function g(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}o(g,"isValidElement");var s=Q(),y=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),V=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),b=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,H=Array.isArray,E=console.createTask?console.createTask:function(){return null};s={react_stack_bottom_frame:o(function(e){return e()},"react_stack_bottom_frame")};var S,w={},P=s.react_stack_bottom_frame.bind(s,R)(),j=E(f(R)),h={};i.Fragment=m,i.jsx=function(e,r,t){var n=1e4>b.recentlyCreatedOwnerStacks++;return O(e,r,t,!1,n?Error("react-stack-top-frame"):P,n?E(f(e)):j)},i.jsxs=function(e,r,t){var n=1e4>b.recentlyCreatedOwnerStacks++;return O(e,r,t,!0,n?Error("react-stack-top-frame"):P,n?E(f(e)):j)}})()});var J=N((te,x)=>{"use strict";x.exports=C()});export{J as a};
@@ -0,0 +1 @@
1
+ import{e as v,f as U}from"./chunk-RRCPZMC2.js";var s=[["path",{d:"M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var a=[["path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var o=[["path",{d:"M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var r=[["path",{d:"M18 6L6.00081 17.9992M17.9992 18L6 6.00085",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var e=[["path",{d:"M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var f=[["path",{d:"M17 17L21 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var S=[["path",{d:"M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M11.4999 12.5L14.9999 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var m=[["path",{d:"M2 12C2 8.31087 2 6.4663 2.81382 5.15877C3.1149 4.67502 3.48891 4.25427 3.91891 3.91554C5.08116 3 6.72077 3 10 3H14C17.2792 3 18.9188 3 20.0811 3.91554C20.5111 4.25427 20.8851 4.67502 21.1862 5.15877C22 6.4663 22 8.31087 22 12C22 15.6891 22 17.5337 21.1862 18.8412C20.8851 19.325 20.5111 19.7457 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7457 3.1149 19.325 2.81382 18.8412C2 17.5337 2 15.6891 2 12Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M9.5 3L9.5 21",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5 7H6M5 10H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]];var h=[["path",{d:"M5 14L8.5 17.5L19 6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var k=[["path",{d:"M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var n=v(U(),1),H={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none"},A=(0,n.forwardRef)(({color:u="currentColor",size:d=24,strokeWidth:c,absoluteStrokeWidth:B=!1,className:w="",altIcon:F,showAlt:M=!1,icon:L,primaryColor:I,secondaryColor:i,disableSecondaryOpacity:P=!1,...D},T)=>{let x=c!==void 0?B?Number(c)*24/Number(d):c:void 0,C=x!==void 0?{strokeWidth:x,stroke:"currentColor"}:{},R={ref:T,...H,width:d,height:d,color:I||u,className:w,...C,...D},y=[...M&&F?F:L].sort(([,p],[,t])=>{let l=p.opacity!==void 0;return t.opacity!==void 0?1:l?-1:0}).map(([p,t])=>{let l=t.opacity!==void 0,g=l&&!P?t.opacity:void 0,b=i?{...t.stroke!==void 0?{stroke:l?i:I||u}:{fill:l?i:I||u}}:{};return(0,n.createElement)(p,{...t,...C,...b,opacity:g,key:t.key})});return(0,n.createElement)("svg",R,y)});A.displayName="HugeiconsIcon";export{a,o as b,r as c,e as d,s as e,f,S as g,m as h,h as i,k as j,A as k};
@@ -0,0 +1 @@
1
+ import{a as e,e as s,f as d}from"./chunk-RRCPZMC2.js";function u(n,o,r,c){return n.addEventListener(o,r,c),()=>{n.removeEventListener(o,r,c)}}e(u,"addEventListener");var t=s(d(),1);var i=t.createContext(void 0);i.displayName="DirectionContext";function f(){return t.useContext(i)?.direction??"ltr"}e(f,"useDirection");export{u as a,f as b};
@@ -0,0 +1 @@
1
+ import{a as S}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{a as C}from"./chunk-BOXSWNXZ.js";import{a as u}from"./chunk-TAD43CG5.js";import{b as T}from"./chunk-C7WTJLC3.js";import{a as N,e as b}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as h}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
@@ -0,0 +1,3 @@
1
+ import{a as J}from"./chunk-YBGC4PPD.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-UKDJ4H7I.js";import{b as j}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as D}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-BOXSWNXZ.js";import{c as L}from"./chunk-C7WTJLC3.js";import{a as v,e as y}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as _}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as E,e as S,f as w,g as b,k as I}from"./chunk-E75ANNWX.js";import{b as N}from"./chunk-GMSGZDDH.js";import{a as o,e as R,f as K,h as U}from"./chunk-RRCPZMC2.js";var c=R(K(),1);var e=R(U(),1);var V=S(f.exportShard),X=S(f.importShard),z=o(m=>m.map(a=>JSON.stringify(a)).join(`
2
+ `),"toNdjson"),G=o(m=>{let a=[],x=m.split(`
3
+ `);for(let[r,n]of x.entries()){let h=n.trim();if(h==="")continue;let l=JSON.parse(h);if(typeof l!="object"||l===null)throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);let s=l;if(typeof s.table!="string"||typeof s.doc!="object"||s.doc===null||Array.isArray(s.doc))throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);a.push(s)}return a},"parseNdjson"),ie=o(({initialShardKey:m})=>{let a=_(),x=L(),r=E(),[n,h]=(0,c.useState)(m??""),[l,s]=(0,c.useState)(""),[C,p]=(0,c.useState)(!1),[T,u]=(0,c.useState)(null),[i,g]=(0,c.useState)(null),[A,O]=(0,c.useState)(null),$=o(async()=>{p(!0),u(null),g(null);try{let t=await a.query(V,{},w(n));j(n),s(z(t.rows)),O(t.rows.length)}catch(t){u(b(t))}finally{p(!1)}},"exportShard"),k=o(async()=>{p(!0),u(null),g(null),O(null);let t;try{t=G(l)}catch(d){u(r("Invalid NDJSON: {message}",{message:b(d)})),p(!1);return}try{let d=await a.query(X,{rows:t},w(n));j(n),g(d),x(f.readTablePage),x(f.listTables)}catch(d){u(b(d))}finally{p(!1)}},"importShard"),M=i===null?0:Object.values(i.inserted).reduce((t,d)=>t+d,0),q=o(()=>{I($())},"runExport"),F=o(()=>{I(k())},"runImport"),H=o(t=>{s(t.target.value)},"onNdjsonChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Export")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(B,{onChange:h,testId:"ei-shard-input",value:n},void 0,!1),(0,e.jsxDEV)(D,{"data-testid":"ei-export",disabled:C,onClick:q,type:"button",children:r("Export")},void 0,!1)]},void 0,!0),A!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:r("Exported {count} rows.",{count:A})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Import")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)(P,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:H,placeholder:'{"table":"messages","doc":{\u2026}}',value:l},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsxDEV)(J,{confirmLabel:r("Import (writes rows)?"),disabled:C||l.trim()==="",onConfirm:F,testId:"ei-import",children:r("Import")},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:r("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:M})},void 0,!1),i.errors.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(t=>(0,e.jsxDEV)("li",{className:"text-xs text-destructive",children:r("line {line} ({table}): {message}",{line:t.line,message:t.message,table:t.table})},`${t.table}-${t.line.toString()}`,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),T!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:T},void 0,!1)]},void 0,!0)},"ExportImportPanel");export{ie as ExportImportPanel};
@@ -0,0 +1,4 @@
1
+ import{a as R}from"./chunk-TQ36RWOP.js";import{R as C}from"./chunk-3CJW6NWG.js";import{c as k}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as w,e as N}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b,g as S,k as T,m as L}from"./chunk-E75ANNWX.js";import{a as f,e as y,f as W,g as j,h as D}from"./chunk-RRCPZMC2.js";var O=y(j(),1),v=y(W(),1);var t=y(D(),1);var I=f(s=>{let e=(0,O.c)(23),{destination:o}=s,h=b(),m;e[0]!==o.snippet?(m=f(()=>{L(o.snippet)},"t1"),e[0]=o.snippet,e[1]=m):m=e[1];let u=m,r;e[2]!==o.title?(r=(0,t.jsxDEV)("h4",{className:"text-sm font-semibold",children:o.title},void 0,!1),e[2]=o.title,e[3]=r):r=e[3];let a;e[4]!==o.description?(a=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[4]=o.description,e[5]=a):a=e[5];let l;e[6]!==r||e[7]!==a?(l=(0,t.jsxDEV)("div",{children:[r,a]},void 0,!0),e[6]=r,e[7]=a,e[8]=l):l=e[8];let g=`drain-copy-${o.id}`,d;e[9]!==h?(d=h("Copy"),e[9]=h,e[10]=d):d=e[10];let i;e[11]!==u||e[12]!==g||e[13]!==d?(i=(0,t.jsxDEV)(k,{"data-testid":g,onClick:u,size:"sm",variant:"outline",children:d},void 0,!1),e[11]=u,e[12]=g,e[13]=d,e[14]=i):i=e[14];let n;e[15]!==l||e[16]!==i?(n=(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-3",children:[l,i]},void 0,!0),e[15]=l,e[16]=i,e[17]=n):n=e[17];let c;e[18]!==o.snippet?(c=(0,t.jsxDEV)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:o.snippet},void 0,!1),e[18]=o.snippet,e[19]=c):c=e[19];let p;return e[20]!==n||e[21]!==c?(p=(0,t.jsxDEV)(w,{className:"py-0","data-testid":"drain-card",children:(0,t.jsxDEV)(N,{className:"p-3",children:[n,c]},void 0,!0)},void 0,!1),e[20]=n,e[21]=c,e[22]=p):p=e[22],p},"DestinationRow"),F=f(()=>{let s=b(),e=[{description:s("Stream every request log to R2, a SIEM, or a third-party log service."),id:"logpush",snippet:["{",' "logpush": true',"}"].join(`
2
+ `),title:s("Logpush")},{description:s("Send logs programmatically to a Worker for custom capture and forwarding."),id:"tail-worker",snippet:["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"].join(`
3
+ `),title:s("Tail Workers")},{description:s("Retain and query recent request logs directly in Cloudflare's dashboard."),id:"workers-logs",snippet:["{",' "observability": { "enabled": true }',"}"].join(`
4
+ `),title:s("Workers Logs")}],[o,h]=(0,v.useState)(""),[m,u]=(0,v.useState)(!1),[r,a]=(0,v.useState)(null),l=f(async()=>{let i=o.trim();if(i==="")return;let n="fetch"in globalThis?globalThis.fetch:void 0;if(n===void 0){a({kind:"error",message:s("fetch is unavailable in this environment.")});return}let c={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};u(!0),a(null);let p=performance.now();try{let x=await n(i,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});a({kind:"success",latencyMs:Math.round(performance.now()-p),status:x.status})}catch(x){a({kind:"error",message:S(x)})}finally{u(!1)}},"sendTest"),g=f(()=>{T(l())},"onSendTest"),d=f(i=>{h(i.target.value)},"onWebhookUrlChange");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:R,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:s("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Cloudflare destinations")},void 0,!1),e.map(i=>(0,t.jsxDEV)(I,{destination:i},i.id,!1))]},void 0,!0),(0,t.jsxDEV)(w,{className:"py-0",children:(0,t.jsxDEV)(N,{className:"p-3",children:(0,t.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,t.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Webhook test")},void 0,!1),(0,t.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:s("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(C,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:d,placeholder:s("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,t.jsxDEV)(k,{"data-testid":"drain-webhook-test",disabled:m||o.trim()==="",onClick:g,children:s(m?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),r!==null&&(0,t.jsxDEV)("p",{className:r.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:r.kind==="error"?"alert":void 0,children:r.kind==="success"?s("Delivered \u2014 status {status} in {latency}ms",{latency:r.latencyMs,status:r.status}):s("Failed: {message}",{message:r.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel");export{F as LogDrainsPanel};