@mattisvensson/strapi-plugin-webatlas 0.9.5 → 0.10.0

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 (117) hide show
  1. package/README.md +24 -36
  2. package/dist/_chunks/FullLoader-Cmsf8xS6.js +0 -1
  3. package/dist/_chunks/FullLoader-CrPED_dY.mjs +0 -1
  4. package/dist/_chunks/{SettingTitle-CiMKrd_1.mjs → SettingTitle-CdR3SVn_.mjs} +1 -2
  5. package/dist/_chunks/{SettingTitle-CAoYbTar.js → SettingTitle-RU1azFIM.js} +1 -1
  6. package/dist/_chunks/{de-C-uxto84.mjs → de-B5pRvs13.mjs} +13 -8
  7. package/dist/_chunks/{de-CGXL_3o_.js → de-CqU1FU8C.js} +13 -8
  8. package/dist/_chunks/{en-B1CHnIH7.mjs → en-BE-zzIv8.mjs} +13 -8
  9. package/dist/_chunks/{en-DWEd5BXK.js → en-C7I90FwV.js} +13 -8
  10. package/dist/_chunks/{index-Bqsd7oPS.mjs → index-B07UVUOa.mjs} +387 -230
  11. package/dist/_chunks/{index-DJBnQbrp.mjs → index-BmyxSosC.mjs} +3 -3
  12. package/dist/_chunks/{index-BOZDZiAv.js → index-BucL4va6.js} +38 -82
  13. package/dist/_chunks/{index-DU58LJ2w.mjs → index-BvcX9hcc.mjs} +61 -25
  14. package/dist/_chunks/{index-ezabqLEP.js → index-BxpDM360.js} +386 -228
  15. package/dist/_chunks/{index-qrC_n9-7.mjs → index-CIM-JzLK.mjs} +38 -82
  16. package/dist/_chunks/{index-qrrfKpw1.mjs → index-CNKWb8pn.mjs} +615 -321
  17. package/dist/_chunks/{index-m2ivL3ht.js → index-D-vJE_K8.js} +3 -3
  18. package/dist/_chunks/{index-BkB1x9Sn.js → index-IRSCe8PX.js} +610 -316
  19. package/dist/_chunks/{index-CC073vGB.js → index-d09V61nm.js} +61 -24
  20. package/dist/admin/index.js +1 -2
  21. package/dist/admin/index.mjs +1 -2
  22. package/dist/admin/src/components/CMEditViewAside/NewPathInfo.d.ts +2 -0
  23. package/dist/admin/src/components/CMEditViewAside/OverrideCheckbox.d.ts +7 -0
  24. package/dist/admin/src/components/CMEditViewAside/Panel.d.ts +5 -0
  25. package/dist/admin/src/components/CMEditViewAside/PathInput.d.ts +11 -0
  26. package/dist/admin/src/components/CMEditViewAside/RouteStructure.d.ts +3 -0
  27. package/dist/admin/src/components/CMEditViewAside/UidPathDisplay.d.ts +4 -0
  28. package/dist/admin/src/components/PathInfo.d.ts +2 -3
  29. package/dist/admin/src/components/modals/externalItem/index.d.ts +1 -1
  30. package/dist/admin/src/components/modals/internalItem/ItemDetails.d.ts +13 -0
  31. package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
  32. package/dist/admin/src/components/modals/internalItem/internalItemEdit.d.ts +1 -1
  33. package/dist/admin/src/components/modals/useModalSharedLogic.d.ts +1 -1
  34. package/dist/admin/src/components/modals/wrapperItem/index.d.ts +1 -1
  35. package/dist/admin/src/hooks/useApi.d.ts +4 -3
  36. package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -15
  37. package/dist/admin/src/pages/Navigation/RouteItemBadge.d.ts +4 -0
  38. package/dist/admin/src/pages/Navigation/RouteItemIcon.d.ts +5 -0
  39. package/dist/admin/src/pages/Navigation/RouteItemMenu.d.ts +10 -0
  40. package/dist/admin/src/pages/Navigation/RouteItemStatus.d.ts +5 -0
  41. package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
  42. package/dist/admin/src/types/index.d.ts +3 -0
  43. package/dist/admin/src/types/modal.d.ts +56 -0
  44. package/dist/admin/src/types/navigation.d.ts +18 -0
  45. package/dist/admin/src/types/panel.d.ts +41 -0
  46. package/dist/admin/src/types/route.d.ts +1 -1
  47. package/dist/admin/src/utils/buildBreadcrumbString.d.ts +16 -0
  48. package/dist/admin/src/utils/createTempNavItemObject.d.ts +6 -8
  49. package/dist/admin/src/utils/duplicateCheck.d.ts +10 -4
  50. package/dist/admin/src/utils/findParentNavItem.d.ts +13 -0
  51. package/dist/admin/src/utils/index.d.ts +3 -2
  52. package/dist/server/index.js +636 -209
  53. package/dist/server/index.mjs +636 -209
  54. package/dist/server/src/content-types/index.d.ts +18 -0
  55. package/dist/server/src/content-types/route/index.d.ts +18 -0
  56. package/dist/server/src/content-types/route/schema.d.ts +18 -0
  57. package/dist/server/src/controllers/admin.d.ts +3 -2
  58. package/dist/server/src/controllers/index.d.ts +3 -2
  59. package/dist/server/src/index.d.ts +24 -4
  60. package/dist/server/src/migrations/001-canonical-path.d.ts +7 -0
  61. package/dist/server/src/migrations/index.d.ts +3 -0
  62. package/dist/server/src/services/admin.d.ts +3 -2
  63. package/dist/server/src/services/index.d.ts +3 -2
  64. package/dist/server/src/utils/buildCanonicalPath.d.ts +1 -0
  65. package/dist/server/src/utils/buildNavigationPath.d.ts +5 -0
  66. package/dist/server/src/utils/cascadeCanonicalPathUpdates.d.ts +1 -0
  67. package/dist/server/src/utils/getNonInternalRouteIds.d.ts +1 -0
  68. package/dist/server/src/utils/getRouteAncestors.d.ts +1 -0
  69. package/dist/server/src/utils/getRouteDescendants.d.ts +1 -0
  70. package/dist/server/src/utils/index.d.ts +10 -2
  71. package/dist/server/src/utils/navigationItemStructure.d.ts +27 -0
  72. package/dist/server/src/utils/routeHandler.d.ts +4 -2
  73. package/dist/server/src/utils/validateRouteDependencies.d.ts +4 -0
  74. package/dist/types/index.d.ts +0 -1
  75. package/dist/types/navigation.d.ts +13 -12
  76. package/dist/types/route.d.ts +7 -2
  77. package/dist/types/strapi.d.ts +1 -2
  78. package/dist/utils/index.d.ts +1 -2
  79. package/package.json +1 -1
  80. package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +0 -1
  81. package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +0 -1
  82. package/dist/_chunks/SettingTitle-ByAhjihc.js +0 -68
  83. package/dist/_chunks/SettingTitle-ByAhjihc.js.map +0 -1
  84. package/dist/_chunks/SettingTitle-CiMKrd_1.mjs.map +0 -1
  85. package/dist/_chunks/SettingTitle-ZM5Yf2b4.mjs +0 -68
  86. package/dist/_chunks/de-C-uxto84.mjs.map +0 -1
  87. package/dist/_chunks/de-CGXL_3o_.js.map +0 -1
  88. package/dist/_chunks/en-B1CHnIH7.mjs.map +0 -1
  89. package/dist/_chunks/en-DWEd5BXK.js.map +0 -1
  90. package/dist/_chunks/index-BqceJPRl.js +0 -235
  91. package/dist/_chunks/index-BqceJPRl.js.map +0 -1
  92. package/dist/_chunks/index-Bqsd7oPS.mjs.map +0 -1
  93. package/dist/_chunks/index-CK1wisw5.mjs +0 -129
  94. package/dist/_chunks/index-CK1wisw5.mjs.map +0 -1
  95. package/dist/_chunks/index-CQ2raqxe.js +0 -129
  96. package/dist/_chunks/index-CQ2raqxe.js.map +0 -1
  97. package/dist/_chunks/index-Ca9T36AU.mjs +0 -263
  98. package/dist/_chunks/index-Ca9T36AU.mjs.map +0 -1
  99. package/dist/_chunks/index-DDN4T6c7.mjs +0 -4188
  100. package/dist/_chunks/index-DH4Rd7aA.mjs +0 -8311
  101. package/dist/_chunks/index-DH4Rd7aA.mjs.map +0 -1
  102. package/dist/_chunks/index-DU58LJ2w.mjs.map +0 -1
  103. package/dist/_chunks/index-DnE_cDwy.js +0 -8311
  104. package/dist/_chunks/index-DnE_cDwy.js.map +0 -1
  105. package/dist/_chunks/index-DzpXVfQ_.js +0 -263
  106. package/dist/_chunks/index-DzpXVfQ_.js.map +0 -1
  107. package/dist/_chunks/index-R7qsEu2N.js +0 -4205
  108. package/dist/_chunks/index-R7qsEu2N.js.map +0 -1
  109. package/dist/_chunks/index-fbC3magu.mjs +0 -234
  110. package/dist/admin/index.js.map +0 -1
  111. package/dist/admin/index.mjs.map +0 -1
  112. package/dist/admin/src/components/CMEditViewAside/Path.d.ts +0 -5
  113. package/dist/admin/src/utils/countChildren.d.ts +0 -2
  114. package/dist/server/index.js.map +0 -1
  115. package/dist/server/index.mjs.map +0 -1
  116. package/dist/types/modal.d.ts +0 -36
  117. package/dist/utils/getPath.d.ts +0 -1
@@ -1,4205 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const icons = require("@strapi/icons");
5
- const admin = require("@strapi/strapi/admin");
6
- const designSystem = require("@strapi/design-system");
7
- const ReactDOM = require("react-dom");
8
- const reactIntl = require("react-intl");
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
- if (e) {
13
- for (const k in e) {
14
- if (k !== "default") {
15
- const d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: () => e[k]
19
- });
20
- }
21
- }
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
27
- const ReactDOM__namespace = /* @__PURE__ */ _interopNamespace(ReactDOM);
28
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
29
- const v = glob[path];
30
- if (v) {
31
- return typeof v === "function" ? v() : Promise.resolve(v);
32
- }
33
- return new Promise((_, reject) => {
34
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
35
- reject.bind(
36
- null,
37
- new Error(
38
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
39
- )
40
- )
41
- );
42
- });
43
- };
44
- function transformToUrl(input) {
45
- const specialCharMap = {
46
- "ü": "ue",
47
- "ä": "ae",
48
- "ö": "oe"
49
- };
50
- if (!input || typeof input !== "string") return "";
51
- input = input.toLowerCase();
52
- input = input.replace(/\/+/g, "/");
53
- input = input.startsWith("/") ? input.slice(1) : input;
54
- input = input.endsWith("/") ? input.slice(0, -1) : input;
55
- for (const char in specialCharMap) {
56
- const regex = new RegExp(char, "g");
57
- input = input.replace(regex, specialCharMap[char]);
58
- }
59
- input = input.trim();
60
- input = input.replace(/\s+/g, "-");
61
- input = input.replace(/[^A-Za-z0-9$\-_.+!*'()/]/g, "");
62
- input = input.replace(/-+/g, "-");
63
- return input;
64
- }
65
- const version = "0.9.5";
66
- const keywords = [];
67
- const type = "commonjs";
68
- const exports$1 = {
69
- "./package.json": "./package.json",
70
- "./strapi-admin": {
71
- types: "./dist/admin/src/index.d.ts",
72
- source: "./admin/src/index.tsx",
73
- "import": "./dist/admin/index.mjs",
74
- require: "./dist/admin/index.js",
75
- "default": "./dist/admin/index.js"
76
- },
77
- "./strapi-server": {
78
- types: "./dist/server/src/index.d.ts",
79
- source: "./server/src/index.ts",
80
- "import": "./dist/server/index.mjs",
81
- require: "./dist/server/index.js",
82
- "default": "./dist/server/index.js"
83
- }
84
- };
85
- const files = [
86
- "dist"
87
- ];
88
- const scripts = {
89
- build: "strapi-plugin build && yalc push --publish",
90
- watch: "strapi-plugin watch",
91
- "watch:link": "strapi-plugin watch:link",
92
- verify: "strapi-plugin verify",
93
- "test:ts:front": "tsc -p admin/tsconfig.json",
94
- "test:ts:back": "tsc -p server/tsconfig.json",
95
- "test:jest": "ENV_PATH=./playground/.env jest --verbose --runInBand --forceExit",
96
- "test:cypress": "cypress run",
97
- "test:cypress:open": "cypress open",
98
- preversion: "yarn build",
99
- postversion: "git push && git push --tags"
100
- };
101
- const dependencies = {
102
- "@dnd-kit/core": "^6.3.1",
103
- "@dnd-kit/sortable": "^10.0.0",
104
- "@dnd-kit/utilities": "^3.2.2",
105
- "@strapi/design-system": "^2.0.0-rc.14",
106
- "@strapi/icons": "^2.0.0-rc.14",
107
- "react-intl": "^7.1.0"
108
- };
109
- const devDependencies = {
110
- "@strapi/sdk-plugin": "^5.0.0",
111
- "@strapi/strapi": "^5.0.0",
112
- "@strapi/typescript-utils": "^5.0.0",
113
- "@types/react": "^19.0.0",
114
- "@types/react-dom": "^19.0.0",
115
- cypress: "^13.9.0",
116
- "cypress-terminal-report": "^6.0.2",
117
- jest: "^29.7.0",
118
- prettier: "^3.4.2",
119
- react: "^19.0.0",
120
- "react-router-dom": "^6.0.0",
121
- supertest: "^7.0.0",
122
- typescript: "^5.7.2"
123
- };
124
- const peerDependencies = {
125
- "@strapi/strapi": "^5.0.0",
126
- react: "^17.0.0 || ^18.0.0",
127
- "react-dom": "^17.0.0 || ^18.0.0",
128
- "react-router-dom": "^6.0.0",
129
- "styled-components": "^6.0.0"
130
- };
131
- const description = "A strapi plugin to manage URL routes and navigations.";
132
- const strapi = {
133
- name: "webatlas",
134
- displayName: "Webatlas",
135
- description: "A strapi plugin to manage URL routes and navigations.",
136
- kind: "plugin"
137
- };
138
- const name = "@mattisvensson/strapi-plugin-webatlas";
139
- const license = "MIT";
140
- const repository = {
141
- type: "git",
142
- url: "git+ssh://git@github.com:mattisvensson/strapi-plugin-webatlas.git"
143
- };
144
- const bugs = {
145
- url: "https://github.com/mattisvensson/strapi-plugin-webatlas/issues"
146
- };
147
- const homepage = "https://github.com/mattisvensson/strapi-plugin-webatlas#readme";
148
- const author = {
149
- name: "Matti Svensson",
150
- email: "mattisvensson@web.de",
151
- url: "https://mattisvensson.dev"
152
- };
153
- const maintainers = [
154
- {
155
- name: "Matti Svensson",
156
- email: "mattisvensson@web.de",
157
- url: "https://mattisvensson.dev"
158
- }
159
- ];
160
- const packageManager = "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e";
161
- const pluginPkg = {
162
- version,
163
- keywords,
164
- type,
165
- exports: exports$1,
166
- files,
167
- scripts,
168
- dependencies,
169
- devDependencies,
170
- peerDependencies,
171
- description,
172
- strapi,
173
- name,
174
- license,
175
- repository,
176
- bugs,
177
- homepage,
178
- author,
179
- maintainers,
180
- packageManager
181
- };
182
- const PLUGIN_ID = pluginPkg.strapi.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, "") || "webatlas";
183
- const PLUGIN_NAME = pluginPkg.strapi.displayName;
184
- const PLUGIN_VERSION = pluginPkg.version;
185
- const Initializer = ({ setPlugin }) => {
186
- const ref = React.useRef(setPlugin);
187
- React.useEffect(() => {
188
- ref.current(PLUGIN_ID);
189
- }, []);
190
- return null;
191
- };
192
- const PathIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Link, {});
193
- const NavigationIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.List, {});
194
- function useApi() {
195
- const { get, put, del, post } = admin.useFetchClient();
196
- const fetchAllContentTypes = async () => {
197
- try {
198
- const { data } = await get("/content-manager/content-types");
199
- return data.data;
200
- } catch (error) {
201
- console.warn("Cannot fetch all content types:", error);
202
- return [];
203
- }
204
- };
205
- const fetchConfiguredContentTypes = async () => {
206
- try {
207
- const { data: config } = await get(`/${PLUGIN_ID}/config`);
208
- const configuredTypes = config?.selectedContentTypes || [];
209
- if (configuredTypes.length === 0) {
210
- return [];
211
- }
212
- const allContentTypes = await fetchAllContentTypes();
213
- const configuredUIDs = new Set(configuredTypes.map((ct) => ct.uid));
214
- return allContentTypes.filter((ct) => configuredUIDs.has(ct.uid));
215
- } catch (err) {
216
- console.error("Error fetching configured content types:", err);
217
- return [];
218
- }
219
- };
220
- const fetchAllEntities = async () => {
221
- try {
222
- const { data } = await get(`/${PLUGIN_ID}/config`);
223
- const contentTypes = data?.selectedContentTypes || [];
224
- if (!contentTypes || contentTypes.length === 0) {
225
- return [];
226
- }
227
- let entities = [];
228
- const entityResults = await Promise.allSettled(
229
- contentTypes.map(async (contentType) => {
230
- try {
231
- const { data: data2 } = await get(`/content-manager/collection-types/${contentType.uid}?pageSize=9999`);
232
- if (!data2 || !data2.results) {
233
- return null;
234
- }
235
- return {
236
- entities: data2.results,
237
- contentType
238
- };
239
- } catch (err) {
240
- console.warn(`Cannot access entities for ${contentType.uid}:`, err);
241
- return null;
242
- }
243
- })
244
- );
245
- entities = entityResults.map((result) => result.status === "fulfilled" ? result.value : null).filter(Boolean);
246
- return entities;
247
- } catch (err) {
248
- console.error("Error fetching entities:", err);
249
- throw err;
250
- }
251
- };
252
- const getRelatedRoute = async (relatedDocumentId) => {
253
- const { data } = await get(`/${PLUGIN_ID}/route/related?documentId=${relatedDocumentId}`);
254
- return data;
255
- };
256
- const getRoutes = async () => {
257
- const { data } = await get(`/${PLUGIN_ID}/route`);
258
- return data;
259
- };
260
- const updateRoute = async (body, documentId) => {
261
- const { data } = await put(`/${PLUGIN_ID}/route?documentId=${documentId}`, {
262
- data: {
263
- ...body
264
- }
265
- });
266
- return data;
267
- };
268
- const getNavigation = async ({ documentId, variant } = {}) => {
269
- const query = [];
270
- if (documentId) query.push(`documentId=${documentId}`);
271
- if (variant) query.push(`variant=${variant}`);
272
- const { data } = await get(`/${PLUGIN_ID}/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`);
273
- return data;
274
- };
275
- const createNavigation = async (body) => {
276
- const { data } = await post(`/${PLUGIN_ID}/navigation`, {
277
- data: body
278
- });
279
- return data;
280
- };
281
- const deleteNavigation = async (documentId) => {
282
- const { data } = await del(`/${PLUGIN_ID}/navigation?documentId=${documentId}`);
283
- return data;
284
- };
285
- const updateNavigation = async (documentId, body) => {
286
- const { data } = await put(`/${PLUGIN_ID}/navigation?documentId=${documentId}`, {
287
- data: body
288
- });
289
- return data;
290
- };
291
- const updateNavigationItemStructure = async (documentId, navigationItems) => {
292
- const { data } = await put(`/${PLUGIN_ID}/navigation/items`, {
293
- navigationId: documentId,
294
- navigationItems
295
- });
296
- return data;
297
- };
298
- return {
299
- fetchAllContentTypes,
300
- fetchConfiguredContentTypes,
301
- fetchAllEntities,
302
- getRelatedRoute,
303
- getRoutes,
304
- updateRoute,
305
- getNavigation,
306
- createNavigation,
307
- deleteNavigation,
308
- updateNavigation,
309
- updateNavigationItemStructure
310
- };
311
- }
312
- const useAllContentTypes = () => {
313
- const { fetchAllContentTypes } = useApi();
314
- const [contentTypes, setContentTypes] = React.useState([]);
315
- const [loading, setLoading] = React.useState(true);
316
- const [error, setError] = React.useState(null);
317
- React.useEffect(() => {
318
- const fetchEntities = async () => {
319
- try {
320
- const result = await fetchAllContentTypes();
321
- setContentTypes(result);
322
- setLoading(false);
323
- } catch (err) {
324
- setError(err);
325
- setLoading(false);
326
- }
327
- };
328
- fetchEntities();
329
- }, []);
330
- return { contentTypes, loading, error };
331
- };
332
- function usePluginConfig() {
333
- const { put, get } = admin.useFetchClient();
334
- const [config, setConfigData] = React.useState(null);
335
- const [loading, setLoading] = React.useState(true);
336
- const [fetchError, setFetchError] = React.useState(null);
337
- React.useEffect(() => {
338
- const fetchData = async () => {
339
- setLoading(true);
340
- setFetchError(null);
341
- try {
342
- const { data: { data: contentTypesArray } } = await get("/content-manager/content-types");
343
- let { data: config2 } = await get(`/${PLUGIN_ID}/config`);
344
- if (!config2 || !config2.selectedContentTypes) {
345
- throw new Error(`Couldn't fetch plugin config`);
346
- }
347
- const allowedContentTypes = contentTypesArray.filter(
348
- (type2) => type2.pluginOptions?.webatlas?.enabled === true
349
- );
350
- const contentTypeUids = new Set(allowedContentTypes.map((type2) => type2.uid));
351
- const activeContentTypes = config2.selectedContentTypes.filter((type2) => contentTypeUids.has(type2.uid));
352
- const displayConfig = {
353
- ...config2,
354
- selectedContentTypes: activeContentTypes
355
- };
356
- setConfigData(displayConfig);
357
- } catch (error) {
358
- setFetchError(error.message);
359
- } finally {
360
- setLoading(false);
361
- }
362
- };
363
- fetchData();
364
- }, []);
365
- async function setConfig(body) {
366
- try {
367
- await put(`/${PLUGIN_ID}/config`, { ...body });
368
- } catch (error) {
369
- throw error;
370
- }
371
- }
372
- return { config, loading, fetchError, setConfig };
373
- }
374
- function _extends() {
375
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
376
- for (var e = 1; e < arguments.length; e++) {
377
- var t = arguments[e];
378
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
379
- }
380
- return n;
381
- }, _extends.apply(null, arguments);
382
- }
383
- function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
384
- return function handleEvent(event) {
385
- originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
386
- if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
387
- };
388
- }
389
- function $6ed0406888f73fc4$var$setRef(ref, value) {
390
- if (typeof ref === "function") ref(value);
391
- else if (ref !== null && ref !== void 0) ref.current = value;
392
- }
393
- function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
394
- return (node) => refs.forEach(
395
- (ref) => $6ed0406888f73fc4$var$setRef(ref, node)
396
- );
397
- }
398
- function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
399
- return React.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
400
- }
401
- function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
402
- let defaultContexts = [];
403
- function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
404
- const BaseContext = /* @__PURE__ */ React.createContext(defaultContext);
405
- const index2 = defaultContexts.length;
406
- defaultContexts = [
407
- ...defaultContexts,
408
- defaultContext
409
- ];
410
- function Provider(props) {
411
- const { scope, children, ...context } = props;
412
- const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
413
- const value = React.useMemo(
414
- () => context,
415
- Object.values(context)
416
- );
417
- return /* @__PURE__ */ React.createElement(Context.Provider, {
418
- value
419
- }, children);
420
- }
421
- function useContext(consumerName, scope) {
422
- const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
423
- const context = React.useContext(Context);
424
- if (context) return context;
425
- if (defaultContext !== void 0) return defaultContext;
426
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
427
- }
428
- Provider.displayName = rootComponentName + "Provider";
429
- return [
430
- Provider,
431
- useContext
432
- ];
433
- }
434
- const createScope = () => {
435
- const scopeContexts = defaultContexts.map((defaultContext) => {
436
- return /* @__PURE__ */ React.createContext(defaultContext);
437
- });
438
- return function useScope(scope) {
439
- const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
440
- return React.useMemo(
441
- () => ({
442
- [`__scope${scopeName}`]: {
443
- ...scope,
444
- [scopeName]: contexts
445
- }
446
- }),
447
- [
448
- scope,
449
- contexts
450
- ]
451
- );
452
- };
453
- };
454
- createScope.scopeName = scopeName;
455
- return [
456
- $c512c27ab02ef895$export$fd42f52fd3ae1109,
457
- $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
458
- ];
459
- }
460
- function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
461
- const baseScope = scopes[0];
462
- if (scopes.length === 1) return baseScope;
463
- const createScope1 = () => {
464
- const scopeHooks = scopes.map(
465
- (createScope) => ({
466
- useScope: createScope(),
467
- scopeName: createScope.scopeName
468
- })
469
- );
470
- return function useComposedScopes(overrideScopes) {
471
- const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {
472
- const scopeProps = useScope(overrideScopes);
473
- const currentScope = scopeProps[`__scope${scopeName}`];
474
- return {
475
- ...nextScopes,
476
- ...currentScope
477
- };
478
- }, {});
479
- return React.useMemo(
480
- () => ({
481
- [`__scope${baseScope.scopeName}`]: nextScopes1
482
- }),
483
- [
484
- nextScopes1
485
- ]
486
- );
487
- };
488
- };
489
- createScope1.scopeName = baseScope.scopeName;
490
- return createScope1;
491
- }
492
- const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
493
- const { children, ...slotProps } = props;
494
- const childrenArray = React.Children.toArray(children);
495
- const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
496
- if (slottable) {
497
- const newElement = slottable.props.children;
498
- const newChildren = childrenArray.map((child) => {
499
- if (child === slottable) {
500
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
501
- return /* @__PURE__ */ React.isValidElement(newElement) ? newElement.props.children : null;
502
- } else return child;
503
- });
504
- return /* @__PURE__ */ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
505
- ref: forwardedRef
506
- }), /* @__PURE__ */ React.isValidElement(newElement) ? /* @__PURE__ */ React.cloneElement(newElement, void 0, newChildren) : null);
507
- }
508
- return /* @__PURE__ */ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
509
- ref: forwardedRef
510
- }), children);
511
- });
512
- $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
513
- const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
514
- const { children, ...slotProps } = props;
515
- if (/* @__PURE__ */ React.isValidElement(children)) return /* @__PURE__ */ React.cloneElement(children, {
516
- ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
517
- ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
518
- });
519
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
520
- });
521
- $5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
522
- const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => {
523
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
524
- };
525
- function $5e63c961fc1ce211$var$isSlottable(child) {
526
- return /* @__PURE__ */ React.isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
527
- }
528
- function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
529
- const overrideProps = {
530
- ...childProps
531
- };
532
- for (const propName in childProps) {
533
- const slotPropValue = slotProps[propName];
534
- const childPropValue = childProps[propName];
535
- const isHandler = /^on[A-Z]/.test(propName);
536
- if (isHandler) {
537
- if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
538
- childPropValue(...args);
539
- slotPropValue(...args);
540
- };
541
- else if (slotPropValue) overrideProps[propName] = slotPropValue;
542
- } else if (propName === "style") overrideProps[propName] = {
543
- ...slotPropValue,
544
- ...childPropValue
545
- };
546
- else if (propName === "className") overrideProps[propName] = [
547
- slotPropValue,
548
- childPropValue
549
- ].filter(Boolean).join(" ");
550
- }
551
- return {
552
- ...slotProps,
553
- ...overrideProps
554
- };
555
- }
556
- const $8927f6f2acc4f386$var$NODES = [
557
- "a",
558
- "button",
559
- "div",
560
- "form",
561
- "h2",
562
- "h3",
563
- "img",
564
- "input",
565
- "label",
566
- "li",
567
- "nav",
568
- "ol",
569
- "p",
570
- "span",
571
- "svg",
572
- "ul"
573
- ];
574
- const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node) => {
575
- const Node2 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
576
- const { asChild, ...primitiveProps } = props;
577
- const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
578
- React.useEffect(() => {
579
- window[Symbol.for("radix-ui")] = true;
580
- }, []);
581
- return /* @__PURE__ */ React.createElement(Comp, _extends({}, primitiveProps, {
582
- ref: forwardedRef
583
- }));
584
- });
585
- Node2.displayName = `Primitive.${node}`;
586
- return {
587
- ...primitive,
588
- [node]: Node2
589
- };
590
- }, {});
591
- function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
592
- if (target) ReactDOM.flushSync(
593
- () => target.dispatchEvent(event)
594
- );
595
- }
596
- function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
597
- const callbackRef = React.useRef(callback);
598
- React.useEffect(() => {
599
- callbackRef.current = callback;
600
- });
601
- return React.useMemo(
602
- () => (...args) => {
603
- var _callbackRef$current;
604
- return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
605
- },
606
- []
607
- );
608
- }
609
- function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
610
- const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
611
- React.useEffect(() => {
612
- const handleKeyDown = (event) => {
613
- if (event.key === "Escape") onEscapeKeyDown(event);
614
- };
615
- ownerDocument.addEventListener("keydown", handleKeyDown);
616
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown);
617
- }, [
618
- onEscapeKeyDown,
619
- ownerDocument
620
- ]);
621
- }
622
- const $5cb92bef7577960e$var$CONTEXT_UPDATE = "dismissableLayer.update";
623
- const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
624
- const $5cb92bef7577960e$var$FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
625
- let $5cb92bef7577960e$var$originalBodyPointerEvents;
626
- const $5cb92bef7577960e$var$DismissableLayerContext = /* @__PURE__ */ React.createContext({
627
- layers: /* @__PURE__ */ new Set(),
628
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
629
- branches: /* @__PURE__ */ new Set()
630
- });
631
- const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
632
- var _node$ownerDocument;
633
- const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
634
- const context = React.useContext($5cb92bef7577960e$var$DismissableLayerContext);
635
- const [node1, setNode] = React.useState(null);
636
- const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
637
- const [, force] = React.useState({});
638
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
639
- forwardedRef,
640
- (node) => setNode(node)
641
- );
642
- const layers = Array.from(context.layers);
643
- const [highestLayerWithOutsidePointerEventsDisabled] = [
644
- ...context.layersWithOutsidePointerEventsDisabled
645
- ].slice(-1);
646
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
647
- const index2 = node1 ? layers.indexOf(node1) : -1;
648
- const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
649
- const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
650
- const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event) => {
651
- const target = event.target;
652
- const isPointerDownOnBranch = [
653
- ...context.branches
654
- ].some(
655
- (branch) => branch.contains(target)
656
- );
657
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
658
- onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
659
- onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
660
- if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
661
- }, ownerDocument);
662
- const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event) => {
663
- const target = event.target;
664
- const isFocusInBranch = [
665
- ...context.branches
666
- ].some(
667
- (branch) => branch.contains(target)
668
- );
669
- if (isFocusInBranch) return;
670
- onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
671
- onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
672
- if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
673
- }, ownerDocument);
674
- $addc16e1bbe58fd0$export$3a72a57244d6e765((event) => {
675
- const isHighestLayer = index2 === context.layers.size - 1;
676
- if (!isHighestLayer) return;
677
- onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
678
- if (!event.defaultPrevented && onDismiss) {
679
- event.preventDefault();
680
- onDismiss();
681
- }
682
- }, ownerDocument);
683
- React.useEffect(() => {
684
- if (!node1) return;
685
- if (disableOutsidePointerEvents) {
686
- if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
687
- $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
688
- ownerDocument.body.style.pointerEvents = "none";
689
- }
690
- context.layersWithOutsidePointerEventsDisabled.add(node1);
691
- }
692
- context.layers.add(node1);
693
- $5cb92bef7577960e$var$dispatchUpdate();
694
- return () => {
695
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
696
- };
697
- }, [
698
- node1,
699
- ownerDocument,
700
- disableOutsidePointerEvents,
701
- context
702
- ]);
703
- React.useEffect(() => {
704
- return () => {
705
- if (!node1) return;
706
- context.layers.delete(node1);
707
- context.layersWithOutsidePointerEventsDisabled.delete(node1);
708
- $5cb92bef7577960e$var$dispatchUpdate();
709
- };
710
- }, [
711
- node1,
712
- context
713
- ]);
714
- React.useEffect(() => {
715
- const handleUpdate = () => force({});
716
- document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
717
- return () => document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
718
- }, []);
719
- return /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
720
- ref: composedRefs,
721
- style: {
722
- pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
723
- ...props.style
724
- },
725
- onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
726
- onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
727
- onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
728
- }));
729
- });
730
- function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
731
- const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
732
- const isPointerInsideReactTreeRef = React.useRef(false);
733
- const handleClickRef = React.useRef(() => {
734
- });
735
- React.useEffect(() => {
736
- const handlePointerDown = (event) => {
737
- if (event.target && !isPointerInsideReactTreeRef.current) {
738
- let handleAndDispatchPointerDownOutsideEvent = function() {
739
- $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
740
- discrete: true
741
- });
742
- };
743
- const eventDetail = {
744
- originalEvent: event
745
- };
746
- if (event.pointerType === "touch") {
747
- ownerDocument.removeEventListener("click", handleClickRef.current);
748
- handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
749
- ownerDocument.addEventListener("click", handleClickRef.current, {
750
- once: true
751
- });
752
- } else handleAndDispatchPointerDownOutsideEvent();
753
- } else
754
- ownerDocument.removeEventListener("click", handleClickRef.current);
755
- isPointerInsideReactTreeRef.current = false;
756
- };
757
- const timerId = window.setTimeout(() => {
758
- ownerDocument.addEventListener("pointerdown", handlePointerDown);
759
- }, 0);
760
- return () => {
761
- window.clearTimeout(timerId);
762
- ownerDocument.removeEventListener("pointerdown", handlePointerDown);
763
- ownerDocument.removeEventListener("click", handleClickRef.current);
764
- };
765
- }, [
766
- ownerDocument,
767
- handlePointerDownOutside
768
- ]);
769
- return {
770
- // ensures we check React component tree (not just DOM tree)
771
- onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
772
- };
773
- }
774
- function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
775
- const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
776
- const isFocusInsideReactTreeRef = React.useRef(false);
777
- React.useEffect(() => {
778
- const handleFocus = (event) => {
779
- if (event.target && !isFocusInsideReactTreeRef.current) {
780
- const eventDetail = {
781
- originalEvent: event
782
- };
783
- $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
784
- discrete: false
785
- });
786
- }
787
- };
788
- ownerDocument.addEventListener("focusin", handleFocus);
789
- return () => ownerDocument.removeEventListener("focusin", handleFocus);
790
- }, [
791
- ownerDocument,
792
- handleFocusOutside
793
- ]);
794
- return {
795
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
796
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
797
- };
798
- }
799
- function $5cb92bef7577960e$var$dispatchUpdate() {
800
- const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
801
- document.dispatchEvent(event);
802
- }
803
- function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) {
804
- const target = detail.originalEvent.target;
805
- const event = new CustomEvent(name2, {
806
- bubbles: false,
807
- cancelable: true,
808
- detail
809
- });
810
- if (handler) target.addEventListener(name2, handler, {
811
- once: true
812
- });
813
- if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
814
- else target.dispatchEvent(event);
815
- }
816
- const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
817
- };
818
- const $1746a345f3d73bb7$var$useReactId = React__namespace["useId".toString()] || (() => void 0);
819
- let $1746a345f3d73bb7$var$count = 0;
820
- function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
821
- const [id, setId] = React__namespace.useState($1746a345f3d73bb7$var$useReactId());
822
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
823
- setId(
824
- (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
825
- );
826
- }, [
827
- deterministicId
828
- ]);
829
- return id ? `radix-${id}` : "";
830
- }
831
- const sides = ["top", "right", "bottom", "left"];
832
- const min = Math.min;
833
- const max = Math.max;
834
- const round = Math.round;
835
- const floor = Math.floor;
836
- const createCoords = (v) => ({
837
- x: v,
838
- y: v
839
- });
840
- const oppositeSideMap = {
841
- left: "right",
842
- right: "left",
843
- bottom: "top",
844
- top: "bottom"
845
- };
846
- const oppositeAlignmentMap = {
847
- start: "end",
848
- end: "start"
849
- };
850
- function clamp(start, value, end) {
851
- return max(start, min(value, end));
852
- }
853
- function evaluate(value, param) {
854
- return typeof value === "function" ? value(param) : value;
855
- }
856
- function getSide(placement) {
857
- return placement.split("-")[0];
858
- }
859
- function getAlignment(placement) {
860
- return placement.split("-")[1];
861
- }
862
- function getOppositeAxis(axis) {
863
- return axis === "x" ? "y" : "x";
864
- }
865
- function getAxisLength(axis) {
866
- return axis === "y" ? "height" : "width";
867
- }
868
- function getSideAxis(placement) {
869
- return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
870
- }
871
- function getAlignmentAxis(placement) {
872
- return getOppositeAxis(getSideAxis(placement));
873
- }
874
- function getAlignmentSides(placement, rects, rtl) {
875
- if (rtl === void 0) {
876
- rtl = false;
877
- }
878
- const alignment = getAlignment(placement);
879
- const alignmentAxis = getAlignmentAxis(placement);
880
- const length = getAxisLength(alignmentAxis);
881
- let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
882
- if (rects.reference[length] > rects.floating[length]) {
883
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
884
- }
885
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
886
- }
887
- function getExpandedPlacements(placement) {
888
- const oppositePlacement = getOppositePlacement(placement);
889
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
890
- }
891
- function getOppositeAlignmentPlacement(placement) {
892
- return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
893
- }
894
- function getSideList(side, isStart, rtl) {
895
- const lr = ["left", "right"];
896
- const rl = ["right", "left"];
897
- const tb = ["top", "bottom"];
898
- const bt = ["bottom", "top"];
899
- switch (side) {
900
- case "top":
901
- case "bottom":
902
- if (rtl) return isStart ? rl : lr;
903
- return isStart ? lr : rl;
904
- case "left":
905
- case "right":
906
- return isStart ? tb : bt;
907
- default:
908
- return [];
909
- }
910
- }
911
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
912
- const alignment = getAlignment(placement);
913
- let list = getSideList(getSide(placement), direction === "start", rtl);
914
- if (alignment) {
915
- list = list.map((side) => side + "-" + alignment);
916
- if (flipAlignment) {
917
- list = list.concat(list.map(getOppositeAlignmentPlacement));
918
- }
919
- }
920
- return list;
921
- }
922
- function getOppositePlacement(placement) {
923
- return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
924
- }
925
- function expandPaddingObject(padding) {
926
- return {
927
- top: 0,
928
- right: 0,
929
- bottom: 0,
930
- left: 0,
931
- ...padding
932
- };
933
- }
934
- function getPaddingObject(padding) {
935
- return typeof padding !== "number" ? expandPaddingObject(padding) : {
936
- top: padding,
937
- right: padding,
938
- bottom: padding,
939
- left: padding
940
- };
941
- }
942
- function rectToClientRect(rect) {
943
- const {
944
- x,
945
- y,
946
- width,
947
- height
948
- } = rect;
949
- return {
950
- width,
951
- height,
952
- top: y,
953
- left: x,
954
- right: x + width,
955
- bottom: y + height,
956
- x,
957
- y
958
- };
959
- }
960
- function computeCoordsFromPlacement(_ref, placement, rtl) {
961
- let {
962
- reference,
963
- floating
964
- } = _ref;
965
- const sideAxis = getSideAxis(placement);
966
- const alignmentAxis = getAlignmentAxis(placement);
967
- const alignLength = getAxisLength(alignmentAxis);
968
- const side = getSide(placement);
969
- const isVertical = sideAxis === "y";
970
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
971
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
972
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
973
- let coords;
974
- switch (side) {
975
- case "top":
976
- coords = {
977
- x: commonX,
978
- y: reference.y - floating.height
979
- };
980
- break;
981
- case "bottom":
982
- coords = {
983
- x: commonX,
984
- y: reference.y + reference.height
985
- };
986
- break;
987
- case "right":
988
- coords = {
989
- x: reference.x + reference.width,
990
- y: commonY
991
- };
992
- break;
993
- case "left":
994
- coords = {
995
- x: reference.x - floating.width,
996
- y: commonY
997
- };
998
- break;
999
- default:
1000
- coords = {
1001
- x: reference.x,
1002
- y: reference.y
1003
- };
1004
- }
1005
- switch (getAlignment(placement)) {
1006
- case "start":
1007
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1008
- break;
1009
- case "end":
1010
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1011
- break;
1012
- }
1013
- return coords;
1014
- }
1015
- const computePosition$1 = async (reference, floating, config) => {
1016
- const {
1017
- placement = "bottom",
1018
- strategy = "absolute",
1019
- middleware = [],
1020
- platform: platform2
1021
- } = config;
1022
- const validMiddleware = middleware.filter(Boolean);
1023
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
1024
- let rects = await platform2.getElementRects({
1025
- reference,
1026
- floating,
1027
- strategy
1028
- });
1029
- let {
1030
- x,
1031
- y
1032
- } = computeCoordsFromPlacement(rects, placement, rtl);
1033
- let statefulPlacement = placement;
1034
- let middlewareData = {};
1035
- let resetCount = 0;
1036
- for (let i = 0; i < validMiddleware.length; i++) {
1037
- const {
1038
- name: name2,
1039
- fn
1040
- } = validMiddleware[i];
1041
- const {
1042
- x: nextX,
1043
- y: nextY,
1044
- data,
1045
- reset
1046
- } = await fn({
1047
- x,
1048
- y,
1049
- initialPlacement: placement,
1050
- placement: statefulPlacement,
1051
- strategy,
1052
- middlewareData,
1053
- rects,
1054
- platform: platform2,
1055
- elements: {
1056
- reference,
1057
- floating
1058
- }
1059
- });
1060
- x = nextX != null ? nextX : x;
1061
- y = nextY != null ? nextY : y;
1062
- middlewareData = {
1063
- ...middlewareData,
1064
- [name2]: {
1065
- ...middlewareData[name2],
1066
- ...data
1067
- }
1068
- };
1069
- if (reset && resetCount <= 50) {
1070
- resetCount++;
1071
- if (typeof reset === "object") {
1072
- if (reset.placement) {
1073
- statefulPlacement = reset.placement;
1074
- }
1075
- if (reset.rects) {
1076
- rects = reset.rects === true ? await platform2.getElementRects({
1077
- reference,
1078
- floating,
1079
- strategy
1080
- }) : reset.rects;
1081
- }
1082
- ({
1083
- x,
1084
- y
1085
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1086
- }
1087
- i = -1;
1088
- }
1089
- }
1090
- return {
1091
- x,
1092
- y,
1093
- placement: statefulPlacement,
1094
- strategy,
1095
- middlewareData
1096
- };
1097
- };
1098
- async function detectOverflow(state, options) {
1099
- var _await$platform$isEle;
1100
- if (options === void 0) {
1101
- options = {};
1102
- }
1103
- const {
1104
- x,
1105
- y,
1106
- platform: platform2,
1107
- rects,
1108
- elements,
1109
- strategy
1110
- } = state;
1111
- const {
1112
- boundary = "clippingAncestors",
1113
- rootBoundary = "viewport",
1114
- elementContext = "floating",
1115
- altBoundary = false,
1116
- padding = 0
1117
- } = evaluate(options, state);
1118
- const paddingObject = getPaddingObject(padding);
1119
- const altContext = elementContext === "floating" ? "reference" : "floating";
1120
- const element = elements[altBoundary ? altContext : elementContext];
1121
- const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
1122
- element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
1123
- boundary,
1124
- rootBoundary,
1125
- strategy
1126
- }));
1127
- const rect = elementContext === "floating" ? {
1128
- x,
1129
- y,
1130
- width: rects.floating.width,
1131
- height: rects.floating.height
1132
- } : rects.reference;
1133
- const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1134
- const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1135
- x: 1,
1136
- y: 1
1137
- } : {
1138
- x: 1,
1139
- y: 1
1140
- };
1141
- const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1142
- elements,
1143
- rect,
1144
- offsetParent,
1145
- strategy
1146
- }) : rect);
1147
- return {
1148
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1149
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1150
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1151
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1152
- };
1153
- }
1154
- const arrow$3 = (options) => ({
1155
- name: "arrow",
1156
- options,
1157
- async fn(state) {
1158
- const {
1159
- x,
1160
- y,
1161
- placement,
1162
- rects,
1163
- platform: platform2,
1164
- elements,
1165
- middlewareData
1166
- } = state;
1167
- const {
1168
- element,
1169
- padding = 0
1170
- } = evaluate(options, state) || {};
1171
- if (element == null) {
1172
- return {};
1173
- }
1174
- const paddingObject = getPaddingObject(padding);
1175
- const coords = {
1176
- x,
1177
- y
1178
- };
1179
- const axis = getAlignmentAxis(placement);
1180
- const length = getAxisLength(axis);
1181
- const arrowDimensions = await platform2.getDimensions(element);
1182
- const isYAxis = axis === "y";
1183
- const minProp = isYAxis ? "top" : "left";
1184
- const maxProp = isYAxis ? "bottom" : "right";
1185
- const clientProp = isYAxis ? "clientHeight" : "clientWidth";
1186
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1187
- const startDiff = coords[axis] - rects.reference[axis];
1188
- const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
1189
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1190
- if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
1191
- clientSize = elements.floating[clientProp] || rects.floating[length];
1192
- }
1193
- const centerToReference = endDiff / 2 - startDiff / 2;
1194
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1195
- const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1196
- const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1197
- const min$1 = minPadding;
1198
- const max2 = clientSize - arrowDimensions[length] - maxPadding;
1199
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1200
- const offset2 = clamp(min$1, center, max2);
1201
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1202
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
1203
- return {
1204
- [axis]: coords[axis] + alignmentOffset,
1205
- data: {
1206
- [axis]: offset2,
1207
- centerOffset: center - offset2 - alignmentOffset,
1208
- ...shouldAddOffset && {
1209
- alignmentOffset
1210
- }
1211
- },
1212
- reset: shouldAddOffset
1213
- };
1214
- }
1215
- });
1216
- const flip$2 = function(options) {
1217
- if (options === void 0) {
1218
- options = {};
1219
- }
1220
- return {
1221
- name: "flip",
1222
- options,
1223
- async fn(state) {
1224
- var _middlewareData$arrow, _middlewareData$flip;
1225
- const {
1226
- placement,
1227
- middlewareData,
1228
- rects,
1229
- initialPlacement,
1230
- platform: platform2,
1231
- elements
1232
- } = state;
1233
- const {
1234
- mainAxis: checkMainAxis = true,
1235
- crossAxis: checkCrossAxis = true,
1236
- fallbackPlacements: specifiedFallbackPlacements,
1237
- fallbackStrategy = "bestFit",
1238
- fallbackAxisSideDirection = "none",
1239
- flipAlignment = true,
1240
- ...detectOverflowOptions
1241
- } = evaluate(options, state);
1242
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1243
- return {};
1244
- }
1245
- const side = getSide(placement);
1246
- const initialSideAxis = getSideAxis(initialPlacement);
1247
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1248
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1249
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1250
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
1251
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1252
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1253
- }
1254
- const placements = [initialPlacement, ...fallbackPlacements];
1255
- const overflow = await detectOverflow(state, detectOverflowOptions);
1256
- const overflows = [];
1257
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1258
- if (checkMainAxis) {
1259
- overflows.push(overflow[side]);
1260
- }
1261
- if (checkCrossAxis) {
1262
- const sides2 = getAlignmentSides(placement, rects, rtl);
1263
- overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
1264
- }
1265
- overflowsData = [...overflowsData, {
1266
- placement,
1267
- overflows
1268
- }];
1269
- if (!overflows.every((side2) => side2 <= 0)) {
1270
- var _middlewareData$flip2, _overflowsData$filter;
1271
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1272
- const nextPlacement = placements[nextIndex];
1273
- if (nextPlacement) {
1274
- return {
1275
- data: {
1276
- index: nextIndex,
1277
- overflows: overflowsData
1278
- },
1279
- reset: {
1280
- placement: nextPlacement
1281
- }
1282
- };
1283
- }
1284
- let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1285
- if (!resetPlacement) {
1286
- switch (fallbackStrategy) {
1287
- case "bestFit": {
1288
- var _overflowsData$filter2;
1289
- const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
1290
- if (hasFallbackAxisSideDirection) {
1291
- const currentSideAxis = getSideAxis(d.placement);
1292
- return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
1293
- // reading directions favoring greater width.
1294
- currentSideAxis === "y";
1295
- }
1296
- return true;
1297
- }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1298
- if (placement2) {
1299
- resetPlacement = placement2;
1300
- }
1301
- break;
1302
- }
1303
- case "initialPlacement":
1304
- resetPlacement = initialPlacement;
1305
- break;
1306
- }
1307
- }
1308
- if (placement !== resetPlacement) {
1309
- return {
1310
- reset: {
1311
- placement: resetPlacement
1312
- }
1313
- };
1314
- }
1315
- }
1316
- return {};
1317
- }
1318
- };
1319
- };
1320
- function getSideOffsets(overflow, rect) {
1321
- return {
1322
- top: overflow.top - rect.height,
1323
- right: overflow.right - rect.width,
1324
- bottom: overflow.bottom - rect.height,
1325
- left: overflow.left - rect.width
1326
- };
1327
- }
1328
- function isAnySideFullyClipped(overflow) {
1329
- return sides.some((side) => overflow[side] >= 0);
1330
- }
1331
- const hide$2 = function(options) {
1332
- if (options === void 0) {
1333
- options = {};
1334
- }
1335
- return {
1336
- name: "hide",
1337
- options,
1338
- async fn(state) {
1339
- const {
1340
- rects
1341
- } = state;
1342
- const {
1343
- strategy = "referenceHidden",
1344
- ...detectOverflowOptions
1345
- } = evaluate(options, state);
1346
- switch (strategy) {
1347
- case "referenceHidden": {
1348
- const overflow = await detectOverflow(state, {
1349
- ...detectOverflowOptions,
1350
- elementContext: "reference"
1351
- });
1352
- const offsets = getSideOffsets(overflow, rects.reference);
1353
- return {
1354
- data: {
1355
- referenceHiddenOffsets: offsets,
1356
- referenceHidden: isAnySideFullyClipped(offsets)
1357
- }
1358
- };
1359
- }
1360
- case "escaped": {
1361
- const overflow = await detectOverflow(state, {
1362
- ...detectOverflowOptions,
1363
- altBoundary: true
1364
- });
1365
- const offsets = getSideOffsets(overflow, rects.floating);
1366
- return {
1367
- data: {
1368
- escapedOffsets: offsets,
1369
- escaped: isAnySideFullyClipped(offsets)
1370
- }
1371
- };
1372
- }
1373
- default: {
1374
- return {};
1375
- }
1376
- }
1377
- }
1378
- };
1379
- };
1380
- async function convertValueToCoords(state, options) {
1381
- const {
1382
- placement,
1383
- platform: platform2,
1384
- elements
1385
- } = state;
1386
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1387
- const side = getSide(placement);
1388
- const alignment = getAlignment(placement);
1389
- const isVertical = getSideAxis(placement) === "y";
1390
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
1391
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1392
- const rawValue = evaluate(options, state);
1393
- let {
1394
- mainAxis,
1395
- crossAxis,
1396
- alignmentAxis
1397
- } = typeof rawValue === "number" ? {
1398
- mainAxis: rawValue,
1399
- crossAxis: 0,
1400
- alignmentAxis: null
1401
- } : {
1402
- mainAxis: rawValue.mainAxis || 0,
1403
- crossAxis: rawValue.crossAxis || 0,
1404
- alignmentAxis: rawValue.alignmentAxis
1405
- };
1406
- if (alignment && typeof alignmentAxis === "number") {
1407
- crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1408
- }
1409
- return isVertical ? {
1410
- x: crossAxis * crossAxisMulti,
1411
- y: mainAxis * mainAxisMulti
1412
- } : {
1413
- x: mainAxis * mainAxisMulti,
1414
- y: crossAxis * crossAxisMulti
1415
- };
1416
- }
1417
- const offset$2 = function(options) {
1418
- if (options === void 0) {
1419
- options = 0;
1420
- }
1421
- return {
1422
- name: "offset",
1423
- options,
1424
- async fn(state) {
1425
- var _middlewareData$offse, _middlewareData$arrow;
1426
- const {
1427
- x,
1428
- y,
1429
- placement,
1430
- middlewareData
1431
- } = state;
1432
- const diffCoords = await convertValueToCoords(state, options);
1433
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1434
- return {};
1435
- }
1436
- return {
1437
- x: x + diffCoords.x,
1438
- y: y + diffCoords.y,
1439
- data: {
1440
- ...diffCoords,
1441
- placement
1442
- }
1443
- };
1444
- }
1445
- };
1446
- };
1447
- const shift$2 = function(options) {
1448
- if (options === void 0) {
1449
- options = {};
1450
- }
1451
- return {
1452
- name: "shift",
1453
- options,
1454
- async fn(state) {
1455
- const {
1456
- x,
1457
- y,
1458
- placement
1459
- } = state;
1460
- const {
1461
- mainAxis: checkMainAxis = true,
1462
- crossAxis: checkCrossAxis = false,
1463
- limiter = {
1464
- fn: (_ref) => {
1465
- let {
1466
- x: x2,
1467
- y: y2
1468
- } = _ref;
1469
- return {
1470
- x: x2,
1471
- y: y2
1472
- };
1473
- }
1474
- },
1475
- ...detectOverflowOptions
1476
- } = evaluate(options, state);
1477
- const coords = {
1478
- x,
1479
- y
1480
- };
1481
- const overflow = await detectOverflow(state, detectOverflowOptions);
1482
- const crossAxis = getSideAxis(getSide(placement));
1483
- const mainAxis = getOppositeAxis(crossAxis);
1484
- let mainAxisCoord = coords[mainAxis];
1485
- let crossAxisCoord = coords[crossAxis];
1486
- if (checkMainAxis) {
1487
- const minSide = mainAxis === "y" ? "top" : "left";
1488
- const maxSide = mainAxis === "y" ? "bottom" : "right";
1489
- const min2 = mainAxisCoord + overflow[minSide];
1490
- const max2 = mainAxisCoord - overflow[maxSide];
1491
- mainAxisCoord = clamp(min2, mainAxisCoord, max2);
1492
- }
1493
- if (checkCrossAxis) {
1494
- const minSide = crossAxis === "y" ? "top" : "left";
1495
- const maxSide = crossAxis === "y" ? "bottom" : "right";
1496
- const min2 = crossAxisCoord + overflow[minSide];
1497
- const max2 = crossAxisCoord - overflow[maxSide];
1498
- crossAxisCoord = clamp(min2, crossAxisCoord, max2);
1499
- }
1500
- const limitedCoords = limiter.fn({
1501
- ...state,
1502
- [mainAxis]: mainAxisCoord,
1503
- [crossAxis]: crossAxisCoord
1504
- });
1505
- return {
1506
- ...limitedCoords,
1507
- data: {
1508
- x: limitedCoords.x - x,
1509
- y: limitedCoords.y - y,
1510
- enabled: {
1511
- [mainAxis]: checkMainAxis,
1512
- [crossAxis]: checkCrossAxis
1513
- }
1514
- }
1515
- };
1516
- }
1517
- };
1518
- };
1519
- const limitShift$2 = function(options) {
1520
- if (options === void 0) {
1521
- options = {};
1522
- }
1523
- return {
1524
- options,
1525
- fn(state) {
1526
- const {
1527
- x,
1528
- y,
1529
- placement,
1530
- rects,
1531
- middlewareData
1532
- } = state;
1533
- const {
1534
- offset: offset2 = 0,
1535
- mainAxis: checkMainAxis = true,
1536
- crossAxis: checkCrossAxis = true
1537
- } = evaluate(options, state);
1538
- const coords = {
1539
- x,
1540
- y
1541
- };
1542
- const crossAxis = getSideAxis(placement);
1543
- const mainAxis = getOppositeAxis(crossAxis);
1544
- let mainAxisCoord = coords[mainAxis];
1545
- let crossAxisCoord = coords[crossAxis];
1546
- const rawOffset = evaluate(offset2, state);
1547
- const computedOffset = typeof rawOffset === "number" ? {
1548
- mainAxis: rawOffset,
1549
- crossAxis: 0
1550
- } : {
1551
- mainAxis: 0,
1552
- crossAxis: 0,
1553
- ...rawOffset
1554
- };
1555
- if (checkMainAxis) {
1556
- const len = mainAxis === "y" ? "height" : "width";
1557
- const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1558
- const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1559
- if (mainAxisCoord < limitMin) {
1560
- mainAxisCoord = limitMin;
1561
- } else if (mainAxisCoord > limitMax) {
1562
- mainAxisCoord = limitMax;
1563
- }
1564
- }
1565
- if (checkCrossAxis) {
1566
- var _middlewareData$offse, _middlewareData$offse2;
1567
- const len = mainAxis === "y" ? "width" : "height";
1568
- const isOriginSide = ["top", "left"].includes(getSide(placement));
1569
- const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1570
- const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1571
- if (crossAxisCoord < limitMin) {
1572
- crossAxisCoord = limitMin;
1573
- } else if (crossAxisCoord > limitMax) {
1574
- crossAxisCoord = limitMax;
1575
- }
1576
- }
1577
- return {
1578
- [mainAxis]: mainAxisCoord,
1579
- [crossAxis]: crossAxisCoord
1580
- };
1581
- }
1582
- };
1583
- };
1584
- const size$2 = function(options) {
1585
- if (options === void 0) {
1586
- options = {};
1587
- }
1588
- return {
1589
- name: "size",
1590
- options,
1591
- async fn(state) {
1592
- var _state$middlewareData, _state$middlewareData2;
1593
- const {
1594
- placement,
1595
- rects,
1596
- platform: platform2,
1597
- elements
1598
- } = state;
1599
- const {
1600
- apply = () => {
1601
- },
1602
- ...detectOverflowOptions
1603
- } = evaluate(options, state);
1604
- const overflow = await detectOverflow(state, detectOverflowOptions);
1605
- const side = getSide(placement);
1606
- const alignment = getAlignment(placement);
1607
- const isYAxis = getSideAxis(placement) === "y";
1608
- const {
1609
- width,
1610
- height
1611
- } = rects.floating;
1612
- let heightSide;
1613
- let widthSide;
1614
- if (side === "top" || side === "bottom") {
1615
- heightSide = side;
1616
- widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1617
- } else {
1618
- widthSide = side;
1619
- heightSide = alignment === "end" ? "top" : "bottom";
1620
- }
1621
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
1622
- const maximumClippingWidth = width - overflow.left - overflow.right;
1623
- const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1624
- const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1625
- const noShift = !state.middlewareData.shift;
1626
- let availableHeight = overflowAvailableHeight;
1627
- let availableWidth = overflowAvailableWidth;
1628
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1629
- availableWidth = maximumClippingWidth;
1630
- }
1631
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1632
- availableHeight = maximumClippingHeight;
1633
- }
1634
- if (noShift && !alignment) {
1635
- const xMin = max(overflow.left, 0);
1636
- const xMax = max(overflow.right, 0);
1637
- const yMin = max(overflow.top, 0);
1638
- const yMax = max(overflow.bottom, 0);
1639
- if (isYAxis) {
1640
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1641
- } else {
1642
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1643
- }
1644
- }
1645
- await apply({
1646
- ...state,
1647
- availableWidth,
1648
- availableHeight
1649
- });
1650
- const nextDimensions = await platform2.getDimensions(elements.floating);
1651
- if (width !== nextDimensions.width || height !== nextDimensions.height) {
1652
- return {
1653
- reset: {
1654
- rects: true
1655
- }
1656
- };
1657
- }
1658
- return {};
1659
- }
1660
- };
1661
- };
1662
- function hasWindow() {
1663
- return typeof window !== "undefined";
1664
- }
1665
- function getNodeName(node) {
1666
- if (isNode(node)) {
1667
- return (node.nodeName || "").toLowerCase();
1668
- }
1669
- return "#document";
1670
- }
1671
- function getWindow(node) {
1672
- var _node$ownerDocument;
1673
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1674
- }
1675
- function getDocumentElement(node) {
1676
- var _ref;
1677
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1678
- }
1679
- function isNode(value) {
1680
- if (!hasWindow()) {
1681
- return false;
1682
- }
1683
- return value instanceof Node || value instanceof getWindow(value).Node;
1684
- }
1685
- function isElement(value) {
1686
- if (!hasWindow()) {
1687
- return false;
1688
- }
1689
- return value instanceof Element || value instanceof getWindow(value).Element;
1690
- }
1691
- function isHTMLElement(value) {
1692
- if (!hasWindow()) {
1693
- return false;
1694
- }
1695
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1696
- }
1697
- function isShadowRoot(value) {
1698
- if (!hasWindow() || typeof ShadowRoot === "undefined") {
1699
- return false;
1700
- }
1701
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1702
- }
1703
- function isOverflowElement(element) {
1704
- const {
1705
- overflow,
1706
- overflowX,
1707
- overflowY,
1708
- display
1709
- } = getComputedStyle$1(element);
1710
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
1711
- }
1712
- function isTableElement(element) {
1713
- return ["table", "td", "th"].includes(getNodeName(element));
1714
- }
1715
- function isTopLayer(element) {
1716
- return [":popover-open", ":modal"].some((selector) => {
1717
- try {
1718
- return element.matches(selector);
1719
- } catch (e) {
1720
- return false;
1721
- }
1722
- });
1723
- }
1724
- function isContainingBlock(elementOrCss) {
1725
- const webkit = isWebKit();
1726
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1727
- return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
1728
- }
1729
- function getContainingBlock(element) {
1730
- let currentNode = getParentNode(element);
1731
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1732
- if (isContainingBlock(currentNode)) {
1733
- return currentNode;
1734
- } else if (isTopLayer(currentNode)) {
1735
- return null;
1736
- }
1737
- currentNode = getParentNode(currentNode);
1738
- }
1739
- return null;
1740
- }
1741
- function isWebKit() {
1742
- if (typeof CSS === "undefined" || !CSS.supports) return false;
1743
- return CSS.supports("-webkit-backdrop-filter", "none");
1744
- }
1745
- function isLastTraversableNode(node) {
1746
- return ["html", "body", "#document"].includes(getNodeName(node));
1747
- }
1748
- function getComputedStyle$1(element) {
1749
- return getWindow(element).getComputedStyle(element);
1750
- }
1751
- function getNodeScroll(element) {
1752
- if (isElement(element)) {
1753
- return {
1754
- scrollLeft: element.scrollLeft,
1755
- scrollTop: element.scrollTop
1756
- };
1757
- }
1758
- return {
1759
- scrollLeft: element.scrollX,
1760
- scrollTop: element.scrollY
1761
- };
1762
- }
1763
- function getParentNode(node) {
1764
- if (getNodeName(node) === "html") {
1765
- return node;
1766
- }
1767
- const result = (
1768
- // Step into the shadow DOM of the parent of a slotted node.
1769
- node.assignedSlot || // DOM Element detected.
1770
- node.parentNode || // ShadowRoot detected.
1771
- isShadowRoot(node) && node.host || // Fallback.
1772
- getDocumentElement(node)
1773
- );
1774
- return isShadowRoot(result) ? result.host : result;
1775
- }
1776
- function getNearestOverflowAncestor(node) {
1777
- const parentNode = getParentNode(node);
1778
- if (isLastTraversableNode(parentNode)) {
1779
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1780
- }
1781
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1782
- return parentNode;
1783
- }
1784
- return getNearestOverflowAncestor(parentNode);
1785
- }
1786
- function getOverflowAncestors(node, list, traverseIframes) {
1787
- var _node$ownerDocument2;
1788
- if (list === void 0) {
1789
- list = [];
1790
- }
1791
- if (traverseIframes === void 0) {
1792
- traverseIframes = true;
1793
- }
1794
- const scrollableAncestor = getNearestOverflowAncestor(node);
1795
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1796
- const win = getWindow(scrollableAncestor);
1797
- if (isBody) {
1798
- const frameElement = getFrameElement(win);
1799
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1800
- }
1801
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1802
- }
1803
- function getFrameElement(win) {
1804
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1805
- }
1806
- function getCssDimensions(element) {
1807
- const css = getComputedStyle$1(element);
1808
- let width = parseFloat(css.width) || 0;
1809
- let height = parseFloat(css.height) || 0;
1810
- const hasOffset = isHTMLElement(element);
1811
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1812
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1813
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1814
- if (shouldFallback) {
1815
- width = offsetWidth;
1816
- height = offsetHeight;
1817
- }
1818
- return {
1819
- width,
1820
- height,
1821
- $: shouldFallback
1822
- };
1823
- }
1824
- function unwrapElement(element) {
1825
- return !isElement(element) ? element.contextElement : element;
1826
- }
1827
- function getScale(element) {
1828
- const domElement = unwrapElement(element);
1829
- if (!isHTMLElement(domElement)) {
1830
- return createCoords(1);
1831
- }
1832
- const rect = domElement.getBoundingClientRect();
1833
- const {
1834
- width,
1835
- height,
1836
- $
1837
- } = getCssDimensions(domElement);
1838
- let x = ($ ? round(rect.width) : rect.width) / width;
1839
- let y = ($ ? round(rect.height) : rect.height) / height;
1840
- if (!x || !Number.isFinite(x)) {
1841
- x = 1;
1842
- }
1843
- if (!y || !Number.isFinite(y)) {
1844
- y = 1;
1845
- }
1846
- return {
1847
- x,
1848
- y
1849
- };
1850
- }
1851
- const noOffsets = /* @__PURE__ */ createCoords(0);
1852
- function getVisualOffsets(element) {
1853
- const win = getWindow(element);
1854
- if (!isWebKit() || !win.visualViewport) {
1855
- return noOffsets;
1856
- }
1857
- return {
1858
- x: win.visualViewport.offsetLeft,
1859
- y: win.visualViewport.offsetTop
1860
- };
1861
- }
1862
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1863
- if (isFixed === void 0) {
1864
- isFixed = false;
1865
- }
1866
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1867
- return false;
1868
- }
1869
- return isFixed;
1870
- }
1871
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1872
- if (includeScale === void 0) {
1873
- includeScale = false;
1874
- }
1875
- if (isFixedStrategy === void 0) {
1876
- isFixedStrategy = false;
1877
- }
1878
- const clientRect = element.getBoundingClientRect();
1879
- const domElement = unwrapElement(element);
1880
- let scale = createCoords(1);
1881
- if (includeScale) {
1882
- if (offsetParent) {
1883
- if (isElement(offsetParent)) {
1884
- scale = getScale(offsetParent);
1885
- }
1886
- } else {
1887
- scale = getScale(element);
1888
- }
1889
- }
1890
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1891
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1892
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1893
- let width = clientRect.width / scale.x;
1894
- let height = clientRect.height / scale.y;
1895
- if (domElement) {
1896
- const win = getWindow(domElement);
1897
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1898
- let currentWin = win;
1899
- let currentIFrame = getFrameElement(currentWin);
1900
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1901
- const iframeScale = getScale(currentIFrame);
1902
- const iframeRect = currentIFrame.getBoundingClientRect();
1903
- const css = getComputedStyle$1(currentIFrame);
1904
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1905
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1906
- x *= iframeScale.x;
1907
- y *= iframeScale.y;
1908
- width *= iframeScale.x;
1909
- height *= iframeScale.y;
1910
- x += left;
1911
- y += top;
1912
- currentWin = getWindow(currentIFrame);
1913
- currentIFrame = getFrameElement(currentWin);
1914
- }
1915
- }
1916
- return rectToClientRect({
1917
- width,
1918
- height,
1919
- x,
1920
- y
1921
- });
1922
- }
1923
- function getWindowScrollBarX(element, rect) {
1924
- const leftScroll = getNodeScroll(element).scrollLeft;
1925
- if (!rect) {
1926
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1927
- }
1928
- return rect.left + leftScroll;
1929
- }
1930
- function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1931
- if (ignoreScrollbarX === void 0) {
1932
- ignoreScrollbarX = false;
1933
- }
1934
- const htmlRect = documentElement.getBoundingClientRect();
1935
- const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
1936
- // RTL <body> scrollbar.
1937
- getWindowScrollBarX(documentElement, htmlRect)
1938
- ));
1939
- const y = htmlRect.top + scroll.scrollTop;
1940
- return {
1941
- x,
1942
- y
1943
- };
1944
- }
1945
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1946
- let {
1947
- elements,
1948
- rect,
1949
- offsetParent,
1950
- strategy
1951
- } = _ref;
1952
- const isFixed = strategy === "fixed";
1953
- const documentElement = getDocumentElement(offsetParent);
1954
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1955
- if (offsetParent === documentElement || topLayer && isFixed) {
1956
- return rect;
1957
- }
1958
- let scroll = {
1959
- scrollLeft: 0,
1960
- scrollTop: 0
1961
- };
1962
- let scale = createCoords(1);
1963
- const offsets = createCoords(0);
1964
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1965
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1966
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1967
- scroll = getNodeScroll(offsetParent);
1968
- }
1969
- if (isHTMLElement(offsetParent)) {
1970
- const offsetRect = getBoundingClientRect(offsetParent);
1971
- scale = getScale(offsetParent);
1972
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1973
- offsets.y = offsetRect.y + offsetParent.clientTop;
1974
- }
1975
- }
1976
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1977
- return {
1978
- width: rect.width * scale.x,
1979
- height: rect.height * scale.y,
1980
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1981
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1982
- };
1983
- }
1984
- function getClientRects(element) {
1985
- return Array.from(element.getClientRects());
1986
- }
1987
- function getDocumentRect(element) {
1988
- const html = getDocumentElement(element);
1989
- const scroll = getNodeScroll(element);
1990
- const body = element.ownerDocument.body;
1991
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1992
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1993
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1994
- const y = -scroll.scrollTop;
1995
- if (getComputedStyle$1(body).direction === "rtl") {
1996
- x += max(html.clientWidth, body.clientWidth) - width;
1997
- }
1998
- return {
1999
- width,
2000
- height,
2001
- x,
2002
- y
2003
- };
2004
- }
2005
- function getViewportRect(element, strategy) {
2006
- const win = getWindow(element);
2007
- const html = getDocumentElement(element);
2008
- const visualViewport = win.visualViewport;
2009
- let width = html.clientWidth;
2010
- let height = html.clientHeight;
2011
- let x = 0;
2012
- let y = 0;
2013
- if (visualViewport) {
2014
- width = visualViewport.width;
2015
- height = visualViewport.height;
2016
- const visualViewportBased = isWebKit();
2017
- if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
2018
- x = visualViewport.offsetLeft;
2019
- y = visualViewport.offsetTop;
2020
- }
2021
- }
2022
- return {
2023
- width,
2024
- height,
2025
- x,
2026
- y
2027
- };
2028
- }
2029
- function getInnerBoundingClientRect(element, strategy) {
2030
- const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
2031
- const top = clientRect.top + element.clientTop;
2032
- const left = clientRect.left + element.clientLeft;
2033
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2034
- const width = element.clientWidth * scale.x;
2035
- const height = element.clientHeight * scale.y;
2036
- const x = left * scale.x;
2037
- const y = top * scale.y;
2038
- return {
2039
- width,
2040
- height,
2041
- x,
2042
- y
2043
- };
2044
- }
2045
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2046
- let rect;
2047
- if (clippingAncestor === "viewport") {
2048
- rect = getViewportRect(element, strategy);
2049
- } else if (clippingAncestor === "document") {
2050
- rect = getDocumentRect(getDocumentElement(element));
2051
- } else if (isElement(clippingAncestor)) {
2052
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2053
- } else {
2054
- const visualOffsets = getVisualOffsets(element);
2055
- rect = {
2056
- x: clippingAncestor.x - visualOffsets.x,
2057
- y: clippingAncestor.y - visualOffsets.y,
2058
- width: clippingAncestor.width,
2059
- height: clippingAncestor.height
2060
- };
2061
- }
2062
- return rectToClientRect(rect);
2063
- }
2064
- function hasFixedPositionAncestor(element, stopNode) {
2065
- const parentNode = getParentNode(element);
2066
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2067
- return false;
2068
- }
2069
- return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
2070
- }
2071
- function getClippingElementAncestors(element, cache) {
2072
- const cachedResult = cache.get(element);
2073
- if (cachedResult) {
2074
- return cachedResult;
2075
- }
2076
- let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
2077
- let currentContainingBlockComputedStyle = null;
2078
- const elementIsFixed = getComputedStyle$1(element).position === "fixed";
2079
- let currentNode = elementIsFixed ? getParentNode(element) : element;
2080
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2081
- const computedStyle = getComputedStyle$1(currentNode);
2082
- const currentNodeIsContaining = isContainingBlock(currentNode);
2083
- if (!currentNodeIsContaining && computedStyle.position === "fixed") {
2084
- currentContainingBlockComputedStyle = null;
2085
- }
2086
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2087
- if (shouldDropCurrentNode) {
2088
- result = result.filter((ancestor) => ancestor !== currentNode);
2089
- } else {
2090
- currentContainingBlockComputedStyle = computedStyle;
2091
- }
2092
- currentNode = getParentNode(currentNode);
2093
- }
2094
- cache.set(element, result);
2095
- return result;
2096
- }
2097
- function getClippingRect(_ref) {
2098
- let {
2099
- element,
2100
- boundary,
2101
- rootBoundary,
2102
- strategy
2103
- } = _ref;
2104
- const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2105
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2106
- const firstClippingAncestor = clippingAncestors[0];
2107
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2108
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2109
- accRect.top = max(rect.top, accRect.top);
2110
- accRect.right = min(rect.right, accRect.right);
2111
- accRect.bottom = min(rect.bottom, accRect.bottom);
2112
- accRect.left = max(rect.left, accRect.left);
2113
- return accRect;
2114
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2115
- return {
2116
- width: clippingRect.right - clippingRect.left,
2117
- height: clippingRect.bottom - clippingRect.top,
2118
- x: clippingRect.left,
2119
- y: clippingRect.top
2120
- };
2121
- }
2122
- function getDimensions(element) {
2123
- const {
2124
- width,
2125
- height
2126
- } = getCssDimensions(element);
2127
- return {
2128
- width,
2129
- height
2130
- };
2131
- }
2132
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2133
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2134
- const documentElement = getDocumentElement(offsetParent);
2135
- const isFixed = strategy === "fixed";
2136
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2137
- let scroll = {
2138
- scrollLeft: 0,
2139
- scrollTop: 0
2140
- };
2141
- const offsets = createCoords(0);
2142
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2143
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2144
- scroll = getNodeScroll(offsetParent);
2145
- }
2146
- if (isOffsetParentAnElement) {
2147
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2148
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2149
- offsets.y = offsetRect.y + offsetParent.clientTop;
2150
- } else if (documentElement) {
2151
- offsets.x = getWindowScrollBarX(documentElement);
2152
- }
2153
- }
2154
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
2155
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
2156
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
2157
- return {
2158
- x,
2159
- y,
2160
- width: rect.width,
2161
- height: rect.height
2162
- };
2163
- }
2164
- function isStaticPositioned(element) {
2165
- return getComputedStyle$1(element).position === "static";
2166
- }
2167
- function getTrueOffsetParent(element, polyfill) {
2168
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
2169
- return null;
2170
- }
2171
- if (polyfill) {
2172
- return polyfill(element);
2173
- }
2174
- let rawOffsetParent = element.offsetParent;
2175
- if (getDocumentElement(element) === rawOffsetParent) {
2176
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
2177
- }
2178
- return rawOffsetParent;
2179
- }
2180
- function getOffsetParent(element, polyfill) {
2181
- const win = getWindow(element);
2182
- if (isTopLayer(element)) {
2183
- return win;
2184
- }
2185
- if (!isHTMLElement(element)) {
2186
- let svgOffsetParent = getParentNode(element);
2187
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2188
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2189
- return svgOffsetParent;
2190
- }
2191
- svgOffsetParent = getParentNode(svgOffsetParent);
2192
- }
2193
- return win;
2194
- }
2195
- let offsetParent = getTrueOffsetParent(element, polyfill);
2196
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2197
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2198
- }
2199
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2200
- return win;
2201
- }
2202
- return offsetParent || getContainingBlock(element) || win;
2203
- }
2204
- const getElementRects = async function(data) {
2205
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2206
- const getDimensionsFn = this.getDimensions;
2207
- const floatingDimensions = await getDimensionsFn(data.floating);
2208
- return {
2209
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2210
- floating: {
2211
- x: 0,
2212
- y: 0,
2213
- width: floatingDimensions.width,
2214
- height: floatingDimensions.height
2215
- }
2216
- };
2217
- };
2218
- function isRTL(element) {
2219
- return getComputedStyle$1(element).direction === "rtl";
2220
- }
2221
- const platform = {
2222
- convertOffsetParentRelativeRectToViewportRelativeRect,
2223
- getDocumentElement,
2224
- getClippingRect,
2225
- getOffsetParent,
2226
- getElementRects,
2227
- getClientRects,
2228
- getDimensions,
2229
- getScale,
2230
- isElement,
2231
- isRTL
2232
- };
2233
- function observeMove(element, onMove) {
2234
- let io = null;
2235
- let timeoutId;
2236
- const root = getDocumentElement(element);
2237
- function cleanup() {
2238
- var _io;
2239
- clearTimeout(timeoutId);
2240
- (_io = io) == null || _io.disconnect();
2241
- io = null;
2242
- }
2243
- function refresh(skip, threshold) {
2244
- if (skip === void 0) {
2245
- skip = false;
2246
- }
2247
- if (threshold === void 0) {
2248
- threshold = 1;
2249
- }
2250
- cleanup();
2251
- const {
2252
- left,
2253
- top,
2254
- width,
2255
- height
2256
- } = element.getBoundingClientRect();
2257
- if (!skip) {
2258
- onMove();
2259
- }
2260
- if (!width || !height) {
2261
- return;
2262
- }
2263
- const insetTop = floor(top);
2264
- const insetRight = floor(root.clientWidth - (left + width));
2265
- const insetBottom = floor(root.clientHeight - (top + height));
2266
- const insetLeft = floor(left);
2267
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2268
- const options = {
2269
- rootMargin,
2270
- threshold: max(0, min(1, threshold)) || 1
2271
- };
2272
- let isFirstUpdate = true;
2273
- function handleObserve(entries) {
2274
- const ratio = entries[0].intersectionRatio;
2275
- if (ratio !== threshold) {
2276
- if (!isFirstUpdate) {
2277
- return refresh();
2278
- }
2279
- if (!ratio) {
2280
- timeoutId = setTimeout(() => {
2281
- refresh(false, 1e-7);
2282
- }, 1e3);
2283
- } else {
2284
- refresh(false, ratio);
2285
- }
2286
- }
2287
- isFirstUpdate = false;
2288
- }
2289
- try {
2290
- io = new IntersectionObserver(handleObserve, {
2291
- ...options,
2292
- // Handle <iframe>s
2293
- root: root.ownerDocument
2294
- });
2295
- } catch (e) {
2296
- io = new IntersectionObserver(handleObserve, options);
2297
- }
2298
- io.observe(element);
2299
- }
2300
- refresh(true);
2301
- return cleanup;
2302
- }
2303
- function autoUpdate(reference, floating, update, options) {
2304
- if (options === void 0) {
2305
- options = {};
2306
- }
2307
- const {
2308
- ancestorScroll = true,
2309
- ancestorResize = true,
2310
- elementResize = typeof ResizeObserver === "function",
2311
- layoutShift = typeof IntersectionObserver === "function",
2312
- animationFrame = false
2313
- } = options;
2314
- const referenceEl = unwrapElement(reference);
2315
- const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
2316
- ancestors.forEach((ancestor) => {
2317
- ancestorScroll && ancestor.addEventListener("scroll", update, {
2318
- passive: true
2319
- });
2320
- ancestorResize && ancestor.addEventListener("resize", update);
2321
- });
2322
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2323
- let reobserveFrame = -1;
2324
- let resizeObserver = null;
2325
- if (elementResize) {
2326
- resizeObserver = new ResizeObserver((_ref) => {
2327
- let [firstEntry] = _ref;
2328
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2329
- resizeObserver.unobserve(floating);
2330
- cancelAnimationFrame(reobserveFrame);
2331
- reobserveFrame = requestAnimationFrame(() => {
2332
- var _resizeObserver;
2333
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2334
- });
2335
- }
2336
- update();
2337
- });
2338
- if (referenceEl && !animationFrame) {
2339
- resizeObserver.observe(referenceEl);
2340
- }
2341
- resizeObserver.observe(floating);
2342
- }
2343
- let frameId;
2344
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2345
- if (animationFrame) {
2346
- frameLoop();
2347
- }
2348
- function frameLoop() {
2349
- const nextRefRect = getBoundingClientRect(reference);
2350
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2351
- update();
2352
- }
2353
- prevRefRect = nextRefRect;
2354
- frameId = requestAnimationFrame(frameLoop);
2355
- }
2356
- update();
2357
- return () => {
2358
- var _resizeObserver2;
2359
- ancestors.forEach((ancestor) => {
2360
- ancestorScroll && ancestor.removeEventListener("scroll", update);
2361
- ancestorResize && ancestor.removeEventListener("resize", update);
2362
- });
2363
- cleanupIo == null || cleanupIo();
2364
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2365
- resizeObserver = null;
2366
- if (animationFrame) {
2367
- cancelAnimationFrame(frameId);
2368
- }
2369
- };
2370
- }
2371
- const offset$1 = offset$2;
2372
- const shift$1 = shift$2;
2373
- const flip$1 = flip$2;
2374
- const size$1 = size$2;
2375
- const hide$1 = hide$2;
2376
- const arrow$2 = arrow$3;
2377
- const limitShift$1 = limitShift$2;
2378
- const computePosition = (reference, floating, options) => {
2379
- const cache = /* @__PURE__ */ new Map();
2380
- const mergedOptions = {
2381
- platform,
2382
- ...options
2383
- };
2384
- const platformWithCache = {
2385
- ...mergedOptions.platform,
2386
- _c: cache
2387
- };
2388
- return computePosition$1(reference, floating, {
2389
- ...mergedOptions,
2390
- platform: platformWithCache
2391
- });
2392
- };
2393
- var index$1 = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
2394
- function deepEqual(a, b) {
2395
- if (a === b) {
2396
- return true;
2397
- }
2398
- if (typeof a !== typeof b) {
2399
- return false;
2400
- }
2401
- if (typeof a === "function" && a.toString() === b.toString()) {
2402
- return true;
2403
- }
2404
- let length;
2405
- let i;
2406
- let keys;
2407
- if (a && b && typeof a === "object") {
2408
- if (Array.isArray(a)) {
2409
- length = a.length;
2410
- if (length !== b.length) return false;
2411
- for (i = length; i-- !== 0; ) {
2412
- if (!deepEqual(a[i], b[i])) {
2413
- return false;
2414
- }
2415
- }
2416
- return true;
2417
- }
2418
- keys = Object.keys(a);
2419
- length = keys.length;
2420
- if (length !== Object.keys(b).length) {
2421
- return false;
2422
- }
2423
- for (i = length; i-- !== 0; ) {
2424
- if (!{}.hasOwnProperty.call(b, keys[i])) {
2425
- return false;
2426
- }
2427
- }
2428
- for (i = length; i-- !== 0; ) {
2429
- const key = keys[i];
2430
- if (key === "_owner" && a.$$typeof) {
2431
- continue;
2432
- }
2433
- if (!deepEqual(a[key], b[key])) {
2434
- return false;
2435
- }
2436
- }
2437
- return true;
2438
- }
2439
- return a !== a && b !== b;
2440
- }
2441
- function getDPR(element) {
2442
- if (typeof window === "undefined") {
2443
- return 1;
2444
- }
2445
- const win = element.ownerDocument.defaultView || window;
2446
- return win.devicePixelRatio || 1;
2447
- }
2448
- function roundByDPR(element, value) {
2449
- const dpr = getDPR(element);
2450
- return Math.round(value * dpr) / dpr;
2451
- }
2452
- function useLatestRef(value) {
2453
- const ref = React__namespace.useRef(value);
2454
- index$1(() => {
2455
- ref.current = value;
2456
- });
2457
- return ref;
2458
- }
2459
- function useFloating(options) {
2460
- if (options === void 0) {
2461
- options = {};
2462
- }
2463
- const {
2464
- placement = "bottom",
2465
- strategy = "absolute",
2466
- middleware = [],
2467
- platform: platform2,
2468
- elements: {
2469
- reference: externalReference,
2470
- floating: externalFloating
2471
- } = {},
2472
- transform = true,
2473
- whileElementsMounted,
2474
- open
2475
- } = options;
2476
- const [data, setData] = React__namespace.useState({
2477
- x: 0,
2478
- y: 0,
2479
- strategy,
2480
- placement,
2481
- middlewareData: {},
2482
- isPositioned: false
2483
- });
2484
- const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
2485
- if (!deepEqual(latestMiddleware, middleware)) {
2486
- setLatestMiddleware(middleware);
2487
- }
2488
- const [_reference, _setReference] = React__namespace.useState(null);
2489
- const [_floating, _setFloating] = React__namespace.useState(null);
2490
- const setReference = React__namespace.useCallback((node) => {
2491
- if (node !== referenceRef.current) {
2492
- referenceRef.current = node;
2493
- _setReference(node);
2494
- }
2495
- }, []);
2496
- const setFloating = React__namespace.useCallback((node) => {
2497
- if (node !== floatingRef.current) {
2498
- floatingRef.current = node;
2499
- _setFloating(node);
2500
- }
2501
- }, []);
2502
- const referenceEl = externalReference || _reference;
2503
- const floatingEl = externalFloating || _floating;
2504
- const referenceRef = React__namespace.useRef(null);
2505
- const floatingRef = React__namespace.useRef(null);
2506
- const dataRef = React__namespace.useRef(data);
2507
- const hasWhileElementsMounted = whileElementsMounted != null;
2508
- const whileElementsMountedRef = useLatestRef(whileElementsMounted);
2509
- const platformRef = useLatestRef(platform2);
2510
- const openRef = useLatestRef(open);
2511
- const update = React__namespace.useCallback(() => {
2512
- if (!referenceRef.current || !floatingRef.current) {
2513
- return;
2514
- }
2515
- const config = {
2516
- placement,
2517
- strategy,
2518
- middleware: latestMiddleware
2519
- };
2520
- if (platformRef.current) {
2521
- config.platform = platformRef.current;
2522
- }
2523
- computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
2524
- const fullData = {
2525
- ...data2,
2526
- // The floating element's position may be recomputed while it's closed
2527
- // but still mounted (such as when transitioning out). To ensure
2528
- // `isPositioned` will be `false` initially on the next open, avoid
2529
- // setting it to `true` when `open === false` (must be specified).
2530
- isPositioned: openRef.current !== false
2531
- };
2532
- if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
2533
- dataRef.current = fullData;
2534
- ReactDOM__namespace.flushSync(() => {
2535
- setData(fullData);
2536
- });
2537
- }
2538
- });
2539
- }, [latestMiddleware, placement, strategy, platformRef, openRef]);
2540
- index$1(() => {
2541
- if (open === false && dataRef.current.isPositioned) {
2542
- dataRef.current.isPositioned = false;
2543
- setData((data2) => ({
2544
- ...data2,
2545
- isPositioned: false
2546
- }));
2547
- }
2548
- }, [open]);
2549
- const isMountedRef = React__namespace.useRef(false);
2550
- index$1(() => {
2551
- isMountedRef.current = true;
2552
- return () => {
2553
- isMountedRef.current = false;
2554
- };
2555
- }, []);
2556
- index$1(() => {
2557
- if (referenceEl) referenceRef.current = referenceEl;
2558
- if (floatingEl) floatingRef.current = floatingEl;
2559
- if (referenceEl && floatingEl) {
2560
- if (whileElementsMountedRef.current) {
2561
- return whileElementsMountedRef.current(referenceEl, floatingEl, update);
2562
- }
2563
- update();
2564
- }
2565
- }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
2566
- const refs = React__namespace.useMemo(() => ({
2567
- reference: referenceRef,
2568
- floating: floatingRef,
2569
- setReference,
2570
- setFloating
2571
- }), [setReference, setFloating]);
2572
- const elements = React__namespace.useMemo(() => ({
2573
- reference: referenceEl,
2574
- floating: floatingEl
2575
- }), [referenceEl, floatingEl]);
2576
- const floatingStyles = React__namespace.useMemo(() => {
2577
- const initialStyles = {
2578
- position: strategy,
2579
- left: 0,
2580
- top: 0
2581
- };
2582
- if (!elements.floating) {
2583
- return initialStyles;
2584
- }
2585
- const x = roundByDPR(elements.floating, data.x);
2586
- const y = roundByDPR(elements.floating, data.y);
2587
- if (transform) {
2588
- return {
2589
- ...initialStyles,
2590
- transform: "translate(" + x + "px, " + y + "px)",
2591
- ...getDPR(elements.floating) >= 1.5 && {
2592
- willChange: "transform"
2593
- }
2594
- };
2595
- }
2596
- return {
2597
- position: strategy,
2598
- left: x,
2599
- top: y
2600
- };
2601
- }, [strategy, transform, elements.floating, data.x, data.y]);
2602
- return React__namespace.useMemo(() => ({
2603
- ...data,
2604
- update,
2605
- refs,
2606
- elements,
2607
- floatingStyles
2608
- }), [data, update, refs, elements, floatingStyles]);
2609
- }
2610
- const arrow$1 = (options) => {
2611
- function isRef(value) {
2612
- return {}.hasOwnProperty.call(value, "current");
2613
- }
2614
- return {
2615
- name: "arrow",
2616
- options,
2617
- fn(state) {
2618
- const {
2619
- element,
2620
- padding
2621
- } = typeof options === "function" ? options(state) : options;
2622
- if (element && isRef(element)) {
2623
- if (element.current != null) {
2624
- return arrow$2({
2625
- element: element.current,
2626
- padding
2627
- }).fn(state);
2628
- }
2629
- return {};
2630
- }
2631
- if (element) {
2632
- return arrow$2({
2633
- element,
2634
- padding
2635
- }).fn(state);
2636
- }
2637
- return {};
2638
- }
2639
- };
2640
- };
2641
- const offset = (options, deps) => ({
2642
- ...offset$1(options),
2643
- options: [options, deps]
2644
- });
2645
- const shift = (options, deps) => ({
2646
- ...shift$1(options),
2647
- options: [options, deps]
2648
- });
2649
- const limitShift = (options, deps) => ({
2650
- ...limitShift$1(options),
2651
- options: [options, deps]
2652
- });
2653
- const flip = (options, deps) => ({
2654
- ...flip$1(options),
2655
- options: [options, deps]
2656
- });
2657
- const size = (options, deps) => ({
2658
- ...size$1(options),
2659
- options: [options, deps]
2660
- });
2661
- const hide = (options, deps) => ({
2662
- ...hide$1(options),
2663
- options: [options, deps]
2664
- });
2665
- const arrow = (options, deps) => ({
2666
- ...arrow$1(options),
2667
- options: [options, deps]
2668
- });
2669
- const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
2670
- const { children, width = 10, height = 5, ...arrowProps } = props;
2671
- return /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.svg, _extends({}, arrowProps, {
2672
- ref: forwardedRef,
2673
- width,
2674
- height,
2675
- viewBox: "0 0 30 10",
2676
- preserveAspectRatio: "none"
2677
- }), props.asChild ? children : /* @__PURE__ */ React.createElement("polygon", {
2678
- points: "0,0 30,0 15,10"
2679
- }));
2680
- });
2681
- const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5;
2682
- function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
2683
- const [size2, setSize] = React.useState(void 0);
2684
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2685
- if (element) {
2686
- setSize({
2687
- width: element.offsetWidth,
2688
- height: element.offsetHeight
2689
- });
2690
- const resizeObserver = new ResizeObserver((entries) => {
2691
- if (!Array.isArray(entries)) return;
2692
- if (!entries.length) return;
2693
- const entry = entries[0];
2694
- let width;
2695
- let height;
2696
- if ("borderBoxSize" in entry) {
2697
- const borderSizeEntry = entry["borderBoxSize"];
2698
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
2699
- width = borderSize["inlineSize"];
2700
- height = borderSize["blockSize"];
2701
- } else {
2702
- width = element.offsetWidth;
2703
- height = element.offsetHeight;
2704
- }
2705
- setSize({
2706
- width,
2707
- height
2708
- });
2709
- });
2710
- resizeObserver.observe(element, {
2711
- box: "border-box"
2712
- });
2713
- return () => resizeObserver.unobserve(element);
2714
- } else
2715
- setSize(void 0);
2716
- }, [
2717
- element
2718
- ]);
2719
- return size2;
2720
- }
2721
- const $cf1ac5d9fe0e8206$var$POPPER_NAME = "Popper";
2722
- const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
2723
- const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
2724
- const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props) => {
2725
- const { __scopePopper, children } = props;
2726
- const [anchor, setAnchor] = React.useState(null);
2727
- return /* @__PURE__ */ React.createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
2728
- scope: __scopePopper,
2729
- anchor,
2730
- onAnchorChange: setAnchor
2731
- }, children);
2732
- };
2733
- const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = "PopperAnchor";
2734
- const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
2735
- const { __scopePopper, virtualRef, ...anchorProps } = props;
2736
- const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
2737
- const ref = React.useRef(null);
2738
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
2739
- React.useEffect(() => {
2740
- context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
2741
- });
2742
- return virtualRef ? null : /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
2743
- ref: composedRefs
2744
- }));
2745
- });
2746
- const $cf1ac5d9fe0e8206$var$CONTENT_NAME = "PopperContent";
2747
- const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
2748
- const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
2749
- var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
2750
- const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = "partial", hideWhenDetached = false, updatePositionStrategy = "optimized", onPlaced, ...contentProps } = props;
2751
- const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
2752
- const [content, setContent] = React.useState(null);
2753
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
2754
- forwardedRef,
2755
- (node) => setContent(node)
2756
- );
2757
- const [arrow$12, setArrow] = React.useState(null);
2758
- const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$12);
2759
- const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
2760
- const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
2761
- const desiredPlacement = side + (align !== "center" ? "-" + align : "");
2762
- const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : {
2763
- top: 0,
2764
- right: 0,
2765
- bottom: 0,
2766
- left: 0,
2767
- ...collisionPaddingProp
2768
- };
2769
- const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
2770
- collisionBoundary
2771
- ];
2772
- const hasExplicitBoundaries = boundary.length > 0;
2773
- const detectOverflowOptions = {
2774
- padding: collisionPadding,
2775
- boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
2776
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2777
- altBoundary: hasExplicitBoundaries
2778
- };
2779
- const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
2780
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2781
- strategy: "fixed",
2782
- placement: desiredPlacement,
2783
- whileElementsMounted: (...args) => {
2784
- const cleanup = autoUpdate(...args, {
2785
- animationFrame: updatePositionStrategy === "always"
2786
- });
2787
- return cleanup;
2788
- },
2789
- elements: {
2790
- reference: context.anchor
2791
- },
2792
- middleware: [
2793
- offset({
2794
- mainAxis: sideOffset + arrowHeight,
2795
- alignmentAxis: alignOffset
2796
- }),
2797
- avoidCollisions && shift({
2798
- mainAxis: true,
2799
- crossAxis: false,
2800
- limiter: sticky === "partial" ? limitShift() : void 0,
2801
- ...detectOverflowOptions
2802
- }),
2803
- avoidCollisions && flip({
2804
- ...detectOverflowOptions
2805
- }),
2806
- size({
2807
- ...detectOverflowOptions,
2808
- apply: ({ elements, rects, availableWidth, availableHeight }) => {
2809
- const { width: anchorWidth, height: anchorHeight } = rects.reference;
2810
- const contentStyle = elements.floating.style;
2811
- contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2812
- contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2813
- contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2814
- contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2815
- }
2816
- }),
2817
- arrow$12 && arrow({
2818
- element: arrow$12,
2819
- padding: arrowPadding
2820
- }),
2821
- $cf1ac5d9fe0e8206$var$transformOrigin({
2822
- arrowWidth,
2823
- arrowHeight
2824
- }),
2825
- hideWhenDetached && hide({
2826
- strategy: "referenceHidden",
2827
- ...detectOverflowOptions
2828
- })
2829
- ]
2830
- });
2831
- const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2832
- const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
2833
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2834
- if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
2835
- }, [
2836
- isPositioned,
2837
- handlePlaced
2838
- ]);
2839
- const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
2840
- const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
2841
- const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
2842
- const [contentZIndex, setContentZIndex] = React.useState();
2843
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2844
- if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2845
- }, [
2846
- content
2847
- ]);
2848
- return /* @__PURE__ */ React.createElement("div", {
2849
- ref: refs.setFloating,
2850
- "data-radix-popper-content-wrapper": "",
2851
- style: {
2852
- ...floatingStyles,
2853
- transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2854
- // keep off the page when measuring
2855
- minWidth: "max-content",
2856
- zIndex: contentZIndex,
2857
- ["--radix-popper-transform-origin"]: [
2858
- (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
2859
- (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
2860
- ].join(" ")
2861
- },
2862
- dir: props.dir
2863
- }, /* @__PURE__ */ React.createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
2864
- scope: __scopePopper,
2865
- placedSide,
2866
- onArrowChange: setArrow,
2867
- arrowX,
2868
- arrowY,
2869
- shouldHideArrow: cannotCenterArrow
2870
- }, /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
2871
- "data-side": placedSide,
2872
- "data-align": placedAlign
2873
- }, contentProps, {
2874
- ref: composedRefs,
2875
- style: {
2876
- ...contentProps.style,
2877
- // if the PopperContent hasn't been placed yet (not all measurements done)
2878
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
2879
- animation: !isPositioned ? "none" : void 0,
2880
- // hide the content if using the hide middleware and should be hidden
2881
- opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : void 0
2882
- }
2883
- }))));
2884
- });
2885
- const $cf1ac5d9fe0e8206$var$ARROW_NAME = "PopperArrow";
2886
- const $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE = {
2887
- top: "bottom",
2888
- right: "left",
2889
- bottom: "top",
2890
- left: "right"
2891
- };
2892
- const $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0 = /* @__PURE__ */ React.forwardRef(function $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd02(props, forwardedRef) {
2893
- const { __scopePopper, ...arrowProps } = props;
2894
- const contentContext = $cf1ac5d9fe0e8206$var$useContentContext($cf1ac5d9fe0e8206$var$ARROW_NAME, __scopePopper);
2895
- const baseSide = $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE[contentContext.placedSide];
2896
- return (
2897
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2898
- // doesn't report size as we'd expect on SVG elements.
2899
- // it reports their bounding box which is effectively the largest path inside the SVG.
2900
- /* @__PURE__ */ React.createElement("span", {
2901
- ref: contentContext.onArrowChange,
2902
- style: {
2903
- position: "absolute",
2904
- left: contentContext.arrowX,
2905
- top: contentContext.arrowY,
2906
- [baseSide]: 0,
2907
- transformOrigin: {
2908
- top: "",
2909
- right: "0 0",
2910
- bottom: "center 0",
2911
- left: "100% 0"
2912
- }[contentContext.placedSide],
2913
- transform: {
2914
- top: "translateY(100%)",
2915
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
2916
- bottom: `rotate(180deg)`,
2917
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
2918
- }[contentContext.placedSide],
2919
- visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2920
- }
2921
- }, /* @__PURE__ */ React.createElement($7e8f5cd07187803e$export$be92b6f5f03c0fe9, _extends({}, arrowProps, {
2922
- ref: forwardedRef,
2923
- style: {
2924
- ...arrowProps.style,
2925
- // ensures the element can be measured correctly (mostly for if SVG)
2926
- display: "block"
2927
- }
2928
- })))
2929
- );
2930
- });
2931
- /* @__PURE__ */ Object.assign($cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0, {
2932
- displayName: $cf1ac5d9fe0e8206$var$ARROW_NAME
2933
- });
2934
- function $cf1ac5d9fe0e8206$var$isNotNull(value) {
2935
- return value !== null;
2936
- }
2937
- const $cf1ac5d9fe0e8206$var$transformOrigin = (options) => ({
2938
- name: "transformOrigin",
2939
- options,
2940
- fn(data) {
2941
- var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
2942
- const { placement, rects, middlewareData } = data;
2943
- const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
2944
- const isArrowHidden = cannotCenterArrow;
2945
- const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2946
- const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2947
- const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2948
- const noArrowAlign = {
2949
- start: "0%",
2950
- center: "50%",
2951
- end: "100%"
2952
- }[placedAlign];
2953
- const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
2954
- const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
2955
- let x = "";
2956
- let y = "";
2957
- if (placedSide === "bottom") {
2958
- x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2959
- y = `${-arrowHeight}px`;
2960
- } else if (placedSide === "top") {
2961
- x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2962
- y = `${rects.floating.height + arrowHeight}px`;
2963
- } else if (placedSide === "right") {
2964
- x = `${-arrowHeight}px`;
2965
- y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2966
- } else if (placedSide === "left") {
2967
- x = `${rects.floating.width + arrowHeight}px`;
2968
- y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2969
- }
2970
- return {
2971
- data: {
2972
- x,
2973
- y
2974
- }
2975
- };
2976
- }
2977
- });
2978
- function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
2979
- const [side, align = "center"] = placement.split("-");
2980
- return [
2981
- side,
2982
- align
2983
- ];
2984
- }
2985
- const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
2986
- const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
2987
- const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
2988
- const $f1701beae083dbae$export$602eac185826482c = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
2989
- var _globalThis$document;
2990
- const { container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body, ...portalProps } = props;
2991
- return container ? /* @__PURE__ */ ReactDOM__namespace.default.createPortal(/* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
2992
- ref: forwardedRef
2993
- })), container) : null;
2994
- });
2995
- function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
2996
- return React.useReducer((state, event) => {
2997
- const nextState = machine[state][event];
2998
- return nextState !== null && nextState !== void 0 ? nextState : state;
2999
- }, initialState);
3000
- }
3001
- const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props) => {
3002
- const { present, children } = props;
3003
- const presence = $921a889cee6df7e8$var$usePresence(present);
3004
- const child = typeof children === "function" ? children({
3005
- present: presence.isPresent
3006
- }) : React.Children.only(children);
3007
- const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
3008
- const forceMount = typeof children === "function";
3009
- return forceMount || presence.isPresent ? /* @__PURE__ */ React.cloneElement(child, {
3010
- ref
3011
- }) : null;
3012
- };
3013
- $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
3014
- function $921a889cee6df7e8$var$usePresence(present) {
3015
- const [node1, setNode] = React.useState();
3016
- const stylesRef = React.useRef({});
3017
- const prevPresentRef = React.useRef(present);
3018
- const prevAnimationNameRef = React.useRef("none");
3019
- const initialState = present ? "mounted" : "unmounted";
3020
- const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
3021
- mounted: {
3022
- UNMOUNT: "unmounted",
3023
- ANIMATION_OUT: "unmountSuspended"
3024
- },
3025
- unmountSuspended: {
3026
- MOUNT: "mounted",
3027
- ANIMATION_END: "unmounted"
3028
- },
3029
- unmounted: {
3030
- MOUNT: "mounted"
3031
- }
3032
- });
3033
- React.useEffect(() => {
3034
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3035
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
3036
- }, [
3037
- state
3038
- ]);
3039
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
3040
- const styles = stylesRef.current;
3041
- const wasPresent = prevPresentRef.current;
3042
- const hasPresentChanged = wasPresent !== present;
3043
- if (hasPresentChanged) {
3044
- const prevAnimationName = prevAnimationNameRef.current;
3045
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
3046
- if (present) send("MOUNT");
3047
- else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none")
3048
- send("UNMOUNT");
3049
- else {
3050
- const isAnimating = prevAnimationName !== currentAnimationName;
3051
- if (wasPresent && isAnimating) send("ANIMATION_OUT");
3052
- else send("UNMOUNT");
3053
- }
3054
- prevPresentRef.current = present;
3055
- }
3056
- }, [
3057
- present,
3058
- send
3059
- ]);
3060
- $9f79659886946c16$export$e5c5a5f917a5871c(() => {
3061
- if (node1) {
3062
- const handleAnimationEnd = (event) => {
3063
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3064
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
3065
- if (event.target === node1 && isCurrentAnimation)
3066
- ReactDOM.flushSync(
3067
- () => send("ANIMATION_END")
3068
- );
3069
- };
3070
- const handleAnimationStart = (event) => {
3071
- if (event.target === node1)
3072
- prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
3073
- };
3074
- node1.addEventListener("animationstart", handleAnimationStart);
3075
- node1.addEventListener("animationcancel", handleAnimationEnd);
3076
- node1.addEventListener("animationend", handleAnimationEnd);
3077
- return () => {
3078
- node1.removeEventListener("animationstart", handleAnimationStart);
3079
- node1.removeEventListener("animationcancel", handleAnimationEnd);
3080
- node1.removeEventListener("animationend", handleAnimationEnd);
3081
- };
3082
- } else
3083
- send("ANIMATION_END");
3084
- }, [
3085
- node1,
3086
- send
3087
- ]);
3088
- return {
3089
- isPresent: [
3090
- "mounted",
3091
- "unmountSuspended"
3092
- ].includes(state),
3093
- ref: React.useCallback((node) => {
3094
- if (node) stylesRef.current = getComputedStyle(node);
3095
- setNode(node);
3096
- }, [])
3097
- };
3098
- }
3099
- function $921a889cee6df7e8$var$getAnimationName(styles) {
3100
- return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none";
3101
- }
3102
- function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => {
3103
- } }) {
3104
- const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
3105
- defaultProp,
3106
- onChange
3107
- });
3108
- const isControlled = prop !== void 0;
3109
- const value1 = isControlled ? prop : uncontrolledProp;
3110
- const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
3111
- const setValue = React.useCallback((nextValue) => {
3112
- if (isControlled) {
3113
- const setter = nextValue;
3114
- const value = typeof nextValue === "function" ? setter(prop) : nextValue;
3115
- if (value !== prop) handleChange(value);
3116
- } else setUncontrolledProp(nextValue);
3117
- }, [
3118
- isControlled,
3119
- prop,
3120
- setUncontrolledProp,
3121
- handleChange
3122
- ]);
3123
- return [
3124
- value1,
3125
- setValue
3126
- ];
3127
- }
3128
- function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) {
3129
- const uncontrolledState = React.useState(defaultProp);
3130
- const [value] = uncontrolledState;
3131
- const prevValueRef = React.useRef(value);
3132
- const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
3133
- React.useEffect(() => {
3134
- if (prevValueRef.current !== value) {
3135
- handleChange(value);
3136
- prevValueRef.current = value;
3137
- }
3138
- }, [
3139
- value,
3140
- prevValueRef,
3141
- handleChange
3142
- ]);
3143
- return uncontrolledState;
3144
- }
3145
- const $ea1ef594cf570d83$export$439d29a4e110a164 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
3146
- return /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
3147
- ref: forwardedRef,
3148
- style: {
3149
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
3150
- position: "absolute",
3151
- border: 0,
3152
- width: 1,
3153
- height: 1,
3154
- padding: 0,
3155
- margin: -1,
3156
- overflow: "hidden",
3157
- clip: "rect(0, 0, 0, 0)",
3158
- whiteSpace: "nowrap",
3159
- wordWrap: "normal",
3160
- ...props.style
3161
- }
3162
- }));
3163
- });
3164
- const $ea1ef594cf570d83$export$be92b6f5f03c0fe9 = $ea1ef594cf570d83$export$439d29a4e110a164;
3165
- const [$a093c7e1ec25a057$var$createTooltipContext, $a093c7e1ec25a057$export$1c540a2224f0d865] = $c512c27ab02ef895$export$50c7b4e9d9f19c1("Tooltip", [
3166
- $cf1ac5d9fe0e8206$export$722aac194ae923
3167
- ]);
3168
- const $a093c7e1ec25a057$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
3169
- const $a093c7e1ec25a057$var$PROVIDER_NAME = "TooltipProvider";
3170
- const $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION = 700;
3171
- const $a093c7e1ec25a057$var$TOOLTIP_OPEN = "tooltip.open";
3172
- const [$a093c7e1ec25a057$var$TooltipProviderContextProvider, $a093c7e1ec25a057$var$useTooltipProviderContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PROVIDER_NAME);
3173
- const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props) => {
3174
- const { __scopeTooltip, delayDuration = $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION, skipDelayDuration = 300, disableHoverableContent = false, children } = props;
3175
- const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);
3176
- const isPointerInTransitRef = React.useRef(false);
3177
- const skipDelayTimerRef = React.useRef(0);
3178
- React.useEffect(() => {
3179
- const skipDelayTimer = skipDelayTimerRef.current;
3180
- return () => window.clearTimeout(skipDelayTimer);
3181
- }, []);
3182
- return /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$TooltipProviderContextProvider, {
3183
- scope: __scopeTooltip,
3184
- isOpenDelayed,
3185
- delayDuration,
3186
- onOpen: React.useCallback(() => {
3187
- window.clearTimeout(skipDelayTimerRef.current);
3188
- setIsOpenDelayed(false);
3189
- }, []),
3190
- onClose: React.useCallback(() => {
3191
- window.clearTimeout(skipDelayTimerRef.current);
3192
- skipDelayTimerRef.current = window.setTimeout(
3193
- () => setIsOpenDelayed(true),
3194
- skipDelayDuration
3195
- );
3196
- }, [
3197
- skipDelayDuration
3198
- ]),
3199
- isPointerInTransitRef,
3200
- onPointerInTransitChange: React.useCallback((inTransit) => {
3201
- isPointerInTransitRef.current = inTransit;
3202
- }, []),
3203
- disableHoverableContent
3204
- }, children);
3205
- };
3206
- const $a093c7e1ec25a057$var$TOOLTIP_NAME = "Tooltip";
3207
- const [$a093c7e1ec25a057$var$TooltipContextProvider, $a093c7e1ec25a057$var$useTooltipContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME);
3208
- const $a093c7e1ec25a057$export$28c660c63b792dea = (props) => {
3209
- const { __scopeTooltip, children, open: openProp, defaultOpen = false, onOpenChange, disableHoverableContent: disableHoverableContentProp, delayDuration: delayDurationProp } = props;
3210
- const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TOOLTIP_NAME, props.__scopeTooltip);
3211
- const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3212
- const [trigger, setTrigger] = React.useState(null);
3213
- const contentId = $1746a345f3d73bb7$export$f680877a34711e37();
3214
- const openTimerRef = React.useRef(0);
3215
- const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
3216
- const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
3217
- const wasOpenDelayedRef = React.useRef(false);
3218
- const [open1 = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
3219
- prop: openProp,
3220
- defaultProp: defaultOpen,
3221
- onChange: (open) => {
3222
- if (open) {
3223
- providerContext.onOpen();
3224
- document.dispatchEvent(new CustomEvent($a093c7e1ec25a057$var$TOOLTIP_OPEN));
3225
- } else providerContext.onClose();
3226
- onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
3227
- }
3228
- });
3229
- const stateAttribute = React.useMemo(() => {
3230
- return open1 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
3231
- }, [
3232
- open1
3233
- ]);
3234
- const handleOpen = React.useCallback(() => {
3235
- window.clearTimeout(openTimerRef.current);
3236
- wasOpenDelayedRef.current = false;
3237
- setOpen(true);
3238
- }, [
3239
- setOpen
3240
- ]);
3241
- const handleClose = React.useCallback(() => {
3242
- window.clearTimeout(openTimerRef.current);
3243
- setOpen(false);
3244
- }, [
3245
- setOpen
3246
- ]);
3247
- const handleDelayedOpen = React.useCallback(() => {
3248
- window.clearTimeout(openTimerRef.current);
3249
- openTimerRef.current = window.setTimeout(() => {
3250
- wasOpenDelayedRef.current = true;
3251
- setOpen(true);
3252
- }, delayDuration);
3253
- }, [
3254
- delayDuration,
3255
- setOpen
3256
- ]);
3257
- React.useEffect(() => {
3258
- return () => window.clearTimeout(openTimerRef.current);
3259
- }, []);
3260
- return /* @__PURE__ */ React.createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$TooltipContextProvider, {
3261
- scope: __scopeTooltip,
3262
- contentId,
3263
- open: open1,
3264
- stateAttribute,
3265
- trigger,
3266
- onTriggerChange: setTrigger,
3267
- onTriggerEnter: React.useCallback(() => {
3268
- if (providerContext.isOpenDelayed) handleDelayedOpen();
3269
- else handleOpen();
3270
- }, [
3271
- providerContext.isOpenDelayed,
3272
- handleDelayedOpen,
3273
- handleOpen
3274
- ]),
3275
- onTriggerLeave: React.useCallback(() => {
3276
- if (disableHoverableContent) handleClose();
3277
- else
3278
- window.clearTimeout(openTimerRef.current);
3279
- }, [
3280
- handleClose,
3281
- disableHoverableContent
3282
- ]),
3283
- onOpen: handleOpen,
3284
- onClose: handleClose,
3285
- disableHoverableContent
3286
- }, children));
3287
- };
3288
- const $a093c7e1ec25a057$var$TRIGGER_NAME = "TooltipTrigger";
3289
- const $a093c7e1ec25a057$export$8c610744efcf8a1d = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
3290
- const { __scopeTooltip, ...triggerProps } = props;
3291
- const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
3292
- const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
3293
- const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3294
- const ref = React.useRef(null);
3295
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onTriggerChange);
3296
- const isPointerDownRef = React.useRef(false);
3297
- const hasPointerMoveOpenedRef = React.useRef(false);
3298
- const handlePointerUp = React.useCallback(
3299
- () => isPointerDownRef.current = false,
3300
- []
3301
- );
3302
- React.useEffect(() => {
3303
- return () => document.removeEventListener("pointerup", handlePointerUp);
3304
- }, [
3305
- handlePointerUp
3306
- ]);
3307
- return /* @__PURE__ */ React.createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({
3308
- asChild: true
3309
- }, popperScope), /* @__PURE__ */ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
3310
- // We purposefully avoid adding `type=button` here because tooltip triggers are also
3311
- // commonly anchors and the anchor `type` attribute signifies MIME type.
3312
- "aria-describedby": context.open ? context.contentId : void 0,
3313
- "data-state": context.stateAttribute
3314
- }, triggerProps, {
3315
- ref: composedRefs,
3316
- onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, (event) => {
3317
- if (event.pointerType === "touch") return;
3318
- if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
3319
- context.onTriggerEnter();
3320
- hasPointerMoveOpenedRef.current = true;
3321
- }
3322
- }),
3323
- onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, () => {
3324
- context.onTriggerLeave();
3325
- hasPointerMoveOpenedRef.current = false;
3326
- }),
3327
- onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, () => {
3328
- isPointerDownRef.current = true;
3329
- document.addEventListener("pointerup", handlePointerUp, {
3330
- once: true
3331
- });
3332
- }),
3333
- onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, () => {
3334
- if (!isPointerDownRef.current) context.onOpen();
3335
- }),
3336
- onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, context.onClose),
3337
- onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onClose)
3338
- })));
3339
- });
3340
- const $a093c7e1ec25a057$var$PORTAL_NAME = "TooltipPortal";
3341
- const [$a093c7e1ec25a057$var$PortalProvider, $a093c7e1ec25a057$var$usePortalContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, {
3342
- forceMount: void 0
3343
- });
3344
- const $a093c7e1ec25a057$export$7b36b8f925ab7497 = (props) => {
3345
- const { __scopeTooltip, forceMount, children, container } = props;
3346
- const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, __scopeTooltip);
3347
- return /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$PortalProvider, {
3348
- scope: __scopeTooltip,
3349
- forceMount
3350
- }, /* @__PURE__ */ React.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3351
- present: forceMount || context.open
3352
- }, /* @__PURE__ */ React.createElement($f1701beae083dbae$export$602eac185826482c, {
3353
- asChild: true,
3354
- container
3355
- }, children)));
3356
- };
3357
- const $a093c7e1ec25a057$var$CONTENT_NAME = "TooltipContent";
3358
- const $a093c7e1ec25a057$export$e9003e2be37ec060 = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
3359
- const portalContext = $a093c7e1ec25a057$var$usePortalContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3360
- const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
3361
- const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3362
- return /* @__PURE__ */ React.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3363
- present: forceMount || context.open
3364
- }, context.disableHoverableContent ? /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({
3365
- side
3366
- }, contentProps, {
3367
- ref: forwardedRef
3368
- })) : /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$TooltipContentHoverable, _extends({
3369
- side
3370
- }, contentProps, {
3371
- ref: forwardedRef
3372
- })));
3373
- });
3374
- const $a093c7e1ec25a057$var$TooltipContentHoverable = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
3375
- const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3376
- const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3377
- const ref = React.useRef(null);
3378
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
3379
- const [pointerGraceArea, setPointerGraceArea] = React.useState(null);
3380
- const { trigger, onClose } = context;
3381
- const content = ref.current;
3382
- const { onPointerInTransitChange } = providerContext;
3383
- const handleRemoveGraceArea = React.useCallback(() => {
3384
- setPointerGraceArea(null);
3385
- onPointerInTransitChange(false);
3386
- }, [
3387
- onPointerInTransitChange
3388
- ]);
3389
- const handleCreateGraceArea = React.useCallback((event, hoverTarget) => {
3390
- const currentTarget = event.currentTarget;
3391
- const exitPoint = {
3392
- x: event.clientX,
3393
- y: event.clientY
3394
- };
3395
- const exitSide = $a093c7e1ec25a057$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
3396
- const paddedExitPoints = $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide);
3397
- const hoverTargetPoints = $a093c7e1ec25a057$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
3398
- const graceArea = $a093c7e1ec25a057$var$getHull([
3399
- ...paddedExitPoints,
3400
- ...hoverTargetPoints
3401
- ]);
3402
- setPointerGraceArea(graceArea);
3403
- onPointerInTransitChange(true);
3404
- }, [
3405
- onPointerInTransitChange
3406
- ]);
3407
- React.useEffect(() => {
3408
- return () => handleRemoveGraceArea();
3409
- }, [
3410
- handleRemoveGraceArea
3411
- ]);
3412
- React.useEffect(() => {
3413
- if (trigger && content) {
3414
- const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
3415
- const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
3416
- trigger.addEventListener("pointerleave", handleTriggerLeave);
3417
- content.addEventListener("pointerleave", handleContentLeave);
3418
- return () => {
3419
- trigger.removeEventListener("pointerleave", handleTriggerLeave);
3420
- content.removeEventListener("pointerleave", handleContentLeave);
3421
- };
3422
- }
3423
- }, [
3424
- trigger,
3425
- content,
3426
- handleCreateGraceArea,
3427
- handleRemoveGraceArea
3428
- ]);
3429
- React.useEffect(() => {
3430
- if (pointerGraceArea) {
3431
- const handleTrackPointerGrace = (event) => {
3432
- const target = event.target;
3433
- const pointerPosition = {
3434
- x: event.clientX,
3435
- y: event.clientY
3436
- };
3437
- const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
3438
- const isPointerOutsideGraceArea = !$a093c7e1ec25a057$var$isPointInPolygon(pointerPosition, pointerGraceArea);
3439
- if (hasEnteredTarget) handleRemoveGraceArea();
3440
- else if (isPointerOutsideGraceArea) {
3441
- handleRemoveGraceArea();
3442
- onClose();
3443
- }
3444
- };
3445
- document.addEventListener("pointermove", handleTrackPointerGrace);
3446
- return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
3447
- }
3448
- }, [
3449
- trigger,
3450
- content,
3451
- pointerGraceArea,
3452
- onClose,
3453
- handleRemoveGraceArea
3454
- ]);
3455
- return /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({}, props, {
3456
- ref: composedRefs
3457
- }));
3458
- });
3459
- const [$a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, $a093c7e1ec25a057$var$useVisuallyHiddenContentContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME, {
3460
- isInside: false
3461
- });
3462
- const $a093c7e1ec25a057$var$TooltipContentImpl = /* @__PURE__ */ React.forwardRef((props, forwardedRef) => {
3463
- const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
3464
- const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, __scopeTooltip);
3465
- const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3466
- const { onClose } = context;
3467
- React.useEffect(() => {
3468
- document.addEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3469
- return () => document.removeEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3470
- }, [
3471
- onClose
3472
- ]);
3473
- React.useEffect(() => {
3474
- if (context.trigger) {
3475
- const handleScroll = (event) => {
3476
- const target = event.target;
3477
- if (target !== null && target !== void 0 && target.contains(context.trigger)) onClose();
3478
- };
3479
- window.addEventListener("scroll", handleScroll, {
3480
- capture: true
3481
- });
3482
- return () => window.removeEventListener("scroll", handleScroll, {
3483
- capture: true
3484
- });
3485
- }
3486
- }, [
3487
- context.trigger,
3488
- onClose
3489
- ]);
3490
- return /* @__PURE__ */ React.createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
3491
- asChild: true,
3492
- disableOutsidePointerEvents: false,
3493
- onEscapeKeyDown,
3494
- onPointerDownOutside,
3495
- onFocusOutside: (event) => event.preventDefault(),
3496
- onDismiss: onClose
3497
- }, /* @__PURE__ */ React.createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({
3498
- "data-state": context.stateAttribute
3499
- }, popperScope, contentProps, {
3500
- ref: forwardedRef,
3501
- style: {
3502
- ...contentProps.style,
3503
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
3504
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
3505
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
3506
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
3507
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
3508
- }
3509
- }), /* @__PURE__ */ React.createElement($5e63c961fc1ce211$export$d9f1ccf0bdb05d45, null, children), /* @__PURE__ */ React.createElement($a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, {
3510
- scope: __scopeTooltip,
3511
- isInside: true
3512
- }, /* @__PURE__ */ React.createElement($ea1ef594cf570d83$export$be92b6f5f03c0fe9, {
3513
- id: context.contentId,
3514
- role: "tooltip"
3515
- }, ariaLabel || children))));
3516
- });
3517
- function $a093c7e1ec25a057$var$getExitSideFromRect(point, rect) {
3518
- const top = Math.abs(rect.top - point.y);
3519
- const bottom = Math.abs(rect.bottom - point.y);
3520
- const right = Math.abs(rect.right - point.x);
3521
- const left = Math.abs(rect.left - point.x);
3522
- switch (Math.min(top, bottom, right, left)) {
3523
- case left:
3524
- return "left";
3525
- case right:
3526
- return "right";
3527
- case top:
3528
- return "top";
3529
- case bottom:
3530
- return "bottom";
3531
- default:
3532
- throw new Error("unreachable");
3533
- }
3534
- }
3535
- function $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
3536
- const paddedExitPoints = [];
3537
- switch (exitSide) {
3538
- case "top":
3539
- paddedExitPoints.push({
3540
- x: exitPoint.x - padding,
3541
- y: exitPoint.y + padding
3542
- }, {
3543
- x: exitPoint.x + padding,
3544
- y: exitPoint.y + padding
3545
- });
3546
- break;
3547
- case "bottom":
3548
- paddedExitPoints.push({
3549
- x: exitPoint.x - padding,
3550
- y: exitPoint.y - padding
3551
- }, {
3552
- x: exitPoint.x + padding,
3553
- y: exitPoint.y - padding
3554
- });
3555
- break;
3556
- case "left":
3557
- paddedExitPoints.push({
3558
- x: exitPoint.x + padding,
3559
- y: exitPoint.y - padding
3560
- }, {
3561
- x: exitPoint.x + padding,
3562
- y: exitPoint.y + padding
3563
- });
3564
- break;
3565
- case "right":
3566
- paddedExitPoints.push({
3567
- x: exitPoint.x - padding,
3568
- y: exitPoint.y - padding
3569
- }, {
3570
- x: exitPoint.x - padding,
3571
- y: exitPoint.y + padding
3572
- });
3573
- break;
3574
- }
3575
- return paddedExitPoints;
3576
- }
3577
- function $a093c7e1ec25a057$var$getPointsFromRect(rect) {
3578
- const { top, right, bottom, left } = rect;
3579
- return [
3580
- {
3581
- x: left,
3582
- y: top
3583
- },
3584
- {
3585
- x: right,
3586
- y: top
3587
- },
3588
- {
3589
- x: right,
3590
- y: bottom
3591
- },
3592
- {
3593
- x: left,
3594
- y: bottom
3595
- }
3596
- ];
3597
- }
3598
- function $a093c7e1ec25a057$var$isPointInPolygon(point, polygon) {
3599
- const { x, y } = point;
3600
- let inside = false;
3601
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
3602
- const xi = polygon[i].x;
3603
- const yi = polygon[i].y;
3604
- const xj = polygon[j].x;
3605
- const yj = polygon[j].y;
3606
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
3607
- if (intersect) inside = !inside;
3608
- }
3609
- return inside;
3610
- }
3611
- function $a093c7e1ec25a057$var$getHull(points) {
3612
- const newPoints = points.slice();
3613
- newPoints.sort((a, b) => {
3614
- if (a.x < b.x) return -1;
3615
- else if (a.x > b.x) return 1;
3616
- else if (a.y < b.y) return -1;
3617
- else if (a.y > b.y) return 1;
3618
- else return 0;
3619
- });
3620
- return $a093c7e1ec25a057$var$getHullPresorted(newPoints);
3621
- }
3622
- function $a093c7e1ec25a057$var$getHullPresorted(points) {
3623
- if (points.length <= 1) return points.slice();
3624
- const upperHull = [];
3625
- for (let i = 0; i < points.length; i++) {
3626
- const p = points[i];
3627
- while (upperHull.length >= 2) {
3628
- const q = upperHull[upperHull.length - 1];
3629
- const r = upperHull[upperHull.length - 2];
3630
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
3631
- else break;
3632
- }
3633
- upperHull.push(p);
3634
- }
3635
- upperHull.pop();
3636
- const lowerHull = [];
3637
- for (let i1 = points.length - 1; i1 >= 0; i1--) {
3638
- const p = points[i1];
3639
- while (lowerHull.length >= 2) {
3640
- const q = lowerHull[lowerHull.length - 1];
3641
- const r = lowerHull[lowerHull.length - 2];
3642
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
3643
- else break;
3644
- }
3645
- lowerHull.push(p);
3646
- }
3647
- lowerHull.pop();
3648
- if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
3649
- else return upperHull.concat(lowerHull);
3650
- }
3651
- const $a093c7e1ec25a057$export$2881499e37b75b9a = $a093c7e1ec25a057$export$f78649fb9ca566b8;
3652
- const $a093c7e1ec25a057$export$be92b6f5f03c0fe9 = $a093c7e1ec25a057$export$28c660c63b792dea;
3653
- const $a093c7e1ec25a057$export$41fb9f06171c75f4 = $a093c7e1ec25a057$export$8c610744efcf8a1d;
3654
- const $a093c7e1ec25a057$export$602eac185826482c = $a093c7e1ec25a057$export$7b36b8f925ab7497;
3655
- const $a093c7e1ec25a057$export$7c6e2c02157bb7d2 = $a093c7e1ec25a057$export$e9003e2be37ec060;
3656
- function Tooltip({ description: description2 }) {
3657
- return /* @__PURE__ */ jsxRuntime.jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { children: /* @__PURE__ */ jsxRuntime.jsxs($a093c7e1ec25a057$export$be92b6f5f03c0fe9, { children: [
3658
- /* @__PURE__ */ jsxRuntime.jsx($a093c7e1ec25a057$export$41fb9f06171c75f4, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Information, { "aria-hidden": "true" }) }),
3659
- /* @__PURE__ */ jsxRuntime.jsx($a093c7e1ec25a057$export$602eac185826482c, { children: /* @__PURE__ */ jsxRuntime.jsx($a093c7e1ec25a057$export$7c6e2c02157bb7d2, { sideOffset: 5, style: { zIndex: 9999 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3660
- designSystem.Box,
3661
- {
3662
- padding: 2,
3663
- margin: 2,
3664
- background: "neutral1000",
3665
- hasRadius: true,
3666
- shadow: "filterShadow",
3667
- maxWidth: "300px",
3668
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral0", children: description2 })
3669
- }
3670
- ) }) })
3671
- ] }) });
3672
- }
3673
- function debounce(func, wait) {
3674
- let timeout;
3675
- return function executedFunction(...args) {
3676
- const later = () => {
3677
- clearTimeout(timeout);
3678
- func(...args);
3679
- };
3680
- clearTimeout(timeout);
3681
- timeout = setTimeout(later, wait);
3682
- };
3683
- }
3684
- async function duplicateCheck(get, url, routeDocumentId) {
3685
- if (!url) throw new Error("URL is required");
3686
- try {
3687
- const { data } = await get(`/${PLUGIN_ID}/checkUniquePath?path=${transformToUrl(url)}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`);
3688
- if (!data.uniquePath) {
3689
- throw new Error("Network response was not ok");
3690
- }
3691
- return data.uniquePath;
3692
- } catch (err) {
3693
- console.error("Error in duplicateCheck:", err);
3694
- throw new Error("Failed to check URL uniqueness");
3695
- }
3696
- }
3697
- const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
3698
- function PathInfo({ validationState, replacement, setUrlStatus }) {
3699
- const [color, setColor] = React.useState(null);
3700
- const [text, setText] = React.useState(null);
3701
- const { formatMessage } = reactIntl.useIntl();
3702
- React.useEffect(() => {
3703
- if (validationState === "initial") return;
3704
- if (validationState === "checking") {
3705
- setColor("neutral800");
3706
- setText(formatMessage({
3707
- id: getTranslation("components.pathInfo.checking"),
3708
- defaultMessage: "Checking if path is available..."
3709
- }));
3710
- } else if (validationState === "done") {
3711
- setColor(replacement ? "danger500" : "success500");
3712
- setText(replacement ? `${formatMessage({
3713
- id: getTranslation("components.pathInfo.notAvailable"),
3714
- defaultMessage: "Path is not available. Replaced with"
3715
- })} "${replacement}".` : formatMessage({
3716
- id: getTranslation("components.pathInfo.available"),
3717
- defaultMessage: "Path is available."
3718
- }));
3719
- if (setUrlStatus) setUrlStatus(replacement ? "invalid" : "valid");
3720
- }
3721
- }, [validationState, replacement, formatMessage, setUrlStatus]);
3722
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: color, children: text }) });
3723
- }
3724
- function reducer(state, action) {
3725
- switch (action.type) {
3726
- case "DEFAULT":
3727
- return {
3728
- ...state,
3729
- value: transformToUrl(action.payload),
3730
- prevValue: state.value,
3731
- needsUrlCheck: true
3732
- };
3733
- case "NO_URL_CHECK":
3734
- return {
3735
- ...state,
3736
- value: transformToUrl(action.payload),
3737
- prevValue: state.value,
3738
- needsUrlCheck: false
3739
- };
3740
- case "NO_TRANSFORM_AND_CHECK":
3741
- return {
3742
- ...state,
3743
- value: action.payload,
3744
- prevValue: state.value,
3745
- needsUrlCheck: false
3746
- };
3747
- case "RESET_URL_CHECK_FLAG":
3748
- return { ...state, needsUrlCheck: false };
3749
- case "SET_UIDPATH":
3750
- return { ...state, uIdPath: action.payload };
3751
- default:
3752
- throw new Error();
3753
- }
3754
- }
3755
- const Path = ({ config }) => {
3756
- const { form, model } = admin.unstable_useContentManagerContext();
3757
- const { initialValues, values, onChange } = form;
3758
- const { getRelatedRoute } = useApi();
3759
- const { formatMessage } = reactIntl.useIntl();
3760
- const { get } = admin.useFetchClient();
3761
- const { allowedActions: {
3762
- canUpdate,
3763
- canCreate
3764
- } } = admin.useRBAC([
3765
- {
3766
- action: "plugin::content-manager.explorer.update",
3767
- subject: model,
3768
- properties: {},
3769
- conditions: []
3770
- },
3771
- {
3772
- action: "plugin::content-manager.explorer.create",
3773
- subject: model,
3774
- properties: {},
3775
- conditions: []
3776
- }
3777
- ]);
3778
- const [routeId, setRouteId] = React.useState();
3779
- const [isOverride, setIsOverride] = React.useState(false);
3780
- const [validationState, setValidationState] = React.useState("initial");
3781
- const [replacement, setReplacement] = React.useState("");
3782
- const [initialLoadComplete, setInitialLoadComplete] = React.useState(false);
3783
- const [urlIsValid, setUrlIsValid] = React.useState(null);
3784
- const [path, dispatchPath] = React.useReducer(reducer, {
3785
- needsUrlCheck: false,
3786
- value: "",
3787
- prevValue: "",
3788
- uIdPath: ""
3789
- });
3790
- const hasUserChangedField = React.useRef(false);
3791
- const initialPath = React.useRef("");
3792
- const prevValueRef = React.useRef(null);
3793
- const debouncedCheckUrl = React.useCallback(debounce(checkUrl, 250), []);
3794
- React.useEffect(() => {
3795
- onChange("webatlas_path", path.value);
3796
- onChange("webatlas_override", isOverride);
3797
- }, [path.value, isOverride]);
3798
- const debouncedValueEffect = React.useMemo(() => debounce((currentValues) => {
3799
- const key = config?.default;
3800
- if (!key) return;
3801
- const currentValue = currentValues[key];
3802
- if (!currentValue) {
3803
- dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3804
- return;
3805
- }
3806
- if (initialLoadComplete && (hasUserChangedField.current || !routeId) && prevValueRef.current !== currentValue && !isOverride) {
3807
- const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3808
- if (currentValue === initialValues[key]) {
3809
- dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3810
- } else {
3811
- dispatchPath({ type: "DEFAULT", payload: path2 });
3812
- }
3813
- prevValueRef.current = currentValue;
3814
- }
3815
- }, 500), [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]);
3816
- React.useEffect(() => {
3817
- const key = config?.default;
3818
- if (!key) return;
3819
- const currentValue = values[key];
3820
- const initialValue = initialValues[key];
3821
- if (currentValue && !isOverride) {
3822
- const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3823
- onChange("webatlas_path", transformToUrl(path2));
3824
- }
3825
- if (!initialLoadComplete) return;
3826
- if (currentValue !== initialValue) {
3827
- hasUserChangedField.current = true;
3828
- }
3829
- debouncedValueEffect(values);
3830
- }, [values, debouncedValueEffect, initialLoadComplete]);
3831
- React.useEffect(() => {
3832
- if (path.needsUrlCheck && path.value) {
3833
- if (path.uIdPath === path.value || initialPath.current === path.value) return;
3834
- debouncedCheckUrl(path.value);
3835
- dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
3836
- }
3837
- }, [path.needsUrlCheck]);
3838
- React.useEffect(() => {
3839
- async function getTypes() {
3840
- if (!initialValues.documentId) {
3841
- setInitialLoadComplete(true);
3842
- return;
3843
- }
3844
- try {
3845
- const route = await getRelatedRoute(initialValues.documentId);
3846
- if (!route) return;
3847
- initialPath.current = initialValues.webatlas_path || route.uidPath;
3848
- setRouteId(route.id);
3849
- setIsOverride(route.isOverride || false);
3850
- dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: route.path || "" });
3851
- dispatchPath({ type: "SET_UIDPATH", payload: route.uidPath || "" });
3852
- const key = config?.default;
3853
- if (key) {
3854
- prevValueRef.current = values[key];
3855
- }
3856
- } catch (err) {
3857
- setRouteId(null);
3858
- console.log(err);
3859
- }
3860
- setInitialLoadComplete(true);
3861
- }
3862
- getTypes();
3863
- }, [config]);
3864
- React.useEffect(() => {
3865
- if (initialValues.webatlas_path) dispatchPath({ type: "NO_URL_CHECK", payload: initialValues.webatlas_path });
3866
- if (initialValues.webatlas_override) setIsOverride(initialValues.webatlas_override);
3867
- }, []);
3868
- async function checkUrl(url) {
3869
- if (!url) return;
3870
- setValidationState("checking");
3871
- setReplacement("");
3872
- try {
3873
- const data = await duplicateCheck(get, url);
3874
- if (!data || data === url) return;
3875
- dispatchPath({ type: "NO_URL_CHECK", payload: data });
3876
- setReplacement(data);
3877
- } catch (err) {
3878
- console.log(err);
3879
- } finally {
3880
- setUrlIsValid(null);
3881
- setValidationState("done");
3882
- }
3883
- }
3884
- if (!initialLoadComplete) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
3885
- id: getTranslation("loading"),
3886
- defaultMessage: "Loading..."
3887
- }) });
3888
- return /* @__PURE__ */ jsxRuntime.jsx(
3889
- designSystem.Box,
3890
- {
3891
- as: "aside",
3892
- "aria-labelledby": "URL Route",
3893
- width: "100%",
3894
- children: /* @__PURE__ */ jsxRuntime.jsxs(
3895
- designSystem.Flex,
3896
- {
3897
- direction: "column",
3898
- alignItems: "stretch",
3899
- gap: 4,
3900
- children: [
3901
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
3902
- !routeId && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3903
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", marginBottom: 2, children: formatMessage({
3904
- id: getTranslation("components.CMEditViewAside.path.newPathInfo"),
3905
- defaultMessage: "A new path will be created upon saving this entry."
3906
- }) }),
3907
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 2, paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) })
3908
- ] }),
3909
- /* @__PURE__ */ jsxRuntime.jsxs(
3910
- designSystem.Field.Root,
3911
- {
3912
- hint: config.default ? formatMessage({
3913
- id: getTranslation("components.CMEditViewAside.path.input.start"),
3914
- defaultMessage: "Edit the"
3915
- }) + ' "' + config.default + '" ' + formatMessage({
3916
- id: getTranslation("components.CMEditViewAside.path.input.end"),
3917
- defaultMessage: "field to generate a path"
3918
- }) : formatMessage({
3919
- id: getTranslation("components.CMEditViewAside.path.input.noSourceField"),
3920
- defaultMessage: "Use the override option to set a custom path"
3921
- }),
3922
- children: [
3923
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
3924
- formatMessage({
3925
- id: getTranslation("components.CMEditViewAside.path.input.label"),
3926
- defaultMessage: "Path"
3927
- }),
3928
- /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { description: formatMessage({
3929
- id: getTranslation("components.CMEditViewAside.path.input.tooltip"),
3930
- defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3931
- }) })
3932
- ] }),
3933
- /* @__PURE__ */ jsxRuntime.jsx(
3934
- designSystem.Field.Input,
3935
- {
3936
- id: "path-input",
3937
- value: path.value,
3938
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3939
- disabled: !isOverride,
3940
- onBlur: (e) => {
3941
- if (e.target.value === path.prevValue) return;
3942
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
3943
- },
3944
- style: { outline: urlIsValid !== null ? urlIsValid === "valid" ? "1px solid #5cb176" : "1px solid #ee5e52" : void 0 }
3945
- }
3946
- ),
3947
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3948
- ]
3949
- }
3950
- ),
3951
- /* @__PURE__ */ jsxRuntime.jsx(PathInfo, { validationState, replacement, setUrlStatus: setUrlIsValid }),
3952
- /* @__PURE__ */ jsxRuntime.jsx(
3953
- designSystem.Flex,
3954
- {
3955
- gap: 2,
3956
- paddingTop: 2,
3957
- children: /* @__PURE__ */ jsxRuntime.jsx(
3958
- designSystem.Checkbox,
3959
- {
3960
- id: "path-override-checkbox",
3961
- checked: isOverride,
3962
- onCheckedChange: () => setIsOverride((prev) => !prev),
3963
- disabled: !routeId && !canCreate || routeId && !canUpdate,
3964
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
3965
- id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
3966
- defaultMessage: "Override automatic path generation"
3967
- }) })
3968
- }
3969
- )
3970
- }
3971
- )
3972
- ] }),
3973
- path.uIdPath && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3974
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) }),
3975
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3976
- designSystem.Field.Root,
3977
- {
3978
- hint: formatMessage({
3979
- id: getTranslation("components.CMEditViewAside.path.uidPath.hint"),
3980
- defaultMessage: "Permanent UID path, cannot be changed"
3981
- }),
3982
- children: [
3983
- /* @__PURE__ */ jsxRuntime.jsx(
3984
- designSystem.Field.Input,
3985
- {
3986
- value: path.uIdPath,
3987
- disabled: true
3988
- }
3989
- ),
3990
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3991
- ]
3992
- }
3993
- ) })
3994
- ] })
3995
- ]
3996
- }
3997
- )
3998
- }
3999
- );
4000
- };
4001
- const pluginPermissions = {
4002
- "cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
4003
- "page.navigation": [{ action: `plugin::${PLUGIN_ID}.page.navigation`, subject: null }],
4004
- "page.routes": [{ action: `plugin::${PLUGIN_ID}.page.routes`, subject: null }],
4005
- "settings.general": [{ action: `plugin::${PLUGIN_ID}.settings.general`, subject: null }],
4006
- "settings.navigation": [{ action: `plugin::${PLUGIN_ID}.settings.navigation`, subject: null }]
4007
- };
4008
- const CMEditViewAside = ({
4009
- // activeTab,
4010
- // collectionType,
4011
- // document,
4012
- documentId,
4013
- // meta,
4014
- model
4015
- }) => {
4016
- const { contentTypes } = useAllContentTypes();
4017
- const { config } = usePluginConfig();
4018
- const { formatMessage } = reactIntl.useIntl();
4019
- const [isAllowedContentType, setIsAllowedContentType] = React.useState(false);
4020
- const [isLoading, setIsLoading] = React.useState(true);
4021
- const [contentTypeConfig, setContentTypeConfig] = React.useState(null);
4022
- const [isActiveContentType, setIsActiveContentType] = React.useState(false);
4023
- const panelTitle = PLUGIN_NAME;
4024
- React.useEffect(() => {
4025
- const contentType = contentTypes?.find((ct) => ct.uid === model);
4026
- setIsAllowedContentType(!!contentType?.pluginOptions?.webatlas?.enabled);
4027
- }, [contentTypes, model]);
4028
- React.useEffect(() => {
4029
- const isWebatlasLabel = (label) => label.textContent?.startsWith("webatlas_");
4030
- const cleanupLabels = () => {
4031
- const labels = document.querySelectorAll("label");
4032
- labels.forEach((label) => {
4033
- if (!isWebatlasLabel(label)) return;
4034
- const container = label.parentElement?.parentElement;
4035
- const parent = container?.parentElement;
4036
- const greatGrandParent = parent?.parentElement?.parentElement;
4037
- if (!container || !parent) return;
4038
- const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(isWebatlasLabel).length;
4039
- const childrenCount = parent.children.length;
4040
- if (greatGrandParent && greatGrandParent?.querySelectorAll("label").length === Array.from(greatGrandParent.querySelectorAll("label")).filter(isWebatlasLabel).length) {
4041
- greatGrandParent.remove();
4042
- } else if (childrenCount === 1 || childrenCount === 2 && parentWebatlasCount === 2) {
4043
- parent.remove();
4044
- } else {
4045
- container.remove();
4046
- }
4047
- });
4048
- };
4049
- const timeoutId = setTimeout(() => {
4050
- cleanupLabels();
4051
- const secondTimeoutId = setTimeout(cleanupLabels, 1e3);
4052
- return () => clearTimeout(secondTimeoutId);
4053
- }, 100);
4054
- return () => clearTimeout(timeoutId);
4055
- }, [documentId, model]);
4056
- React.useEffect(() => {
4057
- if (!config) return;
4058
- setIsActiveContentType(false);
4059
- setContentTypeConfig(null);
4060
- config?.selectedContentTypes?.forEach((type2) => {
4061
- if (type2.uid === model) {
4062
- setIsActiveContentType(true);
4063
- setContentTypeConfig(type2);
4064
- }
4065
- });
4066
- setIsLoading(false);
4067
- }, [config, model]);
4068
- const {
4069
- allowedActions: { canAside }
4070
- } = admin.useRBAC({
4071
- cmAside: pluginPermissions["cm.aside"]
4072
- });
4073
- if (!canAside || !isAllowedContentType || !isActiveContentType || !contentTypeConfig) return null;
4074
- if (!config) {
4075
- console.error("CMEditViewAside: Plugin is not configured.");
4076
- return null;
4077
- }
4078
- if (isLoading) return {
4079
- title: panelTitle,
4080
- content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
4081
- id: getTranslation("loading"),
4082
- defaultMessage: "Loading..."
4083
- }) })
4084
- };
4085
- return {
4086
- title: panelTitle,
4087
- content: /* @__PURE__ */ jsxRuntime.jsx(Path, { config: contentTypeConfig })
4088
- };
4089
- };
4090
- const index = {
4091
- register(app) {
4092
- app.addMenuLink({
4093
- to: `/plugins/${PLUGIN_ID}/paths`,
4094
- icon: PathIcon,
4095
- intlLabel: {
4096
- id: `${PLUGIN_ID}.link.paths`,
4097
- defaultMessage: "Paths"
4098
- },
4099
- Component: async () => {
4100
- const component = await Promise.resolve().then(() => require("./index-BqceJPRl.js"));
4101
- return { default: component.default };
4102
- },
4103
- permissions: [
4104
- pluginPermissions["page.routes"][0]
4105
- ]
4106
- });
4107
- app.addMenuLink({
4108
- to: `/plugins/${PLUGIN_ID}/navigation`,
4109
- icon: NavigationIcon,
4110
- intlLabel: {
4111
- id: `${PLUGIN_ID}.link.navigation`,
4112
- defaultMessage: "Navigation"
4113
- },
4114
- Component: async () => {
4115
- const component = await Promise.resolve().then(() => require("./index-DnE_cDwy.js"));
4116
- return { default: component.default };
4117
- },
4118
- permissions: [
4119
- pluginPermissions["page.navigation"][0]
4120
- ]
4121
- });
4122
- app.addSettingsLink(
4123
- {
4124
- id: PLUGIN_ID,
4125
- intlLabel: {
4126
- id: `${PLUGIN_ID}.settings.section`,
4127
- defaultMessage: PLUGIN_NAME
4128
- }
4129
- },
4130
- {
4131
- intlLabel: {
4132
- id: `${PLUGIN_ID}.settings.section.general`,
4133
- defaultMessage: "General"
4134
- },
4135
- id: `${PLUGIN_ID}-general`,
4136
- to: `/settings/${PLUGIN_ID}/general`,
4137
- Component: async () => {
4138
- return await Promise.resolve().then(() => require(
4139
- /* webpackChunkName: "webatlas-settings-general-page" */
4140
- "./index-DzpXVfQ_.js"
4141
- ));
4142
- },
4143
- permissions: [
4144
- pluginPermissions["settings.general"][0]
4145
- ]
4146
- }
4147
- );
4148
- app.addSettingsLink(
4149
- PLUGIN_ID,
4150
- {
4151
- intlLabel: {
4152
- id: `${PLUGIN_ID}.settings.navigation`,
4153
- defaultMessage: "Navigation"
4154
- },
4155
- id: `${PLUGIN_ID}-navigation`,
4156
- to: `/settings/${PLUGIN_ID}/navigation`,
4157
- Component: async () => {
4158
- return await Promise.resolve().then(() => require(
4159
- /* webpackChunkName: "webatlas-settings-navigation-page" */
4160
- "./index-CQ2raqxe.js"
4161
- ));
4162
- },
4163
- permissions: [
4164
- pluginPermissions["settings.navigation"][0]
4165
- ]
4166
- }
4167
- );
4168
- app.registerPlugin({
4169
- id: PLUGIN_ID,
4170
- initializer: Initializer,
4171
- isReady: false,
4172
- name: PLUGIN_ID
4173
- });
4174
- },
4175
- bootstrap(app) {
4176
- app.getPlugin("content-manager").apis.addEditViewSidePanel([CMEditViewAside]);
4177
- },
4178
- async registerTrads({ locales }) {
4179
- return Promise.all(
4180
- locales.map(async (locale) => {
4181
- try {
4182
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-CGXL_3o_.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-DWEd5BXK.js")) }), `./translations/${locale}.json`, 3);
4183
- return { data, locale };
4184
- } catch {
4185
- return { data: {}, locale };
4186
- }
4187
- })
4188
- );
4189
- }
4190
- };
4191
- exports.PLUGIN_ID = PLUGIN_ID;
4192
- exports.PLUGIN_NAME = PLUGIN_NAME;
4193
- exports.PLUGIN_VERSION = PLUGIN_VERSION;
4194
- exports.PathInfo = PathInfo;
4195
- exports.Tooltip = Tooltip;
4196
- exports.debounce = debounce;
4197
- exports.duplicateCheck = duplicateCheck;
4198
- exports.getTranslation = getTranslation;
4199
- exports.index = index;
4200
- exports.pluginPermissions = pluginPermissions;
4201
- exports.transformToUrl = transformToUrl;
4202
- exports.useAllContentTypes = useAllContentTypes;
4203
- exports.useApi = useApi;
4204
- exports.usePluginConfig = usePluginConfig;
4205
- //# sourceMappingURL=index-R7qsEu2N.js.map