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