@mattisvensson/strapi-plugin-webatlas 0.8.0 → 0.8.1

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