@mattisvensson/strapi-plugin-webatlas 0.2.6 → 0.3.0

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