@sheetxl/utils-mui 0.8.0-beta.1 → 0.8.0-beta.3
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.
- package/browser/cjs/BUKGN088i3WnPm2X.cjs +3 -0
- package/browser/cjs/{CMDyOaq_TZmhbR3R.cjs → BoIvdNHQ8K9GSQnQ.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{DBwwZFuNSwPGoi8L.mjs → Dwdb-fh8Vb4s-W7F.mjs} +563 -543
- package/browser/esm/{DL0kfA1tkA8abU1N.mjs → byuVK5-9-HHDm7Fr.mjs} +4 -4
- package/browser/esm/index.mjs +773 -676
- package/node/esm/{Dil2ramfxzB8VR3D.mjs → CZ_lyaDE0E0aob_6.mjs} +1 -1
- package/node/esm/index.mjs +820 -705
- package/package.json +3 -3
- package/resources/locales/en/ui.msg.json +1 -0
- package/types/src/button/ExhibitMenuItem.d.ts +12 -0
- package/types/src/components/AnimatedLoadingPanel.d.ts +42 -0
- package/types/src/components/LazyLoadErrorPanel.d.ts +16 -0
- package/types/src/components/index.d.ts +1 -0
- package/types/src/dialog/index.d.ts +1 -0
- package/types/src/dialog/lazyModal.d.ts +25 -0
- package/types/src/theme/ExhibitTheme.d.ts +0 -28
- package/browser/cjs/GeHQP4M_1ydWv9v4.cjs +0 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/utils-mui",
|
|
3
3
|
"description": "Utilities MUI - Utilities for MUI Components needed for all SheetXL components.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.3",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"ui"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
48
|
-
"@sheetxl/utils-react": "^0.8.0-beta.
|
|
47
|
+
"@sheetxl/utils": "^0.8.0-beta.3",
|
|
48
|
+
"@sheetxl/utils-react": "^0.8.0-beta.3",
|
|
49
49
|
"clsx": "^2.1.1",
|
|
50
50
|
"detect-it": "^4.0.1",
|
|
51
51
|
"mui-modal-provider": "2.4.6",
|
|
@@ -2,6 +2,18 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { ListItemButtonProps } from '@mui/material';
|
|
3
3
|
import { ExhibitIconButtonProps } from './ExhibitIconButton';
|
|
4
4
|
import { ExhibitTooltipProps } from './ExhibitTooltip';
|
|
5
|
+
/**
|
|
6
|
+
* The horizontal box model of a menu row — the margins and paddings an {@link ExhibitMenuItem} sits
|
|
7
|
+
* in. Exported so a row that is NOT an item (a field row, a header) can occupy the same column as the
|
|
8
|
+
* items around it instead of re-deriving the numbers. Lead such a row with an empty `ListItemIcon` and
|
|
9
|
+
* its content lines up past the icon gutter, where a menu item's label starts.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MenuItemInsets: {
|
|
12
|
+
readonly marginLeft: "4px";
|
|
13
|
+
readonly marginRight: "4px";
|
|
14
|
+
readonly paddingLeft: "6px";
|
|
15
|
+
readonly paddingRight: "18px";
|
|
16
|
+
};
|
|
5
17
|
export interface ExhibitMenuItemProps extends ListItemButtonProps {
|
|
6
18
|
icon?: React.ReactNode | (() => React.ReactNode);
|
|
7
19
|
renderIcon?: (props: ExhibitIconButtonProps) => React.ReactElement;
|
|
@@ -40,6 +40,48 @@ export interface AnimatedLoadingPanelProps extends LoadingPanelProps, Omit<BoxPr
|
|
|
40
40
|
* Wrap the icon and label in a paper panel.
|
|
41
41
|
*/
|
|
42
42
|
panel?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Begin the fade-in as soon as the panel mounts. @defaultValue `true` — mount it when work starts
|
|
45
|
+
* and it shows itself; unmount it when the work ends.
|
|
46
|
+
*
|
|
47
|
+
* Pass `false` to keep the panel mounted but idle and drive it with {@link showLoadingPanel} /
|
|
48
|
+
* {@link hideLoadingPanel}. Both modes obey the same rule — the fade must be COMMITTED before the
|
|
49
|
+
* caller blocks the main thread — but a panel mounted at the moment work begins has never been
|
|
50
|
+
* painted, so committing it costs a mount, a first paint of a full-screen layer, and the wait for
|
|
51
|
+
* `transitionrun` below. An already-mounted panel is already painted: one frame and it is armed.
|
|
52
|
+
*/
|
|
53
|
+
autoStart?: boolean;
|
|
43
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Arm a driven ({@link AnimatedLoadingPanelProps.autoStart} `false`) panel's fade-in, resolving once
|
|
57
|
+
* the browser has COMMITTED it. Only then may the caller seize the main thread: a class change
|
|
58
|
+
* reaches the compositor through a rendering frame, and a blocked thread never yields one, so
|
|
59
|
+
* arm-and-go would animate nothing for exactly the work worth announcing.
|
|
60
|
+
*
|
|
61
|
+
* Whether anything is ever SEEN is the panel's `transition-delay` (1.2s by default), which is CSS
|
|
62
|
+
* rather than a timer for the same reason — a `setTimeout` cannot fire while the thread is blocked,
|
|
63
|
+
* so a JS-scheduled reveal would appear for every operation EXCEPT the long ones. Work that finishes
|
|
64
|
+
* inside the delay disarms before a pixel changes.
|
|
65
|
+
*
|
|
66
|
+
* @param element The panel's root.
|
|
67
|
+
* @param label Replaces the panel's text (for a panel rendered with a string or absent label). Set
|
|
68
|
+
* directly rather than through a render, which could not land before blocking work.
|
|
69
|
+
* @returns A promise that settles once the fade is committed, or `null` when there is nothing to wait
|
|
70
|
+
* for — no element, or already armed (a second concurrent operation rides the first).
|
|
71
|
+
*/
|
|
72
|
+
export declare const showLoadingPanel: (element: HTMLElement | null | undefined, label?: string) => Promise<void> | null;
|
|
73
|
+
/**
|
|
74
|
+
* Disarm a driven panel — at once, and back to the state a fresh mount would be in. Both halves are
|
|
75
|
+
* what an unmount gave the auto-start panel for free:
|
|
76
|
+
* - **at once**: work that outlasted the reveal delay is on screen when it ends. Simply dropping the
|
|
77
|
+
* class would transition BACK through that delay, leaving the panel up for another second after its
|
|
78
|
+
* operation finished; parking it in `animating-idle` (no transition) snaps it away instead.
|
|
79
|
+
* - **fresh**: the next operation gets its own countdown. Without that, back-to-back operations
|
|
80
|
+
* inherit an elapsed delay and the panel appears instantly on work that should have been silent.
|
|
81
|
+
*
|
|
82
|
+
* Costs no forced layout, so it is safe in the same task the work ended in — which it must be:
|
|
83
|
+
* anything that lets a frame paint first shows the panel after its operation.
|
|
84
|
+
*/
|
|
85
|
+
export declare const hideLoadingPanel: (element: HTMLElement | null | undefined) => void;
|
|
44
86
|
export declare const AnimatedLoadingPanel: React.NamedExoticComponent<Omit<AnimatedLoadingPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
45
87
|
//# sourceMappingURL=AnimatedLoadingPanel.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StackTraceErrorPanelProps } from './StackTraceErrorPanel';
|
|
3
|
+
export interface LazyLoadErrorPanelProps extends Omit<StackTraceErrorPanelProps, 'error' | 'hideStackTrace'> {
|
|
4
|
+
/**
|
|
5
|
+
* The load failure.
|
|
6
|
+
*/
|
|
7
|
+
error: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Shows that a feature failed to load.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* When rendered from a `lazyComponent` error renderer, a Retry button loads the feature again.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LazyLoadErrorPanel: React.FC<LazyLoadErrorPanelProps>;
|
|
16
|
+
//# sourceMappingURL=LazyLoadErrorPanel.d.ts.map
|
|
@@ -2,6 +2,7 @@ export * from './ScrollButtons';
|
|
|
2
2
|
export * from './ExhibitDivider';
|
|
3
3
|
export * from './AnimatedLoadingPanel';
|
|
4
4
|
export * from './StackTraceErrorPanel';
|
|
5
|
+
export * from './LazyLoadErrorPanel';
|
|
5
6
|
export * from './StackTrace';
|
|
6
7
|
export * from './ChipStrip';
|
|
7
8
|
export * from './NestingPopupButton';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props added to a modal created with {@link lazyModal}.
|
|
4
|
+
*/
|
|
5
|
+
export interface LazyModalProps {
|
|
6
|
+
/**
|
|
7
|
+
* Called when the modal's module fails to load. Nothing is rendered; the host should dismiss the
|
|
8
|
+
* modal and report the error.
|
|
9
|
+
*/
|
|
10
|
+
onLoadError?: (error: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a lazily loaded modal component that reports a failed load through `onLoadError`
|
|
14
|
+
* instead of throwing.
|
|
15
|
+
*
|
|
16
|
+
* @param loader Loads a module whose default export is the modal component.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Modal hosts such as `mui-modal-provider` render outside any error boundary, so a lazy modal must
|
|
20
|
+
* not throw. Opening the modal again after a failure loads the module again.
|
|
21
|
+
*/
|
|
22
|
+
export declare function lazyModal<C extends React.ComponentType<any>>(loader: () => Promise<{
|
|
23
|
+
default: C;
|
|
24
|
+
}>): React.FC<React.ComponentProps<C> & LazyModalProps>;
|
|
25
|
+
//# sourceMappingURL=lazyModal.d.ts.map
|
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
import { Theme, ThemeOptions, Components, ComponentsProps, ComponentsOverrides, ComponentsVariants, ComponentsPropsList, Interpolation } from '@mui/material';
|
|
2
2
|
export declare const hexToRGB: (hex: string, alpha?: number | null) => string;
|
|
3
3
|
export declare const elevateColor: (color: string, coefficient?: number, mode?: "light" | "dark") => string;
|
|
4
|
-
export declare const overlayAlpha: (elevation: number) => number;
|
|
5
|
-
/**
|
|
6
|
-
* The raised-surface wash — the ONE `backgroundImage` chrome surfaces (toolbar palette, formula
|
|
7
|
-
* bar, name box, border swatches, script panels) use to sit "above" the base background in dark
|
|
8
|
-
* mode; light mode is flat (the borders carry the structure — a white-on-white wash would be
|
|
9
|
-
* invisible anyway). Sized to Material elevation ~2.
|
|
10
|
-
*
|
|
11
|
-
* Resolved through the `--sxl-surface-raised` CSS variable so a host embedding Studio in a FLAT
|
|
12
|
-
* design language (the VS Code extension) can kill the wash everywhere at once: set
|
|
13
|
-
* `--sxl-surface-raised: none` on the document root — portaled popups inherit it too. Without the
|
|
14
|
-
* variable the mode-appropriate fallback applies.
|
|
15
|
-
*
|
|
16
|
-
* Text inputs deliberately do NOT take this wash — fields keep the stock MUI background so custom
|
|
17
|
-
* fields (`InputField`/`FormulaField`) and plain `TextField`s always match side by side.
|
|
18
|
-
*
|
|
19
|
-
* Usage: `sx={{ backgroundImage: raisedSurface }}` (sx resolves the theme callback).
|
|
20
|
-
*/
|
|
21
|
-
export declare const raisedSurfaceAt: (elevation: number) => (theme: Theme) => string;
|
|
22
|
-
export declare const raisedSurface: (theme: Theme) => string;
|
|
23
|
-
/**
|
|
24
|
-
* The same wash at the elevation MUI gives a **popup** (`elevation={8}`).
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Rarely needed directly: the `MuiPaper` root override in {@link createExhibitTheme} already routes every
|
|
28
|
-
* Paper's per-elevation wash through `--sxl-surface-raised`. Use this only for a surface that paints its
|
|
29
|
-
* own `background-image` and still wants to match a popup.
|
|
30
|
-
*/
|
|
31
|
-
export declare const elevatedSurface: (theme: Theme) => string;
|
|
32
4
|
export interface SmartInputFieldProps {
|
|
33
5
|
automatic?: any;
|
|
34
6
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(o,s,c)=>(c=o==null?{}:e(i(o)),((e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c,l=r(i),u=0,d=l.length;u<d;u++)c=l[u],a.call(e,c)||c===o||t(e,c,{get:(e=>i[e]).bind(null,c),enumerable:!(s=n(i,c))||s.enumerable});return e})(!s&&o&&o.__esModule?c:t(c,`default`,{value:o,enumerable:!0}),o));let c=require("@mui/material"),l=require("react/jsx-runtime"),u=require("react");u=s(u,1);let d=require("@mui/system"),f=require("@sheetxl/utils"),p=require("@sheetxl/utils-react"),m=require("@mui/utils"),h=require("react-dom");function g(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=g(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function _(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=g(e))&&(r&&(r+=` `),r+=t);return r}function v(e,t){if(typeof e==`function`)return e(t);e&&(e.current=t)}h=s(h,1);var y=parseInt(u.version.split(`.`)[0],10)>=19?function(e){return t=>{let n=[];for(let r of e){let e=v(r,t),i=typeof e==`function`;n.push(i?e:()=>v(r,null))}return()=>{for(let e of n)e()}}}:function(e){return t=>{for(let n of e)v(n,t)}},b=function(){},x=typeof window<`u`,S=x?u.useLayoutEffect:u.useEffect,C={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},w=x&&window.ResizeObserver!==void 0?function(){var e=(0,u.useState)(null),t=e[0],n=e[1],r=(0,u.useState)(C),i=r[0],a=r[1],o=(0,u.useMemo)(function(){return new window.ResizeObserver(function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,i=t.width,o=t.height,s=t.top,c=t.left,l=t.bottom,u=t.right;a({x:n,y:r,width:i,height:o,top:s,left:c,bottom:l,right:u})}})},[]);return S(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,i]}:function(){return[b,C]},T=(0,u.memo)((0,u.forwardRef)((e,t)=>{let{chips:n,sx:r,...i}=e,a=(0,u.useMemo)(()=>{if(!n)return null;let e=Array.isArray(n)?n:[n],t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n],i=null;typeof r==`string`?i=(0,l.jsx)(c.Chip,{label:r,color:`primary`,size:`small`,sx:{scale:`0.8`}},`chip-`+n):(0,u.cloneElement)(r,{key:`chip-`+n}),t.push(i)}return t},[n]);return(0,l.jsx)(c.Box,{ref:t,sx:{display:`flex`,flexDirection:`row`,marginLeft:`4px`,gap:`2px`,...r},...i,children:a})})),E=e=>{if(e.palette.mode===`dark`)return`drop-shadow(0px 0px 1px ${e.palette.mode===`dark`?e.palette.text.primary:e.palette.divider})`},ee=(e=1)=>t=>{if(t.palette.mode===`dark`)return`drop-shadow(0px 0px ${e}px ${t.palette.mode===`dark`?t.palette.text.primary:t.palette.divider})`},D=e=>(0,l.jsx)(p.DynamicIcon,{...e,iconKey:`ArrowDownOutline`}),O=e=>(0,l.jsx)(p.DynamicIcon,{...e,iconKey:`ArrowRightOutline`}),k=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,A=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,j=function(e,t=null){if(!e)return e;e=e.replace(k,function(e,t,n,r){return t+t+n+n+r+r});let n=A.exec(e);return n?t===null?`rgb(${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)})`:`rgb(${parseInt(n[1],16)} ${parseInt(n[2],16)} ${parseInt(n[3],16)} / ${100*t}%)`:e},M=function(e,t=.2,n=`light`){if(!e)return e;let r=n!==`dark`;t<0&&(r=!r,t*=-1),e=j(e);try{return r?(0,d.darken)(e,Math.max(0,Math.min(1,1*t))):(0,d.lighten)(e,Math.max(0,Math.min(1,1.5*t)))}catch{return e}},N=function(e){let t=0;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Number((t/100).toFixed(2))},P=e=>t=>{if(t.palette.mode!==`dark`)return`var(--sxl-surface-raised, none)`;let n=(0,d.alpha)(`#fff`,N(e));return`var(--sxl-surface-raised, linear-gradient(${n}, ${n}))`},F=P(2),te=P(8),ne=(e,t)=>{let n=(0,c.createTheme)({palette:{mode:e?`dark`:`light`}}),r={"--icon-shadow":e?n.palette.text.primary:n.palette.divider,"--icon-size":`1.25rem`,"@media (pointer: coarse)":{"--icon-size":`1.75rem`}},i={typography:{},palette:{mode:e?`dark`:`light`,text:{secondary:e?n.palette.text.secondary:(0,d.alpha)(n.palette.text.secondary,.75),icon:e?(0,d.alpha)(n.palette.text.secondary,.7):(0,d.alpha)(n.palette.text.primary,.75)}},components:{MuiDialogTitle:{styleOverrides:{root:{fontWeight:`normal`}}},MuiSelect:{defaultProps:{IconComponent:D,MenuProps:{container:()=>document.fullscreenElement}},styleOverrides:{icon:{top:`unset`}}},MuiListItemIcon:{styleOverrides:{root:{minWidth:`0px !important`,overflow:`hidden`,marginLeft:`0px`,marginRight:`6px`,padding:`1px 1px`,border:`solid transparent 1px`,color:`unset`}}},MuiMenuItem:{styleOverrides:{root:{paddingTop:`2px`,paddingBottom:`2px`,marginLeft:`4px`,marginRight:`4px`,paddingLeft:`6px`,paddingRight:`18px`,borderRadius:`4px`,fontSize:`0.875em`,"@media (pointer: coarse)":{fontSize:`1em`},"&.Mui-selected":{}}}},MuiMenu:{defaultProps:{container:()=>document.fullscreenElement},styleOverrides:{root:{paddingTop:`2px`,paddingBottom:`2px`,marginLeft:`4px`,marginRight:`4px`,paddingLeft:`6px`,paddingRight:`18px`,borderRadius:`4px`,fontSize:`0.875em`,"@media (pointer: coarse)":{fontSize:`1em`},"&.Mui-selected":{}}}},MuiToolbar:{styleOverrides:{root:{paddingTop:`4px`,paddingBottom:`4px`,"@media (min-width: 600px)":{paddingTop:`4px`,paddingBottom:`4px`}}}},MuiDivider:{styleOverrides:{root:{marginTop:`4px !important`,marginBottom:`4px !important`,marginLeft:`0px`,marginRight:`0px`}}},MuiInputBase:{styleOverrides:{root:{}}},MuiPaper:{styleOverrides:{root:{...r,backgroundImage:`var(--sxl-surface-raised, var(--Paper-overlay))`}}},MuiPopover:{styleOverrides:{paper:{backgroundColor:`var(--sxl-color-elevated, var(--sxl-color-base-100, ${n.palette.background.paper}))`,border:`1px solid var(--sxl-color-elevated-border, transparent)`}}},MuiPopper:{styleOverrides:{root:{"& .menu":{marginTop:`4px`,marginBottom:`4px`,borderRadius:`4px`}}}},SmartInputField:{styleOverrides:{automatic:{transition:`opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms`,color:function(){return n.palette.text.secondary}},dirty:{fontStyle:`italic`,color:function(){return n.palette.text.secondary}}}}}},a=i;return t&&(a=(0,m.deepmerge)(i,t)),(0,c.createTheme)(a)};function re(e,t){return t=(0,m.deepmerge)({track:M(e.palette.background.paper,.05,e?.palette.mode),thumb:M(e.palette.background.paper,.3,e?.palette.mode),active:e.palette.primary.main,corner:e.palette.background.paper,outline:!1},t||{}),(0,p.getScrollbarCssVariables)({track:(0,d.alpha)(t.track,.2),thumb:t.thumb,button:t.button,active:t.active,corner:t.corner||t.thumb,border:t.track})}function ie(e,t){let n=re(e,t),r={...n,"& .scrollbar, & .vsb-track, & .vsb-thumb":{...n},"&::-webkit-scrollbar, & *::-webkit-scrollbar":{backgroundColor:`var(--scrollbar-track-color)`,width:`var(--scrollbar-width)`,height:`var(--scrollbar-height)`},"&::-webkit-scrollbar-button":{display:`none`},"& .scrollbar-button":{fill:`var(--scrollbar-thumb-color)`,backgroundColor:`transparent`,transition:`fill opacity 260ms ease`,width:`var(--scrollbar-width)`,height:`var(--scrollbar-height)`},"& .scrollbar-button:hover:not([disabled])":{fill:`var(--scrollbar-active-color)`},"& .scrollbar-button:disabled":{opacity:.8},"&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track":{},"&::-webkit-scrollbar-track-piece, & *::-webkit-scrollbar-track-piece":{},"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb":{borderRadius:`var(--scrollbar-border-radius)`,backgroundColor:`var(--scrollbar-thumb-color)`,minHeight:`var(--scrollbar-min-thumb-size)`,minWidth:`var(--scrollbar-min-thumb-size)`,border:`var(--scrollbar-border-width) solid var(--scrollbar-border-color)`},"&::-webkit-scrollbar-thumb:focus, & *::-webkit-scrollbar-thumb:focus":{backgroundColor:`var(--scrollbar-active-color)`,border:t?.outline?t.outline:void 0},"&::-webkit-scrollbar-thumb:active, & *::-webkit-scrollbar-thumb:active":{backgroundColor:`var(--scrollbar-active-color)`,border:t?.outline?t.outline:void 0},"&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover":{backgroundColor:`var(--scrollbar-active-color)`,border:t?.outline?t.outline:void 0},"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner":{backgroundColor:`var(--scrollbar-corner-color)`}};return f.CommonUtils.getPlatform()===f.CommonUtils.OSType.Firefox&&(r[`* .pseudo-scrollbar`]={scrollbarColor:`var(--scrollbar-thumb-color) transparent`},r[`* .pseudo-scrollbar:hover:not([disabled])`]={scrollbarColor:`var(--scrollbar-active-color) transparent`}),r}var ae=(0,u.forwardRef)((e,t)=>{let{slotProps:n,...r}=e,{getPortalContainer:i,isFullscreen:a}=(0,p.useFullscreenPortal)();return(0,l.jsx)(c.Tooltip,{ref:t,slotProps:{...n,popper:{container:a?i:void 0,...n?.popper||{}}},...r})});ae.displayName=`SimpleTooltip`;var oe=(0,u.memo)(e=>{let{modifier:t,sx:n,...r}=e;return(0,l.jsx)(c.Box,{sx:{marginLeft:`1px`,marginRight:`1px`,borderRadius:`4px`,borderStyle:`solid`,borderTopWidth:`1px`,borderLeftWidth:`1px`,borderRightWidth:`1px`,borderBottomWidth:`2px`,borderTopColor:e=>(0,d.alpha)(e.palette.background.paper,e.palette.action.disabledOpacity),borderLeftColor:e=>(0,d.alpha)(e.palette.background.paper,e.palette.action.disabledOpacity),borderRightColor:e=>(0,d.alpha)(e.palette.background.paper,e.palette.action.disabledOpacity),borderBottomColor:e=>(0,d.alpha)(e.palette.background.paper,1-e.palette.action.disabledOpacity),backgroundColor:e=>(0,d.alpha)(e.palette.action.hover,e.palette.action.disabledOpacity),paddingLeft:`4px`,paddingRight:`4px`,minHeight:`1.6em`,display:`flex`,justifyContent:`center`,alignItems:`center`,boxSizing:`content-box`,overflow:`hidden`,...n},...r,children:(0,l.jsx)(c.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,"& *":{fontWeight:`500`}},children:t})})}),se=(e,t,n=!1,r=null)=>{if(Array.isArray(e)){let i=[],a=e;for(let e=0;e<a.length;e++)i.push(se(a[e],t,n,r??``+e));return(0,l.jsx)(c.Box,{sx:{display:`flex`,alignItems:`center`,flexDirection:`column`},children:i},r)}if(!e?.key)return null;let i={};for(let t=0;e.modifiers&&t<e.modifiers.length;t++)i[e.modifiers[t]]=!0;let a=[],o=f.CommonUtils.getPlatform()===f.CommonUtils.OSType.MacOS||f.CommonUtils.getPlatform()===f.CommonUtils.OSType.IOS?t(`shortcut.modifier.cmd`):t(`shortcut.modifier.ctrl`);return i?.[p.KeyModifiers.Ctrl]&&(a.push((0,l.jsx)(oe,{modifier:n?`^`:(0,l.jsx)(`div`,{style:{paddingRight:`1px`},children:o})},`ctrl`)),a.push(`+`)),i?.[p.KeyModifiers.Alt]&&(a.push((0,l.jsx)(oe,{modifier:n?`⌥`:t(`shortcut.modifier.alt`)},`alt`)),a.push(`+`)),i?.[p.KeyModifiers.Shift]&&(a.push((0,l.jsx)(oe,{modifier:n?`⇧`:(0,l.jsx)(`div`,{style:{paddingRight:`1px`},children:t(`shortcut.modifier.shift`)})},`shift`)),a.push(`+`)),i?.[p.KeyModifiers.Meta]&&(a.push((0,l.jsx)(oe,{modifier:n?(0,l.jsx)(`div`,{style:{paddingTop:`1px`},children:`⌘`}):t(`shortcut.modifier.meta`)},`meta`)),a.push(`+`)),a.push((0,l.jsx)(oe,{modifier:p.ReactUtils.toPrettyKeyCode(e.key)},`character`)),(0,l.jsx)(c.Box,{sx:{display:`flex`,alignItems:`center`},children:a},r)},ce=(0,u.memo)((0,u.forwardRef)((e,t)=>{let{disabled:n=!1,label:r,shortcut:i,chips:a,description:o,maxWidth:s=280,useModifierSymbols:d=!1,children:f,simple:m,componentDisabled:h=!1,sx:g,..._}=e,v=(0,p.useTranslator)(),y=null;i&&(y=se(i,v,d));let[b,x]=(0,u.useState)(null);(0,u.useEffect)(()=>{Promise.resolve(r).then(e=>{x(e)})},[r]);let S=(0,l.jsxs)(c.Box,{sx:{maxWidth:`${s}px`},ref:t,children:[(0,l.jsxs)(c.Box,{sx:{display:`flex`,flexDirection:`row`,marginBottom:o?`4px`:`0px`},children:[(0,l.jsx)(c.Typography,{variant:`subtitle1`,component:`div`,sx:{flex:`1 1 100%`},children:b}),a?(0,l.jsx)(T,{chips:a}):null,y?(0,l.jsx)(c.Box,{sx:{marginLeft:`8px`}},`leadingSpace`):(0,l.jsx)(l.Fragment,{}),y]}),o?(0,l.jsx)(c.Typography,{variant:`caption`,sx:{whiteSpace:`pre-line`,lineHeight:`1.4`},children:o}):(0,l.jsx)(l.Fragment,{})]});return(0,l.jsx)(ae,{slotProps:{popper:{sx:{"& .MuiTooltip-tooltip":{marginTop:`0px !important`},...g},modifiers:[{name:`offset`,options:{offset:[0,14]}}]}},className:`tooltip-wrapper`,tabIndex:-1,title:!n&&b?S:``,enterDelay:260,enterNextDelay:130,leaveDelay:230,disableInteractive:!0,..._,children:(0,l.jsx)(`div`,{style:{display:`flex`,alignItems:`stretch`,justifyContent:`stretch`},children:f})})})),le={"dialog.cancel":`Cancel`,"dialog.ok":`Ok`,"overflow.more":`More`,"overflow.moreDescription":`More toolbar options…`,"scroll.edgeBottom":` Bottom: ''Ctrl+Click'' to scroll to the end`,"scroll.edgeLeft":` Left: ''Ctrl+Click'' to scroll to the beginning`,"scroll.edgeRight":` Right: ''Ctrl+Click'' to scroll to the end`,"scroll.edgeTop":` Top: ''Ctrl+Click'' to scroll to the beginning`,"shortcut.modifier.alt":`Alt`,"shortcut.modifier.cmd":`Cmd`,"shortcut.modifier.ctrl":`Ctrl`,"shortcut.modifier.meta":`Meta`,"shortcut.modifier.shift":`Shift`,"stackTrace.causedBy":`Caused by: {cause}`,"stackTrace.copy":`Copy stack trace`,"stackTrace.heading":`Stack Trace`,"stackTrace.headingFrames":`Stack Trace ({count} frames)`,"stackTrace.log":`Log error to console`,"stackTrace.moreFrames":`... and {count} more frames`,"window.close":`Close`},{DefaultCommandCatalogService:I}=p.Command,ue=!1;function de(){ue||(ue=!0,I.registerFromManifest(`@sheetxl/utils-mui`,{}.url,{messages:le}))}var fe=o((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`}),pe=o((e,t)=>{var n=fe();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}function t(){return e}e.isRequired=e;var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}}),L=s(o((e,t)=>{t.exports=pe()()})(),1);function me(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function he(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function ge(e){return typeof e==`number`&&!isNaN(e)}function R(e){return parseInt(e,10)}function _e(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var ve=[`Moz`,`Webkit`,`O`,`ms`];function ye(e,t){return t?`${t}${function(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}(e)}`:e}var z=function(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<ve.length;n++)if(ye(e,ve[n])in t)return ve[n];return``}(),be=``;function xe(e,t){be||=me([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return he(e[t])})??``;let n=e[be];return!!he(n)&&!!n.call(e,t)}function Se(e,t,n){let r=e;do{if(xe(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ce(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function B(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function we(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=R(n.borderTopWidth),t+=R(n.borderBottomWidth),t}function Te(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=R(n.borderLeftWidth),t+=R(n.borderRightWidth),t}function Ee(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=R(n.paddingTop),t-=R(n.paddingBottom),t}function De(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=R(n.paddingLeft),t-=R(n.paddingRight),t}function Oe({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${typeof n.x==`string`?n.x:n.x+r}, ${typeof n.y==`string`?n.y:n.y+r})`+i),i}function ke(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0);r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
2
|
-
`,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
3
|
-
`,e.getElementsByTagName(`head`)[0].appendChild(n)}var r,i;e.body&&(r=e.body,i=`react-draggable-transparent-selection`,r.classList?r.classList.add(i):r.className.match(RegExp(`(?:^|\\s)${i}(?!\\S)`))||(r.className+=` ${i}`))}function Ae(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{je(e)}):je(e)}function je(e){var t,n;if(e)try{e.body&&(t=e.body,n=`react-draggable-transparent-selection`,t.classList?t.classList.remove(n):t.className=t.className.replace(RegExp(`(?:^|\\s)${n}(?!\\S)`,`g`),``));let r=e.selection;if(r)r.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function Me(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Ne(e){return e.props.axis===`both`||e.props.axis===`x`}function Pe(e){return e.props.axis===`both`||e.props.axis===`y`}function Fe(e,t,n){let r=typeof t==`number`?function(e,t){return e.targetTouches&&me(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&me(e.changedTouches,e=>t===e.identifier)}(e,t):null;if(typeof t==`number`&&!r)return null;let i=Re(n);return function(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}(r||e,n.props.offsetParent||i.offsetParent||i.ownerDocument.body,n.props.scale)}function Ie(e,t,n){let r=!ge(e.lastX),i=Re(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Le(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Re(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var ze={start:`touchstart`,move:`touchmove`,stop:`touchend`},Be={start:`mousedown`,move:`mousemove`,stop:`mouseup`},Ve=Be,He=class extends u.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!Se(e.target,this.props.handle,t)||this.props.cancel&&Se(e.target,this.props.cancel,t))return;e.type!==`touchstart`||this.props.allowMobileScroll||e.preventDefault();let r=function(e){return e.targetTouches&&e.targetTouches[0]?e.targetTouches[0].identifier:e.changedTouches&&e.changedTouches[0]?e.changedTouches[0].identifier:void 0}(e);this.touchIdentifier=r;let i=Fe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Ie(this,a,o);this.props.onStart,!1!==this.props.onStart(e,s)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&ke(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,Ce(n,Ve.move,this.handleDrag),Ce(n,Ve.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Fe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Me(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Ie(this,n,r);if(!1!==this.props.onDrag(e,i)&&!1!==this.mounted)this.lastX=n,this.lastY=r;else try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}},this.handleDragStop=e=>{if(!this.dragging)return;let t=Fe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Me(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Ie(this,n,r);if(!1===this.props.onStop(e,i)||!1===this.mounted)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&Ae(a.ownerDocument),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(B(a.ownerDocument,Ve.move,this.handleDrag),B(a.ownerDocument,Ve.stop,this.handleDragStop))},this.onMouseDown=e=>(Ve=Be,this.handleDragStart(e)),this.onMouseUp=e=>(Ve=Be,this.handleDragStop(e)),this.onTouchStart=e=>(Ve=ze,this.handleDragStart(e)),this.onTouchEnd=e=>(Ve=ze,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&Ce(e,ze.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;B(t,Be.move,this.handleDrag),B(t,ze.move,this.handleDrag),B(t,Be.stop,this.handleDragStop),B(t,ze.stop,this.handleDragStop),B(e,ze.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Ae(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=h.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){return u.cloneElement(u.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};He.displayName=`DraggableCore`,He.propTypes={allowAnyClick:L.default.bool,allowMobileScroll:L.default.bool,children:L.default.node.isRequired,disabled:L.default.bool,enableUserSelectHack:L.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:L.default.arrayOf(L.default.number),handle:L.default.string,cancel:L.default.string,nodeRef:L.default.object,nonce:L.default.string,onStart:L.default.func,onDrag:L.default.func,onStop:L.default.func,onMouseDown:L.default.func,scale:L.default.number,className:_e,style:_e,transform:_e},He.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Ue=class extends u.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(!1===this.props.onStart(e,Le(this,t)))return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;let n=Le(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=function(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(r);let i=Re(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+R(s.paddingLeft)+R(o.marginLeft),top:-i.offsetTop+R(s.paddingTop)+R(o.marginTop),right:De(a)-Te(i)-i.offsetLeft+R(s.paddingRight)-R(o.marginRight),bottom:Ee(a)-we(i)-i.offsetTop+R(s.paddingBottom)-R(o.marginBottom)}}return ge(r.right)&&(t=Math.min(t,r.right)),ge(r.bottom)&&(n=Math.min(n,r.bottom)),ge(r.left)&&(t=Math.max(t,r.left)),ge(r.top)&&(n=Math.max(n,r.top)),[t,n]}(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||!1===this.props.onStop(e,Le(this,t)))return!1;let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return!e||t&&e.x===t.x&&e.y===t.y?null:{x:e.x,y:e.y,prevPropsPosition:{...e}}}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=h.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...d}=this.props,f={},p=null,m=!s||this.state.dragging,h=s||r,g={x:Ne(this)&&m?this.state.x:h.x,y:Pe(this)&&m?this.state.y:h.y};this.state.isElementSVG?p=function(e,t){return Oe(e,t,``)}(g,c):f=function(e,t){let n=Oe(e,t,`px`);return{[ye(`transform`,z)]:n}}(g,c);let v=u.Children.only(n),y=_(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return u.createElement(He,{...d,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},u.cloneElement(v,{className:y,style:{...v.props.style,...f},transform:p}))}};Ue.displayName=`Draggable`,Ue.propTypes={...He.propTypes,axis:L.default.oneOf([`both`,`x`,`y`,`none`]),bounds:L.default.oneOfType([L.default.shape({left:L.default.number,right:L.default.number,top:L.default.number,bottom:L.default.number}),L.default.string,L.default.oneOf([!1])]),defaultClassName:L.default.string,defaultClassNameDragging:L.default.string,defaultClassNameDragged:L.default.string,defaultPosition:L.default.shape({x:L.default.number,y:L.default.number}),positionOffset:L.default.shape({x:L.default.oneOfType([L.default.number,L.default.string]),y:L.default.oneOfType([L.default.number,L.default.string])}),position:L.default.shape({x:L.default.number,y:L.default.number}),className:_e,style:_e,transform:_e},Ue.defaultProps={...He.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var We=Ue;de();var Ge={x:0,y:0},Ke=(0,u.memo)((0,u.forwardRef)((e,t)=>{let{defaultPosition:n=Ge,PaperComponent:r=c.Paper,onDragStop:i,rootSel:a=`.MuiModal-root`,handleSel:o=`.draggable-title`,titleSize:s,rootSize:d,...f}=e,p=(0,u.useRef)(null),m=(0,u.useMemo)(()=>s?.width&&s?.height&&d?.width&&d?.height?{left:0,top:0,right:d.width-s.width,bottom:d.height-s.height}:null,[s,d]),[h,g]=(0,u.useState)(null),[_,v]=(0,u.useState)(null),b=h??n??null;return(0,l.jsx)(We,{nodeRef:p,handle:o,cancel:`[class*="MuiDialogContent-root"]`,position:(0,u.useMemo)(()=>b&&m?{x:Math.max(0,Math.min(b.x,m.right)),y:Math.max(0,Math.min(b.y,m.bottom))}:b,[b,m])??void 0,bounds:m??`.MuiModal-root`,enableUserSelectHack:!1,onStop:i,onStart:(e,t)=>{let n=e;v({x:(n.clientX??n.touches?.[0]?.clientX)-t.x,y:(n.clientY??n.touches?.[0]?.clientY)-t.y})},onDrag:(e,t)=>{let n=e;if(!_)return;let r=n.clientX??n.touches?.[0]?.clientX,i=n.clientY??n.touches?.[0]?.clientY;g({x:r-_.x,y:i-_.y})},children:(0,l.jsx)(r,{ref:y([p,t]),...f})})})),qe={x:`50`,y:`50`},Je=(0,u.memo)((0,u.forwardRef)((e,t)=>{let n=(0,c.useThemeProps)({props:e,name:`MuiDialog`}),r=(0,c.useTheme)(),i=(0,p.useTranslator)(),a={enter:.66*r.transitions.duration.enteringScreen,exit:.66*r.transitions.duration.leavingScreen},{title:o=`SheetXL`,onCancel:s,onDone:m,onShow:g,onShown:v,onHide:b,onClose:x,open:S,autoFocusSel:C,children:T,transitionDuration:E=a,TransitionProps:ee,slots:D=f.CommonUtils.EmptyArray,slotProps:O=f.CommonUtils.EmptyArray,sx:k,className:A,onMouseDown:j,initialPosition:M=qe,isModal:N=!1,suspendModal:P=!1,restoreFocus:F=!0,disableAutoDestroy:te=!1,revealToken:ne,startHidden:re=!1,...ae}=n,oe=D.transition??c.Fade,se=D.backdrop??c.Backdrop,le=D.paper??c.Paper,I=O.transition;ee&&(I={...ee,...I});let ue=O.backdrop,de=O.paper,[fe,pe]=(0,u.useState)(null),[L,me]=(0,u.useState)(!1),[he,ge]=(0,u.useState)(!1),R=(0,u.useRef)(null),[_e,ve]=w(),ye=(0,u.useRef)(null),z=(0,u.useRef)(null),[be,xe]=w(),Se=(0,u.useRef)(null),Ce=(0,u.useId)();(0,u.useLayoutEffect)(()=>{fe&&!re&&me(!!S)},[S,fe,re]);let B=(0,p.useCallbackRef)(()=>{s?.(),me(!1)},[s]);(0,u.useLayoutEffect)(()=>{if(fe)return;let e=ye.current,t=Se.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(n.width===0&&n.height===0||r.width===0&&r.height===0)return;let i=n.height-r.height,a=n.width-r.width,o=.5*a,s=.5*i;typeof M?.x==`number`?o=M.x:typeof M?.x==`string`&&(o=a*(parseFloat(M.x)/100)),typeof M?.y==`number`?s=M.y:typeof M?.y==`string`&&(s=i*(parseFloat(M.y)/100)),pe({x:o,y:s})});let[we,Te]=(0,u.useState)(!1),[Ee,De]=(0,u.useState)(null),[Oe,ke]=(0,u.useState)(null),Ae=(0,p.useCallbackRef)(e=>{if(Ee)return Ee.focus(e),!0;if(C){let t=z.current?.querySelectorAll?.(C);if(t&&t.length>0)return t[0]?.focus?.(e),!0}return z.current?.focus?.(e),!1},[Ee,C]),je=(0,p.useImperativeElement)(t,()=>({focus:e=>{Ae(e)}}),[]),Me=(0,u.useRef)(ne);(0,u.useEffect)(()=>{ne!==Me.current&&(Me.current=ne,me(!0))},[ne]);let Ne={...I,onExited:e=>{m?.(null),te||I?.onExited?.(e)},onExit:e=>{let t=Oe,n=typeof F==`function`?F():F;t&&!1!==n&&requestAnimationFrame(()=>{je.current?.contains(document.activeElement)&&t.focus()}),b?.(),ge(!1),I?.onExit?.(e)},onEntered:(e,t)=>{g?.(),I?.onEntered?.(e,t)},onEntering:(e,t)=>{ge(!0),v?.(je.current)}};(0,u.useEffect)(()=>{he&&Ae()},[he]);let Pe=(0,l.jsx)(c.Unstable_TrapFocus,{open:he,disableAutoFocus:!0,disableEnforceFocus:!we,disableRestoreFocus:!0!==F,children:(0,l.jsx)(oe,{in:L,timeout:E,role:`presentation`,...Ne,children:(0,l.jsx)(c.Box,{className:`MuiDialog-container`,ref:z,tabIndex:0,sx:{outline:`none`,position:`relative`},onKeyDown:e=>{e.which===p.KeyCodes.Escape&&(B(),R.current?.start(e,{center:!1}),setTimeout(()=>R.current?.stop(e),180)),e.stopPropagation()},children:(0,l.jsxs)(Ke,{ref:y([Se,t]),className:_({"Mui-focusVisible":we},A,`draggable`),sx:{"& *":e=>ie(e),pointerEvents:`auto`,userSelect:`none`,backgroundColor:`var(--sxl-color-elevated, var(--sxl-color-base-100))`,border:`1px solid var(--sxl-color-elevated-border, transparent)`,"&:hover:not([disabled]):not(.Mui-focusVisible)":{outline:e=>`solid ${(0,d.alpha)(e.palette.text?.primary,.2)} 1px`},"&.Mui-focusVisible":{outline:e=>`solid ${(0,d.alpha)(e.palette.text?.primary,.2)} 1px`},position:`absolute`,maxWidth:`100%`,...k},defaultPosition:fe,titleSize:xe,rootSize:ve,PaperComponent:le,...ae,...de,children:[o?(0,l.jsx)(c.DialogTitle,{className:_({"Mui-selected":we},`draggable-title`),sx:{cursor:`move`,display:`flex`,color:e=>e.palette.text.secondary,boxSizing:`border-box`,padding:`0 0`,transitionProperty:`opacity`,transitionDuration:e=>`${e.transitions.duration.shortest}ms`,opacity:.7,"&.Mui-selected":{opacity:1,transitionDuration:e=>e.transitions.duration.shortest/2+`ms`},backgroundColor:e=>(0,d.alpha)(e.palette.action.hover,.03)},ref:be,children:(0,l.jsxs)(c.Box,{sx:{display:`flex`,flex:`1 1 10%`,flexDirection:`row`,alignItems:`center`,marginTop:e=>e.spacing(1),marginLeft:e=>e.spacing(1),marginRight:e=>e.spacing(1)},children:[(0,l.jsx)(c.Box,{sx:{flex:`1 1 100%`,paddingLeft:e=>e.spacing(1)},children:o}),(0,l.jsx)(ce,{label:i(`window.close`),children:(0,l.jsx)(c.IconButton,{"aria-label":`close`,sx:{color:e=>e.palette.text.icon??e.palette.action.active},touchRippleRef:R,onPointerDown:e=>{R.current?.start(e,{center:!1}),e.stopPropagation(),e.preventDefault()},onPointerUp:B,children:(0,l.jsx)(p.DynamicIcon,{iconKey:`Close`})})})]})}):null,T]})})})}),Fe=null;N&&!P&&(Fe=(0,l.jsx)(se,{...ue,open:L,onMouseDown:e=>{B(),ue?.onMouseDown?.(e)},onClick:e=>{x?.(e,`backdropClick`),ue?.onClick?.(e)},sx:{pointerEvents:`auto`,...ue?.sx}}));let{getPortalContainer:Ie}=(0,p.useFullscreenPortal)(),{className:Le,attrs:Re}=(0,p.floatThemeScopeProps)((0,p.useFloatSurface)()?.themeScope);return(0,h.createPortal)((0,l.jsxs)(c.Box,{className:_(`MuiModal-root`,Le),...Re,sx:{position:`fixed`,zIndex:`1300`,right:`0`,bottom:`0`,top:`0`,left:`0`,outline:`0`,display:`block`,pointerEvents:`none`},ref:y([je,_e,ye]),onPointerDown:e=>{we&&(e.target===z.current||e.target.tabIndex<0)&&z.current?.contains(document.activeElement)},onContextMenu:e=>{e.isPropagationStopped()||e.preventDefault()},onFocus:e=>{!we&&(e.target===z.current||e.target.tabIndex<0)&&setTimeout(()=>{Ae()},100),Te(!0),z.current?.contains(e.target)&&e.target!==z.current&&De(e.target),e.relatedTarget&&!Oe&&ke(e.relatedTarget)},onBlur:e=>{je?.current?.contains(e.relatedTarget)||(ke(null),Te(!1))},children:[Fe,Pe]}),Ie(),Ce)})),V=typeof window<`u`?window:{screen:{},navigator:{}},Ye=(V.matchMedia||function(){return{matches:!1}}).bind(V),Xe={get passive(){return!0}},Ze=function(){};V.addEventListener&&V.addEventListener(`p`,Ze,Xe),V.removeEventListener&&V.removeEventListener(`p`,Ze,!1);var Qe=`ontouchstart`in V,$e=Qe||`TouchEvent`in V&&Ye(`(any-pointer: coarse)`).matches,et=(V.navigator.maxTouchPoints||0)>0||$e,tt=V.navigator.userAgent||``,nt=Ye(`(pointer: coarse)`).matches&&/iPad|Macintosh/.test(tt)&&Math.min(V.screen.width||0,V.screen.height||0)>=768,rt=(Ye(`(pointer: coarse)`).matches||!Ye(`(pointer: fine)`).matches&&Qe)&&!/Windows.*Firefox/.test(tt),it=Ye(`(any-pointer: fine)`).matches||Ye(`(any-hover: hover)`).matches||nt||!Qe,at=!et||!it&&rt?et?`touchOnly`:`mouseOnly`:`hybrid`,ot=at===`mouseOnly`?`mouse`:at===`touchOnly`||rt?`touch`:`mouse`,st=e=>e.type===`checkbox`,ct=e=>e.type===`file`,lt=e=>e instanceof Date,H=e=>e==null,ut=e=>typeof e==`object`,U=e=>!H(e)&&!Array.isArray(e)&&ut(e)&&!lt(e),dt=e=>{let t=e.constructor&&e.constructor.prototype;return U(t)&&t.hasOwnProperty(`isPrototypeOf`)},ft=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function W(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(ft&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!(n||U(e)&&dt(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=W(e[t]));return r}var pt=`blur`,mt=`focusout`,ht=`submit`,gt=`trigger`,_t=`valid`,vt=`onBlur`,yt=`onChange`,bt=`onSubmit`,xt=`onTouched`,St=`all`,Ct=`max`,wt=`min`,Tt=`maxLength`,Et=`minLength`,Dt=`pattern`,Ot=`required`,kt=`validate`,At=`root`,jt=[`__proto__`,`constructor`,`prototype`],Mt=/^\w*$/,Nt=e=>Mt.test(e),G=e=>e===void 0,Pt=/[.[\]'"]/,Ft=e=>e.split(Pt).filter(Boolean),K=(e,t,n)=>{if(!t||!U(e))return n;let r=Nt(t)?[t]:Ft(t);if(r.some(e=>jt.includes(e)))return n;let i=r.reduce((e,t)=>H(e)?void 0:e[t],e);return G(i)||i===e?G(e[t])?n:e[t]:i},q=e=>typeof e==`boolean`,J=e=>typeof e==`function`,Y=(e,t,n)=>{let r=-1,i=Nt(t)?[t]:Ft(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=U(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(jt.includes(t))return;e[t]=a,e=e[t]}},It=u.default.createContext(null);It.displayName=`HookFormControlContext`;var Lt=ft?u.default.useLayoutEffect:u.default.useEffect,X=e=>typeof e==`string`,Rt=e=>H(e)||!ut(e),zt=(e,t)=>t.length===0&&!Array.isArray(e)&&!dt(e);function Z(e,t,n=new WeakMap){if(e===t)return!0;if(Rt(e)||Rt(t))return Object.is(e,t);if(lt(e)&<(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(zt(e,r)||zt(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(lt(r)&<(e)||(U(r)||Array.isArray(r))&&(U(e)||Array.isArray(e))?!Z(r,e,n):!Object.is(r,e))return!1}}return!0}var Bt=e=>({isOnSubmit:!e||e===bt,isOnBlur:e===vt,isOnChange:e===yt,isOnAll:e===St,isOnTouch:e===xt}),Vt=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},Ht=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=K(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(Ht(a,t))break}else if(U(a)&&Ht(a,t))break}}},Ut=(e,t,n)=>{let r=K(e,n),i=Array.isArray(r)?r:[];return Y(i,At,t[n]),Y(e,n,i),e},Q=e=>U(e)&&!Object.keys(e).length,Wt=e=>{if(!ft)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gt=e=>e.type===`radio`,Kt=e=>e instanceof RegExp,qt=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Jt={value:!1,isValid:!1},Yt={value:!0,isValid:!0},Xt=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!G(e[0].attributes.value)?G(e[0].value)||e[0].value===``?Yt:{value:e[0].value,isValid:!0}:Yt:Jt}return Jt},Zt={isValid:!1,value:null},Qt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Zt):Zt;function $t(e,t,n=`validate`){if(X(e)||Array.isArray(e)&&e.every(X)||q(e)&&!e)return{type:n,message:X(e)?e:``,ref:t}}var en=e=>U(e)&&!Kt(e)?e:{value:e,message:``},tn=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=K(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=q(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=Gt(o),C=st(o),w=S||C,T=(g||ct(o))&&G(o.value)&&G(v)||Wt(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=qt.bind(null,h,r,x),ee=(e,t,n,r=Tt,i=Et)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||H(v))||q(v)&&!v||C&&!Xt(s).isValid||S&&!Qt(s).isValid)){let{value:e,message:t}=X(c)?{value:!!c,message:c}:en(c);if(e&&(x[h]={type:Ot,message:t,ref:y,...E(Ot,t)},!r))return b(t),x}if(!(T||H(d)&&H(f))){let e,t,n=en(f),i=en(d);if(H(v)||isNaN(v)){let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;X(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),X(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}else{let r=o.valueAsNumber||v&&+v;H(n.value)||(e=r>n.value),H(i.value)||(t=r<i.value)}if((e||t)&&(ee(!!e,n.message,i.message,Ct,wt),!r))return b(x[h].message),x}if((l||u)&&!T&&(X(v)||a&&Array.isArray(v))){let e=en(l),t=en(u),n=!H(e.value)&&v.length>+e.value,i=!H(t.value)&&v.length<+t.value;if((n||i)&&(ee(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&X(v)){let{value:e,message:t}=en(p);if(Kt(e)&&!v.match(e)&&(x[h]={type:Dt,message:t,ref:o,...E(Dt,t)},!r))return b(t),x}if(m){if(J(m)){let e=$t(await m(v,n),y);if(e&&(x[h]={...e,...E(kt,e.message)},!r))return b(e.message),x}else if(U(m)){let e={};for(let t in m){if(!Q(e)&&!r)break;let i=$t(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!Q(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},nn=e=>Array.isArray(e)?e:[e],rn=e=>Array.isArray(e)?e.filter(Boolean):[];function $(e,t){if(X(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:Nt(t)?[t]:Ft(t);if(n.some(e=>jt.includes(String(e))))return e;let r=n.length===1?e:function(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(H(e)){e=void 0;break}e=e[t[r]],r++}return e}(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(U(r)&&Q(r)||Array.isArray(r)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!G(e[t]))return!1;return!0}(r))&&$(e,n.slice(0,-1)),e}var an=e=>{let t={};for(let n of Object.keys(e))if(ut(e[n])&&e[n]!==null&&!lt(e[n])){let r=an(e[n]);for(let e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},on=u.default.createContext(null);on.displayName=`HookFormContext`;var sn=({children:e,watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y})=>{let b=u.default.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:i,clearErrors:a,setValue:o,setValues:s,trigger:c,formState:l,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y}),[a,g,l,r,n,m,_,f,p,d,i,v,o,s,y,c,h,t]);return u.default.createElement(on.Provider,{value:b},u.default.createElement(It.Provider,{value:b.control},e))},cn=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function ln(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&U(i)&&a){let e=ln(i,a);U(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var un=e=>e.type===`select-multiple`,dn=e=>Wt(e)&&e.isConnected;function fn(e){return Array.isArray(e)||U(e)&&!(e=>{for(let t in e)if(J(e[t]))return!0;return!1})(e)}function pn(e){return!(!e||!(`_f`in e))}function mn(e){return Array.isArray(e)?!e.some(e=>!G(e)):!Object.keys(e).length}function hn(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function gn(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];!fn(i)||Array.isArray(i)&&pn(a)?G(i)||(t[r]=!0):(t[r]=Array.isArray(i)?[]:{},gn(i,t[r],a),mn(t[r])&&hn(t,r))}return t}function _n(e,t,n,r){n||=gn(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];!fn(a)||Array.isArray(a)&&pn(o)?Z(a,t[i])?hn(n,i):n[i]=!0:(G(t)||Rt(n[i])?n[i]=gn(a,Array.isArray(a)?[]:{},o):_n(a,H(t)?{}:t[i],n[i],o),mn(n[i])&&hn(n,i))}return n}var vn=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>G(e)?e:t?e===``?NaN:e&&+e:n&&X(e)?new Date(e):r?r(e):e;function yn(e){let t=e.ref;return ct(t)?t.files:Gt(t)?Qt(e.refs).value:un(t)?[...t.selectedOptions].map(({value:e})=>e):st(t)?Xt(e.refs).value:vn(G(t.value)?e.ref.value:t.value,e)}var bn=e=>G(e)?e:Kt(e)?e.source:U(e)?Kt(e.value)?e.value.source:e.value:e,xn=`AsyncFunction`,Sn=e=>{if(!e||!e.validate)return!1;if(J(e.validate))return e.validate.constructor.name===xn;if(U(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===xn)return!0}return!1};function Cn(e,t,n){let r=K(e,n);if(r||Nt(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=K(t,r),o=K(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var wn={mode:bt,reValidateMode:yt,shouldFocusError:!0},Tn=`form`,En={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Dn(e={}){let t={...wn,...e},n={...W(En),isLoading:J(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(U(t.defaultValues)||U(t.values))&&W(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:W(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=Bt(t.mode),f=Bt(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:cn(),state:cn()},_=0,v=t.criteriaMode===St,y=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},b=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e=++_,i;t.resolver?(i=Q((await E()).errors),e===_&&x()):i=await D({fields:r,onlyCheckValid:!0,eventType:_t}),e===_&&i!==n.isValid&&g.state.next({isValid:i})}},x=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?Y(n.validatingFields,e,r):$(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!Q(n.validatingFields)}))},S=()=>{n.dirtyFields=_n(i,a,void 0,r)},C=(e,t)=>{Y(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},w=(t,c,l,u)=>{let d=K(r,t);if(d){if((e=>{let t=Nt(e)?[e]:Ft(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=H(n)?n:n[i],r=H(r)?r:r[i],n===null&&r!==null)return!0}return!1})(t))return;let r=G(K(a,t)),f=K(a,t,G(l)?K(i,t):l);G(f)||u&&u.defaultChecked||c?Y(a,t,c?f:yn(d._f)):A(t,f),o.mount&&!o.action&&(b(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(O()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!G(K(a,t))&&Vt(t,s)&&(o.watch=!0))}},T=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||!0===c){if(!s||c){let t=Z(K(i,e),o);(m.isDirty||h.isDirty)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||O(),u=d!==f.isDirty),d=!!K(n.dirtyFields,e),t===n.isDirty?t?$(n.dirtyFields,e):Y(n.dirtyFields,e,!0):((e,t)=>{for(let n in e)n in t||delete e[n];Object.assign(e,t)})(n.dirtyFields,_n(i,a,void 0,r)),f.dirtyFields=n.dirtyFields,u||=(m.dirtyFields||h.dirtyFields)&&d!==!t}if(s){let t=K(n.touchedFields,e);t||(Y(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=(m.touchedFields||h.touchedFields)&&t!==s)}u&&l&&g.state.next(f)}return u?f:{}},E=async e=>(x(e,!0),await t.resolver(a,t.context,((e,t,n,r)=>{let i={};for(let n of e){let e=K(t,n);e&&Y(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),ee=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(U(i))for(let e in i){let t=i[e];t&&ie(`${Tn}.${e}`,{message:X(t.message)?t.message:``,type:t.type||kt})}else X(i)||!i?ie(Tn,{message:i||``,type:kt}):re(Tn);return i}return!0},D=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await ee({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&Sn(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&x([r.name],!0);let f=await tn(u,s.disabled,a,v,t.shouldUseNativeValidation&&!i,o);if(c&&d&&x([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(K(f,r.name)?o?Ut(n.errors,f,r.name):Y(n.errors,r.name,f[r.name]):$(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!Q(d)&&await D({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},O=(e,t)=>(e&&t&&Y(a,e,t),!Z(o.mount?a:i,i)),k=(e,t,n)=>((e,t,n,r,i)=>X(e)?(r&&t.watch.add(e),K(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),K(n,e))):(r&&(t.watchAll=!0),n))(e,s,{...o.mount?a:G(t)?i:X(e)?{[e]:t}:t},n,t),A=(e,t,n={},i=!1,o=!1)=>{let s=K(r,e),c=t;if(s){let n=s._f;n&&(!n.disabled&&Y(a,e,vn(t,n)),c=Wt(n.ref)&&H(t)?``:t,un(n.ref)?[...n.ref.options].forEach(e=>e.selected=c.includes(e.value)):n.refs?st(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(c)?e.checked=!!c.find(t=>t===e.value):e.checked=c===e.value||!!c)}):n.refs.forEach(e=>e.checked=e.value===c):ct(n.ref)?n.ref.value=``:(n.ref.value=c,n.ref.type||o||g.state.next({name:e,values:i?a:W(a)})))}(n.shouldDirty||n.shouldTouch)&&T(e,c,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&te(e,{delayError:n.delayError})},j=(e,t,n,i=!1,a=!1)=>{for(let o in t){if(!t.hasOwnProperty(o))return;let c=t[o],l=e+`.`+o,u=K(r,l);(s.array.has(e)||U(c)||u&&!u._f)&&!lt(c)?j(l,c,n,i,a):A(l,c,n,i,a)}},M=(e,t,i,c,l=!1)=>{let u=K(r,e),d=s.array.has(e),f=c?t:W(t),p=Z(K(a,e),f);if(p||Y(a,e,f),d)g.array.next({name:e,values:c?a:W(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(S(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:O(e,f)}));else{let t=Array.isArray(f)&&!f.length||Q(f);!u||u._f||H(f)||t?A(e,f,i,c,l):j(e,f,i,c,l)}if(!p&&!l){let t=Vt(e,s),r=c?a:W(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},N=(e,t,n={})=>M(e,t,n,!1),P=async i=>{o.mount=!0;let p=i.target,_=p.name,S=!0,w=K(r,_),O=e=>{S=Number.isNaN(e)||lt(e)&&isNaN(e.getTime())||Z(e,K(a,_,e))};if(w){let o,k,A=p.type?yn(w._f):(e=>U(e)&&e.target?st(e.target)?e.target.checked:ct(e.target)?e.target.files:e.target.value:e)(i),j=i.type===pt||i.type===mt,M=!((e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(w._f)||e.validate||t.resolver||K(n.errors,_)||w._f.deps),N=M||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(j,K(n.touchedFields,_),n.isSubmitted,f,d),P=Vt(_,s,j);if(Y(a,_,A),j){if(!p||!p.readOnly){w._f.onBlur&&w._f.onBlur(i);let e=c[_];e&&e(0)}}else w._f.onChange&&w._f.onChange(i);let F=T(_,A,j),ne=!Q(F)||P;if(!j&&g.state.next({name:_,type:i.type,...u?{values:W(a)}:{}}),N)return M&&n.isValid||!m.isValid&&!h.isValid||(t.mode===`onBlur`?j&&b():j||b()),ne&&g.state.next({name:_,...P?{}:F});if(!t.resolver&&e.validate&&await ee({name:_,eventType:i.type}),!j&&P&&g.state.next({...n}),t.resolver){let{errors:e}=await E([_]);if(x([_]),O(A),!S)return void(!Q(F)&&g.state.next(F));let t=Cn(n.errors,r,_),i=Cn(e,r,t.name||_);o=i.error,_=i.name,k=Q(e)}else x([_],!0),o=(await tn(w,s.disabled,a,v,t.shouldUseNativeValidation))[_],x([_]),O(A),S&&(o?k=!1:(m.isValid||h.isValid)&&(k=await D({fields:r,onlyCheckValid:!0,name:_,eventType:i.type})));S&&(w._f.deps&&(!Array.isArray(w._f.deps)||w._f.deps.length>0)&&te(w._f.deps),((e,r,i,a)=>{let o=K(n.errors,e),s=(m.isValid||h.isValid)&&q(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=y(e,()=>C(e,i)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e],i?Y(n.errors,e,i):$(n.errors,e),n.errors={...n.errors}),(i?!Z(o,i):o)||!Q(a)||s){let t={...a,...s&&q(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}})(_,k,o,F))}},F=(e,t)=>{if(K(n.errors,t)&&e.focus)return e.focus(),1},te=async(e,i={})=>{let a,o,u=nn(e);if(t.resolver){let t=await(async e=>{let{errors:t}=await E(e);if(x(e),e){for(let r of e){let e=K(t,r);e?s.array.has(r)&&U(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?Ut(n.errors,{[r]:e},r):Y(n.errors,r,e):$(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t})(G(e)?e:u);a=Q(t),o=e?!u.some(e=>K(t,e)):a}else e?(o=(await Promise.all(u.map(async e=>{let t=K(r,e);return await D({fields:t&&t._f?{[e]:t}:t,eventType:gt})}))).every(Boolean),(o||n.isValid)&&b()):o=a=await D({fields:r,name:e,eventType:gt});if(i.delayError&&t.delayError&&X(e)){let r=K(n.errors,e);r?($(n.errors,e),c[e]=y(e,()=>C(e,r)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e])}return g.state.next({...!X(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&Ht(r,F,e?u:s.mount),o},ne=(e,t)=>({invalid:!!K((t||n).errors,e),isDirty:!!K((t||n).dirtyFields,e),error:K((t||n).errors,e),isValidating:!!K(n.validatingFields,e),isTouched:!!K((t||n).touchedFields,e)}),re=e=>{let t=e?nn(e):void 0;t?.forEach(e=>$(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):(n.errors={},g.state.next({errors:n.errors}))},ie=(e,t,i)=>{let a=(K(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=K(n.errors,e)||{};Y(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},ae=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(r=e.name,o=t.name,s=e.exact,(!r||!o||r===o||nn(r).some(e=>e&&(s?e===o||e.startsWith(o+`.`):e.startsWith(o)||o.startsWith(e))))&&((e,t,n,r)=>{n(e);let{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||St))})(t,e.formState||m,fe,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}var r,o,s}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},oe=(e,o={})=>{for(let c of e?nn(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||($(r,c),$(a,c)),!o.keepError&&$(n.errors,c),!o.keepDirty&&$(n.dirtyFields,c),!o.keepTouched&&$(n.touchedFields,c),!o.keepIsValidating&&$(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&$(i,c);g.state.next({values:W(a)}),g.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&b()},se=({disabled:e,name:t})=>{if(q(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&b()}},ce=(e,n={})=>{let a=K(r,e),c=q(n.disabled)||q(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return Y(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?se({disabled:q(n.disabled)?n.disabled:t.disabled,name:e}):w(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:bn(n.min),max:bn(n.max),minLength:bn(n.minLength),maxLength:bn(n.maxLength),pattern:bn(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){s.registerName.add(e),ce(e,n),s.registerName.delete(e),a=K(r,e);let t=G(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=(e=>Gt(e)||st(e))(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;let u={...a._f};o?(u.refs=[...l.filter(dn),t,...Array.isArray(K(i,e))?[{}]:[]],u.ref={type:t.type,name:e}):(u.ref=t,delete u.refs),Y(r,e,{_f:u}),w(e,!1,void 0,t)}else a=K(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!((e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))))(s.array,e)||!o.action)&&s.unMount.add(e)}}},le=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Ht(r,F,s.mount),I=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=W(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await E();x(),n.errors=e,l=W(t)}else await D({fields:r,eventType:ht});if(s.disabled.size)for(let e of s.disabled)$(l,e);if($(n.errors,At),Q(n.errors)){g.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),le(),setTimeout(le);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Q(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ue=(e,c={})=>{let l=e?W(e):i,u=W(l),d=Q(e),f=u,p=r;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(_n(i,a,void 0,p))]);for(let t of Array.from(e)){let e=K(n.dirtyFields,t),r=K(a,t),i=K(f,t);e&&!G(r)?Y(f,t,r):e||G(i)||N(t,i)}}else{if(ft&&G(e))for(let e of s.mount){let t=K(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Wt(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,K(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?W(i):{},c.keepFieldsRef)for(let e of s.mount)Y(a,e,K(f,e))}else a=W(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!Q(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:!d&&(c.keepDirty?n.isDirty:c.keepValues?O():!(!c.keepDefaultValues||Z(e,i))),isSubmitted:!!c.keepIsSubmitted&&n.isSubmitted,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?_n(i,a,void 0,p):n.dirtyFields:c.keepDefaultValues&&e?_n(i,e,void 0,p):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:!!c.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:i})},de=(e,n)=>ue(J(e)?e(a):e,{...t.resetOptions,...n}),fe=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}},pe={control:{register:ce,unregister:oe,getFieldState:ne,handleSubmit:I,setError:ie,_subscribe:ae,_runSchema:E,_updateIsValidating:x,_focusError:le,_getWatch:k,_getDirty:O,_setValid:b,_setFieldArray:(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(K(r,e))){let t=s(K(r,e),c.argA,c.argB);l&&Y(r,e,t)}if(u&&Array.isArray(K(n.errors,e))){let t=s(K(n.errors,e),c.argA,c.argB);l&&Y(n.errors,e,t),((e,t)=>{!rn(K(e,t)).length&&$(e,t)})(n.errors,e)}if((m.touchedFields||h.touchedFields)&&u&&Array.isArray(K(n.touchedFields,e))){let t=s(K(n.touchedFields,e),c.argA,c.argB);l&&Y(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&S(),g.state.next({name:e,isDirty:O(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Y(a,e,i)},_setDisabledField:se,_setErrors:e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>rn(K(o.mount?a:i,e,t.shouldUnregister?K(i,e,[]):[])),_reset:ue,_resetDefaultValues:()=>J(t.defaultValues)&&t.defaultValues().then(e=>{de(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of s.unMount){let t=K(r,e);t&&(t._f.refs?t._f.refs.every(e=>!dn(e)):!dn(t._f.ref))&&oe(e)}s.unMount=new Set},_disableForm:e=>{q(e)&&(g.state.next({disabled:e}),Ht(r,(t,n)=>{let i=K(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:g,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=Bt(t.mode),f=Bt(t.reValidateMode)}},subscribe:e=>(o.mount=!0,h={...h,...e.formState},ae({...e,formState:{...p,...e.formState}})),trigger:te,register:ce,handleSubmit:I,watch:(e,t)=>{if(J(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||k(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return k(e,t,!0)},setValue:N,setValues:(e,t={})=>{let r=J(e)?e(a):e;if(!Z(a,r)){a={...a,...r};let e=an(r);for(let n of s.mount)n in e&&M(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&b()}},getValues:(e,t)=>{let r={...o.mount?a:i};return t&&(r=ln(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),G(e)?r:X(e)?K(r,e):e.map(e=>K(r,e))},reset:de,resetField:(e,t={})=>{K(r,e)&&(G(t.defaultValue)?N(e,W(K(i,e))):(N(e,t.defaultValue),Y(i,e,W(t.defaultValue))),t.keepTouched||$(n.touchedFields,e),t.keepDirty||($(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,W(K(i,e))):O()),t.keepError||($(n.errors,e),m.isValid&&b()),g.state.next({...n}))},resetDefaultValues:(e,t={})=>{if(i=W(e),!t.keepDirty){let e=_n(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!Q(e)}t.keepIsValid||b(),g.state.next({...n,defaultValues:i})},clearErrors:re,unregister:oe,setError:ie,setFocus:(e,t={})=>{let n=K(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&J(e.select)&&e.select()})}},getFieldState:ne};return{...pe,formControl:pe}}function On(e={}){let t=u.default.useRef(void 0),n=u.default.useRef(void 0),r=u.default.useRef(e.formControl),[i,a]=u.default.useState(()=>({...W(En),isLoading:J(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:J(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!J(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=Dn(e);t.current={...r,formState:i}}let o=t.current.control;return o._options=e,Lt(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),u.default.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),u.default.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),u.default.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),u.default.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),u.default.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),u.default.useEffect(()=>{e.values&&!Z(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),u.default.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=u.default.useMemo(()=>((e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==St&&(t._proxyFormState[i]=!r||St),n&&(n[i]=!0),e[i]}});return i})(i,o),[o,i]),t.current}var kn=[`Ok`,`Cancel`],An=e=>typeof e==`string`?e:e.id??e,jn=(e,t)=>t!==void 0&&An(e)===An(t),Mn=e=>typeof e!=`string`&&(typeof e.disabled==`function`?e.disabled():!0===e.disabled),Nn=(0,u.memo)((0,u.forwardRef)((e,t)=>{let{description:n,icon:r,onCancel:i,onOption:a,onDone:o,onValidateOption:s,options:f=kn,autoFocusSel:m=`.defaultOption`,defaultOption:h=f[0],cancelOption:g=`Cancel`,autoFocus:_,children:v,...y}=e,b=On({shouldUseNativeValidation:!1}),{handleSubmit:x,formState:S}=b,C=(0,u.useRef)(null),w=(0,u.useRef)(null),T=(0,p.useTranslator)(),E=(0,p.useCallbackRef)(e=>typeof e==`string`?e===`Ok`?T(`dialog.ok`):e===`Cancel`?T(`dialog.cancel`):e:typeof e.label==`function`?e.label():e.label,[T]),ee=(0,u.useRef)(null),[D,O]=(0,u.useState)(null),k=(0,p.useCallbackRef)(async e=>{let t=An(e);if(D!==null||Mn(e))return;let n=jn(e,g),r;try{if(O(t),r=!!n||(await Promise.resolve(s?.(t))??!0),!0!==r)return;await Promise.resolve(a?.(t,n,jn(e,h))),o?.(t)}catch{}finally{O(null)}},[a,o,s,g,h,D]),A=(0,p.useCallbackRef)((e,t)=>{setTimeout(()=>{k(h)},180)},[k,h]),j=(0,p.useCallbackRef)(()=>{a?.(An(g),!0,!1),i?.(),o?.(null)},[a,g,i,o]),M=S&&(Object.keys(S.errors).length>0||S.disabled||S.isSubmitting),N=(0,p.useCallbackRef)((e,t,n)=>{let r=jn(e,g),i={className:t?`defaultOption`:`action`,type:t?`submit`:`button`,style:{minWidth:`75px`},onClick:()=>{r?j():t||k(e)}},a=typeof e==`string`?void 0:e.renderButton;if(a)return(0,l.jsx)(u.Fragment,{children:a(i,t)},`action:${n}`);let o=D!==null&&jn(e,D),d={className:t?`defaultOption`:`action`,variant:t?`contained`:`outlined`,size:`small`,disabled:!r&&(M||Mn(e))||D!==null&&!o,color:`primary`,...i};if(t||r){let e=t?C:w;d.touchRippleRef=e,d.onPointerDown=t=>{e.current?.start(t,{center:!1}),t.stopPropagation(),t.preventDefault()}}return(0,l.jsxs)(c.Button,{...d,children:[(0,l.jsx)(`div`,{style:{visibility:o?`hidden`:void 0},children:E(e)}),s&&!r?(0,l.jsx)(c.CircularProgress,{size:16,color:`inherit`,style:{opacity:+!!o},sx:{position:`absolute`,top:`calc(50% - 8px)`,left:`calc(50% - 8px)`,zIndex:1,pointerEvents:`none`,transition:`opacity 120ms`}}):null]},`action:${n}`)},[f,h,g,S,E,D]),P=(0,u.useMemo)(()=>{let e=[];for(let t=0;t<f.length;t++){let n=f[t],r=h===void 0?t===0:jn(n,h);e.push(N(n,r,t))}return e},[f,h,S,T,D]);return(0,l.jsx)(Je,{onCancel:j,initialPosition:{y:ot===`touch`?`15`:`35`},onDone:o,autoFocusSel:m,isModal:!0,ref:t,...y,children:(0,l.jsx)(sn,{...b,children:(0,l.jsxs)(`form`,{ref:ee,onSubmit:x(A),children:[(0,l.jsx)(c.DialogContent,{dividers:!0,onKeyDown:e=>{if(e.isDefaultPrevented())return;e.stopPropagation();let t=null,n=null,r=e.which===p.KeyCodes.Escape&&g;if(r){if(D!==null)return;t=g,n=w}else{if(M||D!==null)return;e.which===p.KeyCodes.Enter&&(t=h??f[0],n=C)}t&&(n?.current?.start(e,{center:!1}),setTimeout(()=>{n?.current?.stop(e),r&&j()},180))},children:(0,l.jsxs)(c.Box,{sx:{display:`flex`,flexDirection:`column`,whiteSpace:`pre-wrap`,rowGap:e=>e.spacing(r||n?1.5:0)},children:[(0,l.jsxs)(c.Box,{sx:{display:`flex`,flexDirection:`column`},children:[r,(0,l.jsx)(c.Typography,{children:n})]}),v]})}),(0,l.jsx)(c.DialogActions,{sx:{paddingTop:e=>e.spacing(1),paddingBottom:e=>e.spacing(1),paddingLeft:e=>e.spacing(1),paddingRight:e=>e.spacing(1),backgroundColor:e=>(0,d.alpha)(e.palette.action.hover,.03)},children:P})]})})})}));Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Nn}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ee}});
|