zudoku 0.13.7 → 0.14.1

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 (177) hide show
  1. package/cli.js +2 -2
  2. package/dist/app/entry.client.js +2 -2
  3. package/dist/app/entry.client.js.map +1 -1
  4. package/dist/app/entry.server.js +3 -0
  5. package/dist/app/entry.server.js.map +1 -1
  6. package/dist/app/main.d.ts +1 -0
  7. package/dist/app/main.js +6 -21
  8. package/dist/app/main.js.map +1 -1
  9. package/dist/app/standalone.js.map +1 -1
  10. package/dist/cli/common/machine-id/lib.js.map +1 -1
  11. package/dist/cli/common/outdated.js.map +1 -1
  12. package/dist/cli/common/utils/box.js.map +1 -1
  13. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  14. package/dist/config/validators/SidebarSchema.d.ts +24 -1
  15. package/dist/config/validators/SidebarSchema.js +76 -39
  16. package/dist/config/validators/SidebarSchema.js.map +1 -1
  17. package/dist/config/validators/validate.d.ts +329 -264
  18. package/dist/config/validators/validate.js +11 -10
  19. package/dist/config/validators/validate.js.map +1 -1
  20. package/dist/index.d.ts +4 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/components/Header.js +6 -1
  24. package/dist/lib/components/Header.js.map +1 -1
  25. package/dist/lib/components/Heading.d.ts +1 -1
  26. package/dist/lib/components/SlotletProvider.d.ts +2 -1
  27. package/dist/lib/components/SlotletProvider.js.map +1 -1
  28. package/dist/lib/components/SyntaxHighlight.js +4 -1
  29. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  30. package/dist/lib/components/TopNavigation.js +30 -5
  31. package/dist/lib/components/TopNavigation.js.map +1 -1
  32. package/dist/lib/components/context/ZudokuContext.d.ts +6 -12
  33. package/dist/lib/components/context/ZudokuContext.js +26 -20
  34. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  35. package/dist/lib/components/navigation/Sidebar.js +3 -3
  36. package/dist/lib/components/navigation/Sidebar.js.map +1 -1
  37. package/dist/lib/components/navigation/SidebarCategory.js +2 -4
  38. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  39. package/dist/lib/components/navigation/SidebarItem.js +1 -3
  40. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  41. package/dist/lib/components/navigation/utils.js +10 -14
  42. package/dist/lib/components/navigation/utils.js.map +1 -1
  43. package/dist/lib/core/DevPortalContext.d.ts +3 -7
  44. package/dist/lib/core/DevPortalContext.js.map +1 -1
  45. package/dist/lib/core/plugins.d.ts +1 -0
  46. package/dist/lib/core/plugins.js.map +1 -1
  47. package/dist/lib/plugins/custom-pages/CustomPage.js +2 -2
  48. package/dist/lib/plugins/markdown/index.d.ts +5 -6
  49. package/dist/lib/plugins/markdown/index.js +31 -3
  50. package/dist/lib/plugins/markdown/index.js.map +1 -1
  51. package/dist/lib/plugins/markdown/resolver.d.ts +38 -0
  52. package/dist/lib/plugins/markdown/resolver.js +75 -0
  53. package/dist/lib/plugins/markdown/resolver.js.map +1 -0
  54. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  55. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  56. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  57. package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
  58. package/dist/lib/plugins/openapi/index.js.map +1 -1
  59. package/dist/lib/ui/Badge.d.ts +1 -1
  60. package/dist/lib/ui/Button.d.ts +1 -1
  61. package/dist/lib/ui/Command.d.ts +80 -0
  62. package/dist/lib/ui/Command.js +31 -0
  63. package/dist/lib/ui/Command.js.map +1 -0
  64. package/dist/lib/util/MdxComponents.js.map +1 -1
  65. package/dist/lib/util/useExposedProps.js +3 -2
  66. package/dist/lib/util/useExposedProps.js.map +1 -1
  67. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  68. package/dist/vite/build.js +7 -2
  69. package/dist/vite/build.js.map +1 -1
  70. package/dist/vite/config.js +11 -6
  71. package/dist/vite/config.js.map +1 -1
  72. package/dist/vite/debug.d.ts +1 -0
  73. package/dist/vite/debug.js +10 -0
  74. package/dist/vite/debug.js.map +1 -0
  75. package/dist/vite/plugin-config-reload.js +0 -2
  76. package/dist/vite/plugin-config-reload.js.map +1 -1
  77. package/dist/vite/plugin-docs.js +37 -26
  78. package/dist/vite/plugin-docs.js.map +1 -1
  79. package/dist/vite/plugin-frontmatter.d.ts +2 -1
  80. package/dist/vite/plugin-frontmatter.js +27 -24
  81. package/dist/vite/plugin-frontmatter.js.map +1 -1
  82. package/dist/vite/plugin-sidebar.js +7 -6
  83. package/dist/vite/plugin-sidebar.js.map +1 -1
  84. package/dist/vite/plugin.js +1 -1
  85. package/dist/vite/plugin.js.map +1 -1
  86. package/dist/vite/prerender.d.ts +5 -1
  87. package/dist/vite/prerender.js +6 -5
  88. package/dist/vite/prerender.js.map +1 -1
  89. package/lib/{utils-B2yoT99j.js → AnchorLink-BbB2q-jx.js} +214 -258
  90. package/lib/AnchorLink-BbB2q-jx.js.map +1 -0
  91. package/lib/{AuthenticationPlugin-Bpdes0cJ.js → AuthenticationPlugin-C9BHGXlE.js} +2 -2
  92. package/lib/{AuthenticationPlugin-Bpdes0cJ.js.map → AuthenticationPlugin-C9BHGXlE.js.map} +1 -1
  93. package/lib/Dialog-k70Qfukb.js +67 -0
  94. package/lib/Dialog-k70Qfukb.js.map +1 -0
  95. package/lib/{Markdown-1BO9EA_X.js → Markdown-BDcCAWwm.js} +18 -16
  96. package/lib/{Markdown-1BO9EA_X.js.map → Markdown-BDcCAWwm.js.map} +1 -1
  97. package/lib/{MdxPage-BEOcOICU.js → MdxPage-DKMH_t0f.js} +14 -13
  98. package/lib/{MdxPage-BEOcOICU.js.map → MdxPage-DKMH_t0f.js.map} +1 -1
  99. package/lib/{OperationList-Cea2Yt8e.js → OperationList-Tj7ubW_t.js} +3 -3
  100. package/lib/OperationList-Tj7ubW_t.js.map +1 -0
  101. package/lib/{Route-BHT-onwf.js → Route-C3DGB6OS.js} +2 -2
  102. package/lib/{Route-BHT-onwf.js.map → Route-C3DGB6OS.js.map} +1 -1
  103. package/lib/{Select-m1aXZGAP.js → Select-Bagt3Bme.js} +3 -3
  104. package/lib/{Select-m1aXZGAP.js.map → Select-Bagt3Bme.js.map} +1 -1
  105. package/lib/{SlotletProvider-CPfsBw39.js → SlotletProvider-Da7eFgd2.js} +3 -3
  106. package/lib/{SlotletProvider-CPfsBw39.js.map → SlotletProvider-Da7eFgd2.js.map} +1 -1
  107. package/lib/{ZudokuContext-D1D8Anlj.js → ZudokuContext-BKXGJTmu.js} +459 -410
  108. package/lib/ZudokuContext-BKXGJTmu.js.map +1 -0
  109. package/lib/__vite-browser-external-BYRIRx8p.js +9 -0
  110. package/lib/__vite-browser-external-BYRIRx8p.js.map +1 -0
  111. package/lib/assets/worker-Bf8vjASY.js.map +1 -1
  112. package/lib/{hook-JSRuxV1P.js → hook-sn0zMTkE.js} +2 -2
  113. package/lib/{hook-JSRuxV1P.js.map → hook-sn0zMTkE.js.map} +1 -1
  114. package/lib/{index-Cj-F-4ME.js → index-AjWCJNGC.js} +1180 -1238
  115. package/lib/index-AjWCJNGC.js.map +1 -0
  116. package/lib/ui/Command.js +550 -0
  117. package/lib/ui/Command.js.map +1 -0
  118. package/lib/useExposedProps-ChOIUaS4.js +9 -0
  119. package/lib/useExposedProps-ChOIUaS4.js.map +1 -0
  120. package/lib/zudoku.auth-clerk.js +1 -1
  121. package/lib/zudoku.auth-openid.js +2 -2
  122. package/lib/zudoku.components.js +467 -451
  123. package/lib/zudoku.components.js.map +1 -1
  124. package/lib/zudoku.plugin-api-keys.js +6 -6
  125. package/lib/zudoku.plugin-custom-pages.js +14 -14
  126. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  127. package/lib/zudoku.plugin-markdown.js +93 -27
  128. package/lib/zudoku.plugin-markdown.js.map +1 -1
  129. package/lib/zudoku.plugin-openapi.js +5 -6
  130. package/lib/zudoku.plugin-openapi.js.map +1 -1
  131. package/package.json +4 -3
  132. package/src/app/entry.client.tsx +4 -2
  133. package/src/app/entry.server.tsx +4 -0
  134. package/src/app/main.css +4 -0
  135. package/src/app/main.tsx +9 -25
  136. package/src/app/standalone.tsx +1 -1
  137. package/src/lib/components/Header.tsx +17 -2
  138. package/src/lib/components/SlotletProvider.tsx +2 -0
  139. package/src/lib/components/SyntaxHighlight.tsx +5 -1
  140. package/src/lib/components/TopNavigation.tsx +58 -24
  141. package/src/lib/components/context/ZudokuContext.ts +28 -20
  142. package/src/lib/components/navigation/Sidebar.tsx +5 -5
  143. package/src/lib/components/navigation/SidebarCategory.tsx +2 -4
  144. package/src/lib/components/navigation/SidebarItem.tsx +1 -3
  145. package/src/lib/components/navigation/utils.ts +11 -16
  146. package/src/lib/core/DevPortalContext.ts +3 -7
  147. package/src/lib/core/plugins.ts +2 -0
  148. package/src/lib/plugins/custom-pages/CustomPage.tsx +2 -2
  149. package/src/lib/plugins/markdown/index.tsx +49 -12
  150. package/src/lib/plugins/markdown/resolver.ts +92 -0
  151. package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
  152. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
  153. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  154. package/src/lib/plugins/openapi/client/worker.ts +2 -2
  155. package/src/lib/plugins/openapi/index.tsx +1 -1
  156. package/src/lib/ui/Command.tsx +151 -0
  157. package/src/lib/util/MdxComponents.tsx +0 -1
  158. package/src/lib/util/useExposedProps.tsx +8 -2
  159. package/src/lib/util/useScrollToAnchor.ts +1 -1
  160. package/dist/lib/plugins/markdown/generateRoutes.d.ts +0 -3
  161. package/dist/lib/plugins/markdown/generateRoutes.js +0 -21
  162. package/dist/lib/plugins/markdown/generateRoutes.js.map +0 -1
  163. package/dist/lib/ui/Note.d.ts +0 -8
  164. package/dist/lib/ui/Note.js +0 -23
  165. package/dist/lib/ui/Note.js.map +0 -1
  166. package/lib/OperationList-Cea2Yt8e.js.map +0 -1
  167. package/lib/ZudokuContext-D1D8Anlj.js.map +0 -1
  168. package/lib/index-Cj-F-4ME.js.map +0 -1
  169. package/lib/joinPath-B7kNnUX4.js +0 -8
  170. package/lib/joinPath-B7kNnUX4.js.map +0 -1
  171. package/lib/ui/Note.js +0 -51
  172. package/lib/ui/Note.js.map +0 -1
  173. package/lib/useExposedProps-B9K-9GTc.js +0 -9
  174. package/lib/useExposedProps-B9K-9GTc.js.map +0 -1
  175. package/lib/utils-B2yoT99j.js.map +0 -1
  176. package/src/lib/plugins/markdown/generateRoutes.tsx +0 -38
  177. package/src/lib/ui/Note.tsx +0 -58
@@ -0,0 +1,550 @@
1
+ import { j as A } from "../jsx-runtime-B6kdoens.js";
2
+ import * as Q from "@radix-ui/react-dialog";
3
+ import * as a from "react";
4
+ import we from "react";
5
+ import { Primitive as j } from "@radix-ui/react-primitive";
6
+ import { useId as F } from "@radix-ui/react-id";
7
+ import { Search as Le } from "lucide-react";
8
+ import { D as De, a as je } from "../Dialog-k70Qfukb.js";
9
+ import { c as U } from "../cn-BmFQLtkS.js";
10
+ var Se = 1, Me = 0.9, Ve = 0.8, $e = 0.17, ne = 0.1, ae = 0.999, Te = 0.9999, Ke = 0.99, Ue = /[\\\/_+.#"@\[\(\{&]/, Ge = /[\\\/_+.#"@\[\(\{&]/g, qe = /[\s-]/, _e = /[\s-]/g;
11
+ function ie(e, n, t, f, l, i, s) {
12
+ if (i === n.length) return l === e.length ? Se : Ke;
13
+ var v = `${l},${i}`;
14
+ if (s[v] !== void 0) return s[v];
15
+ for (var g = f.charAt(i), m = t.indexOf(g, l), c = 0, u, S, E, R; m >= 0; ) u = ie(e, n, t, f, m + 1, i + 1, s), u > c && (m === l ? u *= Se : Ue.test(e.charAt(m - 1)) ? (u *= Ve, E = e.slice(l, m - 1).match(Ge), E && l > 0 && (u *= Math.pow(ae, E.length))) : qe.test(e.charAt(m - 1)) ? (u *= Me, R = e.slice(l, m - 1).match(_e), R && l > 0 && (u *= Math.pow(ae, R.length))) : (u *= $e, l > 0 && (u *= Math.pow(ae, m - l))), e.charAt(m) !== n.charAt(i) && (u *= Te)), (u < ne && t.charAt(m - 1) === f.charAt(i + 1) || f.charAt(i + 1) === f.charAt(i) && t.charAt(m - 1) !== f.charAt(i)) && (S = ie(e, n, t, f, m + 1, i + 2, s), S * ne > u && (u = S * ne)), u > c && (c = u), m = t.indexOf(g, m + 1);
16
+ return s[v] = c, c;
17
+ }
18
+ function ye(e) {
19
+ return e.toLowerCase().replace(_e, " ");
20
+ }
21
+ function Fe(e, n, t) {
22
+ return e = t && t.length > 0 ? `${e + " " + t.join(" ")}` : e, ie(e, n, ye(e), ye(n), 0, 0, {});
23
+ }
24
+ var ce = { exports: {} }, le = {};
25
+ /**
26
+ * @license React
27
+ * use-sync-external-store-shim.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */
34
+ var Ee;
35
+ function Pe() {
36
+ if (Ee) return le;
37
+ Ee = 1;
38
+ var e = we;
39
+ function n(u, S) {
40
+ return u === S && (u !== 0 || 1 / u === 1 / S) || u !== u && S !== S;
41
+ }
42
+ var t = typeof Object.is == "function" ? Object.is : n, f = e.useState, l = e.useEffect, i = e.useLayoutEffect, s = e.useDebugValue;
43
+ function v(u, S) {
44
+ var E = S(), R = f({ inst: { value: E, getSnapshot: S } }), C = R[0].inst, I = R[1];
45
+ return i(function() {
46
+ C.value = E, C.getSnapshot = S, g(C) && I({ inst: C });
47
+ }, [u, E, S]), l(function() {
48
+ return g(C) && I({ inst: C }), u(function() {
49
+ g(C) && I({ inst: C });
50
+ });
51
+ }, [u]), s(E), E;
52
+ }
53
+ function g(u) {
54
+ var S = u.getSnapshot;
55
+ u = u.value;
56
+ try {
57
+ var E = S();
58
+ return !t(u, E);
59
+ } catch {
60
+ return !0;
61
+ }
62
+ }
63
+ function m(u, S) {
64
+ return S();
65
+ }
66
+ var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? m : v;
67
+ return le.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, le;
68
+ }
69
+ var oe = {};
70
+ /**
71
+ * @license React
72
+ * use-sync-external-store-shim.development.js
73
+ *
74
+ * Copyright (c) Facebook, Inc. and its affiliates.
75
+ *
76
+ * This source code is licensed under the MIT license found in the
77
+ * LICENSE file in the root directory of this source tree.
78
+ */
79
+ var xe;
80
+ function Be() {
81
+ return xe || (xe = 1, process.env.NODE_ENV !== "production" && function() {
82
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
83
+ var e = we, n = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
84
+ function t(w) {
85
+ {
86
+ for (var x = arguments.length, k = new Array(x > 1 ? x - 1 : 0), p = 1; p < x; p++)
87
+ k[p - 1] = arguments[p];
88
+ f("error", w, k);
89
+ }
90
+ }
91
+ function f(w, x, k) {
92
+ {
93
+ var p = n.ReactDebugCurrentFrame, _ = p.getStackAddendum();
94
+ _ !== "" && (x += "%s", k = k.concat([_]));
95
+ var D = k.map(function(N) {
96
+ return String(N);
97
+ });
98
+ D.unshift("Warning: " + x), Function.prototype.apply.call(console[w], console, D);
99
+ }
100
+ }
101
+ function l(w, x) {
102
+ return w === x && (w !== 0 || 1 / w === 1 / x) || w !== w && x !== x;
103
+ }
104
+ var i = typeof Object.is == "function" ? Object.is : l, s = e.useState, v = e.useEffect, g = e.useLayoutEffect, m = e.useDebugValue, c = !1, u = !1;
105
+ function S(w, x, k) {
106
+ c || e.startTransition !== void 0 && (c = !0, t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
107
+ var p = x();
108
+ if (!u) {
109
+ var _ = x();
110
+ i(p, _) || (t("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
111
+ }
112
+ var D = s({
113
+ inst: {
114
+ value: p,
115
+ getSnapshot: x
116
+ }
117
+ }), N = D[0].inst, M = D[1];
118
+ return g(function() {
119
+ N.value = p, N.getSnapshot = x, E(N) && M({
120
+ inst: N
121
+ });
122
+ }, [w, p, x]), v(function() {
123
+ E(N) && M({
124
+ inst: N
125
+ });
126
+ var P = function() {
127
+ E(N) && M({
128
+ inst: N
129
+ });
130
+ };
131
+ return w(P);
132
+ }, [w]), m(p), p;
133
+ }
134
+ function E(w) {
135
+ var x = w.getSnapshot, k = w.value;
136
+ try {
137
+ var p = x();
138
+ return !i(k, p);
139
+ } catch {
140
+ return !0;
141
+ }
142
+ }
143
+ function R(w, x, k) {
144
+ return x();
145
+ }
146
+ var C = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !C, G = I ? R : S, J = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : G;
147
+ oe.useSyncExternalStore = J, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
148
+ }()), oe;
149
+ }
150
+ process.env.NODE_ENV === "production" ? ce.exports = Pe() : ce.exports = Be();
151
+ var He = ce.exports, W = '[cmdk-group=""]', ue = '[cmdk-group-items=""]', We = '[cmdk-group-heading=""]', se = '[cmdk-item=""]', be = `${se}:not([aria-disabled="true"])`, de = "cmdk-item-select", $ = "data-value", ze = (e, n, t) => Fe(e, n, t), ke = a.createContext(void 0), Y = () => a.useContext(ke), Re = a.createContext(void 0), fe = () => a.useContext(Re), Ce = a.createContext(void 0), Oe = a.forwardRef((e, n) => {
152
+ let t = q(() => {
153
+ var r, d;
154
+ return { search: "", value: (d = (r = e.value) != null ? r : e.defaultValue) != null ? d : "", filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
155
+ }), f = q(() => /* @__PURE__ */ new Set()), l = q(() => /* @__PURE__ */ new Map()), i = q(() => /* @__PURE__ */ new Map()), s = q(() => /* @__PURE__ */ new Set()), v = Ie(e), { label: g, children: m, value: c, onValueChange: u, filter: S, shouldFilter: E, loop: R, disablePointerSelection: C = !1, vimBindings: I = !0, ...G } = e, J = F(), w = F(), x = F(), k = a.useRef(null), p = lt();
156
+ T(() => {
157
+ if (c !== void 0) {
158
+ let r = c.trim();
159
+ t.current.value = r, _.emit();
160
+ }
161
+ }, [c]), T(() => {
162
+ p(6, me);
163
+ }, []);
164
+ let _ = a.useMemo(() => ({ subscribe: (r) => (s.current.add(r), () => s.current.delete(r)), snapshot: () => t.current, setState: (r, d, h) => {
165
+ var o, y, b;
166
+ if (!Object.is(t.current[r], d)) {
167
+ if (t.current[r] = d, r === "search") ee(), M(), p(1, P);
168
+ else if (r === "value" && (h || p(5, me), ((o = v.current) == null ? void 0 : o.value) !== void 0)) {
169
+ let L = d ?? "";
170
+ (b = (y = v.current).onValueChange) == null || b.call(y, L);
171
+ return;
172
+ }
173
+ _.emit();
174
+ }
175
+ }, emit: () => {
176
+ s.current.forEach((r) => r());
177
+ } }), []), D = a.useMemo(() => ({ value: (r, d, h) => {
178
+ var o;
179
+ d !== ((o = i.current.get(r)) == null ? void 0 : o.value) && (i.current.set(r, { value: d, keywords: h }), t.current.filtered.items.set(r, N(d, h)), p(2, () => {
180
+ M(), _.emit();
181
+ }));
182
+ }, item: (r, d) => (f.current.add(r), d && (l.current.has(d) ? l.current.get(d).add(r) : l.current.set(d, /* @__PURE__ */ new Set([r]))), p(3, () => {
183
+ ee(), M(), t.current.value || P(), _.emit();
184
+ }), () => {
185
+ i.current.delete(r), f.current.delete(r), t.current.filtered.items.delete(r);
186
+ let h = B();
187
+ p(4, () => {
188
+ ee(), (h == null ? void 0 : h.getAttribute("id")) === r && P(), _.emit();
189
+ });
190
+ }), group: (r) => (l.current.has(r) || l.current.set(r, /* @__PURE__ */ new Set()), () => {
191
+ i.current.delete(r), l.current.delete(r);
192
+ }), filter: () => v.current.shouldFilter, label: g || e["aria-label"], getDisablePointerSelection: () => v.current.disablePointerSelection, listId: J, inputId: x, labelId: w, listInnerRef: k }), []);
193
+ function N(r, d) {
194
+ var h, o;
195
+ let y = (o = (h = v.current) == null ? void 0 : h.filter) != null ? o : ze;
196
+ return r ? y(r, t.current.search, d) : 0;
197
+ }
198
+ function M() {
199
+ if (!t.current.search || v.current.shouldFilter === !1) return;
200
+ let r = t.current.filtered.items, d = [];
201
+ t.current.filtered.groups.forEach((o) => {
202
+ let y = l.current.get(o), b = 0;
203
+ y.forEach((L) => {
204
+ let V = r.get(L);
205
+ b = Math.max(V, b);
206
+ }), d.push([o, b]);
207
+ });
208
+ let h = k.current;
209
+ H().sort((o, y) => {
210
+ var b, L;
211
+ let V = o.getAttribute("id"), X = y.getAttribute("id");
212
+ return ((b = r.get(X)) != null ? b : 0) - ((L = r.get(V)) != null ? L : 0);
213
+ }).forEach((o) => {
214
+ let y = o.closest(ue);
215
+ y ? y.appendChild(o.parentElement === y ? o : o.closest(`${ue} > *`)) : h.appendChild(o.parentElement === h ? o : o.closest(`${ue} > *`));
216
+ }), d.sort((o, y) => y[1] - o[1]).forEach((o) => {
217
+ var y;
218
+ let b = (y = k.current) == null ? void 0 : y.querySelector(`${W}[${$}="${encodeURIComponent(o[0])}"]`);
219
+ b == null || b.parentElement.appendChild(b);
220
+ });
221
+ }
222
+ function P() {
223
+ let r = H().find((h) => h.getAttribute("aria-disabled") !== "true"), d = r == null ? void 0 : r.getAttribute($);
224
+ _.setState("value", d || void 0);
225
+ }
226
+ function ee() {
227
+ var r, d, h, o;
228
+ if (!t.current.search || v.current.shouldFilter === !1) {
229
+ t.current.filtered.count = f.current.size;
230
+ return;
231
+ }
232
+ t.current.filtered.groups = /* @__PURE__ */ new Set();
233
+ let y = 0;
234
+ for (let b of f.current) {
235
+ let L = (d = (r = i.current.get(b)) == null ? void 0 : r.value) != null ? d : "", V = (o = (h = i.current.get(b)) == null ? void 0 : h.keywords) != null ? o : [], X = N(L, V);
236
+ t.current.filtered.items.set(b, X), X > 0 && y++;
237
+ }
238
+ for (let [b, L] of l.current) for (let V of L) if (t.current.filtered.items.get(V) > 0) {
239
+ t.current.filtered.groups.add(b);
240
+ break;
241
+ }
242
+ t.current.filtered.count = y;
243
+ }
244
+ function me() {
245
+ var r, d, h;
246
+ let o = B();
247
+ o && (((r = o.parentElement) == null ? void 0 : r.firstChild) === o && ((h = (d = o.closest(W)) == null ? void 0 : d.querySelector(We)) == null || h.scrollIntoView({ block: "nearest" })), o.scrollIntoView({ block: "nearest" }));
248
+ }
249
+ function B() {
250
+ var r;
251
+ return (r = k.current) == null ? void 0 : r.querySelector(`${se}[aria-selected="true"]`);
252
+ }
253
+ function H() {
254
+ var r;
255
+ return Array.from(((r = k.current) == null ? void 0 : r.querySelectorAll(be)) || []);
256
+ }
257
+ function te(r) {
258
+ let d = H()[r];
259
+ d && _.setState("value", d.getAttribute($));
260
+ }
261
+ function re(r) {
262
+ var d;
263
+ let h = B(), o = H(), y = o.findIndex((L) => L === h), b = o[y + r];
264
+ (d = v.current) != null && d.loop && (b = y + r < 0 ? o[o.length - 1] : y + r === o.length ? o[0] : o[y + r]), b && _.setState("value", b.getAttribute($));
265
+ }
266
+ function pe(r) {
267
+ let d = B(), h = d == null ? void 0 : d.closest(W), o;
268
+ for (; h && !o; ) h = r > 0 ? nt(h, W) : at(h, W), o = h == null ? void 0 : h.querySelector(be);
269
+ o ? _.setState("value", o.getAttribute($)) : re(r);
270
+ }
271
+ let ve = () => te(H().length - 1), he = (r) => {
272
+ r.preventDefault(), r.metaKey ? ve() : r.altKey ? pe(1) : re(1);
273
+ }, ge = (r) => {
274
+ r.preventDefault(), r.metaKey ? te(0) : r.altKey ? pe(-1) : re(-1);
275
+ };
276
+ return a.createElement(j.div, { ref: n, tabIndex: -1, ...G, "cmdk-root": "", onKeyDown: (r) => {
277
+ var d;
278
+ if ((d = G.onKeyDown) == null || d.call(G, r), !r.defaultPrevented) switch (r.key) {
279
+ case "n":
280
+ case "j": {
281
+ I && r.ctrlKey && he(r);
282
+ break;
283
+ }
284
+ case "ArrowDown": {
285
+ he(r);
286
+ break;
287
+ }
288
+ case "p":
289
+ case "k": {
290
+ I && r.ctrlKey && ge(r);
291
+ break;
292
+ }
293
+ case "ArrowUp": {
294
+ ge(r);
295
+ break;
296
+ }
297
+ case "Home": {
298
+ r.preventDefault(), te(0);
299
+ break;
300
+ }
301
+ case "End": {
302
+ r.preventDefault(), ve();
303
+ break;
304
+ }
305
+ case "Enter":
306
+ if (!r.nativeEvent.isComposing && r.keyCode !== 229) {
307
+ r.preventDefault();
308
+ let h = B();
309
+ if (h) {
310
+ let o = new Event(de);
311
+ h.dispatchEvent(o);
312
+ }
313
+ }
314
+ }
315
+ } }, a.createElement("label", { "cmdk-label": "", htmlFor: D.inputId, id: D.labelId, style: ut }, g), Z(e, (r) => a.createElement(Re.Provider, { value: _ }, a.createElement(ke.Provider, { value: D }, r))));
316
+ }), Ye = a.forwardRef((e, n) => {
317
+ var t, f;
318
+ let l = F(), i = a.useRef(null), s = a.useContext(Ce), v = Y(), g = Ie(e), m = (f = (t = g.current) == null ? void 0 : t.forceMount) != null ? f : s == null ? void 0 : s.forceMount;
319
+ T(() => {
320
+ if (!m) return v.item(l, s == null ? void 0 : s.id);
321
+ }, [m]);
322
+ let c = Ne(l, i, [e.value, e.children, i], e.keywords), u = fe(), S = K((p) => p.value && p.value === c.current), E = K((p) => m || v.filter() === !1 ? !0 : p.search ? p.filtered.items.get(l) > 0 : !0);
323
+ a.useEffect(() => {
324
+ let p = i.current;
325
+ if (!(!p || e.disabled)) return p.addEventListener(de, R), () => p.removeEventListener(de, R);
326
+ }, [E, e.onSelect, e.disabled]);
327
+ function R() {
328
+ var p, _;
329
+ C(), (_ = (p = g.current).onSelect) == null || _.call(p, c.current);
330
+ }
331
+ function C() {
332
+ u.setState("value", c.current, !0);
333
+ }
334
+ if (!E) return null;
335
+ let { disabled: I, value: G, onSelect: J, forceMount: w, keywords: x, ...k } = e;
336
+ return a.createElement(j.div, { ref: z([i, n]), ...k, id: l, "cmdk-item": "", role: "option", "aria-disabled": !!I, "aria-selected": !!S, "data-disabled": !!I, "data-selected": !!S, onPointerMove: I || v.getDisablePointerSelection() ? void 0 : C, onClick: I ? void 0 : R }, e.children);
337
+ }), Je = a.forwardRef((e, n) => {
338
+ let { heading: t, children: f, forceMount: l, ...i } = e, s = F(), v = a.useRef(null), g = a.useRef(null), m = F(), c = Y(), u = K((E) => l || c.filter() === !1 ? !0 : E.search ? E.filtered.groups.has(s) : !0);
339
+ T(() => c.group(s), []), Ne(s, v, [e.value, e.heading, g]);
340
+ let S = a.useMemo(() => ({ id: s, forceMount: l }), [l]);
341
+ return a.createElement(j.div, { ref: z([v, n]), ...i, "cmdk-group": "", role: "presentation", hidden: u ? void 0 : !0 }, t && a.createElement("div", { ref: g, "cmdk-group-heading": "", "aria-hidden": !0, id: m }, t), Z(e, (E) => a.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? m : void 0 }, a.createElement(Ce.Provider, { value: S }, E))));
342
+ }), Xe = a.forwardRef((e, n) => {
343
+ let { alwaysRender: t, ...f } = e, l = a.useRef(null), i = K((s) => !s.search);
344
+ return !t && !i ? null : a.createElement(j.div, { ref: z([l, n]), ...f, "cmdk-separator": "", role: "separator" });
345
+ }), Qe = a.forwardRef((e, n) => {
346
+ let { onValueChange: t, ...f } = e, l = e.value != null, i = fe(), s = K((c) => c.search), v = K((c) => c.value), g = Y(), m = a.useMemo(() => {
347
+ var c;
348
+ let u = (c = g.listInnerRef.current) == null ? void 0 : c.querySelector(`${se}[${$}="${encodeURIComponent(v)}"]`);
349
+ return u == null ? void 0 : u.getAttribute("id");
350
+ }, []);
351
+ return a.useEffect(() => {
352
+ e.value != null && i.setState("search", e.value);
353
+ }, [e.value]), a.createElement(j.input, { ref: n, ...f, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": g.listId, "aria-labelledby": g.labelId, "aria-activedescendant": m, id: g.inputId, type: "text", value: l ? e.value : s, onChange: (c) => {
354
+ l || i.setState("search", c.target.value), t == null || t(c.target.value);
355
+ } });
356
+ }), Ze = a.forwardRef((e, n) => {
357
+ let { children: t, label: f = "Suggestions", ...l } = e, i = a.useRef(null), s = a.useRef(null), v = Y();
358
+ return a.useEffect(() => {
359
+ if (s.current && i.current) {
360
+ let g = s.current, m = i.current, c, u = new ResizeObserver(() => {
361
+ c = requestAnimationFrame(() => {
362
+ let S = g.offsetHeight;
363
+ m.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
364
+ });
365
+ });
366
+ return u.observe(g), () => {
367
+ cancelAnimationFrame(c), u.unobserve(g);
368
+ };
369
+ }
370
+ }, []), a.createElement(j.div, { ref: z([i, n]), ...l, "cmdk-list": "", role: "listbox", "aria-label": f, id: v.listId }, Z(e, (g) => a.createElement("div", { ref: z([s, v.listInnerRef]), "cmdk-list-sizer": "" }, g)));
371
+ }), et = a.forwardRef((e, n) => {
372
+ let { open: t, onOpenChange: f, overlayClassName: l, contentClassName: i, container: s, ...v } = e;
373
+ return a.createElement(Q.Root, { open: t, onOpenChange: f }, a.createElement(Q.Portal, { container: s }, a.createElement(Q.Overlay, { "cmdk-overlay": "", className: l }), a.createElement(Q.Content, { "aria-label": e.label, "cmdk-dialog": "", className: i }, a.createElement(Oe, { ref: n, ...v }))));
374
+ }), tt = a.forwardRef((e, n) => K((t) => t.filtered.count === 0) ? a.createElement(j.div, { ref: n, ...e, "cmdk-empty": "", role: "presentation" }) : null), rt = a.forwardRef((e, n) => {
375
+ let { progress: t, children: f, label: l = "Loading...", ...i } = e;
376
+ return a.createElement(j.div, { ref: n, ...i, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": l }, Z(e, (s) => a.createElement("div", { "aria-hidden": !0 }, s)));
377
+ }), O = Object.assign(Oe, { List: Ze, Item: Ye, Input: Qe, Group: Je, Separator: Xe, Dialog: et, Empty: tt, Loading: rt });
378
+ function nt(e, n) {
379
+ let t = e.nextElementSibling;
380
+ for (; t; ) {
381
+ if (t.matches(n)) return t;
382
+ t = t.nextElementSibling;
383
+ }
384
+ }
385
+ function at(e, n) {
386
+ let t = e.previousElementSibling;
387
+ for (; t; ) {
388
+ if (t.matches(n)) return t;
389
+ t = t.previousElementSibling;
390
+ }
391
+ }
392
+ function Ie(e) {
393
+ let n = a.useRef(e);
394
+ return T(() => {
395
+ n.current = e;
396
+ }), n;
397
+ }
398
+ var T = typeof window > "u" ? a.useEffect : a.useLayoutEffect;
399
+ function q(e) {
400
+ let n = a.useRef();
401
+ return n.current === void 0 && (n.current = e()), n;
402
+ }
403
+ function z(e) {
404
+ return (n) => {
405
+ e.forEach((t) => {
406
+ typeof t == "function" ? t(n) : t != null && (t.current = n);
407
+ });
408
+ };
409
+ }
410
+ function K(e) {
411
+ let n = fe(), t = () => e(n.snapshot());
412
+ return He.useSyncExternalStore(n.subscribe, t, t);
413
+ }
414
+ function Ne(e, n, t, f = []) {
415
+ let l = a.useRef(), i = Y();
416
+ return T(() => {
417
+ var s;
418
+ let v = (() => {
419
+ var m;
420
+ for (let c of t) {
421
+ if (typeof c == "string") return c.trim();
422
+ if (typeof c == "object" && "current" in c) return c.current ? (m = c.current.textContent) == null ? void 0 : m.trim() : l.current;
423
+ }
424
+ })(), g = f.map((m) => m.trim());
425
+ i.value(e, v, g), (s = n.current) == null || s.setAttribute($, v), l.current = v;
426
+ }), l;
427
+ }
428
+ var lt = () => {
429
+ let [e, n] = a.useState(), t = q(() => /* @__PURE__ */ new Map());
430
+ return T(() => {
431
+ t.current.forEach((f) => f()), t.current = /* @__PURE__ */ new Map();
432
+ }, [e]), (f, l) => {
433
+ t.current.set(f, l), n({});
434
+ };
435
+ };
436
+ function ot(e) {
437
+ let n = e.type;
438
+ return typeof n == "function" ? n(e.props) : "render" in n ? n.render(e.props) : e;
439
+ }
440
+ function Z({ asChild: e, children: n }, t) {
441
+ return e && a.isValidElement(n) ? a.cloneElement(ot(n), { ref: n.ref }, t(n.props.children)) : t(n);
442
+ }
443
+ var ut = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
444
+ const Ae = a.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ A.jsx(
445
+ O,
446
+ {
447
+ ref: t,
448
+ className: U(
449
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
450
+ e
451
+ ),
452
+ ...n
453
+ }
454
+ ));
455
+ Ae.displayName = O.displayName;
456
+ const bt = ({ children: e, ...n }) => /* @__PURE__ */ A.jsx(De, { ...n, children: /* @__PURE__ */ A.jsx(je, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ A.jsx(Ae, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: e }) }) }), it = a.forwardRef(({ className: e, ...n }, t) => (
457
+ // eslint-disable-next-line react/no-unknown-property
458
+ /* @__PURE__ */ A.jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
459
+ /* @__PURE__ */ A.jsx(Le, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
460
+ /* @__PURE__ */ A.jsx(
461
+ O.Input,
462
+ {
463
+ ref: t,
464
+ className: U(
465
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
466
+ e
467
+ ),
468
+ ...n
469
+ }
470
+ )
471
+ ] })
472
+ ));
473
+ it.displayName = O.Input.displayName;
474
+ const ct = a.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ A.jsx(
475
+ O.List,
476
+ {
477
+ ref: t,
478
+ className: U("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
479
+ ...n
480
+ }
481
+ ));
482
+ ct.displayName = O.List.displayName;
483
+ const dt = a.forwardRef((e, n) => /* @__PURE__ */ A.jsx(
484
+ O.Empty,
485
+ {
486
+ ref: n,
487
+ className: "py-6 text-center text-sm",
488
+ ...e
489
+ }
490
+ ));
491
+ dt.displayName = O.Empty.displayName;
492
+ const st = a.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ A.jsx(
493
+ O.Group,
494
+ {
495
+ ref: t,
496
+ className: U(
497
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
498
+ e
499
+ ),
500
+ ...n
501
+ }
502
+ ));
503
+ st.displayName = O.Group.displayName;
504
+ const ft = a.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ A.jsx(
505
+ O.Separator,
506
+ {
507
+ ref: t,
508
+ className: U("-mx-1 h-px bg-border", e),
509
+ ...n
510
+ }
511
+ ));
512
+ ft.displayName = O.Separator.displayName;
513
+ const mt = a.forwardRef(({ className: e, ...n }, t) => /* @__PURE__ */ A.jsx(
514
+ O.Item,
515
+ {
516
+ ref: t,
517
+ className: U(
518
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
519
+ e
520
+ ),
521
+ ...n
522
+ }
523
+ ));
524
+ mt.displayName = O.Item.displayName;
525
+ const pt = ({
526
+ className: e,
527
+ ...n
528
+ }) => /* @__PURE__ */ A.jsx(
529
+ "span",
530
+ {
531
+ className: U(
532
+ "ml-auto text-xs tracking-widest text-muted-foreground",
533
+ e
534
+ ),
535
+ ...n
536
+ }
537
+ );
538
+ pt.displayName = "CommandShortcut";
539
+ export {
540
+ Ae as Command,
541
+ bt as CommandDialog,
542
+ dt as CommandEmpty,
543
+ st as CommandGroup,
544
+ it as CommandInput,
545
+ mt as CommandItem,
546
+ ct as CommandList,
547
+ ft as CommandSeparator,
548
+ pt as CommandShortcut
549
+ };
550
+ //# sourceMappingURL=Command.js.map