@alextheman/components 5.4.4 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -11
- package/dist/index.d.ts +18 -11
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CollapseProps } from '@mui/material/Collapse';
|
|
3
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps, PaletteMode, Theme } from '@mui/material/styles';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, ElementType, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
|
|
6
6
|
import { ButtonOwnProps, ButtonProps } from '@mui/material/Button';
|
|
@@ -8,6 +8,7 @@ import { LinkProps } from '@mui/material/Link';
|
|
|
8
8
|
import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
|
|
9
9
|
import { SvgIconTypeMap } from '@mui/material/SvgIcon';
|
|
10
10
|
import { ListItemButtonProps } from '@mui/material/ListItemButton';
|
|
11
|
+
import { OptionalOnCondition } from '@alextheman/utility';
|
|
11
12
|
import { TypographyProps } from '@mui/material/Typography';
|
|
12
13
|
import { LiveProvider } from 'react-live';
|
|
13
14
|
import { SwitchProps } from '@mui/material/Switch';
|
|
@@ -100,6 +101,10 @@ interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
|
|
|
100
101
|
}
|
|
101
102
|
declare function ListItemInternalLink({ children, ...listItemButtonProps }: ListItemInternalLinkProps): react_jsx_runtime.JSX.Element;
|
|
102
103
|
|
|
104
|
+
interface ContextHookOptions<S extends boolean = true> {
|
|
105
|
+
strict?: S;
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
interface LoaderProviderBaseProps<T> {
|
|
104
109
|
/** The current loading status (true if loading, false if not) */
|
|
105
110
|
isLoading: boolean;
|
|
@@ -127,7 +132,7 @@ type LoaderContextValue<T> = LoaderProviderPropsWithNoError<T> | LoaderProviderP
|
|
|
127
132
|
type LoaderProviderProps<T> = LoaderContextValue<T> & {
|
|
128
133
|
children: ReactNode;
|
|
129
134
|
};
|
|
130
|
-
declare function useLoader<T>(): LoaderContextValue<T
|
|
135
|
+
declare function useLoader<T, Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, LoaderContextValue<T>>;
|
|
131
136
|
/** A provider for a context that deals with state management when fetching data from an API.
|
|
132
137
|
* This may be used over Loader if you require more control over the placement of the error message and data display.
|
|
133
138
|
*/
|
|
@@ -174,26 +179,28 @@ interface LoaderErrorPropsWithUndefinedOrNull extends LoaderErrorBaseProps {
|
|
|
174
179
|
undefinedComponent?: ReactNode;
|
|
175
180
|
/** The component to show if no error was thrown but data is null */
|
|
176
181
|
nullComponent?: ReactNode;
|
|
177
|
-
/** The component to show if no error was thrown but data is undefined or null */
|
|
178
182
|
nullableComponent?: never;
|
|
179
183
|
}
|
|
180
184
|
interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
|
|
181
185
|
undefinedComponent?: never;
|
|
182
186
|
nullComponent?: never;
|
|
187
|
+
/** The component to show if no error was thrown but data is undefined or null */
|
|
183
188
|
nullableComponent?: ReactNode;
|
|
184
189
|
}
|
|
185
190
|
type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
|
|
186
191
|
/** The component responsible for showing any errors provided by LoaderProvider. */
|
|
187
192
|
declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
toggleMode: () => void;
|
|
191
|
-
mode: string;
|
|
192
|
-
};
|
|
194
|
+
/** @deprecated Please use `PaletteMode` from `@mui/material/styles` instead. */
|
|
193
195
|
type Mode = "light" | "dark";
|
|
196
|
+
interface ModeContextValue {
|
|
197
|
+
toggleMode: () => void;
|
|
198
|
+
mode: PaletteMode;
|
|
199
|
+
}
|
|
200
|
+
declare function useMode<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ModeContextValue>;
|
|
194
201
|
interface ModeProviderProps {
|
|
195
202
|
children: ReactNode;
|
|
196
|
-
mode?:
|
|
203
|
+
mode?: PaletteMode;
|
|
197
204
|
}
|
|
198
205
|
declare function ModeProvider({ children, mode: modeProp }: ModeProviderProps): react_jsx_runtime.JSX.Element;
|
|
199
206
|
|
|
@@ -207,7 +214,7 @@ interface ScreenSizeContextValue {
|
|
|
207
214
|
windowWidth: number;
|
|
208
215
|
windowHeight: number;
|
|
209
216
|
}
|
|
210
|
-
declare function useScreenSize(): ScreenSizeContextValue
|
|
217
|
+
declare function useScreenSize<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ScreenSizeContextValue>;
|
|
211
218
|
declare function ScreenSizeProvider({ children, largeScreenWidth, largeScreenHeight }: ScreenSizeProps): react_jsx_runtime.JSX.Element;
|
|
212
219
|
|
|
213
220
|
interface SnackbarProviderProps {
|
|
@@ -217,7 +224,7 @@ interface SnackbarProviderProps {
|
|
|
217
224
|
interface SnackbarContextValue {
|
|
218
225
|
addSnackbar: (message: string, severity?: AlertColor, duration?: number) => void;
|
|
219
226
|
}
|
|
220
|
-
declare function useSnackbar(): SnackbarContextValue
|
|
227
|
+
declare function useSnackbar<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, SnackbarContextValue>;
|
|
221
228
|
declare function SnackbarProvider({ children, autoHideDuration }: SnackbarProviderProps): react_jsx_runtime.JSX.Element;
|
|
222
229
|
|
|
223
230
|
type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children"> & Omit<LoaderErrorProps, "errorComponent"> & Omit<LoaderDataProps<T>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
|
|
@@ -289,4 +296,4 @@ declare function SwitchWithIcons({ checkedIcon: CheckedIcon, checkedIconStyles,
|
|
|
289
296
|
|
|
290
297
|
declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
|
|
291
298
|
|
|
292
|
-
export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
|
|
299
|
+
export { CollapsableItem, type CollapsableItemProps, type ContextHookOptions, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CollapseProps } from '@mui/material/Collapse';
|
|
3
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps, PaletteMode, Theme } from '@mui/material/styles';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, ElementType, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
|
|
6
6
|
import { ButtonOwnProps, ButtonProps } from '@mui/material/Button';
|
|
@@ -8,6 +8,7 @@ import { LinkProps } from '@mui/material/Link';
|
|
|
8
8
|
import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
|
|
9
9
|
import { SvgIconTypeMap } from '@mui/material/SvgIcon';
|
|
10
10
|
import { ListItemButtonProps } from '@mui/material/ListItemButton';
|
|
11
|
+
import { OptionalOnCondition } from '@alextheman/utility';
|
|
11
12
|
import { TypographyProps } from '@mui/material/Typography';
|
|
12
13
|
import { LiveProvider } from 'react-live';
|
|
13
14
|
import { SwitchProps } from '@mui/material/Switch';
|
|
@@ -100,6 +101,10 @@ interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
|
|
|
100
101
|
}
|
|
101
102
|
declare function ListItemInternalLink({ children, ...listItemButtonProps }: ListItemInternalLinkProps): react_jsx_runtime.JSX.Element;
|
|
102
103
|
|
|
104
|
+
interface ContextHookOptions<S extends boolean = true> {
|
|
105
|
+
strict?: S;
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
interface LoaderProviderBaseProps<T> {
|
|
104
109
|
/** The current loading status (true if loading, false if not) */
|
|
105
110
|
isLoading: boolean;
|
|
@@ -127,7 +132,7 @@ type LoaderContextValue<T> = LoaderProviderPropsWithNoError<T> | LoaderProviderP
|
|
|
127
132
|
type LoaderProviderProps<T> = LoaderContextValue<T> & {
|
|
128
133
|
children: ReactNode;
|
|
129
134
|
};
|
|
130
|
-
declare function useLoader<T>(): LoaderContextValue<T
|
|
135
|
+
declare function useLoader<T, Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, LoaderContextValue<T>>;
|
|
131
136
|
/** A provider for a context that deals with state management when fetching data from an API.
|
|
132
137
|
* This may be used over Loader if you require more control over the placement of the error message and data display.
|
|
133
138
|
*/
|
|
@@ -174,26 +179,28 @@ interface LoaderErrorPropsWithUndefinedOrNull extends LoaderErrorBaseProps {
|
|
|
174
179
|
undefinedComponent?: ReactNode;
|
|
175
180
|
/** The component to show if no error was thrown but data is null */
|
|
176
181
|
nullComponent?: ReactNode;
|
|
177
|
-
/** The component to show if no error was thrown but data is undefined or null */
|
|
178
182
|
nullableComponent?: never;
|
|
179
183
|
}
|
|
180
184
|
interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
|
|
181
185
|
undefinedComponent?: never;
|
|
182
186
|
nullComponent?: never;
|
|
187
|
+
/** The component to show if no error was thrown but data is undefined or null */
|
|
183
188
|
nullableComponent?: ReactNode;
|
|
184
189
|
}
|
|
185
190
|
type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
|
|
186
191
|
/** The component responsible for showing any errors provided by LoaderProvider. */
|
|
187
192
|
declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
toggleMode: () => void;
|
|
191
|
-
mode: string;
|
|
192
|
-
};
|
|
194
|
+
/** @deprecated Please use `PaletteMode` from `@mui/material/styles` instead. */
|
|
193
195
|
type Mode = "light" | "dark";
|
|
196
|
+
interface ModeContextValue {
|
|
197
|
+
toggleMode: () => void;
|
|
198
|
+
mode: PaletteMode;
|
|
199
|
+
}
|
|
200
|
+
declare function useMode<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ModeContextValue>;
|
|
194
201
|
interface ModeProviderProps {
|
|
195
202
|
children: ReactNode;
|
|
196
|
-
mode?:
|
|
203
|
+
mode?: PaletteMode;
|
|
197
204
|
}
|
|
198
205
|
declare function ModeProvider({ children, mode: modeProp }: ModeProviderProps): react_jsx_runtime.JSX.Element;
|
|
199
206
|
|
|
@@ -207,7 +214,7 @@ interface ScreenSizeContextValue {
|
|
|
207
214
|
windowWidth: number;
|
|
208
215
|
windowHeight: number;
|
|
209
216
|
}
|
|
210
|
-
declare function useScreenSize(): ScreenSizeContextValue
|
|
217
|
+
declare function useScreenSize<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ScreenSizeContextValue>;
|
|
211
218
|
declare function ScreenSizeProvider({ children, largeScreenWidth, largeScreenHeight }: ScreenSizeProps): react_jsx_runtime.JSX.Element;
|
|
212
219
|
|
|
213
220
|
interface SnackbarProviderProps {
|
|
@@ -217,7 +224,7 @@ interface SnackbarProviderProps {
|
|
|
217
224
|
interface SnackbarContextValue {
|
|
218
225
|
addSnackbar: (message: string, severity?: AlertColor, duration?: number) => void;
|
|
219
226
|
}
|
|
220
|
-
declare function useSnackbar(): SnackbarContextValue
|
|
227
|
+
declare function useSnackbar<Strict extends boolean = true>({ strict, }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, SnackbarContextValue>;
|
|
221
228
|
declare function SnackbarProvider({ children, autoHideDuration }: SnackbarProviderProps): react_jsx_runtime.JSX.Element;
|
|
222
229
|
|
|
223
230
|
type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children"> & Omit<LoaderErrorProps, "errorComponent"> & Omit<LoaderDataProps<T>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
|
|
@@ -289,4 +296,4 @@ declare function SwitchWithIcons({ checkedIcon: CheckedIcon, checkedIconStyles,
|
|
|
289
296
|
|
|
290
297
|
declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
|
|
291
298
|
|
|
292
|
-
export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
|
|
299
|
+
export { CollapsableItem, type CollapsableItemProps, type ContextHookOptions, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var Ie=Object.defineProperty,Ce=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var Y=(e,o,r)=>o in e?Ie(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(e,o)=>{for(var r in o||(o={}))q.call(o,r)&&Y(e,r,o[r]);if(B)for(var r of B(o))Q.call(o,r)&&Y(e,r,o[r]);return e},u=(e,o)=>Ce(e,ke(o));var x=(e,o)=>{var r={};for(var n in e)q.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&B)for(var n of B(e))o.indexOf(n)<0&&Q.call(e,n)&&(r[n]=e[n]);return r};var Z=(e,o,r)=>new Promise((n,a)=>{var t=l=>{try{i(r.next(l))}catch(f){a(f)}},p=l=>{try{i(r.throw(l))}catch(f){a(f)}},i=l=>l.done?n(l.value):Promise.resolve(l.value).then(t,p);i((r=r.apply(e,o)).next())});import Te from"@mui/icons-material/ArrowDropDown";import Ne from"@mui/icons-material/ArrowDropUp";import Be from"@mui/material/Box";import O from"@mui/material/ButtonBase";import Ee from"@mui/material/Collapse";import{useEffect as De,useState as Re}from"react";import{jsx as A,jsxs as j}from"react/jsx-runtime";function Me({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:a,buttonContents:t,buttonComponent:p=O,collapseProps:i,openIcon:l=A(Ne,{}),closedIcon:f=A(Te,{}),useDefaultStyling:c=p===O}){let[d,m]=Re(!!e);return De(()=>{d&&o?o():!d&&r&&r()},[d]),j(Be,{children:[j(p,{onClick:()=>{m(P=>!P)},sx:c?s({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":p===O?{backgroundColor:"action.hover"}:null},a):a,"aria-expanded":d,children:[t,d?l:f]}),A(Ee,u(s({in:d},i),{children:n}))]})}var Oe=Me;import xo from"@mui/icons-material/DarkMode";import Po from"@mui/icons-material/LightMode";import vo from"@mui/material/IconButton";import go from"@mui/material/Tooltip";import Ae from"@mui/material/CircularProgress";import{createContext as We,useContext as Fe}from"react";import{jsx as ee}from"react/jsx-runtime";var oe=We(void 0);function I(){let e=Fe(oe);if(!e)throw new Error("LOADER_CONTEXT_NOT_SET");return e}function ze(n){var a=n,{children:e,loadingComponent:o=ee(Ae,{})}=a,r=x(a,["children","loadingComponent"]);return ee(oe.Provider,{value:s({loadingComponent:o},r),children:e})}var W=ze;import{Fragment as g,jsx as y}from"react/jsx-runtime";function Ue({children:e,dataParser:o,loadingComponent:r,onNullable:n,onUndefined:a,onNull:t}){let{isLoading:p,data:i,dataParser:l,loadingComponent:f,error:c}=I(),d=o!=null?o:l;if(p)return y(g,{children:r!=null?r:f});if(c)return y(g,{});if(i==null){if(n){let m=n();return m!=null?m:y(g,{})}if(i===void 0&&a){let m=a();return m!=null?m:y(g,{})}if(i===null&&t){let m=t();return m!=null?m:y(g,{})}return y(g,{})}return d?typeof e=="function"?y(g,{children:e(d(i))}):y(g,{children:e}):typeof e=="function"?y(g,{children:e(i)}):y(g,{children:e})}var F=Ue;import re from"@mui/material/Alert";import{useRef as He}from"react";import{Fragment as C,jsx as b}from"react/jsx-runtime";function Ve({errorComponent:e,undefinedComponent:o,nullComponent:r,nullableComponent:n,logError:a}){var P;let{isLoading:t,data:p,error:i,errorComponent:l,logError:f}=I(),c=a!=null?a:f,d=He(!1),m=e!=null?e:l;return i?(c&&!d.current&&(console.error(i),d.current=!0),typeof m=="function"?m(i):m?b(C,{children:m}):b(re,{severity:"error",children:(P=i==null?void 0:i.message)!=null?P:"An unknown error has occured. Please try again later."})):!t&&p==null?n?(c&&!d.current&&(console.error("Data is nullable after loading."),d.current=!0),b(C,{children:n})):p===void 0&&(c&&!d.current&&(console.error("Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data."),d.current=!0),o)?b(C,{children:o}):p===null&&(c&&!d.current&&(console.error("Data is null after loading."),d.current=!0),r)?b(C,{children:r}):b(re,{severity:"error",children:"Failed to load data. Please try again later."}):b(C,{})}var z=Ve;import Xe from"@mui/material/CssBaseline";import{createTheme as $e,ThemeProvider as _e}from"@mui/material/styles";import{createContext as Ge,useContext as Je,useMemo as Ke,useState as Ye}from"react";import{jsx as te,jsxs as Ze}from"react/jsx-runtime";var ne=Ge({toggleMode:()=>{},mode:"dark"});function k(){return Je(ne)}function qe({children:e,mode:o="dark"}){let[r,n]=Ye(o),a=Ke(()=>$e({palette:{mode:r}}),[r]);return te(ne.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:Ze(_e,{theme:a,children:[te(Xe,{}),e]})})}var Qe=qe;import{createContext as je,useContext as eo,useEffect as ae,useState as U}from"react";import{jsx as no}from"react/jsx-runtime";var ie=je({windowWidth:0,windowHeight:0,isLargeScreen:!1});function oo(){return eo(ie)}function ro({children:e,largeScreenWidth:o,largeScreenHeight:r}){let[n,a]=U(window.innerWidth),[t,p]=U(window.innerHeight);function i(c,d,m=669,P=600){return c>m&&d>P}let[l,f]=U(i(window.innerWidth,window.innerHeight,o,r));return ae(()=>{function c(){a(window.innerWidth),p(window.innerHeight)}return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[]),ae(()=>{f(i(n,t,o,r))},[n,t,o,r]),no(ie.Provider,{value:{isLargeScreen:l,windowWidth:n,windowHeight:t},children:e})}var to=ro;import{wait as ao}from"@alextheman/utility";import io from"@mui/material/Alert";import po from"@mui/material/Snackbar";import{createContext as so,useContext as lo,useState as E}from"react";import{jsx as pe,jsxs as fo}from"react/jsx-runtime";var se=so(void 0);function mo(){let e=lo(se);if(!e)throw new Error("SNACKBAR_CONTEXT_NOT_SET");return e}function co({children:e,autoHideDuration:o=5e3}){let[r,n]=E(!1),[a,t]=E(o),[p,i]=E(""),[l,f]=E("info");function c(m,P,h){n(!0),t(h!=null?h:o),f(P!=null?P:"info"),i(m)}function d(){return Z(this,null,function*(){n(!1),yield ao(.2),i("")})}return fo(se.Provider,{value:{addSnackbar:c},children:[pe(po,{open:r,autoHideDuration:a,onClose:d,children:pe(io,{onClose:d,severity:l,children:p})}),e]})}var uo=co;import{jsx as D}from"react/jsx-runtime";function yo(){let{mode:e,toggleMode:o}=k();return D(go,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:D(vo,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?D(Po,{}):D(xo,{})})})}var ho=yo;import Lo from"@mui/icons-material/ArrowDropDown";import bo from"@mui/icons-material/ArrowDropUp";import de from"@mui/material/Box";import le from"@mui/material/Button";import So from"@mui/material/Menu";import{useEffect as wo,useMemo as Io,useState as Co}from"react";import{jsx as T,jsxs as No}from"react/jsx-runtime";function ko({children:e,button:o=le,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:a=T(bo,{}),isClosedIcon:t=T(Lo,{}),onOpen:p,onClose:i}){let[l,f]=Co(null),c=Io(()=>!!l,[l]),d=u(s({},n),{onClick:m=>{f(m.currentTarget)},"aria-controls":c?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":c});return o===le&&(d.endIcon=c?a:t),wo(()=>{c&&p?p():!c&&i&&i()},[c,p,i]),No(de,{children:[T(o,u(s({},d),{children:r})),T(So,{id:"dropdown-menu",anchorEl:l,open:c,onClose:()=>{f(null)},children:typeof e=="function"?T(de,{children:e(()=>{f(null)})}):e})]})}var To=ko;import Bo from"@mui/material/Link";import{jsx as Ro}from"react/jsx-runtime";function Eo(n){var a=n,{href:e,children:o}=a,r=x(a,["href","children"]);return Ro(Bo,u(s({component:"a",href:e,target:"_blank",rel:"noopener noreferrer"},r),{children:o}))}var Do=Eo;import Mo from"@mui/icons-material/CloudUpload";import Oo from"@mui/material/Button";import{styled as me}from"@mui/material/styles";import{useState as Ao}from"react";import{jsx as H,jsxs as Ho}from"react/jsx-runtime";var Wo={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},Fo=me("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),zo=me("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function Uo(p){var i=p,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:a}=i,t=x(i,["onFileInput","label","multiple","accept","useDropzone"]);var d;let[l,f]=Ao(!1),c=Ho(Oo,u(s({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:m=>{var P;(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),(P=document.getElementById("file-input"))==null||P.click())}},t),{startIcon:(d=t.startIcon)!=null?d:H(Mo,{}),children:[o,H(Fo,{id:"file-input",type:"file",onChange:m=>{var h;let P=m.target;e(Array.from((h=P.files)!=null?h:[])),P.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return a?H(zo,{$dragging:l,onDragOver:m=>{m.preventDefault(),!t.disabled&&f(!0)},onDragLeave:m=>{m.preventDefault(),f(!1)},onDrop:m=>{var h;if(m.preventDefault(),f(!1),t.disabled)return;let P=Array.from((h=m.dataTransfer.files)!=null?h:[]);e(P)},children:c}):c}var V=Uo;import Vo from"@mui/icons-material/Delete";import Xo from"@mui/material/Box";import $o from"@mui/material/IconButton";import _o from"@mui/material/List";import Go from"@mui/material/ListItem";import Jo from"@mui/material/ListItemText";import{jsx as w,jsxs as qo}from"react/jsx-runtime";function Ko(n){var a=n,{files:e,setFiles:o}=a,r=x(a,["files","setFiles"]);function t(i){o(l=>[...l,...i])}let p=u(s({},r),{onFileInput:t});return(p==null?void 0:p.multiple)===void 0&&(p.multiple=!0),qo(Xo,{children:[w(V,s({},p)),w(_o,{children:e.map(i=>w(Go,{secondaryAction:w($o,{"aria-label":"Delete",edge:"end",onClick:()=>{o(l=>l.filter(f=>f!==i))},children:w(Vo,{})}),children:w(Jo,{primary:i.name})},i.name))})]})}var Yo=Ko;import Qo from"@mui/material/Box";import Zo from"@mui/material/Popover";import{useId as jo,useState as er}from"react";import{jsx as ce,jsxs as tr}from"react/jsx-runtime";function or({icon:e,onOpen:o,onClose:r,iconProps:n,children:a}){let[t,p]=er(null),i=!!t,l=jo();function f(d){p(d.currentTarget),o&&o()}function c(){p(null),r&&r()}return tr(Qo,{children:[ce(e,s({"aria-owns":i?l:void 0,"aria-haspopup":"true",onMouseEnter:f,onMouseLeave:c},n)),ce(Zo,{id:l,sx:{pointerEvents:"none"},open:i,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:a})]})}var rr=or;import nr from"@mui/material/Link";import{Link as ar}from"react-router-dom";import{jsx as pr}from"react/jsx-runtime";function ir(n){var a=n,{to:e,children:o}=a,r=x(a,["to","children"]);return pr(nr,u(s({component:ar,to:e},r),{children:o}))}var X=ir;import sr from"@mui/material/ListItemButton";import{jsx as mr}from"react/jsx-runtime";function dr(r){var n=r,{children:e}=n,o=x(n,["children"]);return mr(sr,u(s({component:X},o),{children:e}))}var lr=dr;import cr from"@mui/material/CircularProgress";import{jsx as $,jsxs as xr}from"react/jsx-runtime";function ur(i){var l=i,{children:e,errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:a,loadingComponent:t=$(cr,{})}=l,p=x(l,["children","errorComponent","undefinedComponent","nullComponent","nullableComponent","loadingComponent"]);return xr(W,u(s({loadingComponent:t},p),{children:[$(z,{errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:a}),$(F,{children:e})]}))}var fr=ur;import Pr from"@mui/material/BottomNavigation";import vr from"@mui/material/BottomNavigationAction";import gr from"@mui/material/Box";import yr from"@mui/material/Paper";import{useState as hr}from"react";import{Link as Lr}from"react-router-dom";import{Fragment as wr,jsx as R,jsxs as Ir}from"react/jsx-runtime";function br({children:e,navItems:o}){let[r,n]=hr("");return Ir(wr,{children:[R(gr,{sx:{paddingBottom:7},children:e}),R(yr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:R(Pr,{showLabels:!0,value:r,onChange:(a,t)=>{n(t)},children:o.map(a=>R(vr,u(s({},a),{component:Lr}),a.value))})})]})}var Sr=br;import{truncate as ue}from"@alextheman/utility";import Cr from"@mui/icons-material/ChevronLeft";import kr from"@mui/icons-material/ChevronRight";import Tr from"@mui/icons-material/Menu";import Nr from"@mui/material/AppBar";import fe from"@mui/material/Box";import Br from"@mui/material/CssBaseline";import xe from"@mui/material/Divider";import Er from"@mui/material/Drawer";import Pe from"@mui/material/IconButton";import Dr from"@mui/material/List";import Rr from"@mui/material/ListItem";import Mr from"@mui/material/ListItemButton";import Or from"@mui/material/ListItemIcon";import Ar from"@mui/material/ListItemText";import{styled as G,useTheme as Wr}from"@mui/material/styles";import Fr from"@mui/material/Toolbar";import _ from"@mui/material/Typography";import{Fragment as zr,useState as Ur}from"react";import{Link as Hr,useLocation as Vr}from"react-router-dom";import{jsx as v,jsxs as S}from"react/jsx-runtime";var M=240;function ve(e){return{width:M,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ge(e){return{transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(8)} + 1px)`}}}var ye=G("div")(({theme:e})=>s({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),Xr=G(Nr,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:o})=>o,style:{marginLeft:M,width:`calc(100% - ${M}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),$r=G(Er,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:M,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:u(s({},ve(e)),{"& .MuiDrawer-paper":ve(e)})},{props:({open:o})=>!o,style:u(s({},ge(e)),{"& .MuiDrawer-paper":ge(e)})}]}));function _r({title:e,navItems:o,children:r,headerElements:n}){let a=Wr(),[t,p]=Ur(!0),i=Vr();function l(){p(!0)}function f(){p(!1)}return S(fe,{sx:{display:"flex"},children:[v(Br,{}),v(Xr,{position:"fixed",open:t,children:S(Fr,{children:[v(Pe,{color:"inherit","aria-label":"open drawer",onClick:l,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:v(Tr,{})}),v(_,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),S($r,{variant:"permanent",open:t,children:[v(ye,{children:v(Pe,{onClick:f,children:a.direction==="rtl"?v(kr,{}):v(Cr,{})})}),v(xe,{}),o.map(c=>S(zr,{children:[S(Dr,{children:[v(_,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?c.category:ue(c.category,4)}),c.options.map(d=>v(Rr,{disablePadding:!0,sx:{display:"block"},children:S(Mr,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:Hr,to:d.to,selected:i.pathname===d.to,children:[v(Or,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:d.icon?d.icon:t?null:v(_,{children:ue(d.label,4)})}),v(Ar,{primary:d.label,sx:[t?{opacity:1}:{opacity:0}]})]})},d.to))]}),v(xe,{})]},c.category))]}),S(fe,{component:"main",sx:{flexGrow:1,p:3},children:[v(ye,{}),r]})]})}var Gr=_r;import Jr from"@mui/material/Typography";import{Fragment as qr,jsx as he}from"react/jsx-runtime";function Kr(n){var a=n,{text:e,sx:o}=a,r=x(a,["text","sx"]);return he(qr,{children:e.split(`
|
|
2
|
-
`).map((t,p)=>
|
|
1
|
+
var Ce=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var Y=(e,o,r)=>o in e?Ce(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(e,o)=>{for(var r in o||(o={}))q.call(o,r)&&Y(e,r,o[r]);if(B)for(var r of B(o))Z.call(o,r)&&Y(e,r,o[r]);return e},u=(e,o)=>Ie(e,ke(o));var x=(e,o)=>{var r={};for(var n in e)q.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&B)for(var n of B(e))o.indexOf(n)<0&&Z.call(e,n)&&(r[n]=e[n]);return r};var Q=(e,o,r)=>new Promise((n,i)=>{var t=l=>{try{a(r.next(l))}catch(f){i(f)}},p=l=>{try{a(r.throw(l))}catch(f){i(f)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(t,p);a((r=r.apply(e,o)).next())});import Ne from"@mui/icons-material/ArrowDropDown";import Te from"@mui/icons-material/ArrowDropUp";import Be from"@mui/material/Box";import M from"@mui/material/ButtonBase";import Oe from"@mui/material/Collapse";import{useEffect as De,useState as Re}from"react";import{jsx as A,jsxs as j}from"react/jsx-runtime";function Ee({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:i,buttonContents:t,buttonComponent:p=M,collapseProps:a,openIcon:l=A(Te,{}),closedIcon:f=A(Ne,{}),useDefaultStyling:c=p===M}){let[d,m]=Re(!!e);return De(()=>{d&&o?o():!d&&r&&r()},[d]),j(Be,{children:[j(p,{onClick:()=>{m(P=>!P)},sx:c?s({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":p===M?{backgroundColor:"action.hover"}:null},i):i,"aria-expanded":d,children:[t,d?l:f]}),A(Oe,u(s({in:d},a),{children:n}))]})}var Me=Ee;import xo from"@mui/icons-material/DarkMode";import Po from"@mui/icons-material/LightMode";import yo from"@mui/material/IconButton";import vo from"@mui/material/Tooltip";import Ae from"@mui/material/CircularProgress";import{createContext as Fe,useContext as We}from"react";import{jsx as ee}from"react/jsx-runtime";var oe=Fe(void 0);function C({strict:e=!0}={}){let o=We(oe);if(e&&!o)throw new Error("LOADER_PROVIDER_NOT_FOUND");return o}function Ve(n){var i=n,{children:e,loadingComponent:o=ee(Ae,{})}=i,r=x(i,["children","loadingComponent"]);return ee(oe.Provider,{value:s({loadingComponent:o},r),children:e})}var F=Ve;import{Fragment as v,jsx as h}from"react/jsx-runtime";function ze({children:e,dataParser:o,loadingComponent:r,onNullable:n,onUndefined:i,onNull:t}){let{isLoading:p,data:a,dataParser:l,loadingComponent:f,error:c}=C(),d=o!=null?o:l;if(p)return h(v,{children:r!=null?r:f});if(c)return h(v,{});if(a==null){if(n){let m=n();return m!=null?m:h(v,{})}if(a===void 0&&i){let m=i();return m!=null?m:h(v,{})}if(a===null&&t){let m=t();return m!=null?m:h(v,{})}return h(v,{})}return d?typeof e=="function"?h(v,{children:e(d(a))}):h(v,{children:e}):typeof e=="function"?h(v,{children:e(a)}):h(v,{children:e})}var W=ze;import re from"@mui/material/Alert";import{useRef as He}from"react";import{Fragment as I,jsx as S}from"react/jsx-runtime";function Ue({errorComponent:e,undefinedComponent:o,nullComponent:r,nullableComponent:n,logError:i}){var P;let{isLoading:t,data:p,error:a,errorComponent:l,logError:f}=C(),c=i!=null?i:f,d=He(!1),m=e!=null?e:l;return a?(c&&!d.current&&(console.error(a),d.current=!0),typeof m=="function"?m(a):m?S(I,{children:m}):S(re,{severity:"error",children:(P=a==null?void 0:a.message)!=null?P:"An unknown error has occured. Please try again later."})):!t&&p==null?n?(c&&!d.current&&(console.error("Data is nullable after loading."),d.current=!0),S(I,{children:n})):p===void 0&&(c&&!d.current&&(console.error("Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data."),d.current=!0),o)?S(I,{children:o}):p===null&&(c&&!d.current&&(console.error("Data is null after loading."),d.current=!0),r)?S(I,{children:r}):S(re,{severity:"error",children:"Failed to load data. Please try again later."}):S(I,{})}var V=Ue;import _e from"@mui/material/CssBaseline";import{createTheme as $e,ThemeProvider as Xe}from"@mui/material/styles";import{createContext as Ge,useContext as Je,useMemo as Ke,useState as Ye}from"react";import{jsx as te,jsxs as Qe}from"react/jsx-runtime";var ne=Ge({toggleMode:()=>{},mode:"dark"});function k({strict:e=!0}={}){let o=Je(ne);if(e&&!o)throw new Error("MODE_PROVIDER_NOT_FOUND");return o}function qe({children:e,mode:o="dark"}){let[r,n]=Ye(o),i=Ke(()=>$e({palette:{mode:r}}),[r]);return te(ne.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:Qe(Xe,{theme:i,children:[te(_e,{}),e]})})}var Ze=qe;import{createContext as je,useContext as eo,useEffect as ie,useState as z}from"react";import{jsx as no}from"react/jsx-runtime";var ae=je({windowWidth:0,windowHeight:0,isLargeScreen:!1});function oo({strict:e=!0}={}){let o=eo(ae);if(e&&!o)throw new Error("SCREEN_SIZE_PROVIDER_NOT_FOUND");return o}function ro({children:e,largeScreenWidth:o,largeScreenHeight:r}){let[n,i]=z(window.innerWidth),[t,p]=z(window.innerHeight);function a(c,d,m=669,P=600){return c>m&&d>P}let[l,f]=z(a(window.innerWidth,window.innerHeight,o,r));return ie(()=>{function c(){i(window.innerWidth),p(window.innerHeight)}return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[]),ie(()=>{f(a(n,t,o,r))},[n,t,o,r]),no(ae.Provider,{value:{isLargeScreen:l,windowWidth:n,windowHeight:t},children:e})}var to=ro;import{wait as io}from"@alextheman/utility";import ao from"@mui/material/Alert";import po from"@mui/material/Snackbar";import{createContext as so,useContext as lo,useState as O}from"react";import{jsx as pe,jsxs as fo}from"react/jsx-runtime";var se=so(void 0);function mo({strict:e=!0}={}){let o=lo(se);if(e&&!o)throw new Error("SNACKBAR_PROVIDER_NOT_FOUND");return o}function co({children:e,autoHideDuration:o=5e3}){let[r,n]=O(!1),[i,t]=O(o),[p,a]=O(""),[l,f]=O("info");function c(m,P,g){n(!0),t(g!=null?g:o),f(P!=null?P:"info"),a(m)}function d(){return Q(this,null,function*(){n(!1),yield io(.2),a("")})}return fo(se.Provider,{value:{addSnackbar:c},children:[pe(po,{open:r,autoHideDuration:i,onClose:d,children:pe(ao,{onClose:d,severity:l,children:p})}),e]})}var uo=co;import{jsx as D}from"react/jsx-runtime";function ho(){let{mode:e,toggleMode:o}=k();return D(vo,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:D(yo,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?D(Po,{}):D(xo,{})})})}var go=ho;import Lo from"@mui/icons-material/ArrowDropDown";import So from"@mui/icons-material/ArrowDropUp";import de from"@mui/material/Box";import le from"@mui/material/Button";import bo from"@mui/material/Menu";import{useEffect as wo,useMemo as Co,useState as Io}from"react";import{jsx as N,jsxs as To}from"react/jsx-runtime";function ko({children:e,button:o=le,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:i=N(So,{}),isClosedIcon:t=N(Lo,{}),onOpen:p,onClose:a}){let[l,f]=Io(null),c=Co(()=>!!l,[l]),d=u(s({},n),{onClick:m=>{f(m.currentTarget)},"aria-controls":c?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":c});return o===le&&(d.endIcon=c?i:t),wo(()=>{c&&p?p():!c&&a&&a()},[c,p,a]),To(de,{children:[N(o,u(s({},d),{children:r})),N(bo,{id:"dropdown-menu",anchorEl:l,open:c,onClose:()=>{f(null)},children:typeof e=="function"?N(de,{children:e(()=>{f(null)})}):e})]})}var No=ko;import Bo from"@mui/material/Link";import{jsx as Ro}from"react/jsx-runtime";function Oo(n){var i=n,{href:e,children:o}=i,r=x(i,["href","children"]);return Ro(Bo,u(s({component:"a",href:e,target:"_blank",rel:"noopener noreferrer"},r),{children:o}))}var Do=Oo;import Eo from"@mui/icons-material/CloudUpload";import Mo from"@mui/material/Button";import{styled as me}from"@mui/material/styles";import{useState as Ao}from"react";import{jsx as H,jsxs as Ho}from"react/jsx-runtime";var Fo={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},Wo=me("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),Vo=me("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function zo(p){var a=p,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:i}=a,t=x(a,["onFileInput","label","multiple","accept","useDropzone"]);var d;let[l,f]=Ao(!1),c=Ho(Mo,u(s({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:m=>{var P;(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),(P=document.getElementById("file-input"))==null||P.click())}},t),{startIcon:(d=t.startIcon)!=null?d:H(Eo,{}),children:[o,H(Wo,{id:"file-input",type:"file",onChange:m=>{var g;let P=m.target;e(Array.from((g=P.files)!=null?g:[])),P.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return i?H(Vo,{$dragging:l,onDragOver:m=>{m.preventDefault(),!t.disabled&&f(!0)},onDragLeave:m=>{m.preventDefault(),f(!1)},onDrop:m=>{var g;if(m.preventDefault(),f(!1),t.disabled)return;let P=Array.from((g=m.dataTransfer.files)!=null?g:[]);e(P)},children:c}):c}var U=zo;import Uo from"@mui/icons-material/Delete";import _o from"@mui/material/Box";import $o from"@mui/material/IconButton";import Xo from"@mui/material/List";import Go from"@mui/material/ListItem";import Jo from"@mui/material/ListItemText";import{jsx as w,jsxs as qo}from"react/jsx-runtime";function Ko(n){var i=n,{files:e,setFiles:o}=i,r=x(i,["files","setFiles"]);function t(a){o(l=>[...l,...a])}let p=u(s({},r),{onFileInput:t});return(p==null?void 0:p.multiple)===void 0&&(p.multiple=!0),qo(_o,{children:[w(U,s({},p)),w(Xo,{children:e.map(a=>w(Go,{secondaryAction:w($o,{"aria-label":"Delete",edge:"end",onClick:()=>{o(l=>l.filter(f=>f!==a))},children:w(Uo,{})}),children:w(Jo,{primary:a.name})},a.name))})]})}var Yo=Ko;import Zo from"@mui/material/Box";import Qo from"@mui/material/Popover";import{useId as jo,useState as er}from"react";import{jsx as ce,jsxs as tr}from"react/jsx-runtime";function or({icon:e,onOpen:o,onClose:r,iconProps:n,children:i}){let[t,p]=er(null),a=!!t,l=jo();function f(d){p(d.currentTarget),o&&o()}function c(){p(null),r&&r()}return tr(Zo,{children:[ce(e,s({"aria-owns":a?l:void 0,"aria-haspopup":"true",onMouseEnter:f,onMouseLeave:c},n)),ce(Qo,{id:l,sx:{pointerEvents:"none"},open:a,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:i})]})}var rr=or;import nr from"@mui/material/Link";import{Link as ir}from"react-router-dom";import{jsx as pr}from"react/jsx-runtime";function ar(n){var i=n,{to:e,children:o}=i,r=x(i,["to","children"]);return pr(nr,u(s({component:ir,to:e},r),{children:o}))}var _=ar;import sr from"@mui/material/ListItemButton";import{jsx as mr}from"react/jsx-runtime";function dr(r){var n=r,{children:e}=n,o=x(n,["children"]);return mr(sr,u(s({component:_},o),{children:e}))}var lr=dr;import cr from"@mui/material/CircularProgress";import{jsx as $,jsxs as xr}from"react/jsx-runtime";function ur(a){var l=a,{children:e,errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:i,loadingComponent:t=$(cr,{})}=l,p=x(l,["children","errorComponent","undefinedComponent","nullComponent","nullableComponent","loadingComponent"]);return xr(F,u(s({loadingComponent:t},p),{children:[$(V,{errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:i}),$(W,{children:e})]}))}var fr=ur;import Pr from"@mui/material/BottomNavigation";import yr from"@mui/material/BottomNavigationAction";import vr from"@mui/material/Box";import hr from"@mui/material/Paper";import{useState as gr}from"react";import{Link as Lr}from"react-router-dom";import{Fragment as wr,jsx as R,jsxs as Cr}from"react/jsx-runtime";function Sr({children:e,navItems:o}){let[r,n]=gr("");return Cr(wr,{children:[R(vr,{sx:{paddingBottom:7},children:e}),R(hr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:R(Pr,{showLabels:!0,value:r,onChange:(i,t)=>{n(t)},children:o.map(i=>R(yr,u(s({},i),{component:Lr}),i.value))})})]})}var br=Sr;import{truncate as ue}from"@alextheman/utility";import Ir from"@mui/icons-material/ChevronLeft";import kr from"@mui/icons-material/ChevronRight";import Nr from"@mui/icons-material/Menu";import Tr from"@mui/material/AppBar";import fe from"@mui/material/Box";import Br from"@mui/material/CssBaseline";import xe from"@mui/material/Divider";import Or from"@mui/material/Drawer";import Pe from"@mui/material/IconButton";import Dr from"@mui/material/List";import Rr from"@mui/material/ListItem";import Er from"@mui/material/ListItemButton";import Mr from"@mui/material/ListItemIcon";import Ar from"@mui/material/ListItemText";import{styled as G,useTheme as Fr}from"@mui/material/styles";import Wr from"@mui/material/Toolbar";import X from"@mui/material/Typography";import{Fragment as Vr,useState as zr}from"react";import{Link as Hr,useLocation as Ur}from"react-router-dom";import{jsx as y,jsxs as b}from"react/jsx-runtime";var E=240;function ye(e){return{width:E,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ve(e){return{transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(8)} + 1px)`}}}var he=G("div")(({theme:e})=>s({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),_r=G(Tr,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:o})=>o,style:{marginLeft:E,width:`calc(100% - ${E}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),$r=G(Or,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:E,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:u(s({},ye(e)),{"& .MuiDrawer-paper":ye(e)})},{props:({open:o})=>!o,style:u(s({},ve(e)),{"& .MuiDrawer-paper":ve(e)})}]}));function Xr({title:e,navItems:o,children:r,headerElements:n}){let i=Fr(),[t,p]=zr(!0),a=Ur();function l(){p(!0)}function f(){p(!1)}return b(fe,{sx:{display:"flex"},children:[y(Br,{}),y(_r,{position:"fixed",open:t,children:b(Wr,{children:[y(Pe,{color:"inherit","aria-label":"open drawer",onClick:l,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:y(Nr,{})}),y(X,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),b($r,{variant:"permanent",open:t,children:[y(he,{children:y(Pe,{onClick:f,children:i.direction==="rtl"?y(kr,{}):y(Ir,{})})}),y(xe,{}),o.map(c=>b(Vr,{children:[b(Dr,{children:[y(X,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?c.category:ue(c.category,4)}),c.options.map(d=>y(Rr,{disablePadding:!0,sx:{display:"block"},children:b(Er,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:Hr,to:d.to,selected:a.pathname===d.to,children:[y(Mr,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:d.icon?d.icon:t?null:y(X,{children:ue(d.label,4)})}),y(Ar,{primary:d.label,sx:[t?{opacity:1}:{opacity:0}]})]})},d.to))]}),y(xe,{})]},c.category))]}),b(fe,{component:"main",sx:{flexGrow:1,p:3},children:[y(he,{}),r]})]})}var Gr=Xr;import Jr from"@mui/material/Typography";import{Fragment as qr,jsx as ge}from"react/jsx-runtime";function Kr(n){var i=n,{text:e,sx:o}=i,r=x(i,["text","sx"]);return ge(qr,{children:e.split(`
|
|
2
|
+
`).map((t,p)=>ge(Jr,u(s({sx:s({margin:1},o)},r),{children:t}),p))})}var Yr=Kr;import J from"@mui/material/Box";import Le from"@mui/material/Typography";import{stripIndent as Zr}from"common-tags";import{LiveEditor as Qr,LiveError as jr,LivePreview as et,LiveProvider as ot}from"react-live";import{jsx as L,jsxs as Se}from"react/jsx-runtime";function rt(n){var i=n,{code:e,previewStyles:o}=i,r=x(i,["code","previewStyles"]);let{mode:t}=k(),p={backgroundColor:t==="dark"?"black":"white",border:.3,borderRadius:1,padding:2,borderColor:"darkgray"},a=o?s(s({},p),o):s({},p);return L(J,{sx:{borderRadius:1,border:.5,padding:2},children:Se(ot,u(s({},r),{code:Zr(e!=null?e:""),children:[L(Le,{variant:"h5",children:"Code"}),L(J,{sx:{border:.3,borderRadius:.3,borderColor:"darkgray"},children:L(Qr,{})}),L("br",{}),L(Le,{variant:"h5",children:"Result"}),Se(J,{sx:a,children:[L(et,{}),L(jr,{})]})]}))})}var tt=rt;import{fillArray as nt}from"@alextheman/utility";import it from"@mui/material/Skeleton";import at from"@mui/material/TableCell";import pt from"@mui/material/TableRow";import{jsx as K}from"react/jsx-runtime";function st({columns:e}){return K(pt,{children:nt(o=>K(at,{children:K(it,{})},o),e)})}var dt=st;import lt from"@mui/material/Button";import{useFormContext as mt}from"react-hook-form";import{jsx as ft}from"react/jsx-runtime";function ct(n){var i=n,{disableClean:e,label:o}=i,r=x(i,["disableClean","label"]);let{formState:{disabled:t,isDirty:p,isSubmitting:a}}=mt();return ft(lt,u(s({color:"primary",disabled:r.disabled||e&&!p||t,loading:a,type:"submit",variant:"contained"},r),{children:o}))}var ut=ct;import be from"@mui/material/Box";import{styled as xt}from"@mui/material/styles";import Pt from"@mui/material/Switch";import{jsx as T}from"react/jsx-runtime";var yt=xt(Pt)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",fontSize:16,width:28,height:28}}}));function vt(t){var p=t,{checkedIcon:e,checkedIconStyles:o,uncheckedIcon:r,uncheckedIconStyles:n}=p,i=x(p,["checkedIcon","checkedIconStyles","uncheckedIcon","uncheckedIconStyles"]);let a={borderRadius:"50%",borderColor:"white",backgroundColor:"white",display:"flex",alignItems:"center",justifyContent:"center",padding:.25},l={color:"black",maxWidth:16.5,maxHeight:16.5};return T(yt,s({checkedIcon:T(be,{sx:a,children:T(e,{style:s(s({},l),o)})}),icon:T(be,{sx:a,children:T(r,{style:s(s({},l),n)})})},i))}var ht=vt;import{useCallback as we,useEffect as gt,useState as Lt}from"react";function St(e){let[o,r]=Lt(()=>{let t=window.location.hash.replace("#","");return e&&t===""?e:t}),n=we(()=>{let t=window.location.hash.replace("#","");r(e&&t===""?e:t)},[r,e]);gt(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);let i=we(t=>{let p=typeof t=="function"?t(o):t;p!==o&&(window.location.hash=p)},[o]);return[o,i]}var bt=St;export{Me as CollapsableItem,go as DarkModeToggle,No as DropdownMenu,Do as ExternalLink,U as FileInput,Yo as FileInputList,Fo as FileType,rr as IconWithPopover,_ as InternalLink,lr as ListItemInternalLink,fr as Loader,W as LoaderData,V as LoaderError,F as LoaderProvider,Ze as ModeProvider,br as NavigationBottom,Gr as NavigationDrawer,Yr as PopoverText,tt as ReactPlayground,to as ScreenSizeProvider,dt as SkeletonRow,uo as SnackbarProvider,ut as SubmitButton,ht as SwitchWithIcons,bt as useHash,C as useLoader,k as useMode,oo as useScreenSize,mo as useSnackbar};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|